/* RALLYDAY — single theme, deliberately. Tokens first (doc 04), components after. */

:root {
  --bg: #0B0F14;
  --surface: #121822;
  --surface-2: #1A2230;
  --line: #232E40;
  --text: #EDF1F7;
  --muted: #8A97AB;
  --accent: #D7F235;
  --live: #FF4D5E;
  --win: #39D98A;
  --display: 'Archivo Black', 'Arial Black', sans-serif;
  --body: 'Inter', -apple-system, system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); font-family: var(--body); }
button { font-family: var(--body); color: inherit; background: none; border: none; cursor: pointer; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; }

/* ---------- shell ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 10px;
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 75%, transparent);
}
.wordmark { font-family: var(--display); font-size: 20px; letter-spacing: 0.04em; }
.wordmark span { color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 4px; }
.install-chip {
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px;
  padding: 6px 12px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.bell { position: relative; padding: 8px; color: var(--muted); }
.bell:hover { color: var(--text); }
.badge {
  position: absolute; top: 0; right: 0;
  background: var(--live); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
  padding: 3px 5px; border-radius: 8px;
  animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }

.content { padding: 4px 16px 84px; }
.event { font-family: var(--display); font-size: 13px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin: 10px 2px 12px; }

.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: flex; background: var(--surface-2); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; padding: 13px 0 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); text-transform: uppercase; }
.tab.active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }

.mtop { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.court { color: var(--muted); font-size: 12px; }
.gameno { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; }

.chip { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.live-chip { background: rgba(255, 77, 94, 0.14); color: var(--live); }
.final-chip { background: var(--surface-2); color: var(--muted); }
.up-chip { background: var(--surface-2); color: var(--text); font-variant-numeric: tabular-nums; }
.upset-chip { background: rgba(215, 242, 53, 0.12); color: var(--accent); }
.hit-chip { background: rgba(57, 217, 138, 0.14); color: var(--win); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* match rows */
.mrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.mrow.lost { opacity: 0.55; }
.mseed { width: 26px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; flex: none; }
.mlabels { padding: 0; margin-bottom: -2px; }
.mlabels .g, .collab { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.collab { width: 34px; text-align: right; flex: none; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; margin: -6px 2px 12px; }
.ldot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.mname { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fstar { color: var(--accent); font-size: 12px; }
.serve { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; flex: none; }
.serve-gap { width: 7px; flex: none; }
.games { display: flex; gap: 6px; font-variant-numeric: tabular-nums; }
.g { color: var(--muted); font-size: 13px; width: 18px; text-align: right; }
.g.gw { color: var(--text); font-weight: 700; }
.score-now {
  font-family: var(--display); font-size: 22px; width: 34px; text-align: right;
  font-variant-numeric: tabular-nums; flex: none;
}
.score-now.flash { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { color: var(--accent); transform: scale(1.18); } 100% { color: var(--text); transform: scale(1); } }
.check { color: var(--win); font-weight: 800; }

.vs { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.vs em { color: var(--muted); font-style: normal; font-size: 11px; }

/* ---------- players ---------- */
.prow { display: flex; align-items: center; gap: 10px; }
.pname { flex: 1; font-weight: 700; font-size: 15px; display: flex; flex-direction: column; }
.pmeta { color: var(--muted); font-size: 12px; font-weight: 400; }
.follow {
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.follow.on { background: var(--accent); border-color: var(--accent); color: #10140A; }

/* ---------- pick 'em ---------- */
.pstats { display: flex; gap: 28px; }
.pstats > div { display: flex; flex-direction: column; }
.bignum { font-family: var(--display); font-size: 28px; font-variant-numeric: tabular-nums; }
.statlab { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.pickrow { display: flex; gap: 8px; }
.pick {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 10px; font-weight: 700; font-size: 14px; text-align: left;
  display: flex; flex-direction: column; gap: 3px;
}
.pick:hover { border-color: var(--muted); }
.pick.picked { border-color: var(--accent); background: rgba(215, 242, 53, 0.08); }
.pick.picked::after { content: 'YOUR PICK'; color: var(--accent); font-size: 9px; letter-spacing: 0.1em; }
.pseed { color: var(--muted); font-size: 11px; }
.dog { color: var(--accent); font-size: 10px; font-weight: 600; }
.pickcard.locked { opacity: 0.85; }
.pickcard .mtop { margin-bottom: 0; }
.pickcard .pickrow { margin-top: 10px; }

/* ---------- standings ---------- */
.stable { width: 100%; border-collapse: collapse; font-size: 14px; }
.stable th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 6px 10px; }
.stable td { padding: 8px 6px; border-top: 1px solid var(--line); font-weight: 600; }
.stable .num { font-variant-numeric: tabular-nums; }
.form .f { font-size: 11px; font-weight: 800; margin-right: 4px; }
.f.W { color: var(--win); }
.f.L { color: var(--live); }

/* ---------- alerts drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(340px, 88vw);
  background: var(--surface-2); border-left: 1px solid var(--line);
  transform: translateX(105%); transition: transform 0.22s ease-out;
  z-index: 20; overflow-y: auto; padding: 14px;
}
.drawer.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 15; }
.dhead { display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-size: 15px; margin-bottom: 12px; }
.dhead button { color: var(--muted); font-size: 15px; padding: 4px; }
.alert { padding: 9px 10px; margin-bottom: 8px; font-size: 13px; background: var(--surface); border-radius: 8px; display: flex; align-items: baseline; gap: 8px; }
.alert::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.alert.k-win::before, .alert.k-pick::before { background: var(--win); }
.alert.k-loss::before { background: var(--live); }
.alert.k-upset::before, .alert.k-close::before { background: var(--accent); }
.empty { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- scorer console ---------- */
.sc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.sc-name { flex: 1; font-weight: 700; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-score { font-family: var(--display); font-size: 22px; width: 34px; text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.sc-btn { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-weight: 800; font-size: 14px; background: var(--surface-2); }
.sc-btn.big { font-size: 17px; padding: 12px 18px; }
.sc-btn.accent { background: var(--accent); color: #10140A; border-color: var(--accent); }
.sc-btn.serveon { border-color: var(--accent); color: var(--accent); }
.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

@media (min-width: 560px) {
  .content { padding-top: 10px; }
}
