:root {
  --bg: #0b1220;
  --panel: rgba(13, 20, 34, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3f9;
  --dim: #8d9bb0;
  --accent: #ffd84a;
  --ice: #f4f7fa;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
canvas#game { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.sb { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; background: rgba(10, 15, 26, 0.86); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.35); backdrop-filter: blur(8px); }
.sb-team { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-width: 170px; }
.sb-team.home { justify-content: flex-end; }
.sb-team .chip { width: 6px; align-self: stretch; border-radius: 3px; }
.sb-team .name { font-weight: 700; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-team .score { font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: center; }
.sb-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 16px; background: rgba(255,255,255,0.05); border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 86px; }
.sb-mid .period { font-size: 11px; font-weight: 700; color: var(--dim); letter-spacing: 0.12em; }
.sb-mid .clock { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sb-mid.low .clock { color: #ff8a5c; }
.sb-sub { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); display: flex; gap: 28px; font-size: 11px; font-weight: 600; color: var(--dim); letter-spacing: 0.08em; }
.banner { position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%) scale(0.9); text-align: center; opacity: 0; transition: opacity 0.25s, transform 0.25s; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner .big { font-size: clamp(48px, 9vw, 110px); font-weight: 900; letter-spacing: -0.02em; line-height: 0.95; text-shadow: 0 8px 40px rgba(0,0,0,0.45); }
.banner .small { margin-top: 10px; font-size: 16px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
.hint { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 10px; background: rgba(10,15,26,0.8); font-size: 13px; font-weight: 600; opacity: 0; transition: opacity 0.3s; }
.hint.show { opacity: 1; }
.keys { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: rgba(238,243,249,0.75); background: rgba(10,15,26,0.6); padding: 7px 14px; border-radius: 10px; transition: opacity 1s; }
.keys b { color: #fff; background: rgba(255,255,255,0.12); padding: 1px 6px; border-radius: 5px; margin-right: 3px; font-weight: 700; }
.keys.fade { opacity: 0; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(11,18,32,0.35), rgba(11,18,32,0.85)); overflow-y: auto; }
.panel { width: min(980px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 28px; backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.brand { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-size: 56px; font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.brand h1 span { color: var(--accent); }
.brand p { margin: 0; color: var(--dim); font-size: 14px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: rgba(255,255,255,0.06); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--dim); }
.seg button.on { background: var(--text); color: #0b1220; }
.label { font-size: 11px; font-weight: 700; color: var(--dim); letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 8px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.team { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: rgba(255,255,255,0.03); position: relative; overflow: hidden; }
.team::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tc); }
.team-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.jersey { width: 44px; height: 44px; border-radius: 50%; background: var(--tc); border: 3px solid rgba(0,0,0,0.25); display: grid; place-items: center; font-weight: 900; font-size: 15px; flex: none; }
.team-head input { flex: 1; min-width: 0; background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; font-weight: 700; font-size: 16px; outline: none; }
.team-head input:focus { border-color: rgba(255,255,255,0.35); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.sw { aspect-ratio: 1; border-radius: 9px; border: 2px solid transparent; padding: 0; outline: none; position: relative; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
.sw.custom { background: conic-gradient(#f43, #fc3, #3c6, #39f, #93f, #f43); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sub { margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: rgba(255,255,255,0.04); padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--dim); }
.chips button.on { background: var(--text); color: #0b1220; border-color: transparent; }
.slider { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-top: 8px; }
.slider span:last-child { text-align: right; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.go { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 12px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 12px; padding: 14px 26px; font-weight: 800; font-size: 16px; background: var(--accent); color: #1a1405; box-shadow: 0 8px 24px rgba(255,216,74,0.25); transition: transform 0.1s; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: rgba(255,255,255,0.08); color: var(--text); box-shadow: none; }
.ctrl-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 18px; font-size: 13px; color: var(--dim); }
.ctrl-list b { color: var(--text); display: inline-block; min-width: 52px; }
.small-panel { width: min(440px, 100%); text-align: center; }
.small-panel h2 { margin: 0 0 18px; font-size: 34px; font-weight: 900; letter-spacing: -0.02em; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.final-score { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 6px 0 18px; }
.final-score .fs-team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 110px; }
.final-score .fs-name { font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.final-score .fs-num { font-size: 64px; font-weight: 900; line-height: 1; }
.final-score .dash { font-size: 40px; color: var(--dim); }
.muted { color: var(--dim); font-size: 13px; }
@media (max-width: 760px) {
  .teams { grid-template-columns: 1fr; }
  .brand h1 { font-size: 42px; }
  .sb-team { min-width: 0; padding: 6px 10px; }
  .sb-team .name { max-width: 70px; font-size: 12px; }
}
.go .ctrl-list { flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
.replay { position: absolute; top: 104px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; background: rgba(10,15,26,0.85); font-weight: 900; letter-spacing: 0.18em; font-size: 13px; }
.replay .dot { width: 9px; height: 9px; border-radius: 50%; background: #ff4b4b; animation: blink 1s infinite; }
.replay em { font-style: normal; font-weight: 600; letter-spacing: 0.04em; color: var(--dim); margin-left: 6px; }
@keyframes blink { 50% { opacity: 0.2; } }
