:root {
  --bg: #0b0d12;
  --bg2: #12151d;
  --card: #171b25;
  --card2: #1f2431;
  --line: #2a3040;
  --text: #eef1f7;
  --muted: #8b93a7;
  --accent: #ff3b3b;
  --accent2: #ffb703;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; overscroll-behavior-y: contain; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
a { color: var(--accent2); }

/* Header */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: rgba(11, 13, 18, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 900; font-size: 20px; letter-spacing: -.5px; font-style: italic; }
.logo b { color: var(--accent); }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--card2); font-weight: 700; font-variant-numeric: tabular-nums; }
.pill.gold { background: linear-gradient(135deg, #ffb703, #fb8500); color: #1a1100; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-size: 18px; }

main { padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 90px); max-width: 720px; margin: 0 auto; }

/* Bottom nav */
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(18, 21, 29, .97); border-top: 1px solid var(--line); }
nav.bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; }
nav.bottom button span { font-size: 22px; }
nav.bottom button.on { color: var(--text); }
nav.bottom button.on span { filter: drop-shadow(0 0 6px rgba(255, 59, 59, .7)); }

/* Segmented / chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

h2 { font-size: 18px; margin: 14px 2px 10px; }
h3 { font-size: 14px; margin: 16px 2px 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.ev-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; gap: 8px; }
.ev-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.vs { color: var(--muted); font-weight: 500; margin: 0 4px; }
.live { color: #fff; background: var(--red); font-weight: 800; font-size: 10px; padding: 2px 6px; border-radius: 4px; letter-spacing: .05em; animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.odds { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.odd { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; transition: transform .08s; }
.odd:active { transform: scale(.97); }
.odd .n { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.odd .p { font-weight: 800; font-size: 16px; color: var(--accent2); font-variant-numeric: tabular-nums; }
.odd.on { background: var(--accent); border-color: var(--accent); }
.odd.on .n, .odd.on .p { color: #fff; }
.odd:disabled { opacity: .35; }

/* Polymarket */
.pm-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pm-head img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; background: var(--card2); }
.pm-head .t { font-weight: 700; }
.pm-market { border-top: 1px solid var(--line); padding: 9px 0 3px; }
.pm-market:first-of-type { border-top: 0; }
.pm-q { font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.pm-q b { font-weight: 600; }
.bar { height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; margin: 2px 0 6px; }
.bar i { display: block; height: 100%; background: var(--blue); }
.more { width: 100%; padding: 8px; color: var(--muted); font-size: 13px; }

/* Bets */
.bet .status { font-weight: 800; font-size: 11px; padding: 3px 8px; border-radius: 6px; letter-spacing: .04em; }
.st-pending { background: #33405a; }
.st-won { background: var(--green); color: #052e14; }
.st-lost { background: var(--red); }
.st-void { background: #555; }
.sel { padding: 8px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.sel:first-of-type { border-top: 0; }
.sel .pick { font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #4b5568; }
.dot.won { background: var(--green); } .dot.lost { background: var(--red); } .dot.void { background: #888; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 12px; font-weight: 800; background: var(--card2); border: 1px solid var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.gold { background: var(--accent2); border-color: var(--accent2); color: #1a1100; }
.btn.green { background: var(--green); border-color: var(--green); color: #052e14; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.btn:disabled { opacity: .5; }

/* Bet slip */
.slip-fab { position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); max-width: 696px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--accent); color: #fff; border-radius: 14px; font-weight: 800; box-shadow: 0 8px 30px rgba(255, 59, 59, .35); }
.slip-fab .count { background: #fff; color: var(--accent); border-radius: 999px; min-width: 24px; height: 24px; display: inline-grid; place-items: center; font-size: 13px; margin-right: 8px; }
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); animation: fade .15s; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--bg2); border-radius: 20px 20px 0 0; padding: 8px 14px calc(16px + var(--safe-b)); max-width: 720px; margin: 0 auto; animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 4px auto 10px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.slip-sel { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.slip-sel .x { color: var(--muted); font-size: 18px; padding: 0 4px; }
.stakes { display: flex; gap: 6px; margin: 8px 0; }
.stakes button { flex: 1; padding: 8px 0; border-radius: 9px; background: var(--card2); font-weight: 700; font-size: 13px; }
.sum { display: flex; justify-content: space-between; padding: 6px 0; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; gap: 12px; }
.login .logo { font-size: 44px; text-align: center; }
.login label { font-size: 13px; color: var(--muted); }

/* Leaderboard */
.lb { display: flex; align-items: center; gap: 12px; }
.lb .rank { font-size: 30px; }
.lb .name { font-weight: 800; font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--card2); border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 11px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { background: #2a1d05; border: 1px solid #6b4a0a; color: #ffd27a; padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-bottom: 10px; }

#toast { position: fixed; z-index: 60; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
#toast div { background: var(--card2); border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: up .2s; font-weight: 600; }
#toast div.err { border-color: var(--red); }
#toast div.ok { border-color: var(--green); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; font-size: 60px; display: grid; place-items: center; animation: pop 1.2s forwards; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 30% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
