@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
    --bg:            #04101e;
    --panel-bg:      #06192e;
    --border:        rgba(155, 184, 204, 0.12);
    --text-primary:  #f0f4f8;
    --text-muted:    #6b8ca4;
    --amber:         #f59e0b;
    --orange:        #f97316;
    --coral:         #ef4444;
    --sky:           #38bdf8;
    --green:         #10b981;
    --violet:        #818cf8;
    --station-blue:  #1b4fa8;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body ───────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* background orbs like main page */
body::before {
    content: '';
    position: fixed;
    top: 15%; left: 25%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(27, 79, 168, 0.18) 0%, transparent 65%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: orb 24s ease-in-out infinite alternate;
}
body::after {
    content: '';
    position: fixed;
    bottom: 8%; right: 12%;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(56,189,248,0.10) 0%, transparent 65%);
    border-radius: 50%;
    filter: blur(70px);
    z-index: 0;
    animation: orb 18s ease-in-out infinite alternate-reverse;
}
@keyframes orb {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(70px, 35px); }
}

/* ── Outer wrapper ──────────────────────────────────────────────── */
.game-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 28px;
    background: linear-gradient(160deg, #071528, #040e1b);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    box-shadow:
        0 30px 60px -16px rgba(0,0,0,.7),
        0 0 50px rgba(56, 189, 248, 0.06);
    position: relative;
    z-index: 1;
}

/* ── Top bar ────────────────────────────────────────────────────── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.title-area h1 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--amber) 0%, var(--sky) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-area {
    display: flex;
    gap: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(6, 25, 46, 0.9);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: 10px;
    letter-spacing: 0.4px;
}
.score-box { color: var(--amber); }
.lives-box  { color: var(--coral); }

/* ── Button ─────────────────────────────────────────────────────── */
button.btn-primary {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 11px 26px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--amber), var(--orange));
    color: #04101e;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 16px rgba(245,158,11,.4);
    transition: transform .2s, box-shadow .2s;
}
button.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245,158,11,.6);
}
button.btn-primary:active { transform: translateY(0); }

/* ── Board ──────────────────────────────────────────────────────── */
.board-container {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1.5px solid rgba(155,184,204,0.12);
    background: radial-gradient(ellipse at 50% -5%, #081c38 0%, #020b17 75%);
    box-shadow: inset 0 0 70px rgba(0,0,0,.6);
    transition: transform .06s ease;
}
svg { display: block; }

/* ── Switches ───────────────────────────────────────────────────── */
.switch-node { cursor: pointer; }
.switch-node:hover .sw-body {
    fill: rgba(245,158,11,.25) !important;
}

/* ── Game Over ──────────────────────────────────────────────────── */
#game-over {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 20, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
    z-index: 50;
}
#game-over.show { opacity: 1; pointer-events: auto; }
.go-title {
    font-size: 3.6rem;
    font-weight: 800;
    letter-spacing: 5px;
    color: var(--coral);
    text-shadow: 0 0 40px rgba(239,68,68,.5);
    margin-bottom: 12px;
}
.go-score {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}
.go-score strong { color: var(--amber); }

/* ── Hint bar ───────────────────────────────────────────────────── */
.hint-bar {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: .2px;
}
.hint-bar span {
    color: var(--amber);
    font-weight: 700;
}

/* ── Train headlamp ─────────────────────────────────────────────── */
@keyframes headlamp {
    0%   { opacity: .6; }
    100% { opacity: 1; }
}
.train-lamp { animation: headlamp 1s ease-in-out infinite alternate; }

/* ── Score pop ──────────────────────────────────────────────────── */
.score-pop {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    pointer-events: none;
    animation: popUp 1s ease forwards;
}
@keyframes popUp {
    0%   { transform: translateY(0);     opacity: 1; }
    100% { transform: translateY(-44px); opacity: 0; }
}
