:root {
    --hud-color: #4aff71;
    --hud-dim: rgba(74, 255, 113, 0.3);
    --hud-glow: rgba(74, 255, 113, 0.6);
    --bg-dark: #000c04;
    --glass-bg: rgba(0, 15, 5, 0.9);
    --text-white: #e0ffd9;
    --font-ui: 'Share Tech Mono', monospace;
    --font-heading: 'Rajdhani', sans-serif;
    --font-blackletter: 'UnifrakturMaguntia', cursive;
    --nuke-red: #ff003c;
}

/* THEMES */
body.theme-nvg-green {
    --hud-color: #66ff88;
    --hud-dim: rgba(102, 255, 136, 0.3);
    --hud-glow: rgba(102, 255, 136, 0.7);
    --bg-dark: #020804;
    --glass-bg: rgba(2, 20, 10, 0.9);
    --text-white: #e1ffe8;
    --filter-tint: invert(0%) sepia(80%) saturate(600%) hue-rotate(85deg) brightness(80%) contrast(150%);
}

body.theme-nvg-white {
    --hud-color: #b0fce5;
    --hud-dim: rgba(176, 252, 229, 0.3);
    --hud-glow: rgba(176, 252, 229, 0.7);
    --bg-dark: #02080a;
    --glass-bg: rgba(5, 15, 20, 0.9);
    --text-white: #ffffff;
    --filter-tint: invert(0%) sepia(50%) saturate(200%) hue-rotate(140deg) brightness(120%) contrast(140%);
}

body.theme-thermal {
    --hud-color: #ff3300;
    --hud-dim: rgba(255, 51, 0, 0.3);
    --hud-glow: rgba(255, 51, 0, 0.7);
    --bg-dark: #220000;
    --glass-bg: rgba(40, 5, 5, 0.9);
    --text-white: #ffcc00;
    --filter-tint: invert(100%) sepia(100%) saturate(500%) hue-rotate(150deg) brightness(90%) contrast(200%);
}

* { box-sizing: border-box; margin: 0; padding: 0; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='32' viewBox='0 0 60 32'%3E%3Cfilter id='o'%3E%3CfeMorphology in='SourceAlpha' result='D' operator='dilate' radius='1'/%3E%3CfeFlood flood-color='black' flood-opacity='1' result='B'/%3E%3CfeComposite in='B' in2='D' operator='in' result='O'/%3E%3CfeMerge%3E%3CfeMergeNode in='O'/%3E%3CfeMergeNode in='SourceGraphic'/%3E%3C/feMerge%3E%3C/filter%3E%3Cg filter='url(%23o)' fill='white'%3E%3Crect x='2' y='14' width='18' height='4'/%3E%3Crect x='20' y='12' width='18' height='8'/%3E%3Cpath d='M24,20 L24,28 L30,28 L30,20 Z' fill='%234aff71'/%3E%3Cpath d='M34,20 L32,28 L36,28 L38,20 Z'/%3E%3Crect x='38' y='14' width='16' height='4'/%3E%3Crect x='48' y='12' width='6' height='12' fill='%234aff71'/%3E%3Crect x='6' y='10' width='2' height='4'/%3E%3Crect x='34' y='8' width='2' height='4'/%3E%3C/g%3E%3C/svg%3E") 0 16, crosshair !important; user-select: none; }
body { background-color: #000; color: var(--hud-color); font-family: var(--font-ui); overflow: hidden; height: 100vh; }

/* ---------------------------------
   BACKGROUND VIDEO & EFFECTS
--------------------------------- */
#videoContainer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -10; }
#bgVideo { width: 100vw; height: 100vh; object-fit: cover; filter: var(--filter-tint); transition: filter 0.5s, opacity 0.5s; background: #000; }
.video-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.8) 100%); pointer-events: none; }
.nvg-grain { position: absolute; top:0; left:0; width:100%; height:100%; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"); opacity: 0.15; pointer-events: none; mix-blend-mode: overlay; }
.scanlines { position: absolute; top:0; left:0; width:100%; height:100%; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%); background-size: 100% 4px; pointer-events: none; }
#hudCanvas { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events: none; opacity: 0.7; }

/* ---------------------------------
   BOOT SCREEN
--------------------------------- */
.fullscreen-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; display: flex; justify-content: center; align-items: center; background: #000; z-index: 100; transition: opacity 0.5s; }
.text-center { text-align: center; }
.glitch-text { font-family: var(--font-heading); font-size: 4rem; color: var(--hud-color); text-shadow: 2px 0 blue; animation: glitch 1s infinite alternate; }
@keyframes glitch { 0% { transform: skew(0deg); } 20% { transform: skew(-5deg); text-shadow: -2px 0 blue; } 40% { transform: skew(0deg); } }

/* ---------------------------------
   MAIN LAYOUT & HUD
--------------------------------- */
.layout { display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 1; }
.hidden { display: none !important; opacity: 0 !important; pointer-events: none !important; }

.hud-topbar { display: flex; justify-content: space-between; padding: 15px 30px; border-bottom: 1px solid var(--hud-dim); font-size: 1.1rem; text-shadow: 0 0 5px var(--hud-glow); background: linear-gradient(180deg, var(--glass-bg), transparent); }
.main-columns { display: flex; flex: 1; overflow: hidden; }

.sidebar { width: 300px; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; border-right: 1px solid var(--hud-dim); background: var(--glass-bg); backdrop-filter: blur(5px); }
.nav-menu { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 40px;}
.nav-btn { background: var(--glass-bg); border: 1px solid transparent; color: var(--hud-dim); text-align: left; padding: 10px; font-family: var(--font-ui); font-size: 1.1rem; transition: 0.3s; }
.nav-btn:hover { color: var(--hud-color); background: rgba(255,255,255,0.05); border-left: 2px solid var(--hud-color); }
.nav-btn.active { color: var(--hud-color); border-left: 4px solid var(--hud-color); background: var(--hud-dim); text-shadow: 0 0 5px var(--hud-glow); font-weight: bold;}

.content-wrapper { flex: 1; padding: 40px; position: relative; overflow-y: auto; }
.view-panel { position: absolute; width: 90%; max-width: 1200px; opacity: 0; transform: translateY(10px); transition: all 0.4s; pointer-events: none; }
.view-panel.active { opacity: 1; transform: translateY(0); pointer-events: all; position: relative; margin: 0 auto 40px auto; }

/* REUSABLE GLASS COMPONENTS */
.glass-container { background: var(--glass-bg); border: 1px solid var(--hud-dim); padding: 40px; box-shadow: 0 0 20px rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.section-title { font-size: 0.9rem; letter-spacing: 5px; color: var(--hud-color); margin-bottom: 20px; border-bottom: 1px solid var(--hud-dim); padding-bottom: 5px; text-transform: uppercase;}
.bold-header { font-family: var(--font-heading); font-size: 3.5rem; font-weight: 700; color: var(--text-white); text-shadow: 0 0 10px var(--hud-glow); margin-bottom: 20px; text-transform: uppercase; }
p { font-size: 1.2rem; line-height: 1.7; color: var(--text-white); margin-bottom: 10px; }

/* DOSSIER BACKGROUND PHOTOS */
#view-dossier { position: relative; }
.dossier-bg { position: fixed; top:0; left:0; width:100vw; height:100vh; display: block; z-index: 1; opacity: 1.0; pointer-events: none; filter: brightness(80%); transition: opacity 0.5s; }

/* Hyper-Sharp Neon Slice Connectors injected directly into the gaps */
.dossier-bg::before, .dossier-bg::after {
    content: ''; position: absolute; top:0; left:0; width:100vw; height:100vh;
    background: var(--text-white); filter: drop-shadow(0 0 5px var(--hud-color));
    z-index: 10;
}
.dossier-bg::before { clip-path: polygon(33.43% 0, 33.53% 0, 23.53% 100%, 23.43% 100%); }
.dossier-bg::after { clip-path: polygon(66.76% 0, 66.86% 0, 56.86% 100%, 56.76% 100%); }

.slice { position: absolute; top:0; left:0; width:100vw; height:100vh; }
.slice-1 { clip-path: polygon(0 0, 33.33% 0, 23.33% 100%, 0 100%); }
.slice-2 { clip-path: polygon(33.63% 0, 66.66% 0, 56.66% 100%, 23.63% 100%); }
.slice-3 { clip-path: polygon(66.96% 0, 100% 0, 100% 100%, 56.96% 100%); }

/* Precise zero-zoom subject targeting: perfectly align the actual center of the 100vw image with the window's center */
.slice img { position: absolute; top:0; width: 100vw; height: 100vh; object-fit: cover; }
.slice-1 img { left: -33.33vw; }
.slice-2 img { left: 0vw; }
.slice-3 img { left: 33.33vw; }

/* .glass-overlay-mode removed */

/* BUTTONS */
.action-btn { background: var(--glass-bg); border: 1px solid var(--hud-color); color: var(--hud-color); padding: 12px 20px; font-family: var(--font-ui); font-size: 1rem; transition: 0.2s; box-shadow: 0 0 10px var(--hud-dim); width: 100%; display:block;}
.action-btn:hover { background: var(--hud-color); color: #000; box-shadow: 0 0 20px var(--hud-glow); }
.action-btn.action-active { background: var(--hud-color); color: #000; border-color: var(--text-white); font-weight:bold; }
.ext-link { letter-spacing: 1px; }
.ext-link:hover { background: var(--text-white); color: #000; border-color: transparent;}
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 30px; }


/* SURVEILLANCE POPUP */
#surveillancePopup { position: fixed; top: 10%; left: 10%; width: 80%; height: 80%; background: #000; z-index: 10000; border: 2px solid var(--hud-color); box-shadow: 0 0 50px rgba(0,0,0,0.9), 0 0 20px var(--hud-glow); display: flex; flex-direction: column; }
.popup-header { display: flex; justify-content: space-between; padding: 10px 20px; border-bottom: 2px solid var(--hud-dim); font-size: 1.2rem; background: var(--glass-bg); }
#closePopupBtn { background: transparent; border: none; color: #ff003c; font-family: var(--font-ui); font-size: 1.2rem; font-weight: bold; cursor: crosshair !important; text-shadow: 0 0 10px red; letter-spacing:2px;}
#closePopupBtn:hover { color: #fff; text-shadow: 0 0 15px #ff003c; }
.popup-video-mask { flex: 1; position: relative; pointer-events: none; overflow: hidden; } /* Blocks clicking on the video completely */
.popup-video-mask iframe { position: absolute; top:-5%; left:-5%; width:110%; height:110%; border:none; }

/* SPECIALTY UI: DOSSIER COMMS */
.tactical-list.no-bullet { list-style: none; }
.tactical-list.no-bullet li { border: 1px solid var(--hud-dim); padding: 15px; margin-bottom: 10px; background: rgba(0,0,0,0.4); display:flex; align-items:center; }
.icon-svg { width: 30px; height: 30px; fill: var(--hud-color); margin-right: 15px; vertical-align: middle; }
.cyber-link { color: var(--hud-color); text-decoration: underline; font-weight:bold; text-underline-offset: 4px; transition: 0.3s; cursor: pointer !important; }
.cyber-link:hover { color: var(--text-white); text-decoration-color: var(--text-white); text-shadow: 0 0 10px var(--hud-glow); }
.discord-gothic { font-family: var(--font-blackletter); font-size: 2rem; color: var(--text-white); text-shadow: 0 0 5px rgba(255,255,255,0.4); letter-spacing:1px; }
.copy-btn-small { background: var(--hud-dim); border: 1px solid var(--hud-color); color: var(--hud-color); padding: 5px 10px; font-family: var(--font-ui); margin-left:auto; border-radius: 4px; }
.copy-btn-small:hover { background: var(--hud-color); color: #000; }
.status-msg { color: var(--hud-color); font-size: 0.9rem; padding: 10px; border-left: 2px solid var(--hud-color); background: rgba(0,0,0,0.5); }

/* SPECIALTY UI: RADAR MAP & FLAGS */
.leaflet-container { background: #000 !important; }
.leaflet-control-attribution { display: none !important; }

.map-container { width: 100%; height: 500px; border: 2px solid var(--hud-dim); box-shadow: 0 0 20px rgba(0,0,0,0.5); filter: sepia(70%) hue-rotate(90deg) saturate(200%) brightness(180%) contrast(150%); }

.waving-flag { 
    display: inline-block; 
    border: 1px solid rgba(255,255,255,0.3); 
    box-shadow: 0 0 10px var(--hud-glow); 
    animation: waveFlag 2.5s ease-in-out infinite alternate;
    border-radius:2px;
}
@keyframes waveFlag {
    0% { transform: translateY(0px) skewY(0deg); }
    100% { transform: translateY(-4px) skewY(2deg); }
}

/* SETTINGS GRID */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.settings-grid h3 { font-family: var(--font-heading); font-size: 1.5rem; border-bottom: 1px solid var(--hud-dim); margin-bottom: 15px; }

/* FOOTER QUOTES */
.hud-footer { padding: 20px; border-top: 1px solid var(--hud-dim); background: linear-gradient(0deg, var(--glass-bg), transparent); display: flex; justify-content: center; align-items: center; position: relative; }
.quote-container { text-align: center; max-width: 800px; }
.tactical-quote { font-family: var(--font-heading); font-size: 2rem; color: var(--text-white); text-shadow: 0 0 10px transparent; transition: opacity 0.5s; font-style:italic;}
.quote-author { font-size: 1rem; color: var(--hud-color); margin-top: 5px; font-weight:bold; letter-spacing: 2px;}
.hl-green { color: var(--hud-color); text-shadow: 0 0 15px var(--hud-glow); }
.blink { animation: bl 1s infinite; }
@keyframes bl { 50% {opacity:0;} }

/* --- THE DECRYPTION GAME UI --- */
.mission-card { border: 1px dashed var(--hud-dim); padding: 15px 20px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.4); transition: 0.2s; }
.mission-card:hover { border-color: var(--hud-color); background: var(--hud-dim); box-shadow: 0 0 15px var(--hud-glow); }
.mission-diff { font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 1px solid; font-size: 0.8rem;}
.diff-EASY { color: #00e5ff; border-color: #00e5ff; }
.diff-MED { color: #ffeb3b; border-color: #ffeb3b; }
.diff-HARD { color: #ff3d00; border-color: #ff3d00; }
.diff-BLACK { color: #ff003c; border-color: #ff003c; background: rgba(255,0,60,0.1); }
.mission-title { font-size: 1.2rem; color: var(--text-white); flex: 1; margin: 0 20px; }
.mission-btn { background: var(--glass-bg); border: 1px solid var(--hud-color); color: var(--hud-color); padding: 8px 15px; font-weight: bold; font-family: var(--font-ui); }
.mission-btn:hover { background: var(--hud-color); color: #000; }

.terminal-box { background: rgba(0,0,0,0.8); border: 2px solid var(--hud-color); border-radius: 8px; padding: 30px; min-height: 200px; box-shadow: inset 0 0 30px rgba(0,0,0,0.8), 0 0 20px var(--hud-glow); text-align: center; position:relative; overflow:hidden;}
.progress-bar-container { width: 100%; height: 10px; background: rgba(255,255,255,0.1); border: 1px solid var(--hud-dim); border-radius: 5px; overflow: hidden; }
.progress-bar-fill { width: 100%; height: 100%; background: var(--hud-color); transform-origin: left; display: block;}

.game-grid { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.hex-node { background: transparent; border: 2px solid var(--hud-dim); color: var(--text-white); padding: 15px 30px; font-size: 1.5rem; font-family: var(--font-ui); transition: 0.2s; min-width: 120px; letter-spacing: 2px; }
.hex-node:hover { border-color: var(--hud-color); background: var(--hud-dim); color: var(--hud-color); box-shadow: 0 0 15px var(--hud-glow), inset 0 0 10px var(--hud-glow); transform: scale(1.05); }
.mission-btn.completed { background: rgba(74, 255, 113, 0.4); color: white; border-color: transparent; pointer-events: none; }

/* --- JUMPSCARE OVERLAY --- */
#jumpscareOverlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 99999999; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
#jumpscareOverlay.hidden { display: none !important; }
#jumpscareOverlay img { width: 100vw; height: 100vh; object-fit: cover; position: absolute; top: 0; left: 0; z-index: -1; animation: glitch 0.1s infinite alternate; mix-blend-mode: color-dodge; }
#jumpscareOverlay h1 { font-family: var(--font-heading); font-size: 5rem; color: #ff0000; text-shadow: 0 0 30px #ff0000; z-index: 1; background: rgba(0,0,0,0.8); padding: 30px; border: 4px solid #ff0000; letter-spacing: 5px; text-transform: uppercase; }

/* --- THE NUKE OVERLAY --- */
#nuke-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(25, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: none;
}

.nuke-text {
    font-size: 8vw;
    font-weight: bold;
    color: #ff003c;
    text-shadow: 0 0 30px #ff003c, 0 0 60px #fff;
    text-align: center;
    letter-spacing: 5px;
}

#nuke-timer {
    font-size: 12vw;
    margin-top: 20px;
    color: #ff003c;
    text-shadow: 0 0 30px #ff003c;
    font-weight: bold;
}

/* --- SHAKE ANIMATION --- */
.shake-hard {
    animation: shake 0.1s infinite cubic-bezier(.36,.07,.19,.97);
}
@keyframes shake {
    0% { transform: translate(0, 0) }
    20% { transform: translate(-25px, 20px) }
    40% { transform: translate(20px, -25px) }
    60% { transform: translate(-20px, 25px) }
    80% { transform: translate(25px, -20px) }
    100% { transform: translate(0, 0) }
}
