/* Sports Arena — shared look: a night stadium. Navy stands, floodlit turf,
   amber scoreboard digits. One dark theme on purpose (it's a stadium). */
:root {
    --night: #0a1020;
    --stand: #121a30;
    --stand-2: #1a2440;
    --line: rgba(255, 255, 255, 0.12);
    --chalk: #f2f5fb;
    --muted: #9aa6c2;
    --turf: #2bd96b;
    --turf-dark: #12804a;
    --amber: #ffb627;
    --you: #38bdf8;
    --them: #ff6b6b;
    --f-display: 'Teko', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
    --f-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
    background: radial-gradient(ellipse at 50% -10%, #1d2a52 0%, var(--night) 55%) fixed, var(--night);
    color: var(--chalk); font-family: var(--f-body); font-size: 15px;
    display: flex; flex-direction: column; align-items: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    user-select: none; -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.a-top { width: 100%; max-width: 760px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.a-back {
    display: inline-flex; align-items: center; gap: 8px; color: var(--chalk); text-decoration: none; font-weight: 700; font-size: 0.9rem;
    padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,0.07); border: 1px solid var(--line);
}
.a-back:hover { border-color: var(--turf); color: var(--turf); }
.a-title { font-family: var(--f-display); font-size: 1.9rem; line-height: 1; letter-spacing: 0.02em; text-transform: uppercase; }
.a-title span { color: var(--turf); }

/* scoreboard */
.a-board {
    width: 100%; max-width: 760px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
    background: #05080f; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px;
}
.a-side { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-side.right { text-align: right; align-items: flex-end; }
.a-name { font-weight: 700; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.a-side.left .a-name { color: var(--you); } .a-side.right .a-name { color: var(--them); }
.a-score { font-family: var(--f-display); font-size: 2.3rem; line-height: 0.9; color: var(--amber); font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(255,182,39,0.35); }
.a-sub { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.a-mid { text-align: center; font-family: var(--f-display); font-size: 1.35rem; line-height: 1; color: var(--chalk); min-width: 70px; }
.a-mid small { display: block; font-family: var(--f-body); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.dot-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--turf); margin-left: 5px; vertical-align: 1px; }
.dot-online.off { background: #64748b; }

/* play surface */
.a-stage { position: relative; width: 100%; max-width: 760px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #0b1428; touch-action: none; }
.a-stage canvas { display: block; width: 100%; height: auto; }
.a-hint { margin-top: 10px; color: var(--muted); font-size: 0.85rem; text-align: center; max-width: 760px; }
.a-controls { width: 100%; max-width: 760px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

.a-btn {
    border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; font-size: 1rem; cursor: pointer;
    background: var(--turf); color: #04210f; transition: transform 0.08s, filter 0.15s;
}
.a-btn:hover { filter: brightness(1.08); } .a-btn:active { transform: translateY(1px); }
.a-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.a-btn.ghost { background: rgba(255,255,255,0.07); color: var(--chalk); box-shadow: inset 0 0 0 1px var(--line); }
.a-btn.amber { background: var(--amber); color: #2a1a00; }
.a-btn.big { font-size: 1.15rem; padding: 14px 20px; }

/* overlays (lobby, waiting, countdown, result) */
.a-overlay {
    position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; overflow: auto;
    background: rgba(5, 9, 20, 0.82); backdrop-filter: blur(3px);
}
.a-card {
    width: min(100%, 380px); display: grid; gap: 12px; text-align: center;
    background: var(--stand); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}
.a-card h2 { font-family: var(--f-display); font-size: 2rem; line-height: 1; text-transform: uppercase; letter-spacing: 0.02em; }
.a-card h2 em { font-style: normal; color: var(--turf); }
.a-card p { color: var(--muted); font-size: 0.9rem; }
.a-card label { text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: grid; gap: 6px; }
.a-input { width: 100%; min-width: 0; background: var(--night); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 1rem; }
.a-row { display: flex; gap: 8px; }
.a-row > * { flex: 1; min-width: 0; }
.a-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.a-or::before, .a-or::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.a-code { font-family: var(--f-display); font-size: 3rem; letter-spacing: 0.25em; color: var(--amber); line-height: 1; }
.a-count { font-family: var(--f-display); font-size: 6rem; color: var(--amber); line-height: 1; text-shadow: 0 0 24px rgba(255,182,39,0.5); }
.a-err { color: #fca5a5; font-size: 0.85rem; min-height: 1.1em; }
.a-lines { display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.a-lines div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); }
.a-lines b { color: var(--amber); }
.a-spinner { width: 34px; height: 34px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--turf); border-radius: 50%; animation: a-spin 0.9s linear infinite; }
@keyframes a-spin { to { transform: rotate(360deg); } }

.a-toast {
    position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
    background: var(--chalk); color: #0a1020; padding: 10px 16px; border-radius: 10px; font-weight: 700; max-width: calc(100% - 32px); text-align: center;
}
.a-flash {
    position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
    font-family: var(--f-display); font-size: clamp(2.4rem, 9vw, 4.5rem); line-height: 1; text-transform: uppercase; color: var(--amber);
    text-shadow: 0 4px 18px rgba(0,0,0,0.7); animation: a-pop 1.4s ease-out forwards; white-space: nowrap;
}
@keyframes a-pop { 0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .a-flash { animation-duration: 2s; } .a-spinner { animation: none; } }
@media (max-width: 480px) { .a-title { font-size: 1.5rem; } .a-score { font-size: 1.9rem; } .a-code { font-size: 2.4rem; } }
