/* One look: night-game navy with ticket-yellow. Phone first; slips are tear-off tickets. */
:root {
  color-scheme: dark;
  --bg: #0a1220; --surface: #121c2e; --raised: #1a2740; --line: #2a3a58;
  --ink: #eef3fb; --muted: #8fa0bc;
  --accent: #ffc93c; --accent-ink: #1a1300;
  --on: #4fd6a5; --on-bg: #11382e;
  --off: #8fa0bc; --off-bg: #1c2638;
  --danger: #ff8473;
  --display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); min-height: 100dvh; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { font: 700 22px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; margin: 0; }
.brand span { color: var(--accent); }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--raised); border-radius: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.link { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* Sign-in */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter-r) 24px var(--gutter-l); }
.gate-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.gate-card h1 { font: 700 44px/1 var(--display); text-transform: uppercase; margin: 8px 0 0; }
.sub { color: var(--muted); margin: 0; }
.sent-msg { background: var(--on-bg); color: var(--on); border-radius: 10px; padding: 12px 14px; margin: 0; }
form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
input, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; font-size: 16px; }
textarea { resize: vertical; }
::placeholder { color: #5f7191; }
.form-error { color: var(--danger); margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* App shell */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in, .tabs, .list, .banner { max-width: 640px; margin: 0 auto; }
.top-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px var(--gutter-r) 8px var(--gutter-l); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; }
.who #me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tabs { display: flex; padding: 0 var(--gutter-r) 0 var(--gutter-l); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 4px; cursor: pointer; color: var(--muted);
  font: 700 17px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-variant-numeric: tabular-nums; color: var(--accent); margin-left: 2px; }
.banner { margin-top: 12px; padding: 10px var(--gutter-r) 10px var(--gutter-l); color: var(--accent); font-size: 13px; }
.list { display: flex; flex-direction: column; gap: 14px; padding: 16px var(--gutter-r) calc(96px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.empty { border: 1px dashed var(--line); border-radius: 14px; padding: 28px 18px; text-align: center; color: var(--muted); margin: 0; }
.empty strong { display: block; color: var(--ink); font: 700 22px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }

.fab { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 14px 26px; cursor: pointer; white-space: nowrap;
  font: 700 19px/1 var(--display); letter-spacing: 0.05em; text-transform: uppercase; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }

/* Bet slip */
.slip { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; animation: rise 0.2s ease-out; }
@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .slip { animation: none; } .btn:active:not(:disabled) { transform: none; } }
.slip-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--raised); }
.matchup { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font: 700 22px/1 var(--display); letter-spacing: 0.03em; text-transform: uppercase; }
.matchup .at { color: var(--muted); font-size: 15px; }
.matchup .event { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team { display: inline-flex; align-items: center; gap: 6px; }
.badge { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--line); overflow: hidden;
  font: 700 12px/1 var(--display); color: #fff; }
.badge img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 2px; border-radius: 50%; }
.sport-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); flex: none; }
.slip-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.terms { font-size: 18px; font-weight: 500; margin: 0; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.slip-stub { border-top: 2px dashed var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stake { flex: 1 1 140px; min-width: 0; }
.stake .lbl, .clock .lbl { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stake .val { font: 700 24px/1.1 var(--display); color: var(--accent); overflow-wrap: anywhere; }
.clock { text-align: right; flex: none; }
.clock .val { font: 700 24px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.clock.soon .val { color: var(--danger); }
.acts { display: flex; gap: 8px; flex: 1 1 100%; }
.acts .btn { flex: 1; }
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; flex: none; }
.pill.on { color: var(--on); background: var(--on-bg); }
.pill.nobet { color: var(--off); background: var(--off-bg); }
.slip.nobet .terms, .slip.nobet .stake .val { color: var(--muted); }
.slip.on { border-color: #1f5a49; }

/* Propose sheet */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: 100%; max-width: 560px; max-height: 92dvh;
  margin: auto auto 0; border-radius: 18px 18px 0 0; overflow-y: auto; }
@media (min-width: 620px) { dialog { margin: auto; border-radius: 18px; } }
dialog::backdrop { background: rgba(3, 7, 14, 0.7); }
dialog form { padding: 18px var(--gutter-r) calc(20px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font: 700 28px/1 var(--display); text-transform: uppercase; margin: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chips button { flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted); }
.chips button[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#game-picker { display: flex; flex-direction: column; gap: 8px; }
.games { display: flex; flex-direction: column; gap: 6px; max-height: 232px; overflow-y: auto; }
.game { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; min-height: 44px; }
.game[aria-selected="true"] { border-color: var(--accent); background: #2a2410; }
.game .g-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.game .g-time { color: var(--muted); font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }
.games .note { color: var(--muted); margin: 0; padding: 10px 2px; }

#toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); font-weight: 600; padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); text-align: center; }

/* Bet builder */
select { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; font: inherit; font-size: 16px; color: inherit; }
dialog select, dialog input, dialog textarea { background: var(--bg); }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; display: block; }
#builder { display: flex; flex-direction: column; gap: 14px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--accent); background: #2a2410; border-radius: 10px; padding: 8px 12px; }
.picked #picked-name { font: 700 20px/1.1 var(--display); letter-spacing: 0.03em; text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; border-left: 1px solid var(--line); padding: 10px 4px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; min-height: 44px; }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.side { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 8px; cursor: pointer; min-height: 44px; }
.side .badge { width: 40px; height: 40px; }
.side .s-name { font: 700 20px/1 var(--display); letter-spacing: 0.03em; text-transform: uppercase; overflow-wrap: anywhere; text-align: center; }
.side .s-line { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.side[aria-checked="true"] { border-color: var(--accent); background: #2a2410; }
.side[aria-checked="true"] .s-line { color: var(--accent); }
.preview { border-radius: 12px; background: var(--raised); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.preview .p-row, .duel .d-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.preview .p-who, .duel .d-who { color: var(--muted); font-size: 13px; flex: none; }
.preview .p-side, .duel .d-side { font: 700 22px/1.1 var(--display); letter-spacing: 0.02em; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.preview .p-row:first-child .p-side { color: var(--accent); }
.game .g-odds { display: block; color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* Both sides of a structured bet on a slip */
.duel { display: flex; flex-direction: column; gap: 6px; }
.duel .d-row.open .d-side { color: var(--muted); }
.duel .d-row.mine .d-who { color: var(--accent); }
.note { margin: 0; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
