:root {
    --bg-color: #050505;
    --phosphor-green: #39ff14;
    --phosphor-dark: #0f380f;
    --phosphor-light: #88ff88;
    --alert-red: #ff003c;
    --alert-amber: #ffaa00;
    --phosphor-glow-subtle: rgba(57, 255, 20, 0.2);
    --phosphor-glow-heavy: rgba(0, 255, 0, 0.3);
    --scanline-color: rgba(57, 255, 20, 0.02);
    --window-bg: rgba(0, 10, 0, 0.95);
    --panel-bg: rgba(0, 20, 0, 0.5);
    --crt-glow: 0 0 5px var(--phosphor-green), 0 0 10px var(--phosphor-green);
    --font-stack: 'VT323', monospace;
}

body.theme-amber {
    --phosphor-green: #ffaa00;
    --phosphor-dark: #332000;
    --phosphor-light: #ffd488;
    /* Rich, dark pumpkin orange blobs to avoid blinding yellow blowouts */
    --phosphor-glow-subtle: rgba(200, 100, 0, 0.25);
    --phosphor-glow-heavy: rgba(200, 100, 0, 0.4);
    --scanline-color: rgba(255, 170, 0, 0.02);
    --window-bg: rgba(15, 10, 0, 0.95);
    --panel-bg: rgba(30, 15, 0, 0.5);
    --crt-glow: 0 0 5px var(--phosphor-green), 0 0 10px var(--phosphor-green);
}

body.theme-cyan {
    --phosphor-green: #00ffff;
    --phosphor-dark: #002222;
    --phosphor-light: #88ffff;
    /* Deep oceanic teal bloobs for the authentic polar vibe */
    --phosphor-glow-subtle: rgba(0, 150, 200, 0.25);
    --phosphor-glow-heavy: rgba(0, 150, 200, 0.4);
    --scanline-color: rgba(0, 255, 255, 0.02);
    --window-bg: rgba(0, 10, 15, 0.95);
    --panel-bg: rgba(0, 15, 30, 0.5);
    --crt-glow: 0 0 5px var(--phosphor-green), 0 0 10px var(--phosphor-green);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--phosphor-green);
    font-family: var(--font-stack);
    font-size: 20px;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-shadow: var(--crt-glow);
}

/* --- CRT Visual Effects --- */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg, 
        rgba(255, 0, 0, 0.06), 
        var(--scanline-color), 
        rgba(0, 0, 255, 0.06)
    );
    background-size: 100% 4px, 6px 100%;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    font-size: 24px;
    display: flex;
    flex-direction: column;
}

#boot-cursor {
    animation: blink 1s step-end infinite;
}

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

/* --- Main App Layout --- */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 2px;
}

/* Header */
#tactical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 2px solid var(--phosphor-green);
    background: rgba(0,20,0,0.3);
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 20px;
}

h1 {
    font-size: 32px;
    letter-spacing: 2px;
    margin: 0;
}

#clock {
    font-size: 24px;
}

#defcon-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
}

#defcon-select {
    padding: 2px 10px;
    border: 2px solid;
    font-weight: bold;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    cursor: pointer;
    /* Kill the green glow bleeding in from the master page body */
    text-shadow: none;
    appearance: none;
}
#defcon-select option {
    background: var(--bg-color);
    color: var(--phosphor-green);
    text-shadow: none;
}

.defcon-5 { color: var(--phosphor-green); border-color: var(--phosphor-green); text-shadow: 0 0 10px var(--phosphor-green); box-shadow: 0 0 15px var(--phosphor-glow-subtle), inset 0 0 10px var(--phosphor-glow-subtle); }
.defcon-4 { color: #aaff00; border-color: #aaff00; text-shadow: 0 0 10px #aaff00; box-shadow: 0 0 15px rgba(170, 255, 0, 0.3), inset 0 0 10px rgba(170, 255, 0, 0.3); }
.defcon-3 { color: var(--alert-amber); border-color: var(--alert-amber); text-shadow: 0 0 10px var(--alert-amber); box-shadow: 0 0 15px rgba(255, 170, 0, 0.3), inset 0 0 10px rgba(255, 170, 0, 0.3); }
.defcon-2 { color: #ff5500; border-color: #ff5500; text-shadow: 0 0 10px #ff5500; box-shadow: 0 0 15px rgba(255, 85, 0, 0.3), inset 0 0 10px rgba(255, 85, 0, 0.3); }
.defcon-1 { color: var(--alert-red); border-color: var(--alert-red); text-shadow: 0 0 10px var(--alert-red); box-shadow: 0 0 15px rgba(255, 0, 60, 0.3), inset 0 0 10px rgba(255, 0, 60, 0.3); }

/* Main Area */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Globe Area */
#globe-container {
    flex: 1;
    position: relative;
    cursor: grab;
    background: radial-gradient(circle at center, #001100 0%, #000000 70%);
}

#globe-container:active {
    cursor: grabbing;
}

#globe-svg {
    width: 100%;
    height: 100%;
}

/* Terminal Sidebar */
#terminal-sidebar {
    width: 350px;
    border-left: 2px solid var(--phosphor-green);
    display: flex;
    flex-direction: column;
    background: rgba(0,20,0,0.5);
}

.terminal-header {
    padding: 10px;
    border-bottom: 2px solid var(--phosphor-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.blinking-dot {
    width: 12px;
    height: 12px;
    background-color: var(--phosphor-green);
    border-radius: 50%;
    box-shadow: var(--crt-glow);
    animation: blink 2s infinite;
}

#terminal-output {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#terminal-output::-webkit-scrollbar {
    width: 8px;
}
#terminal-output::-webkit-scrollbar-thumb {
    background: var(--phosphor-green);
}

.log-entry {
    border-left: 2px solid var(--phosphor-green);
    padding-left: 10px;
}

.log-time {
    color: var(--phosphor-light);
    font-size: 0.9em;
}

.log-event {
    margin-top: 4px;
}

.log-event.urgent {
    color: var(--alert-red);
    text-shadow: 0 0 5px var(--alert-red);
    border-left-color: var(--alert-red);
}

/* Config Panel */
#config-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    border: 1px solid var(--phosphor-green);
    background: rgba(0,0,0,0.8);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.config-title {
    border-bottom: 1px dashed var(--phosphor-green);
    margin-bottom: 5px;
    padding-bottom: 2px;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

input[type="number"] {
    background: transparent;
    color: var(--phosphor-green);
    border: none;
    border-bottom: 1px solid var(--phosphor-green);
    font-family: inherit;
    font-size: inherit;
    width: 50px;
    text-align: right;
    outline: none;
    text-shadow: inherit;
}

button {
    background: transparent;
    color: var(--phosphor-green);
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    text-shadow: inherit;
}

button:hover {
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

/* Intel Brief Window */
#intel-brief {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    border: 2px solid var(--phosphor-green);
    background: var(--window-bg);
    z-index: 200;
    box-shadow: 0 0 30px var(--phosphor-glow-heavy);
}

#intel-brief.hidden {
    display: none;
}

.intel-header {
    background: var(--phosphor-green);
    color: var(--bg-color);
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    text-shadow: none;
}

#close-intel {
    color: var(--bg-color);
}

.intel-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#intel-title {
    font-size: 24px;
    border-bottom: 1px dashed var(--phosphor-green);
    padding-bottom: 5px;
}

.intel-meta {
    font-size: 0.9em;
    color: var(--phosphor-light);
}

.intel-box {
    border: 1px solid var(--phosphor-green);
    background: var(--panel-bg);
    padding: 10px;
    min-height: 80px;
    box-shadow: inset 0 0 10px var(--phosphor-glow-subtle);
}

#intel-link {
    color: var(--phosphor-green);
    text-decoration: none;
    margin-top: 10px;
    display: inline-block;
}

#intel-link:hover {
    text-decoration: underline;
    background: var(--phosphor-green);
    color: var(--bg-color);
    text-shadow: none;
}

/* Map SVG Styling */
.sphere {
    fill: transparent;
    stroke: var(--phosphor-dark);
    stroke-width: 1px;
}

.graticule {
    fill: none;
    stroke: var(--phosphor-glow-subtle);
    stroke-width: 0.5px;
}

.country {
    fill: rgba(0, 20, 0, 0.4);
    stroke: var(--phosphor-green);
    stroke-width: 0.8px;
    transition: fill 0.2s;
}

.country:hover {
    fill: var(--phosphor-glow-subtle);
}

.country.active-country {
    fill: rgba(255, 0, 60, 0.25) !important;
    stroke: var(--alert-red) !important;
    stroke-width: 1.5px !important;
}

.news-blip {
    fill: var(--alert-red);
    cursor: pointer;
}

.news-blip-pulse {
    fill: transparent;
    stroke: var(--alert-red);
    stroke-width: 2px;
    pointer-events: none;
}

.news-label {
    fill: #fff;
    font-family: var(--font-stack);
    font-size: 14px;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    pointer-events: none;
}

.news-rect {
    fill: rgba(0, 10, 0, 0.95);
    stroke: #888;
    stroke-width: 1px;
    cursor: crosshair;
}

.news-rect:hover {
    stroke: var(--phosphor-green);
    fill: rgba(0, 20, 0, 0.95);
}

.loading-bar-bg {
    fill: #222;
}

.loading-bar-fg {
    fill: var(--phosphor-green);
    box-shadow: 0 0 5px var(--phosphor-green);
}
