:root {
  --bg: #0b1120;
  --bg-2: #111a30;
  --panel: #182340;
  --panel-2: #1f2c4f;
  --line: #2c3a63;
  --text: #f4f6fb;
  --muted: #9aa6c4;
  --gold: #e6b84a;
  --gold-2: #f6d77e;
  --green: #3ccf7a;
  --red: #ff5c6c;
  --team-a: #1e5631;
  --team-a-accent: #f2a900;
  --team-b: #b9121b;
  --team-b-accent: #e8e8e8;
  --radius: 14px;
  --display: 'Bungee', 'Impact', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2a55 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.4;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-2); }
h1, h2, h3 { margin: 0; }
.display { font-family: var(--display); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

.wrap { max-width: 600px; margin: 0 auto; padding: 14px 14px 96px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel h2 { font-family: var(--display); font-size: 1.05rem; color: var(--gold); margin-bottom: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-weight: 600; min-height: 46px;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #1a1500; border-color: var(--gold); }
.btn.danger { background: #4a1a22; border-color: #7a2a36; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; min-height: 34px; font-size: .9rem; border-radius: 9px; }

.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; min-height: 46px; outline: none;
}
.input:focus { border-color: var(--gold); }
label.field { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--panel-2); border: 1px solid var(--line); }
.badge.gold { background: var(--gold); color: #1a1500; border-color: var(--gold); }
.badge.live { background: var(--red); color: #fff; border-color: var(--red); }
.badge.ok { background: #16423a; color: var(--green); border-color: #1f6a56; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: #2d1a1f; color: #fff; border: 1px solid var(--red); padding: 12px 16px; border-radius: 12px;
  max-width: 90vw; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-weight: 600;
}
.toast.ok { background: #16423a; border-color: var(--green); }

/* Header & matchup */
.hero { text-align: center; padding: 10px 0 6px; }
.hero .pub { color: var(--gold); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
.hero h1 { font-family: var(--display); font-size: clamp(1.7rem, 7vw, 2.4rem); line-height: 1; margin: 6px 0; }
.hero h1 span { color: var(--gold); }
.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 12px 0; }
.team-card { border-radius: var(--radius); padding: 12px 8px; text-align: center; border: 2px solid transparent; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.team-card.a { background: linear-gradient(160deg, var(--team-a), color-mix(in srgb, var(--team-a) 60%, black)); }
.team-card.b { background: linear-gradient(160deg, var(--team-b), color-mix(in srgb, var(--team-b) 60%, black)); }
.team-card .key { font-family: var(--display); font-size: 1.6rem; line-height: 1; }
.team-card .name { font-size: .78rem; opacity: .9; }
.team-card .score { font-family: var(--display); font-size: 2.4rem; line-height: 1; margin-top: 4px; }
.vs { text-align: center; }
.vs .at { font-family: var(--display); color: var(--muted); font-size: .9rem; }
.vs .status { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.countdown { font-family: var(--display); color: var(--gold); font-size: 1.1rem; }

/* Tabs */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 2px; border-radius: 10px; font-size: .72rem; font-weight: 700; display: grid; gap: 2px; justify-items: center; }
.tabs button .ico { font-size: 1.3rem; line-height: 1; }
.tabs button.active { color: var(--gold); background: var(--panel); }

/* Winner pick */
.pick-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-team { border-radius: var(--radius); padding: 18px 10px; border: 3px solid transparent; color: #fff; text-align: center; font-family: var(--display); font-size: 1.2rem; text-shadow: 0 1px 2px rgba(0,0,0,.5); opacity: .7; }
.pick-team.a { background: var(--team-a); }
.pick-team.b { background: var(--team-b); }
.pick-team.selected { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,184,74,.25); }
.pick-team small { display: block; font-family: var(--body); font-size: .72rem; font-weight: 600; opacity: .9; }
.stepper { display: grid; grid-template-columns: 54px 1fr 54px; gap: 8px; }
.stepper input { text-align: center; font-family: var(--display); font-size: 1.5rem; }
.split { height: 14px; border-radius: 999px; overflow: hidden; display: flex; background: var(--bg-2); border: 1px solid var(--line); }
.split .a { background: var(--team-a); } .split .b { background: var(--team-b); }
.split-labels { display: flex; justify-content: space-between; font-size: .8rem; margin-top: 4px; }

/* Squares grid */
.grid-wrap { overflow-x: auto; }
.grid { display: grid; grid-template-columns: 26px repeat(10, 1fr); gap: 3px; min-width: 340px; }
.grid .cell {
  aspect-ratio: 1; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 800;
  overflow: hidden; padding: 0; color: var(--text); position: relative;
}
.grid .cell.taken { background: var(--panel-2); color: #cdd6f0; }
.grid .cell.mine { background: var(--gold); color: #1a1500; border-color: var(--gold-2); }
.grid .cell.win { outline: 3px solid var(--green); outline-offset: -2px; }
.grid .cell.hot { box-shadow: 0 0 0 2px var(--green), 0 0 14px var(--green); animation: hot 1.2s ease-in-out infinite; z-index: 1; }
@keyframes hot { 0%, 100% { box-shadow: 0 0 0 2px var(--green), 0 0 6px var(--green); } 50% { box-shadow: 0 0 0 3px var(--green-2, #7ff0b0), 0 0 18px var(--green); } }
.grid .cell.win::after { content: attr(data-win); position: absolute; top: -1px; right: 1px; font-size: .5rem; color: var(--green); }
.grid .hdr { aspect-ratio: auto; min-height: 22px; background: transparent; border: 0; font-family: var(--display); font-size: .9rem; }
.grid .hdr.a { color: var(--team-a-accent); background: var(--team-a); border-radius: 6px; }
.grid .hdr.b { color: var(--team-b-accent); background: var(--team-b); border-radius: 6px; }
.grid .corner { background: transparent; border: 0; }
.axis-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.axis-label.a { color: var(--team-a-accent); } .axis-label.b { color: var(--team-b-accent); }
.axis-side { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.grid-layout { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: stretch; }

/* Props */
.prop { border-top: 1px solid var(--line); padding: 12px 0; }
.prop:first-of-type { border-top: 0; padding-top: 0; }
.prop .q { font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.opts { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.opt { position: relative; text-align: left; overflow: hidden; }
.opt.selected { border-color: var(--gold); background: #3a3015; }
.opt.correct { border-color: var(--green); background: #16423a; }
.opt.wrong { border-color: var(--red); background: #3a1a1f; }
.opt .pct { float: right; color: var(--muted); font-weight: 600; }
.opt .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); opacity: .8; }

/* Leaderboard */
table.lb { width: 100%; border-collapse: collapse; }
table.lb th, table.lb td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
table.lb th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
table.lb td.num, table.lb th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.lb tr.me td { background: #3a3015; }
table.lb .rank { font-family: var(--display); color: var(--gold); width: 36px; }
.payout-list { display: grid; gap: 6px; }
.payout { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.payout .who { font-weight: 700; }
.payout.pending { opacity: .6; }

/* Overlay */
.overlay { position: fixed; inset: 0; background: rgba(5,8,18,.92); display: grid; place-items: center; padding: 20px; z-index: 40; }
.overlay .card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
