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

/* Team colour token — overridden by JS on selection */
:root {
    --team-color: #1ca691;
}

body {
    background: #00010b;
    overflow: hidden;
    font-family: 'Courier New', 'Lucida Console', monospace;
    color: var(--team-color);
    user-select: none;
}

/* Scanlines */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(28, 166, 145, 0.018) 2px,
        rgba(28, 166, 145, 0.018) 4px
    );
    pointer-events: none;
    z-index: 900;
}

/* Vignette */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, transparent 50%, rgba(0, 0, 14, 0.82) 100%);
    pointer-events: none;
    z-index: 5;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 220px;
    z-index: 0;
}

/* ─── TEAM SELECTION SPLASH ──────────────────────────────────────── */
#team-select {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 1, 11, 0.88);
}

#team-select-inner {
    text-align: center;
    max-width: 560px;
    width: 90vw;
}

#team-select-title {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: rgba(200, 200, 220, 0.7);
    margin-bottom: 10px;
    text-transform: uppercase;
}

#team-select-sub {
    font-size: 0.68rem;
    letter-spacing: 0.28em;
    color: rgba(200, 200, 220, 0.35);
    margin-bottom: 36px;
    text-transform: uppercase;
}

#team-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.team-btn {
    background: rgba(0, 5, 18, 0.9);
    border: 1px solid rgba(200, 200, 220, 0.15);
    border-top: 2px solid rgba(200, 200, 220, 0.25);
    font-family: inherit;
    cursor: pointer;
    padding: 22px 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
}

.team-btn-name {
    font-size: 0.88rem;
    letter-spacing: 0.18em;
    font-weight: bold;
}

.team-btn-role {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    color: rgba(200, 200, 220, 0.4);
}

/* Per-team button accent colours */
.team-btn[data-team="blue"]   .team-btn-name { color: #1ca691; }
.team-btn[data-team="red"]    .team-btn-name { color: #ff2020; }
.team-btn[data-team="orange"] .team-btn-name { color: #ff7700; }
.team-btn[data-team="purple"] .team-btn-name { color: #9933ff; }

.team-btn[data-team="blue"]:hover,
.team-btn[data-team="blue"]:focus   { border-color: #1ca691; box-shadow: 0 0 18px rgba(28,166,145,0.3); }
.team-btn[data-team="red"]:hover,
.team-btn[data-team="red"]:focus    { border-color: #ff2020; box-shadow: 0 0 18px rgba(255,32,32,0.3); }
.team-btn[data-team="orange"]:hover,
.team-btn[data-team="orange"]:focus { border-color: #ff7700; box-shadow: 0 0 18px rgba(255,119,0,0.3); }
.team-btn[data-team="purple"]:hover,
.team-btn[data-team="purple"]:focus { border-color: #9933ff; box-shadow: 0 0 18px rgba(153,51,255,0.3); }

/* ─── TOP OVERLAY ──────────────────────────────────────────────────── */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 22px 10px;
    z-index: 20;
    pointer-events: none;
    background: linear-gradient(rgba(0, 1, 11, 0.65) 60%, transparent);
    transition: opacity 0.6s ease;
}

#header {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: rgba(200, 200, 220, 0.45);
    margin-bottom: 7px;
    text-transform: uppercase;
}

#team-role {
    color: var(--team-color);
    opacity: 0.8;
}

#status-bar {
    display: flex;
    gap: 48px;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
}

#nodes-compromised { color: rgba(200, 200, 220, 0.35); }

.status-secure   { color: #1ca691; }
.status-breach   { color: #ff9900; }
.status-critical { color: #ff2020; animation: pulse-red 0.7s ease-in-out infinite; }

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* ─── TERMINAL PANEL ───────────────────────────────────────────────── */
#terminal {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, 88vw);
    background: rgba(0, 5, 18, 0.94);
    border: 1px solid rgba(28, 166, 145, 0.38);
    border-top: 2px solid rgba(28, 166, 145, 0.55);
    box-shadow:
        0 0 32px rgba(28, 166, 145, 0.07),
        0 -2px 12px rgba(28, 166, 145, 0.06),
        inset 0 1px 0 rgba(28, 166, 145, 0.08);
    padding: 20px 26px 18px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.9s ease;
}

#challenge-display { margin-bottom: 16px; }

#challenge-text {
    font-size: 0.83rem;
    line-height: 1.75;
    color: var(--team-color);
    letter-spacing: 0.07em;
    white-space: pre-line;
    min-height: 86px;
}

#input-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(28, 166, 145, 0.35);
    padding-bottom: 6px;
    margin-bottom: 9px;
}

.prompt {
    font-size: 0.78rem;
    color: rgba(28, 166, 145, 0.45);
    white-space: nowrap;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--team-color);
    font-family: inherit;
    font-size: 0.83rem;
    letter-spacing: 0.1em;
    caret-color: var(--team-color);
}

#input::placeholder {
    color: rgba(28, 166, 145, 0.2);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

#input:disabled { opacity: 0.4; }

#response-text {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    min-height: 20px;
    transition: color 0.2s;
}

.response-ok  { color: var(--team-color); }
.response-err { color: #ff3a3a; }

/* ─── BLINK ─────────────────────────────────────────────────────────── */
.blink { animation: blink 1s step-end infinite; }

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

/* ─── FLICKER ───────────────────────────────────────────────────────── */
@keyframes flicker {
    0%   { opacity: 1; }
    12%  { opacity: 0.25; }
    28%  { opacity: 0.85; }
    46%  { opacity: 0.1; }
    60%  { opacity: 0.9; }
    78%  { opacity: 0.3; }
    100% { opacity: 1; }
}

body.flicker { animation: flicker 0.28s linear; }

/* ─── SESSION TIMER ─────────────────────────────────────────────────── */
#session-timer {
    color: rgba(200, 200, 220, 0.35);
    letter-spacing: 0.12em;
}

#session-timer.timer-low {
    color: #ff3a3a;
    animation: pulse-red 0.7s ease-in-out infinite;
}

/* ─── GAME-OVER OVERLAY ─────────────────────────────────────────────── */
#gameover-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 1, 11, 0.78);
}

#gameover-overlay.active { display: flex; }

#gameover-inner {
    text-align: center;
    max-width: 440px;
    width: 88vw;
    padding: 36px 32px 30px;
    background: rgba(0, 4, 16, 0.97);
    border: 1px solid var(--go-color, #1ca691);
    border-top: 2px solid var(--go-color, #1ca691);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#gameover-blink {
    font-size: 0.9rem;
    color: var(--go-color, #1ca691);
    margin-bottom: 18px;
}

#gameover-result {
    font-size: 1rem;
    letter-spacing: 0.22em;
    color: var(--go-color, #1ca691);
    text-transform: uppercase;
    margin-bottom: 12px;
}

#gameover-msg {
    font-size: 0.68rem;
    letter-spacing: 0.13em;
    color: rgba(200, 200, 220, 0.45);
    text-transform: uppercase;
    margin-bottom: 24px;
    line-height: 1.8;
}

#gameover-wait {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: rgba(200, 200, 220, 0.22);
    text-transform: uppercase;
    animation: pulse-red 2s ease-in-out infinite;
}

/* ─── SCROLLBAR HIDE ─────────────────────────────────────────────────── */
::-webkit-scrollbar { display: none; }
