:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #5b5b66;
  --line: #d9d9de;
  --accent: #c2410c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181b;
    --surface: #232328;
    --text: #f4f4f5;
    --muted: #a5a5b0;
    --line: #3a3a42;
    --accent: #fb923c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}
a { color: inherit; }
.message { padding: 40px 0; text-align: center; color: var(--muted); }

/* Top bar with back button and title */
.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding-top: env(safe-area-inset-top);
}
.bar h1 { margin: 0; font-size: 20px; flex: 1; min-width: 0; }
.bar .sub { color: var(--muted); font-size: 13px; }
.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: -10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 28px;
  line-height: 1;
}
.back:focus-visible, .row:focus-visible, .button:focus-visible, th button:focus-visible,
.switch button:focus-visible, td a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Teams list */
.teams { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}
.row .gp { font-weight: 400; font-size: 14px; white-space: nowrap; }

/* Team-coloured panel */
.panel { border-radius: 14px; padding: 18px 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 4px; font-size: 24px; }
.panel p { margin: 0; }
.panel .lines p { margin: 6px 0; font-size: 17px; }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid currentColor;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}
.button.wide { grid-column: 1 / -1; }

/* Tables scroll sideways inside their own box */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 0 10px; height: 48px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
td .date { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }
td .opp { line-height: 1.2; }
.sticky th:first-child, .sticky td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-width: 120px;
  max-width: 150px;
  white-space: normal;
  line-height: 1.2;
}
th button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 4px;
  min-height: 44px;
  min-width: 36px;
  cursor: pointer;
}
th[aria-sort] button { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
tbody tr[data-href] { cursor: pointer; }
td a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 600; }

/* Player page */
.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.switch button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.stats { display: grid; gap: 10px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat h3 { margin: 0 0 6px; font-size: 15px; color: var(--muted); font-weight: 600; }
.figures { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 8px; }
.figures div { display: flex; flex-direction: column; }
.figures b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figures span { font-size: 12px; color: var(--muted); }
.working { margin: 8px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Upcoming games */
.upcoming-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
}
.upcoming-link .gp { font-weight: 400; font-size: 14px; color: var(--muted); }
.games-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.game-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
}
.teams-line { display: flex; align-items: center; gap: 6px; }
.at { color: var(--muted); font-size: 14px; }
.pill { display: inline-block; min-width: 52px; padding: 4px 8px; border-radius: 6px; font-weight: 700; font-size: 15px; text-align: center; }
.when { font-size: 13px; color: var(--muted); text-align: right; display: flex; flex-direction: column; }
.when .note { font-size: 12px; }
.matchup { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.matchup .panel { padding: 12px; margin-bottom: 14px; }
.matchup .panel h2 { font-size: 17px; line-height: 1.2; }
.matchup .panel p { font-size: 13px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side { min-width: 0; }
.side-head { border-radius: 6px; padding: 4px 8px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font-size: 14px;
}
.side li:last-child a { border-bottom: 0; }
.side .name { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.side b { font-size: 18px; font-variant-numeric: tabular-nums; }
.side .none { margin: 8px 0; font-size: 13px; color: var(--muted); }

/* Claude's formula */
.tabs { margin-bottom: 12px; }
.proj-score { font-weight: 700; color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.panel h2.big { font-size: 30px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.panel .small { font-size: 12px; opacity: 0.85; }
.out-line { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.side .mins { display: block; font-size: 11px; color: var(--muted); }
.side .tag { font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 4px; background: var(--accent); color: var(--bg); vertical-align: 1px; }

/* Results */
table.results td { vertical-align: middle; }
table.results td b { display: block; line-height: 1.1; }
table.results .proj { display: block; font-size: 12px; color: var(--muted); line-height: 1.1; }
table.results td.win { font-weight: 700; color: var(--accent); }
table.results th[scope="row"] { text-align: left; color: var(--text); font-size: 15px; }
.stat h3 .pill { min-width: 0; font-size: 12px; padding: 2px 6px; }
.stat h3 .proj { font-weight: 400; }

/* Previous / next upcoming game */
.game-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.game-nav span { font-size: 13px; color: var(--muted); text-align: center; }
.game-nav a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; font-size: 26px; line-height: 1;
}
.game-nav a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Confirm lineup */
.lineup-link { display: flex; justify-content: space-between; align-items: center; min-height: 48px; margin: 0 0 10px; padding: 8px 14px;
  border-radius: 10px; border: 2px dashed var(--accent); text-decoration: none; font-weight: 700; color: var(--accent); }
.lineup-link.done { border-style: solid; background: var(--surface); color: var(--text); }
.lineup-link .gp { font-weight: 400; font-size: 13px; color: var(--muted); }
ul.lineup { list-style: none; margin: 0; padding: 0; }
ul.lineup li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.lineup li:last-child { border-bottom: 0; }
ul.lineup .name { min-width: 0; overflow-wrap: anywhere; font-size: 15px; line-height: 1.2; }
ul.lineup .mins { display: block; font-size: 11px; color: var(--muted); }
.lineup-actions { margin: 14px 0; }
.lineup-actions .button { background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.lineup-actions .button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.stat h3 b.warn { color: #b91c1c; }
ul.lineup .tag { font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 4px; background: var(--accent); color: var(--bg); vertical-align: 1px; }

ul.lineup li { display: block; }
.lineup-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 52px; padding: 6px 4px;
  background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-left: 4px solid transparent; }
.lineup-row.role-confirmed { border-left-color: var(--text); }
.lineup-row.role-projected { border-left-color: var(--muted); }
.lineup-row.role-out { opacity: 0.55; border-left-color: #b91c1c; }
.lineup-row:focus-visible, .choice button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pra { flex-shrink: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pra b { font-size: 15px; color: var(--text); margin-left: 4px; }
.lineup-panel { padding: 8px 4px 12px; border-top: 1px dashed var(--line); }
.lineup-panel h4 { margin: 0 0 6px; font-size: 18px; }
.panel-label { margin: 8px 0 4px; font-size: 12px; color: var(--muted); }
.choice { display: flex; gap: 4px; flex-wrap: wrap; }
.choice button { flex: 1; min-height: 44px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.choice button small { font-weight: 400; color: var(--muted); }
.choice button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.choice button[aria-pressed="true"] small { color: var(--bg); }
.choice button[data-role="out"][aria-pressed="true"] { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.lineup-panel .figures { margin-top: 10px; }
.choice button { min-width: 0; }
.choice button small { display: block; font-size: 10px; line-height: 1; }

/* Bet slips */
.slip .legs { list-style: none; margin: 0 0 10px; padding: 0; }
.slip .leg { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.slip .leg .name { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.slip .leg .pill { min-width: 0; font-size: 11px; padding: 1px 5px; }
.line-edit { display: flex; align-items: center; gap: 4px; flex-shrink: 0; text-align: center; }
.slip .leg .mins { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.line-edit .line { display: block; min-width: 64px; }
.line-edit b { display: block; font-size: 15px; white-space: nowrap; }
.line-edit small { display: block; font-size: 11px; color: var(--muted); }
.line-edit > b + small { margin-top: -2px; }
.line-edit button { min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 20px; cursor: pointer; }
.line-edit button:focus-visible, .odds input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.odds { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.odds input { width: 110px; min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.slip .button { width: 100%; margin-top: 6px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.slip .button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; color: #fff; background: var(--muted); }
.badge.won { background: #15803d; }
.badge.lost { background: #b91c1c; }
.slip.locked { border-style: dashed; }
h2.group { font-size: 18px; margin: 22px 0 8px; }
h2.group small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
details.claude-slips summary { cursor: pointer; font-weight: 700; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 10px; min-height: 44px; }
.levels-box { margin: 0 0 12px; }
.levels-title { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.levels { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.levels button { flex: 0 0 auto; min-width: 58px; min-height: 44px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.levels button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.levels button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
