:root {
  --bg: #0b1124; --panel: #141d3a; --panel-2: #1c2850; --line: #2a3766;
  --text: #f3f5ff; --muted: #9aa6cf; --accent: #ff6a1f; --accent-2: #ffb84d;
  --good: #58e39a; --bad: #ff7b7b;
  --team: #e63946; --trim: #fff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 16px/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-image: radial-gradient(900px 500px at 50% -200px, #1d2b5c 0%, transparent 70%);
  background-repeat: no-repeat;
}
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

.top {
  max-width: 992px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 22px; letter-spacing: -.02em; }
.logo b { font-weight: 900; color: var(--accent); }
.logo .ball {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffa257, #e8641b);
  box-shadow: inset 0 0 0 1.5px rgba(60,25,5,.5);
}
nav { display: flex; gap: 4px; }
nav a, nav button {
  background: none; border: 0; padding: 7px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px;
}
nav a:hover, nav button:hover { color: var(--text); background: var(--panel); }
nav a.active { color: var(--text); background: var(--panel-2); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

main { max-width: 992px; margin: 0 auto; padding: 0 16px 48px; }

/* ---- Game ---- */
.scoreboard {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px;
  background: #060a17; border: 1px solid var(--line); border-radius: 14px 14px 0 0; padding: 10px 16px;
}
.side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.side.opp { justify-content: flex-end; text-align: right; }
.side .name { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--muted); line-height: 1.2; }
.side.opp .name { border-right: 4px solid var(--team); padding-right: 8px; }
.side.you .name { border-left: 4px solid var(--accent); padding-left: 8px; }
.pts { font-weight: 900; font-size: clamp(30px, 6vw, 44px); line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.mid { text-align: center; display: grid; font-size: 12px; color: var(--muted); }
.mid b { color: var(--text); font-size: 14px; }

.stage { position: relative; border: 1px solid var(--line); border-top: 0; background: #0a1024; }
canvas { display: block; width: 100%; aspect-ratio: 3 / 2; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
canvas:active { cursor: grabbing; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  background: rgba(6, 10, 23, .72); backdrop-filter: blur(3px); overflow: auto;
}
.overlay[hidden] { display: none; }
.card { max-width: 440px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.card h1 { font-size: clamp(24px, 5vw, 38px); font-weight: 900; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
.card h1 em { font-style: normal; color: var(--team); filter: brightness(1.35); }
.card h1.win { color: var(--good); } .card h1.loss { color: var(--bad); }
.card p { color: #cfd6f3; text-wrap: pretty; }
.card p b { color: var(--text); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2) !important; }
.final { font-size: 34px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.row { font-size: 20px; letter-spacing: 2px; }
.next { font-size: 13px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: 15px;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0b02; padding-inline: 26px; }

.stats { display: flex; gap: 22px; margin: 0; }
.stats div { text-align: center; }
.stats dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stats dd { margin: 0; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }

.pips {
  list-style: none; margin: 0; padding: 10px 12px; display: flex; gap: 6px; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); border-top: 0;
}
.pips li {
  flex: 1; max-width: 56px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: var(--panel-2); color: var(--muted); font-weight: 800; font-size: 14px; border: 2px solid transparent;
}
.pips li.now { border-color: var(--accent-2); color: var(--text); }
.pips li.make { background: var(--good); color: #06281a; }
.pips li.miss { background: #3a2233; color: var(--bad); text-decoration: line-through; }
.info {
  display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 14px 14px; font-size: 14px; color: #cfd6f3;
}
.info b { color: var(--text); }
.info span { color: var(--accent-2); font-weight: 700; }

/* ---- Archive ---- */
.archive-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin: 12px 0 4px; }
.archive h1 { font-size: 34px; font-weight: 900; letter-spacing: -.02em; }
.archive-head p { color: var(--muted); }
.archive h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--team);
}
.tile:hover { background: var(--panel-2); }
.tile .num { font-weight: 900; font-size: 17px; }
.tile .date, .tile .vs { font-size: 13px; color: var(--muted); }
.tile .badge { margin-top: 6px; font-size: 13px; font-weight: 800; color: var(--accent-2); }
.tile.won .badge { color: var(--good); } .tile.lost .badge { color: var(--bad); }
.tile.locked { opacity: .6; }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; max-width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(4, 7, 16, .7); }
dialog h2 { font-weight: 900; margin-bottom: 10px; }
dialog ol { padding-left: 20px; display: grid; gap: 8px; color: #cfd6f3; }
dialog p { color: #cfd6f3; margin: 12px 0 16px; }
dialog b { color: var(--text); }

@media (max-width: 560px) {
  main, .top { padding-inline: 0; } .top { padding: 10px 12px; }
  .scoreboard, .info, .stage, .pips { border-radius: 0; border-inline: 0; }
  .side .name { font-size: 10px; } .side { gap: 7px; } .scoreboard { padding-inline: 12px; gap: 6px; } .mid span { display: none; } .pips li { height: 26px; font-size: 12px; }
  .archive { padding-inline: 16px; }
  .card { gap: 6px; } .card p { font-size: 13px; } .stats dd { font-size: 17px; } .final { font-size: 24px; } .row { font-size: 15px; }
  .btn { padding: 7px 13px; font-size: 13px; }
}
