:root {
  --bg: #0b0f14; --bg2: #10161d; --card: #151c25; --card2: #1b2430; --line: #243040; --text: #e8eef4; --muted: #8796a8;
  --accent: #c6f432; --accent-ink: #11160a; --live: #ff8a3d; --warn: #ffd23f; --good: #3ddc84; --bad: #ff5d6c; --blue: #5aa9ff;
  --r: 14px; --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 2px 10px; }
h3 { font-size: 18px; font-weight: 750; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
label > input, label > select, label > textarea { margin-top: 6px; color: var(--text); }
.num, .tscore, .bigscore, td, .coins { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 11px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .grow { flex: 1; } .between { justify-content: space-between; }
.wrap { flex-wrap: wrap; } .center { text-align: center; } .mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* shell */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(11,15,20,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 850; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand img { width: 24px; height: 24px; }
main#view { max-width: 620px; margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + var(--safe-b) + 24px); }
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(16,22,29,.95); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a.on { color: var(--accent); }

/* coins */
.coins { display: inline-flex; align-items: center; gap: 5px; font-weight: 750; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe680, #f2b705 60%, #b88400); box-shadow: inset 0 0 0 1.5px #a87a00; flex: none; }
.coinpill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.neg { color: var(--bad); } .pos { color: var(--good); }

/* cards */
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
a.card:active, button.card:active { transform: scale(.99); background: var(--card2); }
.list > * + * { border-top: 1px solid var(--line); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 10px; }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; background: none; border: 0; text-align: left; }
a.li:active, button.li:active { background: var(--card2); }
.li .grow { min-width: 0; }
.chev::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; }
.rank { width: 26px; height: 26px; border-radius: 8px; background: var(--card2); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.rank.r1 { background: var(--accent); color: var(--accent-ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-weight: 800; flex: none; border: 1px solid var(--line); }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--r); margin-bottom: 10px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.live { background: var(--live); color: #1a0c00; border-color: var(--live); }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(255,93,108,.4); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.pill { display: inline-block; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 800; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; 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: 650; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.seg.sides button.on.a { background: var(--blue); color: #04121f; }
.seg.sides button.on.b { background: var(--live); color: #1a0c00; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--card2); color: var(--muted); }
.badge.live { background: rgba(255,138,61,.15); color: var(--live); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.2s infinite; }
.badge.review { background: rgba(255,210,63,.14); color: var(--warn); }
.badge.final { background: rgba(198,244,50,.12); color: var(--accent); }
.badge.won { background: rgba(61,220,132,.15); color: var(--good); }
.badge.lost { background: rgba(255,93,108,.14); color: var(--bad); }
.badge.open { background: rgba(90,169,255,.14); color: var(--blue); }
@keyframes pulse { 50% { opacity: .3; } }

/* game cards */
.game .game-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.game .team { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-weight: 700; padding: 2px 0; }
.game .team.won .tname::after { content: " ◂"; color: var(--accent); }
.game .tscore { font-size: 22px; font-weight: 850; }
.game.live { border-color: rgba(255,138,61,.5); }
.game.review { border-color: rgba(255,210,63,.45); }

/* scoreboard */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: 18px; padding: 16px 12px; margin-bottom: 12px; }
.scoreboard .side { text-align: center; min-width: 0; }
.scoreboard .side .nm { font-weight: 750; font-size: 14px; color: var(--muted); }
.scoreboard .side.a .nm { color: var(--blue); } .scoreboard .side.b .nm { color: var(--live); }
.bigscore { font-size: 52px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; }
.scoreboard .dash { color: var(--muted); font-weight: 800; }
.scoreboard .side.won .bigscore { color: var(--accent); }
.banner { border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.banner.review { background: rgba(255,210,63,.08); border-color: rgba(255,210,63,.35); }
.banner.final { background: rgba(198,244,50,.07); border-color: rgba(198,244,50,.3); }
.banner.info { background: rgba(90,169,255,.07); border-color: rgba(90,169,255,.3); }

/* live scoring */
.teams2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.teamcol { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.teamcol .th { padding: 10px 12px; font-weight: 800; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.teamcol.a .th { color: var(--blue); } .teamcol.b .th { color: var(--live); }
.prow { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px; cursor: pointer; }
.prow:active { background: var(--card2); }
.prow .pn { font-weight: 750; font-size: 15px; }
.prow .pl { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 16px; }
.teampts { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px; }
.teampts span { font-size: 12px; color: var(--muted); text-align: center; }
.sqbtn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-size: 20px; font-weight: 800; cursor: pointer; }
.sqbtn:active { background: var(--accent); color: var(--accent-ink); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.tile { position: relative; }
.tile .plus { width: 100%; min-height: 86px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; }
.tile .plus:active { background: var(--accent); color: var(--accent-ink); transform: scale(.97); }
.tile .plus b { font-size: 30px; font-weight: 900; line-height: 1; }
.tile .plus span { font-size: 13px; font-weight: 700; margin-top: 4px; }
.tile .plus small { font-size: 11px; color: var(--muted); }
.tile .minus { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); font-weight: 900; cursor: pointer; }
.tile .minus[disabled] { opacity: .25; }

/* tables */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; background: var(--card2); }
th a { display: block; } th.on { color: var(--accent); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
th:first-child { background: var(--card2); }
tr:last-child td { border-bottom: 0; }
td.hl { color: var(--accent); font-weight: 800; }
tr.total td { font-weight: 800; background: var(--card2); }

/* markets */
.market .mt { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.market .mt b { font-size: 15px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.opt { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; min-height: 62px; justify-content: center; }
.opt:active { border-color: var(--accent); }
.opt span { font-weight: 650; font-size: 14px; text-align: center; }
.opt b { font-size: 17px; color: var(--accent); }
.opt small { font-size: 11px; color: var(--muted); }
.opt[disabled] { cursor: default; } .opt[disabled] b { color: var(--muted); }
.opt.win { border-color: var(--good); } .opt.win b { color: var(--good); }
.mybet { margin-top: 8px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg2); border-radius: 10px; }
.admrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* draft */
.clock { text-align: center; padding: 16px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); margin-bottom: 12px; }
.clock.me { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(198,244,50,.12); }
.clock .who { font-size: 24px; font-weight: 850; margin-top: 4px; }
.order { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; }
.order span { flex: none; font-size: 12px; padding: 5px 9px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.order span.now { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.order span.done { opacity: .45; text-decoration: line-through; }

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .15s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 90vh; overflow-y: auto; background: var(--bg2); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); animation: up .2s ease-out; max-width: 620px; margin: 0 auto;
}
.sheet-panel::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.x { background: var(--card2); border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; font-size: 18px; cursor: pointer; flex: none; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); margin: 0; color: var(--text); font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.pickrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pickrow .seg { width: 150px; flex: none; }
.statedit { display: grid; grid-template-columns: 1fr 64px 58px 58px 36px; gap: 6px; align-items: center; margin-bottom: 6px; }
.statedit input { padding: 10px 8px; font-size: 15px; }
.statedit.h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }

/* toasts */
#toasts { position: fixed; left: 0; right: 0; top: calc(64px + var(--safe-t)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--card2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-weight: 650; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: up .2s; transition: opacity .3s; max-width: 100%; }
.toast.err { border-color: var(--bad); color: #ffd0d5; } .toast.ok { border-color: var(--good); }
.toast.out { opacity: 0; }

/* login */
.auth { max-width: 420px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 20px 40px; }
.auth .logo { width: 64px; height: 64px; margin-bottom: 14px; }
.auth h1 { font-size: 32px; }
.auth .seg { margin: 22px 0 6px; }
.pin { letter-spacing: .6em; text-align: center; font-size: 24px; font-weight: 800; }

details.log summary { cursor: pointer; color: var(--muted); font-weight: 700; padding: 8px 2px; }
.logrow { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.logrow button { background: none; border: 0; color: var(--bad); font-size: 18px; padding: 4px 8px; cursor: pointer; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.statgrid div { background: var(--bg2); border-radius: 10px; padding: 8px; text-align: center; }
.statgrid b { display: block; font-size: 18px; } .statgrid span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
@media (min-width: 700px) { body { font-size: 16px; } }
.card.row { display: flex; }
.seg button { white-space: nowrap; }
.card.mine { border-color: rgba(198,244,50,.45); background: linear-gradient(180deg, rgba(198,244,50,.06), var(--card)); }
tr.me td { background: rgba(198,244,50,.08); }
tr.me td:first-child { background: #1d2618; font-weight: 800; }
