:root {
  --bg: #0e0e0e;
  --surface: #1a1a1a;
  --line: #2e2e2e;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #ffffff;
  --accent-ink: #000000;
  --pad-top: #e11d48;
  --pad-bottom: #2563eb;
  --good: #34d399;
  --bad: #fb7185;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.error { color: var(--bad); margin: 0; font-size: 15px; }
.hint { color: var(--muted); margin: 0; font-size: 14px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
input, select {
  width: 100%; min-height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 16px; font-weight: 400;
}
select { text-overflow: ellipsis; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary {
  min-height: 52px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px; cursor: pointer;
}
.primary:disabled { background: var(--surface); color: var(--muted); cursor: default; }
.link { background: none; border: 0; color: var(--muted); padding: 12px; cursor: pointer; text-decoration: underline; }

.gate {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px 20px 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
}
.gate[open] { display: flex; flex-direction: column; gap: 20px; }
.gate::backdrop { background: rgba(0, 0, 0, 0.7); }
.gate #gate-close { align-self: center; padding: 8px; }
.gate-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary { min-height: 48px; background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 700; cursor: pointer; }
.warning { margin: 0; padding: 12px; border: 1px solid #b45309; border-radius: 10px; background: rgba(180, 83, 9, 0.14); font-size: 14px; display: grid; gap: 10px; }
.warning p { margin: 0; }
.claim { padding: 12px; background: var(--surface); border-radius: 10px; display: grid; gap: 10px; font-size: 14px; }
.claim p { margin: 0; }
.header-side { display: inline-flex; align-items: center; gap: 10px; }
.header-action { min-height: 32px; padding: 0 10px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.header-help { width: 32px; height: 32px; background: none; border: 1px solid var(--line); border-radius: 50%; color: var(--text); font-weight: 700; cursor: pointer; }
.leaders { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.leaders th { padding: 8px 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--line); }
.leaders td { padding: 12px 6px; border-bottom: 1px solid var(--surface); }
.leaders .num { text-align: right; white-space: nowrap; }
.leaders .name { font-weight: 600; overflow-wrap: anywhere; }
.leaders tr.you td { background: var(--surface); }
.faq details { padding: 12px 0; border-bottom: 1px solid var(--line); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p, .faq ul { margin: 10px 0 0; color: var(--text); font-size: 15px; }
.faq ul { padding-left: 20px; }
.faq li + li { margin-top: 4px; }
.faq .formula { padding: 10px 12px; background: var(--surface); border-radius: 8px; font-weight: 700; }
.faq > .hint { margin-top: 14px; }
.brand-block { text-align: center; }
.brand-block h1 { margin: 10px 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.brand-block p { margin: 0; color: var(--muted); font-size: 17px; }
form { display: grid; gap: 16px; }

.app {
  height: 100dvh; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.conn { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.conn[data-state="up"]::before { background: var(--good); }
.app-tip { flex-shrink: 0; margin: 0 16px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.5; }
.app-tip strong { color: var(--text); }
.volume-red { color: #fb7185; font-weight: 700; }
.volume-blue { color: #93c5fd; font-weight: 700; }
.practice { margin: 0 16px 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; }

.view { flex: 1; min-height: 0; padding: 4px 16px 12px; }
.signal-view { display: flex; flex-direction: column; gap: 10px; }
.wallet-view { display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }

.score, .balance { display: flex; flex-direction: column; align-items: center; }
.score-number { font-size: clamp(56px, 14dvh, 96px); font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--accent); }
.balance { padding-top: 16px; }
.balance-number { font-size: 56px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.score-label { color: var(--muted); font-size: 14px; font-weight: 600; }
.result { margin: 0; min-height: 44px; text-align: center; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.result[data-tone="good"] { color: var(--good); }
.result[data-tone="bad"] { color: var(--bad); }
.result[data-tone="muted"] { color: var(--muted); }

.pads { flex: 1; min-height: 180px; display: grid; grid-template-rows: 1fr 1fr; gap: 10px; }
.pad {
  border: 0; border-radius: 18px; color: #fff; font-size: clamp(24px, 7vw, 36px); font-weight: 800; padding: 8px 16px;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 60ms ease-out, opacity 120ms linear;
}
.pad-top { background: var(--pad-top); }
.pad-bottom { background: var(--pad-bottom); }
.pad.pressed { transform: scale(0.97); }
.pad:disabled { opacity: 0.35; cursor: default; }
.pad-note { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

.games-view { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.zip-form { gap: 6px; }
.zip-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.zip-row .primary { min-height: 48px; padding: 0 18px; font-size: 16px; }
.next-up { padding: 16px; border: 1px solid var(--accent); border-radius: 14px; display: grid; gap: 4px; }
.next-up-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.next-up-teams { font-size: 18px; font-weight: 700; }
.next-up-count { font-size: 36px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.game-list { display: grid; gap: 18px; }
.city-group { display: grid; gap: 8px; }
.city-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; font-size: 17px; }
.city-head span { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.game-card { padding: 14px; background: var(--surface); border-radius: 12px; display: grid; gap: 10px; }
.game-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.game-teams { font-weight: 700; }
.game-venue { color: var(--muted); font-size: 13px; }
.game-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-count.live { color: var(--good); }
.verdict { font-size: 14px; font-weight: 700; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.game-actions > * { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; }
.action-go { background: var(--accent); color: var(--accent-ink); border: 0; }
.action-link { background: none; color: var(--text); border: 1px solid var(--line); }
.game-actions > :only-child { grid-column: 1 / -1; }

.history-view { overflow-y: auto; }
.history-view h2 { margin: 8px 0 12px; font-size: 20px; }
.predictions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prediction { padding: 14px; background: var(--surface); border-radius: 12px; display: grid; gap: 10px; }
.prediction-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.prediction-pick { font-weight: 700; font-size: 17px; }
.prediction-game { color: var(--muted); font-size: 13px; }
.prediction-value { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.prediction-value.paid { color: var(--good); }
.prediction-value.unpaid { color: var(--muted); }
.facts, .game-facts { margin: 0; display: grid; gap: 4px; font-size: 14px; }
.facts div, .working div, .game-facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt, .game-facts dt { color: var(--muted); }
.facts dd, .game-facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.facts dd.good { color: var(--good); }
.facts dd.bad { color: var(--bad); }
.working { padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.working .total { font-weight: 700; padding-top: 4px; }
.note { margin: 0; color: var(--muted); font-size: 13px; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 12px; background: var(--surface); border-radius: 10px; font-size: 14px; }
.history .state { color: var(--muted); }

nav { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { min-height: 52px; padding: 0 2px; background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
nav button[aria-current="page"] { color: var(--accent); }

.wordmark, .header-action { white-space: nowrap; }
/* On phones the connection state is just its dot; screen readers still get the text. */
@media (max-width: 430px) {
  .conn { font-size: 0; gap: 0; }
}
