:root {
    --amber: #ffb000;
    --amber-dim: rgba(255, 176, 0, 0.25);
    --bg-dark: #07080a;
    --panel-bg: hsla(220, 20%, 8%, 0.9);
    --neon-green: #00ff88;
    --neon-blue: #00d4ff;
    --neon-red: #ff3344;
    --ticker-bg: rgba(0, 0, 0, 0.92);
    --mobile-nav-h: 65px;
    --glass-edge: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Share Tech Mono', monospace; }
body, html { width: 100%; height: 100%; overflow: hidden; background: #000; color: var(--amber); }

#map { position: absolute; inset: 0; z-index: 1; }
/* MapLibre Control Position Fix */
.maplibregl-ctrl-bottom-right { bottom: 65px; right: 10px; display: block; }
.maplibregl-ctrl-bottom-left { display: none; }

/* -------------------------------------------------------
   GLOBAL NEWS TICKER (Marquee)
------------------------------------------------------- */
.global-ticker {
    position: fixed;
    left: 0; width: 100%; height: 28px;
    background: rgba(0, 0, 0, 0.75);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 500;
    display: flex; align-items: center;
    overflow: hidden;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

#ticker-top { top: 0; border-top: none; transform: translateY(-40px); opacity: 0; }
#ticker-bottom { bottom: 0; border-bottom: none; }

.ticker-content {
    white-space: nowrap;
    padding-left: 100%;
    display: inline-block;
    animation: marquee 120s linear infinite;
    font-size: 0.85rem;
    color: var(--amber) !important;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 500;
}

.ticker-content:hover { animation-play-state: paused; cursor: pointer; }

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* -------------------------------------------------------
   MOBILE UI - NAVIGATION & SHEETS
------------------------------------------------------- */
#mobile-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: var(--mobile-nav-h);
    background: rgba(10,12,20,0.95);
    border-top: 2px solid var(--amber-dim);
    z-index: 1000;
    display: none; justify-content: space-around; align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    background: none; border: none; color: rgba(255,176,0,0.4);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer; transition: all 0.3s; width: 20%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 8px 4px;
}
.nav-btn i { font-size: 1.2rem; }
.nav-btn span { font-size: 0.6rem; letter-spacing: 1px; }
.nav-btn.active { color: var(--amber); text-shadow: 0 0 8px var(--amber); }

/* Unified Command Sheets (Mobile) */
@media (max-width: 768px) {
    #ticker-top { transform: translateY(0); opacity: 1; }
    #ticker-bottom { transform: translateY(0); opacity: 1; bottom: var(--mobile-nav-h); border-bottom: none; }
    
    #mobile-nav { display: flex; z-index: 1000; }
    #mobile-menu-btn { display: none !important; }

    /* CRITICAL: Override ALL inline styles from switchMode() so .active class always wins */
    #sidebar, #info-panel {
        position: fixed !important;
        width: 100% !important;
        left: 0 !important; right: 0 !important;
        border: none !important; border-radius: 0 !important;
        margin: 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1) !important;
        height: calc(100% - var(--mobile-nav-h) - 28px) !important;
        max-height: none !important;
        top: 28px !important;
        bottom: var(--mobile-nav-h) !important;
        /* Override switchMode() inline styles */
        opacity: 1 !important;
        pointer-events: none !important;
        display: block !important;
        z-index: 900 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #sidebar.active, #info-panel.active {
        transform: translateY(0%) !important;
        z-index: 950 !important;
        pointer-events: auto !important;
    }

    /* Disable desktop hover-expand on mobile — drawer handles this */
    #sidebar:hover {
        max-height: none !important;
        width: 100% !important;
    }
    #info-panel:hover {
        max-height: none !important;
        width: 100% !important;
    }

    .sidebar-body { height: calc(100% - 60px); overflow-y: auto; -webkit-overflow-scrolling: touch; }

    /* Semi-transparent backdrop when a panel is open */
    body.mobile-panel-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 899;
        pointer-events: none;
    }

    /* Ensure toggle switches are touch-friendly */
    .control-item {
        min-height: 36px;
        padding: 4px 6px;
    }
    .toggle-switch {
        min-width: 44px;
        min-height: 20px;
    }

    /* Collapsible sections need visible tap targets */
    .category-title {
        padding: 12px 8px;
        min-height: 44px;
    }

    #map-branding {
        display: none !important;
    }

    /* Fixed Crisis Briefing Panel on Mobile */
    #briefing-panel {
        top: 90px !important;
        right: 10px !important;
        left: 10px !important;
        width: calc(100vw - 20px) !important;
        bottom: calc(var(--mobile-nav-h) + 10px) !important;
        max-height: calc(100vh - var(--mobile-nav-h) - 100px) !important;
        z-index: 1050 !important;
    }

    /* Popups always above sidebar */
    .maplibregl-popup {
        z-index: 960 !important;
    }

    /* Tour briefing above everything */
    .tour-briefing-panel {
        z-index: 1060 !important;
    }
}

/* -------------------------------------------------------
   DESKTOP PANELS (Premium Glassmorphism V7.0)
------------------------------------------------------- */
.terminal-panel {
    position: fixed; z-index: 100;
    background: var(--panel-bg);
    border: 1px solid var(--glass-edge);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.03);
    backdrop-filter: blur(18px);
    overflow: hidden;
    transition: all 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

#sidebar {
    top: 52px; right: 14px; width: 300px;
    border-right: 3px solid var(--amber);
    max-height: 42px;
}
#sidebar:hover { max-height: 90vh; overflow-y: auto; width: 320px; box-shadow: 0 0 30px var(--amber-dim); }



/* CRT Scanline Overlay */
.terminal-panel::before {
    content: ""; display: block; position: absolute; inset: 0;
    pointer-events: none; z-index: 100;
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,.08) 50%);
    background-size: 100% 3px; opacity: 0.25;
}

/* Header & Typography */
header {
    padding: 8px 12px; display: flex; flex-direction: column; gap: 3px;
    position: relative; border-bottom: 1px solid rgba(255,255,255,0.05);
}
#sidebar header {
    position: sticky; top: 0; z-index: 10;
    background: var(--panel-bg); backdrop-filter: blur(18px);
}
.header-top-row { display: flex; justify-content: space-between; align-items: center; }

/* Main title row — amber, signature color — use ID specificity to guarantee override */
#sidebar header h1 { font-size: 0.85rem; letter-spacing: 2.5px; font-weight: 700; margin: 0; color: #ffb000; text-shadow: 0 0 5px rgba(255,176,0,0.5); }
#sidebar .header-main .sidebar-expand-hint {
    font-size: 0.8rem; letter-spacing: 2px; font-weight: 600;
    color: #ffb000; opacity: 0.8; margin: 0;
}

/* Meta row — dimmed, secondary info */
.header-meta { margin-top: 1px; }
.header-meta .byline {
    font-size: 0.5rem; letter-spacing: 1.5px;
    text-transform: uppercase; font-weight: normal;
    color: rgba(255,255,255,0.3); opacity: 1;
}
.header-meta .sub-header {
    font-size: 0.5rem; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35); opacity: 1; gap: 4px;
}

header h2 { font-size: 0.85rem; letter-spacing: 2.5px; font-weight: 700; margin: 0; }

.version { font-size: 0.6rem; opacity: 0.5; }
.sub-header {
    font-size: 0.52rem; opacity: 0.5; display: flex; align-items: center;
    gap: 4px; letter-spacing: 1.2px; color: #fff;
}
.blinking-cursor {
    width: 6px; height: 10px; background: currentColor;
    animation: cursor-blink 1s step-end infinite;
}
@keyframes cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.category-title {
    font-size: .75rem; text-transform: uppercase; letter-spacing: 1px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 6px; cursor: pointer;
    border-left: 2px solid var(--amber-dim); user-select: none;
}
.category-title:hover { border-left-color: var(--amber); background: rgba(255,176,0,.08); }

/* Toggles */
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.control-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; min-height: 28px; margin-bottom:4px; }
.control-item > span:first-child { flex: 1; }

/* Status Badges */
.layer-status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.5rem; padding: 2px 6px; border-radius: 2px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 1px; cursor: help; margin-top:2px; font-weight: normal;
}
.layer-status-badge.status-live { color: var(--neon-green); border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.05); }
.layer-status-badge.status-live::before { content: ''; width: 4px; height: 4px; background: var(--neon-green); border-radius: 50%; animation: pulse-green 2s infinite; }
.layer-status-badge.status-delayed { color: var(--amber); border-color: rgba(255,176,0,0.3); background: rgba(255,176,0,0.05); }
.layer-status-badge.status-delayed::before { content: ''; width: 4px; height: 4px; background: var(--amber); border-radius: 50%; opacity: 0.8; }
.layer-status-badge.status-degraded { color: #ffb000; border-color: rgba(255,176,0,0.3); background: rgba(255,176,0,0.15); }
.layer-status-badge.status-degraded::before { content: ''; width: 4px; height: 4px; background: var(--amber); border-radius: 50%; animation: pulse-amber 2s infinite; }
@keyframes pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(255,176,0,0.4); } 70% { box-shadow: 0 0 0 4px rgba(255,176,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,176,0,0); } }
.layer-status-badge.status-limited { color: var(--neon-blue); border-color: rgba(0,212,255,0.3); background: rgba(0,212,255,0.05); }
.layer-status-badge.status-limited::before { content: ''; width: 4px; height: 4px; background: var(--neon-blue); border-radius: 50%; }
.layer-status-badge.status-static { color: #aaa; border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.02); }
.layer-status-badge.status-static::before { content: ''; width: 4px; height: 4px; background: #aaa; border-radius: 50%; }
.layer-status-badge.status-error { color: var(--neon-red); border-color: rgba(255,51,68,0.3); background: rgba(255,51,68,0.08); }
.layer-status-badge.status-error::before { content: ''; width: 4px; height: 4px; background: var(--neon-red); border-radius: 50%; animation: pulse-red 1s infinite; }
.layer-status-badge.status-experimental { color: #e066ff; border-color: rgba(224,102,255,0.3); background: rgba(224,102,255,0.05); }
.layer-status-badge.status-experimental::before { content: ''; width: 4px; height: 4px; background: #e066ff; border-radius: 50%; }

/* Hardware Toggles (V8.1 Aero-Switch) */
.toggle-switch {
    position: relative; width: 44px; height: 16px;
    background: rgba(40,45,50,0.8); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px; cursor: pointer; transition: all 0.3s;
    overflow: hidden; display: block;
}
.toggle-switch input {
    opacity: 0; width: 0; height: 0; position: absolute;
}
.slider {
    position: absolute; inset: 0; background: rgba(0,0,0,0.4);
    transition: 0.2s ease-in-out;
}
.slider:before {
    position: absolute; content: "";
    height: 100%; width: 18px; left: 0; top: 0;
    background: #555; border-right: 1px solid rgba(255,255,255,0.1);
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
    transition: 0.2s ease-in-out;
}
input:checked + .slider {
    background: rgba(0,255,255,0.15);
}
input:checked + .slider:before {
    transform: translateX(26px);
    background: var(--neon-cyan);
    box-shadow: -2px 0 10px rgba(0,255,255,0.4);
}
.control-item:hover .toggle-switch {
    border-color: rgba(0,255,255,0.3);
}



/* -------------------------------------------------------
   POWER OUTAGE MARKERS
------------------------------------------------------- */
.marker-power {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

.marker-power-live .core {
    width: 10px; height: 10px; background: #ff0000; border-radius: 50%;
    box-shadow: 0 0 10px #ff0000; animation: pulse-red 1.5s infinite;
}

.marker-power-hist .core {
    width: 8px; height: 8px; background: #555; border-radius: 50%;
    border: 1px solid var(--amber-dim); opacity: 0.7;
}

@keyframes pulse-red {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255,0,0,0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255,0,0,0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255,0,0,0); }
}

/* -------------------------------------------------------
   ORIENTATION HINT
------------------------------------------------------- */
#orientation-hint {
    display: none;
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.95);
    color: var(--amber);
    flex-direction: column; align-items: center; justify-content: center;
    gap: 20px; text-align: center; font-size: 1.2rem;
}

@media (max-width: 600px) and (orientation: portrait) {
    #orientation-hint { display: none; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* -------------------------------------------------------
   UTILITIES
------------------------------------------------------- */
.pulse { animation: pulse-green 2s infinite; }
@keyframes pulse-green {
    0%   { opacity: 1; }
    50%  { opacity: 0.4; }
    100% { opacity: 1; }
}

#status-text { color: var(--amber); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; }
.cat-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.collapsible-section.open .cat-body { max-height: 1500px; padding: 10px 0; }
.category-title { opacity: 0.9 !important; font-size: 0.75rem !important; }
.control-item span { opacity: 0.95 !important; font-size: 0.72rem !important; }



#launch-hud {
    position: fixed; bottom: 45px; left: 14px; z-index: 800;
    background: rgba(0,5,20,0.9); border: 1px solid rgba(255,100,0,0.4);
    backdrop-filter: blur(10px); padding: 10px; border-radius: 4px;
    font-size: 0.65rem; opacity: 0; pointer-events: none;
    transition: all 0.3s;
}

/* -------------------------------------------------------
   V7.1 MAP BRANDING & POPUPS
------------------------------------------------------- */
#map-branding {
    position: fixed; bottom: 45px; left: 0; width: 100%;
    z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none; gap: 4px;
}
.tactical-footer-hud {
    font-size: 0.58rem; color: rgba(255,255,255,0.7);
    letter-spacing: 1.5px; font-family: 'Share Tech Mono', monospace;
    background: rgba(0,0,0,0.65); padding: 5px 16px; border-radius: 4px;
    border-top: 1px solid rgba(255,176,0,0.6); border-bottom: 1px solid rgba(255,176,0,0.2);
    backdrop-filter: blur(6px); pointer-events: auto; text-shadow: 0 0 4px rgba(255,255,255,0.2);
}
.tactical-footer-hud a { color: #fff; text-decoration: none; margin: 0 2px; transition: 0.2s; }
.tactical-footer-hud a:hover { opacity: 1; text-shadow: 0 0 5px var(--amber); }
.neon-number { color: var(--neon-blue); text-shadow: 0 0 5px rgba(0, 212, 255, 0.5); }

/* Popup Dark Mode Correction */
.maplibregl-popup-content {
    background: rgba(10, 14, 20, 0.95) !important;
    color: #fff !important;
    border: 1px solid var(--glass-edge) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9) !important;
    padding: 12px !important; border-radius: 4px !important;
    font-size: 0.82rem !important;
    line-height: 1.5 !important;
    max-width: 320px !important;
}
.maplibregl-popup-tip { border-top-color: var(--panel-bg) !important; }
.maplibregl-popup-close-button { color: #888 !important; outline: none !important; }

/* Remove legacy elements */
/* Hide elements when ticker is disabled */
body.no-ticker .global-ticker { display: none !important; }
body.no-ticker #sidebar { top: 14px !important; }

/* -------------------------------------------------------
   SOLAR WIDGET — Integrated Menu Style
------------------------------------------------------- */
.solar-widget { margin-top: 8px; padding: 6px 8px; border-top: 1px solid rgba(255,255,255,0.07); font-family: 'Share Tech Mono', monospace; }
.solar-title { font-size: 0.58rem; letter-spacing: 1.5px; color: rgba(255,255,255,0.35); text-transform: uppercase; margin-bottom: 5px; }
.solar-loading { font-size: 0.55rem; color: rgba(255,255,255,0.25); letter-spacing: 1px; }
.solar-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin-bottom: 4px; }
.solar-cell { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); padding: 4px 2px; border-radius: 2px; }
.solar-val { font-size: 0.85rem; font-weight: 700; line-height: 1; }
.solar-lbl { font-size: 0.42rem; opacity: 0.4; letter-spacing: 1px; margin-top: 2px; text-transform: uppercase; }
.solar-level { font-size: 0.5rem; letter-spacing: 1px; text-align: center; margin-top: 3px; opacity: 0.85; }
.solar-alert { font-size: 0.5rem; color: #ffe066; text-align: center; margin-top: 3px; letter-spacing: 1px; }

/* -------------------------------------------------------
   LAYER LEGEND (SST / Surface Temp)
------------------------------------------------------- */
#layer-legend {
    position: fixed; bottom: 65px; left: 50%; transform: translateX(-50%);
    z-index: 460; flex-direction: column; align-items: center; gap: 3px;
    background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px; padding: 6px 14px; backdrop-filter: blur(6px);
    font-family: 'Share Tech Mono', monospace; pointer-events: none; min-width: 180px;
}
.legend-title { font-size: 0.5rem; letter-spacing: 1.5px; color: rgba(255,255,255,0.5); text-align: center; text-transform: uppercase; margin-bottom: 3px; }
.legend-bar { width: 100%; height: 6px; border-radius: 3px; opacity: 0.85; }
.legend-labels { display: flex; justify-content: space-between; width: 100%; font-size: 0.42rem; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* -------------------------------------------------------
   TACTICAL BUTTONS (shared — scenarios, etc.)
------------------------------------------------------- */
.tactical-btn {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 10px 20px; font-size: 0.8rem; letter-spacing: 2px;
    cursor: pointer; transition: all 0.3s; pointer-events: auto;
}
.tactical-btn:hover { background: var(--neon-blue); color: #000; box-shadow: 0 0 20px var(--neon-blue); }
.exit-btn { border-color: var(--neon-red); color: var(--neon-red); background: rgba(255, 51, 68, 0.05); }
.exit-btn:hover { background: var(--neon-red); color: #fff; box-shadow: 0 0 20px var(--neon-red); }


/* -------------------------------------------------------
   LANGUAGE SELECTOR
------------------------------------------------------- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switch {
    display: flex;
    gap: 2px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    padding: 1px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.35);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.55rem;
    padding: 3px 7px;
    cursor: pointer;
    border-radius: 2px;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.05);
}

.lang-btn.active {
    color: var(--neon-blue);
    background: rgba(0,212,255,0.12);
    font-weight: bold;
}

/* -------------------------------------------------------
   INFO PANEL (In-App Educational Content)
------------------------------------------------------- */
#info-panel {
    position: fixed; z-index: 100;
    top: 52px; left: 14px; width: 240px;
    border-left: 3px solid var(--neon-blue);
    max-height: 42px;
    background: var(--panel-bg);
    border: 1px solid var(--glass-edge);
    border-left: 3px solid var(--neon-blue);
    border-radius: 4px;
    backdrop-filter: blur(18px);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.03);
    transition: all 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}
#info-panel:hover { max-height: 85vh; width: 340px; box-shadow: 0 0 30px rgba(0,212,255,0.15); overflow-y: auto; }

#info-panel header h2 { color: var(--neon-blue); font-size: 0.8rem; text-shadow: 0 0 5px rgba(0,212,255,0.5); }

.info-panel-body {
    padding: 6px 10px 10px;
    font-size: 0.72rem;
    line-height: 1.5;
}

.info-section {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.info-section h3 {
    font-size: 0.68rem;
    letter-spacing: 1px;
    color: var(--neon-blue);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.info-section p {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
    margin: 0;
}

.info-source-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-source-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px;
    background: rgba(255,255,255,0.02);
    border-radius: 3px;
}

.info-source-item strong {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.8);
    letter-spacing: 0.5px;
}

.info-source-item p {
    font-size: 0.55rem !important;
    margin-top: 2px;
    color: rgba(255,255,255,0.4) !important;
}

.source-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.source-dot.live {
    background: var(--neon-green);
    box-shadow: 0 0 4px var(--neon-green);
    animation: pulse-green 2s infinite;
}

.source-dot.static {
    background: #888;
}

.info-link-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.info-link {
    display: block;
    font-size: 0.6rem;
    color: var(--neon-blue);
    text-decoration: none;
    background: rgba(0,212,255,0.05);
    border: 1px solid rgba(0,212,255,0.15);
    padding: 5px 8px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    font-family: 'Share Tech Mono', monospace;
}

.info-link:hover {
    background: rgba(0,212,255,0.12);
    border-color: rgba(0,212,255,0.4);
}

/* -------------------------------------------------------
   Intelligence Briefing Panel
------------------------------------------------------- */
#briefing-panel {
    position: absolute;
    top: 110px;
    right: 340px;
    width: 360px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    background: rgba(8, 12, 20, 0.96) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.9);
}

#briefing-panel.hidden {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
}

.briefing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.briefing-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.briefing-header.severity-critical h2 { color: #ff0000; }
.briefing-header.severity-high h2 { color: #ff3300; }
.briefing-header.severity-medium h2 { color: #ffb000; }
.briefing-header.severity-low h2 { color: #00d4ff; }

.btn-close-briefing {
    background: transparent;
    border: none;
    color: #fff;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.2rem;
    transition: opacity 0.2s;
}

.btn-close-briefing:hover {
    opacity: 1;
}

.btn-narrate-briefing {
    background: rgba(255,176,0,0.15);
    border: 1px solid rgba(255,176,0,0.5);
    color: #ffb000;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 5px 14px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: auto;
    margin-right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    animation: audioGlow 3s ease-in-out infinite;
}
@keyframes audioGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(255,176,0,0.15); }
    50% { box-shadow: 0 0 12px rgba(255,176,0,0.3); }
}
.btn-narrate-briefing:hover {
    color: #fff;
    border-color: rgba(255,176,0,0.8);
    background: rgba(255,176,0,0.25);
    box-shadow: 0 0 15px rgba(255,176,0,0.4);
}
.btn-narrate-briefing.active {
    color: #00d4ff;
    border-color: rgba(0,212,255,0.6);
    background: rgba(0,212,255,0.2);
    box-shadow: 0 0 15px rgba(0,212,255,0.35);
    animation: none;
}

.briefing-body h3 {
    margin: 0 0 5px 0;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
}

.briefing-body p {
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #eed;
    border-left: 2px solid rgba(255,255,255,0.2);
    padding-left: 10px;
}

.briefing-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 15px;
    border-radius: 4px;
}

.briefing-meta-grid div {
    font-size: 0.8rem;
    color: #fff;
}

.briefing-meta-grid span {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 2px;
}

.related-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.related-chip {
    background: rgba(0,212,255,0.1);
    border: 1px solid rgba(0,212,255,0.3);
    color: #00d4ff;
    padding: 5px 10px;
    font-size: 0.7rem;
    border-radius: 2px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.related-chip:hover {
    background: rgba(0,212,255,0.2);
    border-color: rgba(0,212,255,0.6);
}

@media (max-width: 768px) {
    #briefing-panel {
        top: auto;
        bottom: 85px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

/* -------------------------------------------------------
   AI Infrastructure Atlas (markers only)
------------------------------------------------------- */
.ai-atlas-marker {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-direction: column;
}

.ai-score-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ffb000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-atlas-marker:hover .ai-score-ring {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.ai-cluster-label {
    position: absolute;
    bottom: -15px;
    font-size: 0.6rem;
    white-space: nowrap;
    text-shadow: 1px 1px 2px #000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* -------------------------------------------------------
   THREAT SCENARIOS (V9.0)
------------------------------------------------------- */
.scenario-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px 0;
}

.preset-btn {
    background: rgba(40,45,50,0.8);
    border: 1px solid rgba(255,51,51,0.3);
    color: #ff5555;
    padding: 8px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    cursor: pointer;
    text-transform: uppercase;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(255,51,51,0.15);
    box-shadow: 0 0 10px rgba(255,51,51,0.4);
    border-color: #ff3333;
    color: #fff;
}

/* -------------------------------------------------------
   LAYER DESCRIPTIONS
------------------------------------------------------- */
.layer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.layer-desc {
    font-size: 0.55rem !important;
    color: rgba(255,255,255,0.45) !important;
    line-height: 1.3;
    margin: 0;
    opacity: 1 !important;
}

/* -------------------------------------------------------
   WELCOME OVERLAY (First Visit)
------------------------------------------------------- */
#welcome-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.6s ease;
    padding: 20px;
}

#welcome-overlay.hidden { display: none; }

#welcome-card {
    position: relative;
    background: linear-gradient(135deg, rgba(10,15,25,0.95), rgba(15,20,35,0.95));
    border: 1px solid rgba(255,176,0,0.3);
    border-radius: 8px;
    padding: 40px 36px 30px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 80px rgba(255,176,0,0.08);
    overflow: hidden;
}

.welcome-glow {
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 80%, rgba(255,176,0,0.06) 0%, transparent 50%);
    pointer-events: none;
    animation: welcome-rotate 20s linear infinite;
}
@keyframes welcome-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: welcome-float 3s ease-in-out infinite;
}
@keyframes welcome-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.welcome-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 2rem;
    letter-spacing: 6px;
    color: var(--amber);
    text-shadow: 0 0 20px rgba(255,176,0,0.4);
    margin: 0 0 4px;
}

.welcome-subtitle {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--neon-blue);
    opacity: 0.8;
    margin: 0 0 20px;
}

.welcome-features {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 24px;
    text-align: left;
}

.welcome-feat {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
}

.welcome-feat i {
    width: 18px; text-align: center;
    color: var(--amber); font-size: 0.8rem;
}

.welcome-actions {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 14px;
}

.welcome-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 2px;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.3s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

.welcome-btn-primary {
    background: rgba(255,176,0,0.15);
    border-color: var(--amber);
    color: var(--amber);
}
.welcome-btn-primary:hover {
    background: var(--amber);
    color: #000;
    box-shadow: 0 0 30px rgba(255,176,0,0.4);
}

.welcome-btn-secondary {
    background: rgba(0,212,255,0.08);
    border-color: rgba(0,212,255,0.4);
    color: var(--neon-blue);
}
.welcome-btn-secondary:hover {
    background: rgba(0,212,255,0.2);
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0,212,255,0.2);
}

.welcome-remember {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; margin-bottom: 12px;
}
.welcome-remember input { accent-color: var(--amber); }

.welcome-footer {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.25);
    letter-spacing: 1px;
}

/* -------------------------------------------------------
   TOUR BRIEFING PANEL
------------------------------------------------------- */
.tour-briefing-panel {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 420px;
    max-width: calc(100vw - 30px);
    background: rgba(5, 10, 20, 0.95);
    border: 1px solid rgba(255,176,0,0.35);
    border-radius: 6px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 40px rgba(255,176,0,0.08);
    backdrop-filter: blur(15px);
    font-family: 'Share Tech Mono', monospace;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.tour-briefing-panel.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
    pointer-events: none;
}

.tour-briefing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tour-step-num {
    font-size: 0.6rem;
    color: var(--amber);
    letter-spacing: 2px;
    opacity: 0.7;
}

.tour-title {
    font-size: 1rem;
    color: var(--amber);
    letter-spacing: 1.5px;
    margin: 0 0 8px;
    text-shadow: 0 0 10px rgba(255,176,0,0.3);
}

.tour-text {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
    margin: 0 0 14px;
}

.tour-nav {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.tour-nav-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.6);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; gap: 5px;
}
.tour-nav-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.tour-nav-primary {
    background: rgba(255,176,0,0.12);
    border-color: rgba(255,176,0,0.4);
    color: var(--amber);
}
.tour-nav-primary:hover {
    background: rgba(255,176,0,0.25);
    border-color: var(--amber);
    box-shadow: 0 0 12px rgba(255,176,0,0.2);
}

/* Tour Image (Wikipedia Thumbnails) */
.tour-image-container {
    margin: 10px 0;
    text-align: center;
    animation: tour-img-fade 0.5s ease;
}
.tour-image-container.hidden { display: none; }
.tour-image-container img {
    max-width: 200px;
    max-height: 130px;
    border-radius: 4px;
    border: 1px solid rgba(255,176,0,0.25);
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    object-fit: cover;
}
.tour-image-caption {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    margin-top: 4px;
}
@keyframes tour-img-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.tour-interact-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    color: var(--neon-blue);
    opacity: 0.7;
    padding: 8px 10px;
    margin: 8px 0;
    background: rgba(0,212,255,0.05);
    border: 1px solid rgba(0,212,255,0.12);
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.tour-interact-hint i {
    font-size: 0.75rem;
    animation: tour-point 1.5s ease-in-out infinite;
}

@keyframes tour-point {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.tour-briefing-panel.flying .tour-text {
    opacity: 0.3;
}

.tour-briefing-panel.flying .tour-title::after {
    content: ' ...';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-width: 768px) {
    .tour-briefing-panel {
        bottom: calc(var(--mobile-nav-h) + 10px);
        width: calc(100vw - 20px);
    }
    #welcome-card {
        padding: 28px 20px 20px;
    }
    .welcome-title { font-size: 1.5rem; }
    #quick-links { display: none; }
}

/* -------------------------------------------------------
   QUICK LINKS (bottom-left corner)
------------------------------------------------------- */
#quick-links {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 500;
    display: flex;
    gap: 2px;
    background: rgba(5, 10, 20, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
    pointer-events: auto;
}

#quick-links a {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    border-right: 1px solid rgba(255,255,255,0.04);
}

#quick-links a:last-child {
    border-right: none;
}

#quick-links a:hover {
    color: var(--amber);
    background: rgba(255,176,0,0.08);
}

#quick-links a i {
    font-size: 0.55rem;
    opacity: 0.7;
}

/* -------------------------------------------------------
   FEEDBACK WIDGET
------------------------------------------------------- */
#feedback-widget {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 2500;
}

#feedback-toggle {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,176,0,0.2), rgba(255,100,0,0.15));
    border: 1px solid rgba(255,176,0,0.4);
    color: var(--amber);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
}
#feedback-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255,176,0,0.3);
    border-color: var(--amber);
}

#feedback-panel {
    position: absolute;
    bottom: 54px; right: 0;
    width: 300px;
    background: rgba(5, 10, 20, 0.96);
    border: 1px solid rgba(255,176,0,0.3);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.8), 0 0 30px rgba(255,176,0,0.06);
    backdrop-filter: blur(15px);
    font-family: 'Share Tech Mono', monospace;
    transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}
#feedback-panel.hidden {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    pointer-events: none;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,176,0,0.2);
}
.feedback-title {
    font-size: 0.7rem;
    color: var(--amber);
    letter-spacing: 2px;
}
.feedback-close-btn {
    background: transparent; border: none;
    color: rgba(255,255,255,0.4); cursor: pointer;
    font-size: 0.9rem; transition: color 0.2s;
}
.feedback-close-btn:hover { color: #fff; }

.feedback-section { margin-bottom: 12px; }
.feedback-label {
    display: block;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

/* Star Rating */
.star-rating {
    display: flex; gap: 4px;
}
.star {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.15);
    cursor: pointer;
    transition: all 0.15s;
}
.star:hover, .star.hover { color: rgba(255,176,0,0.6); transform: scale(1.15); }
.star.active { color: var(--amber); text-shadow: 0 0 8px rgba(255,176,0,0.4); }
.star-label {
    font-size: 0.55rem;
    color: var(--amber);
    margin-left: 8px;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* Form inputs */
.feedback-select, .feedback-input, .feedback-textarea {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #ddd;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    padding: 7px 9px;
    transition: border-color 0.2s;
    outline: none;
}
.feedback-select:focus, .feedback-input:focus, .feedback-textarea:focus {
    border-color: rgba(255,176,0,0.4);
}
.feedback-select option {
    background: #111; color: #ddd;
}
.feedback-textarea { resize: vertical; min-height: 36px; }

/* Actions */
.feedback-actions {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 14px;
}
.feedback-submit-btn {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    padding: 10px;
    border: 1px solid rgba(255,176,0,0.4);
    background: rgba(255,176,0,0.12);
    color: var(--amber);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.feedback-submit-btn:hover {
    background: var(--amber);
    color: #000;
    box-shadow: 0 0 20px rgba(255,176,0,0.3);
}
.feedback-bug-link {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    text-align: center;
    letter-spacing: 1px;
    padding: 4px;
    transition: color 0.2s;
}
.feedback-bug-link:hover { color: var(--neon-blue); }

.feedback-footer {
    font-size: 0.45rem;
    color: rgba(255,255,255,0.2);
    text-align: center;
    margin-top: 10px;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    #feedback-panel {
        width: calc(100vw - 30px);
        right: -5px;
    }
}
