:root {
    color-scheme: dark;
    --cream: #f5edda;
    --ink: #09130f;
    --panel: #132920;
    --lime: #d8f36a;
    --red: #ed4b43;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    display: grid;
    place-items: center;
    color: var(--cream);
    background:
        radial-gradient(circle at 12% 0%, #315141 0, transparent 30%),
        radial-gradient(circle at 90% 100%, #283e33 0, transparent 28%),
        #08130f;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.game-shell {
    width: min(1180px, 96vw);
    padding: 24px 0 18px;
}

.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 28px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 3px;
    color: #9eb0a6;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .22em;
}

h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 4vw, 48px);
    font-style: italic;
    line-height: .9;
    letter-spacing: -.06em;
}

h1 span { color: var(--lime); }

.scoreboard {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 11px 20px;
    border: 1px solid #365044;
    border-radius: 14px;
    background: rgba(6, 16, 12, .65);
    box-shadow: inset 0 1px rgba(255,255,255,.04);
}

.scoreboard strong {
    min-width: 100px;
    display: flex;
    justify-content: center;
    gap: 12px;
    font-variant-numeric: tabular-nums;
    font-size: 31px;
    letter-spacing: -.04em;
}

.scoreboard small { color: #617269; font-weight: 400; }
.team { display: flex; align-items: center; gap: 8px; color: #9eb0a6; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.team i, .legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.team-white i, .white-dot { background: #f6f1e7; box-shadow: 0 0 0 2px #6d766f; }
.team-red i, .red-dot { background: var(--red); box-shadow: 0 0 0 2px #762b29; }

.reset-button {
    justify-self: end;
    padding: 10px 14px;
    color: #b9c5be;
    border: 1px solid #365044;
    border-radius: 9px;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.reset-button:hover { color: var(--cream); border-color: #71847a; }

.pitch-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 5 / 3;
    border: 8px solid #1b3328;
    border-radius: 18px;
    background: #275c38;
    box-shadow: 0 26px 70px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.12);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
    touch-action: manipulation;
}

canvas.can-play { cursor: pointer; }

.status-pill {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px;
    color: #132018;
    background: rgba(245, 237, 218, .9);
    backdrop-filter: blur(6px);
    font-size: 9px;
    letter-spacing: .12em;
    pointer-events: none;
    transition: .2s ease;
}
.status-pill span { width: 6px; height: 6px; border-radius: 50%; background: #3d8e4e; box-shadow: 0 0 0 3px rgba(61,142,78,.18); }
.status-pill.busy { opacity: .7; transform: translateX(-50%) translateY(-4px); }
.status-pill.busy span { background: #e3a02e; }

.instructions {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 14px;
    color: #9baaa2;
    font-size: 12px;
}
.instructions p { margin: 0; }
.instructions p b { margin-right: 8px; color: var(--cream); }
.legend { display: flex; gap: 17px; white-space: nowrap; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend b { color: var(--lime); }

@media (max-width: 760px) {
    .game-shell { width: 98vw; padding-top: 12px; }
    .topbar { grid-template-columns: 1fr auto; gap: 10px; padding: 0 8px; }
    .scoreboard { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
    .reset-button span { display: none; }
    .pitch-frame { border-width: 4px; border-radius: 10px; }
    .instructions { padding: 0 9px; }
    .legend { display: none; }
}
