*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #020c09; cursor: none; }
canvas { display: block; }

/* ── Splash screen ── */
#splash {
    position: fixed;
    inset: 0;
    background: url('img/splash-background.jpg') center / cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10vh;
    z-index: 300;
    cursor: auto;
    /* needed so #splash-credits absolute positioning is relative to this */
}
#splash-title {
    width: min(1000px, 72vw);
    max-width: 90%;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 32px rgba(0, 0, 0, 0.7));
}
#splash-slogan {
    width: min(900px, 70vw);
    max-width: 85%;
    margin-bottom: 4rem;
    filter: drop-shadow(0 2px 16px rgba(0, 0, 0, 0.6));
}
/* Wave selector */
#splash-wave-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}
#splash-wave-label {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: rgba(140, 200, 150, 0.70);
    text-transform: uppercase;
}
#splash-wave-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.wave-btn {
    width: 2.6rem;
    height: 2.6rem;
    background: transparent;
    border: 1px solid rgba(140, 200, 150, 0.35);
    color: rgba(140, 200, 150, 0.70);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer !important;
    transition: all 0.15s;
}
.wave-btn:hover { border-color: rgba(140,200,150,0.75); color: rgba(140,200,150,1.0); }
.wave-btn-active {
    background: rgba(140, 200, 150, 0.20);
    border-color: rgba(140, 200, 150, 0.90);
    color: rgba(165, 240, 185, 1.0);
}

#splash-start {
    padding: 0.75rem 3.5rem;
    background: rgba(0, 0, 0, .5);
    border: 2px solid rgba(140, 200, 150, 0.85);
    color: rgba(140, 200, 150, 0.96);
    font-family: 'Courier New', monospace;
    font-size: 2.25rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#splash-start:hover {
    color: rgba(8, 22, 12, 1.0);
    background: rgba(140, 200, 150, 0.90);
    border-color: rgba(140, 200, 150, 0.90);
}
#splash-credits {
    margin-top: auto;
    margin-bottom: 2rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: rgba(140, 200, 150, 0.5);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
#splash-credits a {
    color: rgba(140, 200, 150, 0.96);
    text-decoration: none;
}

/* ── HUD ── */
#hud {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    font-family: 'Courier New', monospace;
    pointer-events: none;
    user-select: none;
}
#hud-name {
    font-size: 1.125rem;
    letter-spacing: 0.25em;
    color: rgba(160, 220, 170, 0.96);
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 0.4rem;
}
#hud-meta {
    font-size: 0.875rem;
    letter-spacing: 0.15em;
    color: rgba(140, 200, 150, 0.92);
    text-transform: uppercase;
}
#hud-temp {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 0.3rem;
    transition: color 0.8s ease;
}

/* ── Progress bars ── */
#progress-wrap {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    text-align: center;
    pointer-events: none;
    user-select: none;
}
#progress-label {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.18em;
    color: rgba(140, 200, 150, 0.92);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
#progress-track {
    height: 3px;
    background: rgba(140, 200, 150, 0.18);
    border-radius: 2px;
}
#progress-fill {
    height: 100%;
    width: 0%;
    background: rgba(140, 200, 150, 0.85);
    border-radius: 2px;
    transition: width 0.35s ease, background-color 0.4s ease;
}

#energy-label {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.18em;
    color: rgba(210, 175, 80, 0.92);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
#energy-track {
    height: 3px;
    background: rgba(210, 175, 80, 0.18);
    border-radius: 2px;
    margin-bottom: 1rem;
}
#energy-fill {
    height: 100%;
    width: 50%;
    background: rgba(210, 175, 80, 0.85);
    border-radius: 2px;
    transition: width 0.2s ease, background-color 0.3s ease;
}

/* ── Hamburger ── */
#menu-btn {
    position: fixed;
    top: 1.2rem;
    right: 1.5rem;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    border: 1px solid rgba(140, 200, 150, 0.45);
    color: rgba(140, 200, 150, 0.88);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer !important;
    z-index: 150;
    transition: color 0.2s, border-color 0.2s;
}
#menu-btn:hover { color: rgba(160, 230, 175, 1.0); border-color: rgba(140, 200, 150, 0.75); }

/* ── Settings modal ── */
#settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 5, 0.92);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 190;
    font-family: 'Courier New', monospace;
    cursor: auto;
}
#settings-content {
    padding: 2.4rem 2.8rem;
    border: 1px solid rgba(140, 200, 150, 0.35);
    background: rgba(4, 14, 8, 0.96);
    min-width: 300px;
}
#settings-title {
    font-size: 1rem;
    letter-spacing: 0.35em;
    color: rgba(140, 200, 150, 0.96);
    text-transform: uppercase;
    margin-bottom: 1.8rem;
}
.ctrl-option { margin-bottom: 1.3rem; }
.ctrl-option input[type="radio"] { display: none; }
.ctrl-option label {
    display: block;
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: rgba(140, 200, 150, 0.90);
    text-transform: uppercase;
    cursor: pointer !important;
    padding-left: 1.4rem;
    position: relative;
}
.ctrl-option label::before {
    content: '○';
    position: absolute;
    left: 0;
    color: rgba(140, 200, 150, 0.75);
}
.ctrl-option input[type="radio"]:checked + label { color: rgba(185, 250, 200, 1.0); }
.ctrl-option input[type="radio"]:checked + label::before { content: '●'; color: rgba(140, 200, 150, 1.0); }
.ctrl-desc {
    font-size: 0.875rem;
    letter-spacing: 0.06em;
    color: rgba(140, 200, 150, 0.80);
    text-transform: uppercase;
    margin-top: 0.25rem;
    padding-left: 1.4rem;
}
#settings-close {
    display: block;
    margin-top: 1.8rem;
    margin-left: auto;
    padding: 0.45rem 1.1rem;
    background: transparent;
    border: 1px solid rgba(140, 200, 150, 0.55);
    color: rgba(140, 200, 150, 0.90);
    font-family: inherit;
    font-size: 0.875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s;
}
#settings-close:hover { color: rgba(185, 250, 200, 1.0); border-color: rgba(140, 200, 150, 0.85); }

/* ── Wave cleared ── */
#wave-cleared {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 5, 0.92);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 200;
    font-family: 'Courier New', monospace;
    cursor: auto;
}
#wc-content { text-align: center; }
#wc-title {
    font-size: 3rem;
    letter-spacing: 0.45em;
    color: rgba(140, 220, 170, 0.98);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
#wc-sub {
    font-size: 1rem;
    letter-spacing: 0.22em;
    color: rgba(140, 200, 150, 0.92);
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 1.6rem;
}
#wc-stats {
    font-size: 1rem;
    letter-spacing: 0.18em;
    color: rgba(140, 200, 150, 0.96);
    text-transform: uppercase;
    margin-bottom: 2rem;
}
#wc-next {
    padding: 0.65rem 2rem;
    background: transparent;
    border: 2px solid rgba(140, 200, 150, 0.75);
    color: rgba(140, 200, 150, 0.96);
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#wc-next:hover {
    color: rgba(10, 25, 15, 1.0);
    background: rgba(140, 200, 150, 0.88);
    border-color: rgba(140, 200, 150, 0.88);
}

/* ── Game over ── */
#game-over {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 5, 0.92);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 200;
    font-family: 'Courier New', monospace;
    cursor: auto;
}
#go-content { text-align: center; }
#go-title {
    font-size: 3rem;
    letter-spacing: 0.45em;
    color: rgba(210, 75, 95, 0.98);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
#go-sub {
    font-size: 1rem;
    letter-spacing: 0.22em;
    color: rgba(210, 75, 95, 0.90);
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 2rem;
}
#go-stats {
    font-size: 1rem;
    letter-spacing: 0.18em;
    color: rgba(140, 200, 150, 0.96);
    text-transform: uppercase;
    margin-bottom: 1.4rem;
}
#go-fact-label {
    font-size: 0.875rem;
    letter-spacing: 0.25em;
    color: rgba(140, 200, 150, 0.88);
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}
#go-fact {
    font-size: 1rem;
    letter-spacing: 0.03em;
    color: rgba(160, 220, 175, 0.92);
    font-style: italic;
    max-width: 380px;
    line-height: 1.85;
    margin: 0 auto 2rem;
    text-align: center;
}
/* Game over dual buttons */
#go-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}
#go-retry {
    padding: 0.55rem 1.8rem;
    background: transparent;
    border: 2px solid rgba(210, 75, 95, 0.75);
    color: rgba(210, 75, 95, 0.96);
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#go-retry:hover {
    color: rgba(25, 8, 12, 1.0);
    background: rgba(210, 75, 95, 0.88);
    border-color: rgba(210, 75, 95, 0.88);
}
#go-restart {
    padding: 0.4rem 1.4rem;
    background: transparent;
    border: 1px solid rgba(140, 200, 150, 0.40);
    color: rgba(140, 200, 150, 0.70);
    font-family: inherit;
    font-size: 0.875rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s;
}
#go-restart:hover {
    color: rgba(165, 240, 185, 0.95);
    border-color: rgba(140, 200, 150, 0.70);
}

/* ── Game over stats panel ── */
#go-layout {
    display: flex;
    align-items: center;
    gap: 4rem;
    padding: 0 2rem;
}
#go-stats-panel {
    border-left: 1px solid rgba(140, 200, 150, 0.30);
    padding-left: 3rem;
    min-width: 220px;
}

/* ── Splash credits ── */
#splash-credits {
    position: absolute;
    bottom: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    color: rgba(140, 200, 150, 0.55);
    text-transform: uppercase;
}
#splash-credits a {
    color: rgba(140, 200, 150, 0.80);
    text-decoration: none;
}
#splash-credits a:hover { color: rgba(165, 240, 185, 1.0); }

/* ── Mobile overrides ── */
@media (max-width: 700px) {
    #go-layout {
        flex-direction: column;
        gap: 2rem;
        padding: 1.5rem 1.25rem;
        overflow-y: auto;
        max-height: 100vh;
    }
    #go-stats-panel {
        border-left: none;
        border-top: 1px solid rgba(140, 200, 150, 0.25);
        padding-left: 0;
        padding-top: 1.5rem;
        min-width: 0;
        width: 100%;
    }
    #go-title    { font-size: 2rem; letter-spacing: 0.3em; }
    #go-sub      { font-size: 0.875rem; margin-bottom: 1.2rem; }
    #go-fact     { font-size: 0.875rem; max-width: 100%; margin-bottom: 1.2rem; }
    #go-fact-label { font-size: 0.75rem; }
    .stat-val    { font-size: 1.25rem; }
    .stat-label  { font-size: 0.75rem; }
    #wc-title    { font-size: 2rem; letter-spacing: 0.3em; }
}
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 2rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(140, 200, 150, 0.10);
}
.stat-row:last-child { border-bottom: none; }
.stat-label {
    font-size: 0.875rem;
    letter-spacing: 0.15em;
    color: rgba(140, 200, 150, 0.80);
    text-transform: uppercase;
}
.stat-val {
    font-size: 1.75rem;
    letter-spacing: 0.05em;
    color: rgba(165, 235, 185, 0.98);
    text-align: right;
    font-style: normal;
}
