@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: none;
}

/* The 3D Canvas */
#webgl-canvas {
    display: block;
    width: 100%;
    height: 100%;
    filter: contrast(1.4) brightness(1.3);
}

#white-flash {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: #fff; z-index: 8; opacity: 0; pointer-events: none;
    transition: opacity 0.5s;
}

/* FLIR Monitor Overlays */
#crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    z-index: 10;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}

#noise-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    opacity: 0.1;
    z-index: 9;
    background-image: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* HUD Styling */
#hud {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 20;
    padding: 20px;
    box-sizing: border-box;
    text-shadow: 0 0 4px rgba(255,255,255,0.8);
    font-size: 16px;
}

.hud-element { position: absolute; }
#top-left { top: 20px; left: 30px; }
#top-right { top: 20px; right: 30px; text-align: right; }
#bottom-left { bottom: 30px; left: 30px; }
#bottom-right { bottom: 30px; right: 30px; text-align: right; }

/* 2D Crosshair overlaid on 3D scene */
#crosshair {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 25;
    width: 100px;
    height: 100px;
}

/* Weapon Selection UI */
#weapon-selector {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    pointer-events: auto;
    z-index: 30;
}

.weapon-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #fff;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.weapon-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    box-shadow: 0 0 15px rgba(255,255,255,0.6);
}

.cooldown-bar {
    position: absolute;
    bottom: 0; left: 0; height: 3px;
    background: #f00; width: 0%;
}

.weapon-btn.active .cooldown-bar { background: #000; }

/* Support UI */
#support-panel {
    position: absolute;
    top: 150px;
    left: 30px;
    pointer-events: auto;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #555;
    color: #555;
    font-family: 'Share Tech Mono', monospace;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.2s;
}

.support-btn.affordable {
    border-color: #fff;
    color: #fff;
    background: rgba(50, 50, 50, 0.6);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.support-btn.affordable:hover {
    background: #fff;
    color: #000;
}

.support-btn.nuke-btn {
    border-color: #aa0000;
    color: #ff5555;
    margin-top: 20px;
}

.support-btn.nuke-btn.affordable {
    border-color: #ff0000;
    color: #fff;
    background: rgba(150, 0, 0, 0.6);
    box-shadow: 0 0 15px rgba(255,0,0,0.5);
}

#bunker-health-container {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    text-align: center;
}

#bunker-health-bar {
    width: 100%; height: 10px; border: 1px solid #fff; margin-top: 5px;
}

#bunker-health-fill {
    height: 100%; background: #fff; width: 100%; transition: width 0.2s;
}

/* Menus */
.overlay-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    text-align: center;
}

.hidden { display: none !important; }

.menu-title { font-size: 36px; margin-bottom: 10px; text-shadow: 0 0 10px #fff; }
.menu-desc { font-size: 18px; margin-bottom: 30px; }

button.action-btn {
    padding: 15px 30px; background: #fff; color: #000;
    border: none; font-family: 'Share Tech Mono', monospace;
    font-size: 20px; cursor: pointer; text-transform: uppercase;
    margin: 10px;
}
button.action-btn:hover { background: #ccc; }

#btn-pause {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
    background: transparent; border: 1px solid #fff; color: #fff;
    padding: 5px 15px; font-family: 'Share Tech Mono', monospace;
    cursor: pointer; pointer-events: auto; z-index: 30;
}

#victory-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 101; opacity: 0; transition: opacity 3s ease-in; pointer-events: auto;
    background: rgba(0,0,0,0.5);
}

#victory-screen h1 {
    font-size: 60px; color: #fff; text-shadow: 0 0 30px #fff; text-transform: uppercase;
    text-align: center; margin-bottom: 40px;
}

/* Cinematic Elements */
.cinematic-bar {
    position: absolute; left: 0; width: 100%; height: 12%; background: #000;
    z-index: 99; transition: transform 2s ease-in-out; pointer-events: none;
}
#cinematic-top { top: 0; transform: translateY(-100%); }
#cinematic-bottom { bottom: 0; transform: translateY(100%); }
#cinematic-top.active, #cinematic-bottom.active { transform: translateY(0); }

.hide-ui { opacity: 0 !important; pointer-events: none !important; transition: opacity 1s; }

@media (max-width: 768px) {
    #weapon-selector { gap: 5px; bottom: 10px; }
    .weapon-btn { padding: 8px 10px; font-size: 12px; }
    #top-left, #top-right, #bottom-left, #bottom-right { font-size: 12px; }
    #bunker-health-container { width: 200px; top: 50px; }
    #victory-screen h1 { font-size: 30px; }
}
