/* SNAFU Bets – calm, friendly, roomy.
   Light by default, dark follows the system (or the choice under Me). */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface2: #f3f1ec;
  --line: #e8e4db;
  --line2: #d9d4c8;
  --text: #22252a;
  --text2: #5c636e;
  --muted: #8b919a;
  --accent: #2f8f6a;        /* friendly green: buttons, links, active tab */
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ea;
  --t1: #3a7bd5;            /* team 1 */
  --t1-soft: #e6effb;
  --t2: #e07a2e;            /* team 2 */
  --t2-soft: #fcefe3;
  --good: #2f8f5a;
  --good-soft: #e4f3ea;
  --bad: #cf4b4b;
  --bad-soft: #fbe9e7;
  --live: #e0483f;
  --gold: #e9a91b;
  --shadow: 0 1px 2px rgba(40, 35, 20, .04), 0 6px 20px rgba(40, 35, 20, .05);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 62px;
  --topbar-h: 60px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --logo-s: 72%; --logo-l: 90%; --logo-ink: 32%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #17191d; --surface: #1f2227; --surface2: #262a30; --line: #2d3137; --line2: #3a3f47;
    --text: #eceef1; --text2: #b3b9c2; --muted: #848b95;
    --accent: #4cbf91; --accent-ink: #0f1a15; --accent-soft: #1d3a2e;
    --t1: #6fa6f0; --t1-soft: #1e2b3d; --t2: #f0a05e; --t2-soft: #3a2a1d;
    --good: #5cc98c; --good-soft: #1c3428; --bad: #ef7a7a; --bad-soft: #3a2224; --live: #ff6b62;
    --shadow: 0 1px 2px rgba(0, 0, 0, .2);
    --logo-s: 30%; --logo-l: 28%; --logo-ink: 82%;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #17191d; --surface: #1f2227; --surface2: #262a30; --line: #2d3137; --line2: #3a3f47;
  --text: #eceef1; --text2: #b3b9c2; --muted: #848b95;
  --accent: #4cbf91; --accent-ink: #0f1a15; --accent-soft: #1d3a2e;
  --t1: #6fa6f0; --t1-soft: #1e2b3d; --t2: #f0a05e; --t2-soft: #3a2a1d;
  --good: #5cc98c; --good-soft: #1c3428; --bad: #ef7a7a; --bad-soft: #3a2224; --live: #ff6b62;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2);
  --logo-s: 30%; --logo-l: 28%; --logo-ink: 82%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: transparent; font: 16px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
/* page background: blurred image + a layer of the page colour on top (Admin → Settings) */
body::before { content: ""; position: fixed; inset: -60px; z-index: -2; background: var(--bg-image, none) center / cover no-repeat; filter: blur(var(--bg-blur, 14px)); transform: translateZ(0); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--bg); opacity: var(--bg-fade, .65); pointer-events: none; }
.bg-preview { position: relative; height: 150px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface2); }
.bg-preview .img { position: absolute; inset: -30px; background: center / cover no-repeat; }
.bg-preview .fade { position: absolute; inset: 0; background: var(--bg); }
.bg-preview .sample { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; white-space: nowrap; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3 { letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.dim { color: var(--text2); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.accent { color: var(--accent); }
.link { color: var(--accent); font-weight: 600; }
.hidden { display: none !important; }
.small { font-size: 14px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0; display: flex; align-items: center; gap: 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-text b { font-weight: 700; }
.topnav { display: none; gap: 2px; }
.topnav a { padding: 8px 14px; border-radius: 999px; color: var(--text2); font-weight: 600; font-size: 15px; }
.topnav a:hover { color: var(--text); background: var(--surface2); }
.topnav a.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.coinpill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 9px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 650; font-variant-numeric: tabular-nums; }
.coin { width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-block; background: var(--gold); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--gold) 70%, #fff); }
.coin.sm { width: 13px; height: 13px; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 70%, #fff); }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; color: var(--text2); }
.iconbtn:hover { background: var(--surface2); color: var(--text); }
.iconbtn svg { width: 21px; height: 21px; }

/* ---------- tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--accent); }

/* ---------- layout ---------- */
.app { max-width: 960px; margin: 0 auto; padding: 12px 18px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
.boot { display: grid; place-items: center; min-height: 60vh; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 750; }
.page-head .sub { color: var(--text2); margin-top: 4px; }
.section { margin: 36px 0 14px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { margin: 0; font-size: 19px; font-weight: 700; }
.section .count { color: var(--muted); font-size: 15px; }
.section .more { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 15px; }
.section .line { display: none; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.pad0 { padding: 0; overflow: hidden; }
.card h3 { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.card .card-sub { color: var(--muted); font-size: 14px; margin: -10px 0 14px; }
.empty { text-align: center; color: var(--text2); padding: 40px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* disclosure ("More …") */
details.more { margin-top: 14px; }
details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); font-weight: 650; color: var(--text2); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; margin-top: -4px; }
details.more[open] > summary { margin-bottom: 14px; }
details.more[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.more > summary .hint { font-weight: 500; color: var(--muted); font-size: 14px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: var(--surface2); color: var(--text); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; font-family: var(--mono); font-size: 12px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; cursor: pointer; color: var(--text2); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; padding: 4px; background: var(--surface2); border-radius: 999px; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; color: var(--text2); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { white-space: nowrap; border: 1px solid var(--line2); background: var(--surface); color: var(--text2); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }

/* ---------- auth ---------- */
.auth { max-width: 400px; margin: 6vh auto 0; }
.auth-hero { text-align: center; margin-bottom: 28px; }
.auth-hero img { margin: 0 auto 16px; width: 64px; height: 64px; }
.auth-hero h1 { margin: 0; font-size: 28px; }
.auth-hero p { margin: 8px 0 0; color: var(--text2); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice { padding: 13px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 15px; margin-bottom: 16px; }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--good-soft); }

/* ---------- team logos & avatars ---------- */
.logo { position: relative; width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: hsl(var(--h, 220) var(--logo-s) var(--logo-l)); color: hsl(var(--h, 220) 45% var(--logo-ink)); font-weight: 700; font-size: 12px; }
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 4px; background: var(--surface); }
.logo.lg { width: 60px; height: 60px; border-radius: 16px; font-size: 18px; }
.logo.lg img { padding: 6px; }
.logo.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
.logo.sm img { padding: 2px; }
.logo.tbd { background: var(--surface2); color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 15px;
  background: hsl(var(--h, 220) var(--logo-s) var(--logo-l)); color: hsl(var(--h, 220) 45% var(--logo-ink)); }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- match card (scoreboard style) ---------- */
.matches { display: grid; gap: 12px; }
.mcard { display: block; background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: transform .08s; }
.mcard:active { transform: scale(.99); }
.mcard-top { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.mcard-top .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mline { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mline + .mline { margin-top: 10px; }
.mline .tn { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mline .sc { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.mline.lost .tn, .mline.lost .sc { color: var(--muted); font-weight: 500; }
.mline .mypick { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.mcard-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text2); display: flex; gap: 8px; align-items: center; }
.mcard-foot .good, .mcard-foot .bad { font-weight: 650; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--text2); white-space: nowrap; }
.badge.live { background: var(--bad-soft); color: var(--live); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.badge.open { background: var(--accent-soft); color: var(--accent); }
.badge.won { background: var(--good-soft); color: var(--good); }
.badge.lost { background: var(--bad-soft); color: var(--bad); }
.badge.void { background: var(--surface2); color: var(--text2); }
.badge.mine { background: var(--accent-soft); color: var(--accent); }
.badge.bo { background: transparent; color: var(--muted); padding: 0; }

/* ---------- match page ---------- */
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--text2); font-weight: 600; margin-bottom: 14px; }
.backlink svg { width: 18px; height: 18px; }
.mhero { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 24px 18px; text-align: center; }
.mhero-top { color: var(--muted); font-size: 14px; margin-bottom: 18px; display: flex; justify-content: center; gap: 8px; align-items: center; flex-wrap: wrap; }
.mhero-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.mhero-team { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.mhero-team .tn { font-weight: 700; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mhero-mid .score { font-size: 38px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.mhero-mid .score .sep { color: var(--muted); font-weight: 400; margin: 0 4px; }
.mhero-mid .time { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mhero-mid .small { color: var(--muted); margin-top: 6px; }
.lockinfo { margin-top: 20px; color: var(--text2); font-size: 15px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.lockinfo svg { width: 16px; height: 16px; }
.lockinfo b { color: var(--text); font-variant-numeric: tabular-nums; }
.market { padding: 20px; }
.market-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.market-head h3 { margin: 0; font-size: 17px; }
.market-head .meta { margin-left: auto; font-size: 14px; color: var(--muted); }
.outcomes { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; }
.oc { position: relative; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .08s; }
.oc:not(:disabled):hover { border-color: var(--line2); background: var(--surface2); }
.oc:not(:disabled):active { transform: scale(.98); }
.oc:disabled { cursor: default; }
.oc .ol { font-size: 15px; font-weight: 600; color: var(--text2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc .oo { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.oc.p1 .oo { color: var(--t1); }
.oc.p2 .oo { color: var(--t2); }
.oc.mine { border-color: var(--accent); background: var(--accent-soft); }
.oc .tag { font-size: 13px; font-weight: 600; color: var(--accent); }
.oc.winner { border-color: var(--good); }
.oc.winner .ol::before { content: "✓ "; color: var(--good); }
.oc.loser { opacity: .5; }
.mybet { margin-top: 14px; font-size: 15px; color: var(--text2); }
.mybet b { color: var(--text); }
.betlist { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.betline { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.betline .who { font-weight: 600; }
.betline .what { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.betline .amt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.maps { display: grid; gap: 2px; }
.maprow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.maprow:last-child { border-bottom: 0; }
.maprow .nm { font-weight: 600; }
.maprow .nm .no { color: var(--muted); font-weight: 500; margin-right: 8px; }
.maprow .sc { font-weight: 700; font-variant-numeric: tabular-nums; }
.maprow.skipped { opacity: .5; }
.potline { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.potline a { color: var(--accent); font-weight: 600; }

/* ---------- bet sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(20, 18, 12, .35); animation: fade .18s ease; }
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 12px 22px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .15); animation: up .22s cubic-bezier(.2, .9, .3, 1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line2); margin: 0 auto 16px; }
.sheet h2 { margin: 0 0 4px; font-size: 21px; }
.sheet .sheet-sub { color: var(--text2); margin-bottom: 20px; }
.sheet-close { position: absolute; top: 14px; right: 14px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.stake-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 60px; border-radius: 16px; background: var(--surface2); margin: 18px 0 12px; }
.stake-input:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.stake-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slip-win { margin: 20px 0 16px; text-align: center; color: var(--text2); font-size: 16px; }
.slip-win b { color: var(--good); font-size: 20px; font-variant-numeric: tabular-nums; }
.slip-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; text-align: center; }

/* ---------- leaderboard ---------- */
.lbrow { display: grid; grid-template-columns: 26px 40px 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lbrow:last-child { border-bottom: 0; }
.lbrow:hover { background: var(--surface2); }
.lbrow.me { background: var(--accent-soft); }
.lbrow .pos { font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.lbrow .pos.p1 { color: var(--gold); } .lbrow .pos.p2 { color: #9aa2ab; } .lbrow .pos.p3 { color: #c08457; }
.lbrow .nm { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow .sub { font-size: 14px; color: var(--muted); }
.lbrow .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- numbers row, stats ---------- */
.numbers { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 6px; }
.numbers > div { text-align: center; padding: 0 8px; min-width: 0; }
.numbers > div + div { border-left: 1px solid var(--line); }
.numbers .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; justify-content: center; align-items: center; gap: 6px; }
.numbers .k { font-size: 14px; color: var(--muted); margin-top: 2px; }
.tile { padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.tile .k { font-size: 14px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .s { font-size: 14px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fame { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.fame:last-child { border-bottom: 0; }
.fame .t { font-weight: 650; }
.fame .d { font-size: 14px; color: var(--muted); }
.fame .u { text-align: right; font-weight: 600; }
.fame .u small { display: block; color: var(--text2); font-weight: 500; font-size: 14px; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: minmax(80px, 36%) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; font-size: 15px; }
.hbar .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.hbar .b { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.hbar .b i { display: block; height: 100%; border-radius: 4px; background: var(--accent); min-width: 2px; }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 42px; text-align: right; }
.hbar.neg .b i { background: var(--bad); }
.hbar.pos .b i { background: var(--good); }
.lead { font-size: 17px; color: var(--text2); line-height: 1.6; margin: 0; }
.lead b { color: var(--text); }
.chart { position: relative; width: 100%; color: var(--accent); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ln { stroke: var(--accent); }
.chart .bar { fill: var(--accent); }
.chart .grid-l { stroke: var(--line); }
.chart text { fill: var(--muted); }
.chart stop { stop-color: var(--accent); }
.chart .dot { fill: var(--accent); stroke: var(--surface); }
.chart .xh { stroke: var(--muted); }
.chart .tip { position: absolute; pointer-events: none; transform: translate(-50%, -115%); background: var(--surface); border-radius: 10px; padding: 6px 10px; font-size: 13px; white-space: nowrap; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); opacity: 0; transition: opacity .1s; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.bg { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; }
.bg .c { color: var(--muted); font-weight: 500; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 24px; }
.profile-head h1 { margin: 0; font-size: 26px; }

/* ---------- lists ---------- */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.li { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); min-width: 0; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.li:last-child { border-bottom: 0; }
a.li:hover, button.li:hover { background: var(--surface2); }
.li > svg { width: 21px; height: 21px; flex: none; color: var(--text2); }
.li .main { flex: 1; min-width: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .end { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.li.danger, .li.danger > svg { color: var(--bad); }
.tcard { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tcard h3 { margin: 0; font-size: 17px; }
.tcard .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tcard > svg { width: 20px; height: 20px; color: var(--muted); margin-left: auto; flex: none; }
.progress { height: 4px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tabs-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px 18px; padding: 0 18px; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.dayhead { font-size: 15px; font-weight: 650; color: var(--text2); margin: 24px 2px 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.logline { font-size: 12px; font-family: var(--mono); padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--text2); word-break: break-word; }
.logline.err { color: var(--bad); }
.mapedit { display: grid; grid-template-columns: 1fr 64px 64px 112px; gap: 6px; margin-bottom: 6px; }
.mapedit .input { height: 40px; padding: 0 10px; }
.prose { color: var(--text2); }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; padding: 13px 18px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: 0 8px 30px rgba(0, 0, 0, .18); font-weight: 600; font-size: 15px; animation: up .2s ease; }
.toast.err { background: var(--bad); color: #fff; }
.toast.win { background: var(--good); color: #fff; }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  .tabbar { display: none; }
  .topnav { display: flex; }
  .admin-mobile { display: none !important; }
  .app { padding: 24px 28px 64px; }
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .matches { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .toasts { bottom: 28px; }
  .sheet { left: 50%; right: auto; bottom: 50%; transform: translate(-50%, 50%); width: 440px; border-radius: 24px; animation: pop .18s ease; }
  .sheet .grab { display: none; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 52%) scale(.98); } to { opacity: 1; transform: translate(-50%, 50%); } }
  .page-head h1 { font-size: 32px; }
  .mhero { padding: 32px 28px; }
  .mhero-team .tn { font-size: 20px; }
  .mhero-mid .score { font-size: 46px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.playeredit { display: grid; grid-template-columns: 1fr 90px auto; gap: 6px; margin-bottom: 6px; }
.playeredit .input { height: 40px; padding: 0 10px; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scoreboard h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.scoreboard .pl { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.scoreboard .pl:last-child { border-bottom: 0; }
.scoreboard .pl.top b { color: var(--accent); }

/* bet types: a colour + icon each, so the extended bets are easy to tell apart */
.market { --mk: var(--accent); }
.mk-score { --mk: #8a6dd8; } .mk-map { --mk: #2a9d8f; } .mk-margin { --mk: #c75c8a; } .mk-rounds { --mk: #3f8fc0; }
.mk-ot { --mk: #c08a24; } .mk-top { --mk: #d4a017; } .mk-bottom { --mk: #7d8794; }
.market:not(.mk-winner) { box-shadow: inset 4px 0 0 var(--mk), var(--shadow); }
.market-head { align-items: center; }
.mk-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--mk); background: color-mix(in srgb, var(--mk) 15%, transparent); }
.mk-ico svg, .sum-ico svg { width: 17px; height: 17px; }
.market:not(.mk-winner) .oc:not(:disabled):hover { border-color: color-mix(in srgb, var(--mk) 55%, var(--line)); }
.sum-ico { display: grid; place-items: center; color: var(--muted); }
/* many options (fraggers, long score lists): small buttons, three per row */
.outcomes.compact { gap: 8px; }
.outcomes.compact .oc { padding: 8px 10px; border-radius: 11px; gap: 0; }
.outcomes.compact .oc .ol { font-size: 13px; }
.outcomes.compact .oc .oo { font-size: 16px; }
.outcomes.compact .oc .tag { display: none; }
@media (max-width: 520px) {
  .market { padding: 16px; }
  .market-head { margin-bottom: 12px; }
  .market-head h3 { font-size: 16px; }
}
@media (max-width: 340px) { .outcomes.compact { --cols: 2 !important; } }
/* extended bets with few options: a bit flatter than the main winner question */
.market:not(.mk-winner) .outcomes:not(.compact) .oc { padding: 10px 14px; }
.market:not(.mk-winner) .outcomes:not(.compact) .oc .oo { font-size: 19px; }

/* tournament overview */
.logo.xs { width: 18px; height: 18px; border-radius: 5px; font-size: 8px; }
.logo.xs img { padding: 1px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.me td, .table th.me, .table td.me { background: var(--accent-soft); }
.ovrank .rk { color: var(--muted); width: 1%; }
.ovrank .who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.ovwrap { padding: 0; }
.ovmx { font-size: 13px; }
.ovmx th { text-align: center; padding: 10px 8px; white-space: nowrap; vertical-align: bottom; }
.ovmx th .pn { max-width: 84px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--text2); }
.ovmx td { padding: 8px; }
.ovmx tbody tr { cursor: pointer; }
.ovmx tbody tr:hover td { background: var(--surface2); }
.ovmx .mcol { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 150px; max-width: 190px; text-align: left; }
.ovmx .mt { font-weight: 600; line-height: 1.3; }
.ovmx .mt .w { color: var(--good); }
.ovmx tfoot td { border-top: 1px solid var(--line2); border-bottom: 0; }
.ovc { min-width: 84px; text-align: center; font-weight: 600; white-space: nowrap; }
.ovc.none { color: var(--muted); }
.ovc .pk { display: flex; align-items: center; justify-content: center; gap: 5px; font-weight: 600; white-space: nowrap; }
.ovc .pk span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.ovc .st { margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--text2); }
.ovc.won .st { color: var(--good); font-weight: 650; }
.ovc.lost > * { opacity: .45; }
@media (max-width: 440px) {
  .hide-sm { display: none; }
  .ovrank th, .ovrank td { padding-left: 9px; padding-right: 9px; }
  .ovmx .mcol { min-width: 128px; }
}

/* live rounds of the current map */
.mline .lr { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--live); font-weight: 650; min-width: 22px; text-align: right; }
.mcard-top .lr-note { margin-left: auto; color: var(--muted); font-size: 13px; }
.lr-hero { color: var(--live); font-variant-numeric: tabular-nums; }
.mhero-mid .lr-line { margin-top: 4px; white-space: nowrap; font-size: 13px; }

/* feedback */
.iconbtn { position: relative; }
.iconbtn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.fbkind button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.fbkind svg { width: 17px; height: 17px; }
.seg .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--live); color: #fff; font-size: 12px; line-height: 18px; }
.fbtext { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 12px; }
.fbitem.done { opacity: .7; }
#fb textarea.input { font-family: inherit; font-size: 15px; }
.betline .what svg { width: 13px; height: 13px; vertical-align: -2px; }

/* Live / Upcoming / Results tabs */
.mtabs { display: flex; width: 100%; margin: 6px 0 16px; }
.mtabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mtabs .cnt { font-size: 12px; color: var(--muted); font-weight: 600; }
.mtabs .on .cnt { color: var(--text2); }
.mtabs .livedot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.mtab-body > .dayhead:first-child { margin-top: 0; }

/* new coins badge + list */
.coinpill { position: relative; }
.coinpill .newdot { position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--live); border: 2px solid var(--surface); }
.credit-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--good-soft); color: var(--good); flex: none; }
.credit-ico svg { width: 18px; height: 18px; }
.notice svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--gold); }
