:root {
  --bg: #0a0e13;
  --surface: #111821;
  --surface-2: #17202c;
  --surface-3: #1e2937;
  --border: #233042;
  --text: #e8eef5;
  --muted: #8a99ab;
  --faint: #5d6b7c;
  --accent: #1fd17a;
  --accent-ink: #04210f;
  --win: #1fd17a;
  --loss: #ff5a5f;
  --push: #f5b942;
  --live: #ff5a5f;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: -0.5px;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.bankroll { display: flex; gap: 28px; }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-value.big { color: var(--accent); font-size: 22px; }
.pos { color: var(--win); }
.neg { color: var(--loss); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; align-items: center; gap: 4px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 67px; z-index: 19;
}
.tab { padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); font-size: 11px; line-height: 18px; text-align: center; }
.count:empty { display: none; }
.sync { margin-left: auto; color: var(--faint); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.dot.live { background: var(--live); animation: pulse 1.4s infinite; }
.dot.ok { background: var(--accent); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 20px 24px 80px; max-width: 1280px; margin: 0 auto; }
main { min-width: 0; }

.day-head { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin: 22px 0 10px; }
.day-head:first-child { margin-top: 4px; }
.empty { color: var(--muted); padding: 40px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.error { color: var(--loss); background: rgba(255, 90, 95, 0.08); border: 1px solid rgba(255, 90, 95, 0.3); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; }

/* ---------- Game card ---------- */
.game { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.game-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); gap: 10px; }
.game-head .when { font-weight: 600; color: var(--text); }
.game-head .live-tag { color: var(--live); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.mybets-tag { background: rgba(31, 209, 122, 0.12); color: var(--accent); border-radius: 6px; padding: 2px 7px; font-weight: 600; }
.game-body { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 108px); gap: 6px; padding: 10px 14px 12px; align-items: center; }
.col-head { color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; height: 46px; }
.team img { width: 28px; height: 28px; flex: none; }
.team-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-rec { color: var(--faint); font-size: 12px; margin-left: 4px; font-weight: 500; }
.team-score { margin-left: auto; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; padding-right: 8px; }
.team.loser .team-name, .team.loser .team-score { color: var(--muted); }
.poss { color: var(--push); font-size: 10px; margin-left: -4px; flex: none; }

.odd {
  height: 46px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: background 0.12s, border-color 0.12s;
}
.odd:hover:not(:disabled) { border-color: var(--accent); }
.odd .line { font-weight: 600; font-size: 13px; }
.odd .price { color: var(--accent); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.odd.only .price { font-size: 14px; }
.odd.selected { background: var(--accent); border-color: var(--accent); }
.odd.selected .line, .odd.selected .price { color: var(--accent-ink); }
.odd:disabled { cursor: default; opacity: 0.4; }
.odd.na { color: var(--faint); }
.game-foot { padding: 0 14px 10px; color: var(--muted); font-size: 12px; }
.game-foot.red { color: var(--loss); }

/* ---------- Bet slip ---------- */
.slip { position: sticky; top: 130px; align-self: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.slip-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.slip-title { font-weight: 700; font-size: 15px; }
.link { color: var(--muted); font-size: 12px; font-weight: 600; }
.link:hover { color: var(--text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px 16px 0; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.seg button { padding: 7px; border-radius: 7px; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.slip-items { overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.slip-empty { color: var(--muted); text-align: center; padding: 28px 8px; line-height: 1.5; }
.sel { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.sel.changed { border-color: var(--push); }
.sel-top { display: flex; justify-content: space-between; gap: 8px; }
.sel-pick { font-weight: 700; }
.sel-odds { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.sel-sub { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; justify-content: space-between; }
.sel-x { color: var(--faint); font-size: 16px; line-height: 1; padding: 0 2px; }
.sel-x:hover { color: var(--text); }
.moved { color: var(--push); font-size: 11px; font-weight: 600; margin-top: 4px; }
.stake-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.stake-wrap { flex: 1; position: relative; }
.stake-wrap::before { content: '$'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.stake-input { width: 100%; padding: 8px 10px 8px 20px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-variant-numeric: tabular-nums; }
.stake-input:focus { outline: none; border-color: var(--accent); }
.towin { text-align: right; font-size: 12px; color: var(--muted); min-width: 92px; }
.towin b { display: block; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button { flex: 1; padding: 5px 0; font-size: 12px; font-weight: 600; background: var(--surface-3); border-radius: 6px; color: var(--muted); }
.quick button:hover { color: var(--text); }
.parlay-box { border-top: 1px solid var(--border); padding: 12px 16px 0; }
.parlay-line { display: flex; justify-content: space-between; font-weight: 700; }
.slip-foot { border-top: 1px solid var(--border); padding: 14px 16px 16px; }
.slip-sum { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.slip-sum b { color: var(--text); }
.slip-warn { color: var(--push); font-size: 12px; margin: 6px 0; }
.place { width: 100%; margin-top: 8px; padding: 13px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px; }
.place:disabled { background: var(--surface-3); color: var(--faint); cursor: not-allowed; }
.place.accept { background: var(--push); }
.slip-bar, .slip-backdrop, .slip-grab, .minimize { display: none; }
.minimize { color: var(--muted); font-size: 12px; font-weight: 700; margin-left: 12px; }
.minimize:hover { color: var(--text); }

/* ---------- My bets ---------- */
.section-title { font-weight: 700; font-size: 15px; margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title + .empty { margin-bottom: 24px; }
.bet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.bet.won { border-color: rgba(31, 209, 122, 0.45); }
.bet.lost { opacity: 0.8; }
.bet-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border); gap: 10px; }
.bet-kind { font-weight: 700; }
.bet-kind span { color: var(--accent); margin-left: 6px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.pill.pending { background: var(--surface-3); color: var(--muted); }
.pill.win, .pill.won { background: rgba(31, 209, 122, 0.15); color: var(--win); }
.pill.loss, .pill.lost { background: rgba(255, 90, 95, 0.15); color: var(--loss); }
.pill.push { background: rgba(245, 185, 66, 0.15); color: var(--push); }
.pill.live-win { background: rgba(31, 209, 122, 0.15); color: var(--win); }
.pill.live-loss { background: rgba(255, 90, 95, 0.15); color: var(--loss); }
.pill.live-push { background: rgba(245, 185, 66, 0.15); color: var(--push); }
.leg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.leg:last-of-type { border-bottom: 0; }
.leg-pick { font-weight: 700; }
.leg-pick .o { color: var(--muted); font-weight: 600; margin-left: 6px; }
.leg-game { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.leg-game .sc { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.leg-game .clock { color: var(--live); font-weight: 600; }
.leg-margin { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.neg { background: var(--loss); }
.bet-foot { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--surface-2); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; gap: 12px; flex-wrap: wrap; }
.bet-foot b { color: var(--text); }

/* ---------- History ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
table.hist { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--border); }
.hist th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; background: var(--surface-2); }
.hist th:first-child, .hist td:first-child { text-align: left; }
.hist tr:last-child td { border-bottom: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.link-strong { color: var(--accent); font-weight: 700; }
.link-strong:hover { text-decoration: underline; }
.banner { background: rgba(31, 209, 122, 0.08); border: 1px solid rgba(31, 209, 122, 0.3); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.empty.small { padding: 18px; font-size: 13px; }
.league-note { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.league-note b { color: var(--text); }

/* ---------- Header extras ---------- */
.league-picker select {
  margin-left: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font: inherit; font-weight: 600; max-width: 220px;
}
.user { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.user-name { font-weight: 700; }
.tabs .tab .dot { display: inline-block; vertical-align: middle; margin-left: 2px; }

/* ---------- Forms & panels ---------- */
.field { width: 100%; padding: 11px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.field:focus { outline: none; border-color: var(--accent); }
.field.code { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; }
.btn { padding: 11px 16px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 800; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.panel .muted { margin: 0; font-size: 13px; line-height: 1.5; }
.panel-title { font-weight: 800; font-size: 16px; }
.onboard-intro { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.onboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.invite { margin-top: 4px; }
.copy-row { display: flex; gap: 8px; }
.code-tag { color: var(--text); letter-spacing: 0.12em; }
.more-leagues { margin-top: 28px; }
.more-leagues summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 12px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { margin-bottom: 8px; }
.auth-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.auth-card p { margin: 0; text-align: center; }
.auth-msg { font-size: 13px; padding: 10px 12px; border-radius: 8px; }
.auth-msg.err { background: rgba(255, 90, 95, 0.1); color: var(--loss); }
.auth-msg.ok { background: rgba(31, 209, 122, 0.1); color: var(--win); }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Matchup ---------- */
.matchup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; }
.ms-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600; }
.ms-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 22px 16px 16px; }
.ms-side { min-width: 0; }
.ms-side:last-child { text-align: right; }
.ms-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you { font-size: 10px; font-weight: 800; background: var(--surface-3); color: var(--muted); border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.ms-score { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; margin: 4px 0; }
.ms-sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ms-side.leading .ms-name::after { content: ' ▲'; color: var(--accent); font-size: 11px; }
.ms-vs { color: var(--faint); font-weight: 800; font-size: 13px; }
.ms-bar { height: 6px; background: var(--loss); margin: 0 16px; border-radius: 3px; overflow: hidden; opacity: 0.85; }
.ms-bar i { display: block; height: 100%; background: var(--accent); }
.ms-foot { padding: 12px 16px 14px; color: var(--muted); font-size: 12px; }
.ms-foot b { color: var(--text); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto 56px auto minmax(0, 1fr); gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); align-items: center; }
.row:last-child { border-bottom: 0; }
.row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .num { font-variant-numeric: tabular-nums; color: var(--muted); }
.row .winner { color: var(--text); font-weight: 700; }
.row-mid { text-align: center; color: var(--faint); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.standings td:nth-child(2), .standings th:nth-child(2) { text-align: left; }
.standings .me-row td { background: rgba(31, 209, 122, 0.06); }
.remove-btn { color: var(--loss); font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255, 90, 95, 0.35); }
.remove-btn:hover { background: rgba(255, 90, 95, 0.1); }
.removed-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.leave { margin-top: 20px; }
.leave .link { color: var(--loss); }

/* ---------- How it Works ---------- */
.help { max-width: 760px; line-height: 1.6; }
.help-hero { background: linear-gradient(135deg, rgba(31, 209, 122, 0.14), rgba(31, 209, 122, 0.02)); border: 1px solid rgba(31, 209, 122, 0.3); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
.help-kicker { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.help-hero h1 { font-size: 26px; letter-spacing: -0.5px; line-height: 1.2; margin: 6px 0 10px; }
.help-hero > p { color: var(--muted); margin: 0 0 18px; }
.help-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.help-steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 12px 48px; position: relative; display: flex; flex-direction: column; line-height: 1.4; }
.help-steps li::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.help-steps span { color: var(--muted); font-size: 13px; margin-top: 2px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.help-toc a { color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.help-toc a:hover { color: var(--text); border-color: var(--accent); }
.help-section { padding: 22px 0 6px; border-bottom: 1px solid var(--border); scroll-margin-top: 130px; }
.help-section:last-child { border-bottom: 0; }
.help-section h2 { font-size: 18px; margin: 0 0 10px; letter-spacing: -0.2px; }
.help-section p { margin: 0 0 10px; }
.help-section ul, .help-section ol { margin: 0 0 12px; padding-left: 20px; }
.help-section li { margin-bottom: 6px; }
.help-section li::marker { color: var(--accent); }
.help-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.help-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.help-card h3 { margin: 0 0 6px; font-size: 15px; }
.help-card p { font-size: 13px; color: var(--muted); }
.help-card p:last-child { margin: 0; }
.help-eg { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; color: var(--text) !important; }
.help details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.help summary { cursor: pointer; font-weight: 700; }
.help details p { color: var(--muted); margin: 8px 0 0; }
@media (max-width: 620px) {
  .help-steps, .help-cards { grid-template-columns: 1fr; }
  .help-hero { padding: 18px; }
  .help-hero h1 { font-size: 22px; }
}

/* ---------- Admin ---------- */
body.admin-mode .layout { grid-template-columns: minmax(0, 1fr); max-width: 1400px; }
body.admin-mode .slip, body.admin-mode .slip-bar { display: none !important; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-nav { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.admin-nav button { padding: 8px 14px; border-radius: 7px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.admin-nav button.on { background: var(--surface-3); color: var(--text); }
.admin-meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.count.warn { background: var(--loss); color: #fff; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 3px; font-weight: 400; }
.search { margin-bottom: 12px; max-width: 360px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.admin-table { min-width: 860px; }
.admin-table td, .admin-table th { text-align: left; vertical-align: top; }
.admin-table tr.clickable { cursor: pointer; }
.admin-table tr.clickable:hover td { background: var(--surface-2); }
.admin-table .sub-row td { background: var(--surface-2); }
.member-chip { display: inline-block; background: var(--surface-3); border-radius: 999px; padding: 4px 10px; margin: 3px 6px 3px 0; font-size: 13px; }
.chip-x { color: var(--loss); font-weight: 800; margin-left: 4px; padding: 0 4px; border-radius: 4px; }
.chip-x:hover { background: rgba(255, 90, 95, 0.15); }
.chips { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--surface-3); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: rise 0.2s ease-out; }
.toast.loss { border-left-color: var(--loss); }
.toast.push { border-left-color: var(--push); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Responsive ---------- */
/* Pieces that only exist on phones stay hidden on bigger screens. */
.bottom-nav, .more-sheet, .sync-mobile { display: none; }

/* Tablets and phones: the bet slip becomes a bottom sheet. */
@media (max-width: 960px) {
  :root { --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --bn-h: 0px; }
  .layout { grid-template-columns: 1fr; padding: 14px 16px calc(96px + var(--bn-h) + var(--safe-bottom)); }

  /* iPhones zoom in when you tap a text box whose text is under 16px. */
  input, select, textarea, .field, .stake-input { font-size: 16px; }

  .slip {
    position: fixed; inset: auto 0 0 0; top: auto; max-height: 75vh; border-radius: 16px 16px 0 0;
    transform: translateY(105%); transition: transform 0.25s ease; z-index: 40; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    padding-bottom: var(--safe-bottom);
  }
  body.slip-open .slip { transform: none; }
  .slip-grab { display: flex; justify-content: center; padding: 8px 0 0; cursor: pointer; }
  .slip-grab span { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); }
  .minimize { display: inline-block; }
  .slip-backdrop {
    display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.55);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  body.slip-open .slip-backdrop, body.more-open .slip-backdrop { opacity: 1; pointer-events: auto; }

  .slip-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 12px; right: 12px;
    bottom: calc(12px + var(--bn-h) + var(--safe-bottom)); z-index: 30;
    background: var(--accent); color: var(--accent-ink); padding: 11px 16px; border-radius: 14px; text-align: left;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
  body.slip-open .slip-bar { display: none; }
  .slip-bar-count {
    display: grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent-ink); color: var(--accent); font-weight: 800;
  }
  .slip-bar-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
  .slip-bar-text b { font-weight: 800; }
  .slip-bar-text span { font-size: 12px; font-weight: 600; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .slip-bar-open { font-weight: 800; font-size: 13px; }
  .slip-bar.pulse { animation: bar-pulse 0.45s ease-out; }
  @keyframes bar-pulse { 40% { transform: scale(1.04); } }

  .topbar { padding: calc(12px + var(--safe-top)) 16px 12px; flex-wrap: wrap; }
  .tabs { padding: 0 16px; top: auto; position: static; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .bankroll { gap: 18px; }
  .two-col { grid-template-columns: 1fr; }
  .auth { padding-top: calc(24px + var(--safe-top)); padding-bottom: calc(24px + var(--safe-bottom)); }
}

/* Phones: compact header, bottom tab bar, "More" sheet, toasts at the top. */
@media (max-width: 760px) {
  :root { --bn-h: 58px; }

  /* Header: logo + league menu + status on one line, balances in a strip below. */
  .topbar { position: static; gap: 10px; padding-bottom: 10px; }
  .brand { width: 100%; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; flex: none; }
  .brand:has(#league-picker select) .brand-text { display: none; }
  .league-picker { flex: 1; min-width: 0; }
  .league-picker select { margin-left: 0; width: 100%; max-width: none; padding: 8px 10px; }
  .sync-mobile { display: flex; align-items: center; gap: 5px; margin-left: auto; font-size: 12px; color: var(--live); font-weight: 700; flex: none; }
  .user, .tabs { display: none; }
  .bankroll {
    width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
  }
  .bankroll > div:not(:first-child) { text-align: right; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 15px; }
  .stat-value.big { font-size: 17px; }

  /* Bottom tab bar */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
    height: calc(var(--bn-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
    background: rgba(17, 24, 33, 0.96); border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .bn-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bn-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .bn-item.active { color: var(--accent); }
  .bn-badge {
    position: absolute; top: 6px; left: calc(50% + 7px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  }
  .bn-badge.live { min-width: 8px; width: 8px; height: 8px; padding: 0; top: 8px; background: var(--live); animation: pulse 1.4s infinite; }

  /* "More" sheet */
  .more-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0;
    padding-bottom: calc(8px + var(--safe-bottom)); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(105%); transition: transform 0.25s ease;
  }
  body.more-open .more-sheet { transform: none; }
  .more-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 12px; }
  .more-head .muted { font-size: 12px; }
  .more-name { font-weight: 800; font-size: 16px; }
  .more-item { display: block; width: 100%; text-align: left; padding: 15px 16px; border-top: 1px solid var(--border); font-weight: 600; font-size: 15px; }
  .more-item.active { color: var(--accent); }
  .more-item.danger { color: var(--loss); }

  /* Toasts drop in from the top so they never cover the slip bar or tab bar. */
  .toasts { top: calc(10px + var(--safe-top)); bottom: auto; }
  .toast { animation: drop 0.2s ease-out; }
  @keyframes drop { from { transform: translateY(-8px); opacity: 0; } }
}

@media (max-width: 620px) {
  .onboard-grid { grid-template-columns: 1fr; }
  .ms-body { grid-template-columns: 1fr; text-align: left; gap: 8px; }
  .ms-side:last-child { text-align: left; }
  .ms-score { font-size: 24px; }
  .ms-vs { display: none; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row .row-mid { display: none; }
  .row > :nth-child(4) { order: 5; }
  .row > :nth-child(5) { order: 4; text-align: left !important; }
  .game-body { grid-template-columns: minmax(0, 1fr) repeat(3, 68px); gap: 5px; padding: 10px; }
  .team-rec, .team-name .full { display: none; }
  .team img { width: 22px; height: 22px; }
  .team-score { font-size: 17px; padding-right: 2px; }
  .odd .line, .odd .price { font-size: 12px; }
  .hist .opt { display: none; }
  .sync .ago { display: none; }
}
