:root {
    --bg: #1a0f0a;
    --panel: #2d1a12;
    --text: #f0d4b0;
    --accent: #c47a3a;
    --muted: #8a6a4a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', monospace;
    overflow: hidden;
}

#wrap {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    background: #8ec3e6;
    image-rendering: pixelated;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 8, 5, 0.85);
    transition: opacity 0.5s ease;
}

.screen.hidden { opacity: 0; pointer-events: none; }

.screen h1 {
    font-size: 64px;
    letter-spacing: 0.15em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 0.2em;
}

.screen .subtitle {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 2em;
}

.screen button {
    pointer-events: auto;
    background: var(--accent);
    color: #1a0f0a;
    border: none;
    padding: 14px 48px;
    font-family: 'Courier New', monospace;
    font-size: 22px;
    letter-spacing: 0.1em;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.screen button:hover { background: #d48a4a; }

.screen .hint {
    margin-top: 24px;
    font-size: 14px;
    color: var(--muted);
}

#score-display {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: var(--accent);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.65), 0 0 12px rgba(196, 122, 58, 0.5);
    text-align: center;
    min-width: 200px;
}

#wave-display {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    color: #f0d4b0;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
    text-align: center;
    min-width: 300px;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

#crosshair::before,
#crosshair::after {
    content: "";
    position: absolute;
    background: rgba(240, 212, 176, 0.9);
    border-radius: 2px;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85));
}

#crosshair::before { width: 2px; height: 16px; top: 4px; left: 50%; margin-left: -1px; }
#crosshair::after { height: 2px; width: 16px; left: 4px; top: 50%; margin-top: -1px; }

#game-over {
    text-align: center;
}

#game-over h1 { font-size: 48px; }

#game-over .score {
    font-size: 32px;
    color: var(--accent);
    margin: 0.5em 0;
}

#hs-form {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

#hs-form input {
    background: var(--panel);
    color: var(--text);
    border: 2px solid var(--accent);
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    text-transform: uppercase;
}

#hs-form button {
    background: var(--accent);
    color: #1a0f0a;
    border: none;
    padding: 8px 24px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    cursor: pointer;
}

#leaderboard {
    max-height: 200px;
    overflow-y: auto;
}

#leaderboard li {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(240, 212, 176, 0.15);
    font-size: 18px;
}

#leaderboard li.winners { background: rgba(196, 122, 58, 0.15); }

#status-display {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    color: var(--text);
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
    text-align: center;
    white-space: nowrap;
}

#game-over h3 {
    font-size: 16px;
    color: var(--muted);
    letter-spacing: 0.15em;
    margin-top: 1.2em;
}

#leaderboard {
    list-style: none;
    padding: 0;
    margin: 0.5em 0;
    min-width: 260px;
    border-top: 1px solid rgba(240, 212, 176, 0.15);
}

#hs-form input, #hs-form button { pointer-events: auto; }

#newgame-btn { margin-top: 16px; }
