: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 { display: 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, #intelligence-panel, #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, #intelligence-panel.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;
    }
    #intelligence-panel:hover, #info-panel:hover {
        max-height: none !important;
        width: 100% !important;
    }

    .sidebar-body { height: calc(100% - 60px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
    #alert-list { max-height: none !important; 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;
    }
}

/* -------------------------------------------------------
   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); }

#intelligence-panel {
    top: 52px; left: 14px; width: 240px;
    border-left: 3px solid var(--neon-green);
    max-height: 42px;
}
#intelligence-panel:hover { max-height: 85vh; width: 320px; box-shadow: 0 0 30px rgba(0,255,136,0.15); }

/* 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);
}
.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;
}

/* Intelligence panel title */
header h2 { font-size: 0.85rem; letter-spacing: 2.5px; font-weight: 700; margin: 0; }
#intelligence-panel header h2 { color: var(--neon-green); font-size: 0.8rem; text-shadow: 0 0 5px rgba(0,255,136,0.5); }

.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);
}

/* -------------------------------------------------------
   INTELLIGENCE PULSE MARKERS
------------------------------------------------------- */
@keyframes pulse-red-alert {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; box-shadow: 0 0 0 0 rgba(255,51,0,0.7); }
    70% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.3; box-shadow: 0 0 0 20px rgba(255,51,0,0); }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; box-shadow: 0 0 0 0 rgba(255,51,0,0); }
}
.intel-pulse-red {
    width: 60px; height: 60px;
    background: rgba(255,51,0,0.2);
    border: 2px solid #ff3300;
    border-radius: 50%;
    animation: pulse-red-alert 2s infinite;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
}

.marker-intel {
    position: relative; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; pointer-events: auto;
}
.intel-pulse {
    position: absolute; inset: 0;
    border-radius: 50%; opacity: 0.3;
    animation: pulse-red-alert 2s infinite;
}
.marker-intel.severity-high .intel-pulse { background: var(--neon-red); border: 2px solid var(--neon-red); }
.marker-intel.severity-medium .intel-pulse { background: var(--amber); border: 2px solid var(--amber); }
.marker-intel.severity-low .intel-pulse { background: var(--neon-green); border: 2px solid var(--neon-green); }

.intel-icon {
    position: relative; z-index: 2;
    font-size: 1.1rem; text-shadow: 0 0 5px currentColor;
}

/* -------------------------------------------------------
   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; }

/* -------------------------------------------------------
   INTELLIGENCE ALERT CARDS
------------------------------------------------------- */
#alert-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px 10px 8px;
    font-family: 'Share Tech Mono', monospace;
}

.alert-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-left: 3px solid var(--amber);
    border-radius: 3px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.alert-item:hover { background: rgba(255,176,0,0.06); }

.alert-item.severity-high   { border-left-color: #ff3333; }
.alert-item.severity-medium { border-left-color: #ffb000; }
.alert-item.severity-low    { border-left-color: #00ff88; }

.alert-item h4 {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--amber);
    margin: 0 0 3px;
    text-transform: uppercase;
}
.alert-item.severity-high h4   { color: #ff5555; }
.alert-item.severity-medium h4 { color: #ffb000; }
.alert-item.severity-low h4    { color: #00ff88; }

.alert-item p {
    font-size: 0.6rem;
    margin: 0 0 4px;
    color: rgba(255,255,255,0.75);
    line-height: 1.4;
}

.alert-item .timestamp {
    font-size: 0.52rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.5px;
    display: block;
}


#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: var(--panel-bg) !important;
    color: #fff !important;
    border: 1px solid var(--glass-edge) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8) !important;
    padding: 12px !important; border-radius: 4px !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; }
body.no-ticker #intelligence-panel { 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: 20px;
    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;
}

#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;
}

.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.35) !important;
    line-height: 1.3;
    margin: 0;
    opacity: 0.7 !important;
}
