/* Daily Push — "race day" design system
   Chalk paper, lane blue, bib red, ink. Scoreboard numerals (Big Shoulders) + Barlow text.
   The one loud thing: your result is a race bib. Everything else stays quiet. */
:root {
  --chalk: #f5f6f3;      /* page */
  --paper: #ffffff;      /* bibs, sheets */
  --ink: #16181d;        /* text */
  --ink-2: #4b505a;      /* secondary text (AA on chalk) */
  --rule: #dcdfe3;       /* hairlines */
  --lane: #2443d6;       /* primary action, your row */
  --lane-ink: #ffffff;
  --lane-soft: #e6eafc;
  --bib: #e3372a;        /* bib stripe, warnings, sparingly */
  --win: #13814b;        /* rank up */
  --num: 'Big Shoulders Display', 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --text: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  --r: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--chalk); color: var(--ink); font: 500 16px/1.45 var(--text); }
body { -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
[hidden] { display: none !important; }
.center { text-align: center; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* ------------------------------------------------ header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px; max-width: 560px; width: 100%; margin: 0 auto; }
.mark { font: 900 26px/1 var(--num); text-transform: uppercase; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.mark svg { width: 28px; height: 28px; flex: none; }
.date { font-size: 14px; color: var(--ink-2); }
.back { border: 0; background: none; font-size: 24px; line-height: 1; padding: 6px 8px 6px 0; }

/* ------------------------------------------------ home */
.home { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 18px 132px; display: flex; flex-direction: column; gap: 18px; }
.intro h1 { margin: 6px 0 4px; font: 900 clamp(52px, 17vw, 76px)/.86 var(--num); text-transform: uppercase; letter-spacing: -.005em; }
.intro p { margin: 0; color: var(--ink-2); font-size: 17px; }
.live { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.stat { padding: 10px 0 9px; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--rule); }
.stat b { display: block; font: 900 34px/1 var(--num); font-variant-numeric: tabular-nums; }
.stat:first-child b { color: var(--lane); }
.stat span { font-size: 14px; color: var(--ink-2); }
.ticker { margin: 10px 0 0 !important; font-size: 15px; color: var(--ink) !important; display: flex; align-items: center; gap: 8px; min-height: 1.45em; }
.ticker::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--bib); animation: pulse 1.6s ease-in-out infinite; }
.ticker span { animation: tick-in .35s ease-out; }
@keyframes pulse { 50% { opacity: .25; } }
@keyframes tick-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bib-best { display: inline-block; margin-top: 10px; background: var(--lane); color: #fff; font-weight: 700; font-size: 15px; padding: 5px 12px; border-radius: 999px; }
.foot { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }

/* ------------------------------------------------ scoreboard */
.board { background: var(--paper); border-radius: var(--r); border: 1px solid var(--rule); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--rule); }
.tab { flex: 1; background: none; border: 0; padding: 12px 8px 10px; font-weight: 600; font-size: 15px; color: var(--ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--lane); }
.rows { list-style: none; margin: 0; padding: 4px 0; }
.rows li { display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline; gap: 12px; padding: 10px 16px; }
.rows li + li { border-top: 1px solid #eef0f2; }
.rows .r { font: 800 22px/1 var(--num); color: var(--ink-2); text-align: left; font-variant-numeric: tabular-nums; }
.rows .n { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .v { font: 900 26px/1 var(--num); text-align: right; min-width: 2ch; font-variant-numeric: tabular-nums; }
.rows li.top1 .r, .rows li.top1 .v { color: var(--bib); }
.rows li.me { background: var(--lane); color: var(--lane-ink); border-top-color: transparent; }
.rows li.me .r { color: rgba(255,255,255,.8); }
.rows li.me + li { border-top-color: transparent; }
.rows .you { font-weight: 500; opacity: .8; margin-left: 4px; }
.rows .gap { display: block; text-align: center; color: var(--ink-2); padding: 0; line-height: 1; border: 0; }
.rows .empty { display: block; padding: 18px 16px; color: var(--ink-2); font-size: 15px; }
.rows .label { display: block; padding: 10px 16px 2px; font-size: 13px; color: var(--ink-2); font-weight: 600; border: 0; }
.rows .tick { font-size: 13px; font-weight: 600; color: var(--win); margin-left: 6px; }
.rows li.me .tick { color: #fff; }
.rows .miss { font-size: 13px; color: var(--ink-2); margin-left: 6px; }

/* ------------------------------------------------ buttons */
.btn { border: 0; border-radius: 999px; padding: 15px 22px; font-weight: 700; font-size: 17px; width: 100%; letter-spacing: .005em; }
.btn.go { background: var(--lane); color: var(--lane-ink); padding: 19px 22px; font-size: 19px; box-shadow: 0 6px 18px rgba(36,67,214,.28); }
.btn.go:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(36,67,214,.28); }
.btn.line { background: transparent; border: 2px solid var(--ink); }
.btn.quiet { background: transparent; color: var(--ink-2); padding: 10px; font-weight: 600; }
.btn:disabled { opacity: .5; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 18px 18px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--chalk) 62%, rgba(245,246,243,0)); display: flex; justify-content: center; }
.dock .btn { max-width: 524px; }
.chip { display: inline-block; border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; text-decoration: none; }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; color: var(--ink-2); }
.links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }

.banner { margin: 10px 18px 0; padding: 12px 14px; border-radius: var(--r); background: #fff4d6; border: 1px solid #f0d58a; font-size: 15px; display: flex; flex-direction: column; gap: 8px; }
.banner .row { display: flex; gap: 8px; }
.banner.warn { background: #fde8e6; border-color: #f4b8b1; margin: 0; }

/* ------------------------------------------------ ads */
.ad { display: flex; align-items: center; justify-content: center; margin: 4px auto 0; background: #eceee9; color: #8b9097;
  font-size: 11px; letter-spacing: .08em; border-radius: 8px; overflow: hidden; }
.ad.placeholder::before { content: 'Advertisement'; }
.ad-banner { width: 320px; max-width: calc(100% - 36px); height: 50px; }
.ad-box { width: 300px; max-width: 100%; height: 250px; }
.ad.off { display: none; }
.ad-rail { display: none; }
@media (min-width: 1100px) {
  .ad-rail { display: flex; position: fixed; top: 96px; width: 160px; height: 600px; margin: 0; z-index: 3; }
  .ad-rail.left { left: calc(50% - 280px - 190px); }
  .ad-rail.right { right: calc(50% - 280px - 190px); }
  .ad-rail.off { display: none; }
}
#cam.active ~ .ad-rail { display: none !important; }

/* ------------------------------------------------ result: the race bib */
.result { width: 100%; max-width: 560px; margin: 0 auto; padding: 6px 18px max(28px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.bib { position: relative; background: var(--paper); border-radius: 10px; margin: 12px 4px 0; padding: 0 0 18px; text-align: center;
  box-shadow: 0 1px 0 #d4d7db, 0 18px 40px -18px rgba(22,24,29,.35); transform: rotate(-1.2deg); }
.bib-top { display: flex; justify-content: space-between; align-items: center; background: var(--bib); color: #fff;
  border-radius: 10px 10px 0 0; padding: 10px 36px; font: 800 20px/1 var(--num); text-transform: uppercase; letter-spacing: .03em; }
.bib-num { font: 900 clamp(130px, 46vw, 200px)/.9 var(--num); letter-spacing: -.02em; margin-top: 14px; font-variant-numeric: tabular-nums; }
.bib-unit { font-weight: 700; font-size: 17px; margin-top: 2px; }
.pin { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--chalk); box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.pin.a { left: 12px; top: 14px; } .pin.b { right: 12px; top: 14px; } .pin.c { left: 12px; bottom: 12px; } .pin.d { right: 12px; bottom: 12px; }
.bib.stamp { animation: stamp .5s cubic-bezier(.2,.9,.3,1.15) both; }
@keyframes stamp { from { transform: rotate(-6deg) scale(1.12); opacity: 0; } to { transform: rotate(-1.2deg) scale(1); opacity: 1; } }

.placing { text-align: center; }
.placing .big { font: 900 44px/1 var(--num); text-transform: uppercase; }
.placing .big span { color: var(--ink-2); }
.placing p { margin: 6px 0 0; color: var(--ink-2); font-size: 16px; }
.facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 15px; color: var(--ink-2); }
.facts b { color: var(--ink); font-weight: 700; }
.facts .up { color: var(--win); font-weight: 700; }
.facts .down { color: var(--bib); font-weight: 700; }
.me-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
.me-name b { color: var(--ink); }

/* ------------------------------------------------ challenges */
.ch-list { display: flex; flex-direction: column; gap: 8px; }
.ch-list:empty { display: none; }
.ch-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--paper); border: 1px solid var(--rule); border-left: 5px solid var(--bib); border-radius: var(--r); padding: 12px 14px; }
.ch-item b { display: block; font-size: 16px; }
.ch-item small { color: var(--ink-2); font-size: 14px; }
.ch-item .go { font: 900 22px/1 var(--num); color: var(--lane); }
.ch-head h1 { margin: 2px 0 6px; font: 900 clamp(40px, 12vw, 56px)/.9 var(--num); text-transform: uppercase; }
.ch-head .kind { font-weight: 700; color: var(--bib); font-size: 15px; }
.ch-head p { margin: 0; color: var(--ink-2); }
.note { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ------------------------------------------------ sheets */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(22,24,29,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: min(560px, 100%); background: var(--paper); border-radius: 22px 22px 0 0; padding: 22px 18px max(18px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0; font: 900 34px/.95 var(--num); text-transform: uppercase; }
.sheet p { margin: 0; color: var(--ink-2); }
.sheet input { width: 100%; font: 600 19px var(--text); padding: 14px 16px; border-radius: 12px; border: 2px solid var(--rule); background: var(--chalk); color: var(--ink); }
.sheet input:focus { outline: none; border-color: var(--lane); }
.err { margin: -4px 0 0 !important; color: var(--bib) !important; font-size: 14px; min-height: 1.2em; }
.lengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lengths .btn { border-radius: var(--r); background: var(--lane); color: #fff; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.lengths .btn b { font: 900 30px/1 var(--num); }
.lengths .btn span { font-size: 14px; font-weight: 600; opacity: .85; }

/* ------------------------------------------------ errors */
.plain { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 30px 18px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.plain h1 { margin: 0; font: 900 44px/.95 var(--num); text-transform: uppercase; }
.plain p { margin: 0; color: var(--ink-2); font-size: 17px; }

/* ------------------------------------------------ camera */
#cam { position: fixed; inset: 0; background: #0d0f14; color: #fff; }
#cam.active { display: block; }
.stage { position: absolute; inset: 0; }
#video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
#overlay { pointer-events: none; }
.layer { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.layer.center { justify-content: center; align-items: center; background: rgba(13,15,20,.35); }
.cam-top { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: rgba(13,15,20,.6); color: #fff; font-size: 18px; }
.status { flex: 1; background: rgba(13,15,20,.72); border-radius: 999px; padding: 11px 16px; font-size: 16px; font-weight: 600; text-align: center; }
.status.ok { background: var(--lane); }
.setup-card { align-self: center; width: min(460px, 100%); background: var(--paper); color: var(--ink); border-radius: 18px; padding: 16px 18px 18px; }
.setup-art { width: 100%; height: auto; color: var(--ink); }
.setup-line { margin: 8px 0 0; font-size: 16px; line-height: 1.45; text-align: center; }
.cam-bottom { display: flex; flex-direction: column; gap: 10px; align-items: center; width: min(460px, 100%); align-self: center; }
.checks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.checks span { font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgba(13,15,20,.7); color: rgba(255,255,255,.7); }
.checks span.on { background: #fff; color: var(--ink); }
.checks span.on::before { content: '✓ '; color: var(--win); }
.cam-bottom .btn.line { border-color: #fff; color: #fff; background: rgba(13,15,20,.45); }

.count-num { font: 900 min(46vw, 46vh)/.85 var(--num); color: #fff; text-shadow: 0 8px 40px rgba(0,0,0,.5); }
.count-sub { font-size: 20px; font-weight: 700; text-shadow: 0 2px 10px #000; margin: 6px 0 0; }

.att-top { display: flex; align-items: center; gap: 8px; }
.timer { font: 900 44px/1 var(--num); background: rgba(13,15,20,.65); padding: 6px 16px 4px; border-radius: 14px; font-variant-numeric: tabular-nums; }
.timer.hot { background: var(--bib); }
.tag { background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.att-top .icon-btn { margin-left: auto; }
.att-center { flex: 1; display: flex; align-items: center; justify-content: center; }
.reps { font: 900 min(58vw, 58vh)/.8 var(--num); color: #fff; text-shadow: 0 10px 50px rgba(0,0,0,.55); font-variant-numeric: tabular-nums; }
.reps.bump { animation: bump .28s ease-out; }
@keyframes bump { from { transform: scale(1.14); color: #9fb2ff; } to { transform: scale(1); color: #fff; } }
.cue { align-self: center; background: rgba(13,15,20,.72); padding: 10px 22px; border-radius: 999px; font: 800 26px/1 var(--num); text-transform: uppercase; letter-spacing: .02em; }
.cue.warn { background: var(--bib); }
.debug { position: absolute; left: 8px; bottom: 8px; font: 12px/1.3 ui-monospace, monospace; background: rgba(0,0,0,.7); padding: 6px 8px; border-radius: 6px; white-space: pre; }

.toast { position: fixed; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; z-index: 60; max-width: calc(100% - 36px); text-align: center; }

@media (orientation: landscape) and (max-height: 500px) { .setup-card { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------ v5: GeoSports-style hero + sticky ad */
/* ghost replay: stick figure of a top push */
.ghost { display: grid; grid-template-columns: 1fr 44%; height: 196px; border-radius: var(--r); overflow: hidden;
  background: radial-gradient(120% 90% at 30% 100%, #263063 0%, #16181d 62%); color: #fff; }
.ghost canvas { width: 100%; height: 100%; display: block; }
.ghost-info { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 14px 16px 14px 4px; min-width: 0; }
.ghost-tag:empty, .ghost-n:empty + .ghost-unit { visibility: hidden; }
.ghost-tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--lane); border-radius: 999px; padding: 4px 10px; }
.ghost-name { margin-top: 8px; font-size: 17px; font-weight: 600; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-n { margin-top: 2px; font: 900 72px/.9 var(--num); font-variant-numeric: tabular-nums; }
.ghost-unit { font-size: 14px; color: rgba(255,255,255,.7); }
.ghost-n.bump { animation: bump .3s ease-out; }
.ghost.demo .ghost-name { white-space: normal; font-size: 16px; }
.hero { text-align: center; padding: 6px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero-line { margin: 0; font-size: 17px; color: var(--ink-2); }
.hero-line b { color: var(--ink); }
.hero .btn.go { margin: 12px 0 14px; }
.hero .live { margin-top: 0; text-align: left; }
.home, .result { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.foot { margin: 2px 0 0; }

/* v6: top ad, big start button, rankings own the bottom */
.ad.ad-top { width: 320px; max-width: 100%; height: 50px; margin: 0 auto -4px; flex: none;
  background: #e4e6e1; border: 1px solid var(--rule); color: #6f747c; border-radius: 6px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.help { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center;
  font: 800 15px/1 var(--text); text-decoration: none; }
.btn.go.start { padding: 0 22px; height: 76px; border-radius: 22px; font: 900 34px/1 var(--num); text-transform: uppercase; letter-spacing: .01em; }
.hero .btn.go.start { margin: 0 0 10px; }
.hero .live { margin-top: 14px; }
.home .board { flex: 1; }
.rows .ch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 16px;
  background: none; border: 0; text-align: left; }
.rows .ch-row b { display: block; font-size: 16px; }
.rows .ch-row small { color: var(--ink-2); font-size: 14px; }
.rows .ch-row .go { font: 900 22px/1 var(--num); color: var(--lane); }
.rows li.pad { display: block; padding: 12px 16px 14px; }
.rows li.chi { display: block; padding: 0; }

/* v7: head-to-head, cleaner stats */
.hero .live { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
.live .stat { padding-left: 14px; border-left: 1px solid var(--rule); }
.live .stat.first { padding-left: 0; border-left: 0; }
.live .stat b { color: var(--ink); }
.live .stat.first b { color: var(--lane); }
.vs-banner { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r); background: var(--lane-soft); color: var(--ink); font-size: 17px; }
.vs-banner b { color: var(--lane); }
.vs-card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); padding: 14px 16px; }
.vs-head { font: 900 30px/1 var(--num); text-transform: uppercase; margin-bottom: 8px; }
.vs-head.win { color: var(--win); }
.vs-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 17px; font-weight: 600; }
.vs-row + .vs-row { border-top: 1px solid var(--rule); }
.vs-row b { font: 900 32px/1 var(--num); }
.vs-row.me b { color: var(--lane); }

/* v8: ads — fixed sizes (no jumping), clearly framed, never on the camera */
.ad { position: relative; flex: none; }
.ad.placeholder { background: #fff; border: 1px solid #c9cdd3; color: #5d636c; font-size: 13px; letter-spacing: .02em; }
.ad.placeholder::before { content: attr(data-size) ' ad'; font-weight: 600; }
.ad.placeholder::after { content: 'Ad'; position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 700; color: #8b9097; }
.ad.ad-top { margin: 0 auto; }
.result .ad-box { margin: 0 auto; }

/* v9: ad fixes + desktop layout (mobile stays the base) */
.ad.ad-rail { position: fixed; }
.col-a, .col-b { display: contents; }
.ad-side { display: none; width: 300px; height: 250px; }
.phone-qr { display: none; }
@media (min-width: 960px) {
  #home .top, #result .top { max-width: 1040px; }
  #home .home, #result .result { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; row-gap: 22px; align-items: start; padding-top: 4px; }
  #home .home > .ad-top, #result .result > .ad-top { grid-column: 1 / -1; }
  .col-a, .col-b { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
  .ad.ad-top { width: 728px; height: 90px; }
  .ad.ad-top.placeholder::before { content: '728 × 90 ad'; }
  .ad-side { display: flex; margin: 4px auto 0; }
  .ghost { height: 230px; }
  .phone-qr:not([hidden]) { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); }
  .phone-qr b { display: block; font-size: 17px; }
  .phone-qr span { color: var(--ink-2); font-size: 15px; }
  .qr { flex: none; width: 96px; height: 96px; }
  .qr svg, .qr img { width: 100%; height: 100%; display: block; }
  .result .bib { margin-top: 6px; }
  .result .col-b .board { margin-top: 0; }
}
.ad-rail { display: none !important; }
@media (min-width: 1440px) {
  .ad-side { display: none !important; }
  .ad.ad-rail { display: flex !important; top: 120px; width: 160px; height: 600px; margin: 0; z-index: 3; }
  .ad-rail.left { left: calc(50% - 520px - 196px); }
  .ad-rail.right { right: calc(50% - 520px - 196px); left: auto; }
  .ad-rail.off, #cam.active ~ .ad-rail { display: none !important; }
}

/* v10: dare headline, all-time, country switch, flags */
.dare { margin: 0 0 10px; font: 900 clamp(34px, 10.5vw, 50px)/.95 var(--num); white-space: nowrap; text-transform: uppercase; letter-spacing: .005em; }
.dare em { font-style: normal; color: var(--lane); }
.dare small { display: block; margin-top: 6px; font: 600 16px/1.2 var(--text); text-transform: none; color: var(--ink-2); }
.dare:empty { display: none; }
.rows li.scope { display: flex; gap: 6px; padding: 10px 12px 8px; border: 0; }
.scope button { flex: 1; border: 1px solid var(--rule); background: var(--chalk); border-radius: 999px; padding: 8px 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.rows li.scope + li { border-top: 0; }
.rows .flag { margin-right: 6px; }
.rows .note { display: block; padding: 2px 16px 8px; font-size: 13px; color: var(--ink-2); border: 0; }

.ghost { height: 178px; }
@media (min-width: 960px) { .ghost { height: 230px; } }

/* v11: setup hint on home */
.how { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); text-align: left; }
.how svg { flex: none; width: 112px; height: 40px; color: var(--ink); }
.how p { margin: 0; font-size: 14px; line-height: 1.3; color: var(--ink-2); }
.how p b { display: block; color: var(--ink); font-size: 15px; }

.how { flex-direction: column; gap: 6px; padding: 12px 14px 12px; text-align: center; }
.how svg { width: 100%; max-width: 250px; height: 72px; }
.how p { font-size: 14px; }
.how p b { font-size: 16px; }

/* v12: setup screen right after the camera opens */
.setup-card { width: min(480px, 100%); padding: 20px 20px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.setup-h { margin: 0 0 10px; text-align: center; font: 900 clamp(34px, 10vw, 46px)/.95 var(--num); text-transform: uppercase; }
.setup-h em { font-style: normal; color: var(--lane); }
.setup-line { font-size: 16px; color: var(--ink-2); }

.setup-card { transition: opacity .35s ease, transform .35s ease; cursor: pointer; }
.setup-card.fade { opacity: 0; transform: scale(.96); }

/* v13: steady camera screen — fixed sizes so changing text never shifts things */
.status { height: 44px; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color .25s; }
.checks span { transition: background-color .2s, color .2s; }
.checks span::before { content: '○'; display: inline-block; width: 1.1em; text-align: left; opacity: .7; }
.checks span.on::before { content: '✓'; opacity: 1; }

/* v14: setup picture plays a little story: phone goes down, camera looks at you, you get in position */
.setup-card.play .ph { animation: dp-drop .7s cubic-bezier(.2,.8,.3,1.1) both; }
.setup-card.play .cone { animation: dp-fade .5s ease .8s both; }
.setup-card.play .pp { animation: dp-slide .6s ease 1.1s both; }
@keyframes dp-drop { from { transform: translateY(-46px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dp-slide { from { transform: translateX(26px); opacity: 0; } to { transform: none; opacity: 1; } }

.status.warn { background: var(--bib); color: #fff; }

/* v15: compact setup card near the top so the camera view (you) stays visible below it */
#setup-ui { justify-content: flex-start; gap: 14px; }
#setup-ui .cam-bottom { margin-top: auto; }
.setup-card { padding: 14px 16px 14px; }
.setup-h { font-size: clamp(30px, 9vw, 40px); margin-bottom: 6px; }
.setup-art { max-height: 120px; }
.setup-line { margin-top: 4px; font-size: 15px; }

/* v16: result screen — group challenge invite + share section under the ranking */
.group-card, .share-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.group-card { border: 2px solid var(--ink); }
.group-card h3, .share-card h3 { margin: 0; font: 900 28px/1 var(--num); text-transform: uppercase; }
.group-card p { margin: 0; color: var(--ink-2); font-size: 15px; }
.group-card .ch-list:empty { display: none; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-row .btn { padding: 13px 10px; font-size: 16px; }

/* v17: result screen order on phones — score, place, ranking first; challenges and ads after */
#result .bib { order: 1; } #result .placing { order: 2; } #res-offline { order: 3; } #vs-card { order: 4; }
#result .board { order: 5; } #statline { order: 6; } #result .dare-card { order: 7; } #result .ad-box { order: 8; } #result .foot { order: 9; }
.dare-card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dare-card h3 { margin: 0; font: 900 28px/1 var(--num); text-transform: uppercase; }
.dare-card .opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dare-card .opt + .opt { padding-top: 12px; border-top: 1px solid var(--rule); }
.dare-card .opt b { display: block; font-size: 17px; }
.dare-card .opt span { display: block; color: var(--ink-2); font-size: 14px; line-height: 1.3; }
.dare-card .opt .btn { width: auto; flex: none; min-width: 92px; padding: 12px 18px; font-size: 16px; box-shadow: none; }
.dare-card .ch-list:empty { display: none; }
.dare-card .linkbtn { align-self: center; }
.dare-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dare-card .two .btn { padding: 12px 8px; font-size: 15px; }

/* v18: the 300x250 ad sits right under your place (seen by everyone); head-to-head moves down next to the challenge box */
#result .bib { order: 1; } #result .placing { order: 2; } #res-offline { order: 3; } #result .ad-box { order: 4; }
#result .board { order: 5; } #statline { order: 6; } #vs-card { order: 7; } #result .dare-card { order: 8; } #result .foot { order: 9; }
#result .ad-box { margin: 0 auto; }

/* v19: ad between the ranking and Challenge friends; score picture preview */
#result .bib { order: 1; } #result .placing { order: 2; } #res-offline { order: 3; } #vs-card { order: 4; }
#result .board { order: 5; } #statline { order: 6; } #result .ad-box { order: 7; } #result .dare-card { order: 8; } #result .foot { order: 9; }
.share-hero { display: flex; gap: 14px; align-items: stretch; }
.card-thumb { flex: none; width: 104px; aspect-ratio: 9 / 16; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--lane);
  box-shadow: 0 8px 20px rgba(36,67,214,.3); transform: rotate(-3deg); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.share-copy b { font-size: 17px; }
.share-copy span { color: var(--ink-2); font-size: 14px; line-height: 1.3; }
.share-copy .btn { margin-top: auto; padding: 13px 14px; font-size: 16px; }
.share-hero + .opt { padding-top: 12px; border-top: 1px solid var(--rule); }

/* v20: result reveal — everything rises up from the bottom, one after another, so people feel there's more below */
#result.rise .col-a > *:not(.bib), #result.rise .col-b > * { animation: dp-rise .7s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d, 0ms); }
@keyframes dp-rise { from { transform: translateY(70px); opacity: 0; } to { transform: none; opacity: 1; } }
.more-hint { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 25;
  border: 0; border-radius: 999px; padding: 12px 20px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(22,24,29,.3); animation: dp-hint-in .5s ease 1.2s both; transition: opacity .3s; }
.more-hint span { display: inline-block; margin-left: 6px; animation: dp-bounce 1.1s ease-in-out infinite; }
.more-hint.gone { opacity: 0; pointer-events: none; }
@keyframes dp-hint-in { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes dp-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* v21: the friend invite lives inside the result (right under your place); the group race sits lower */
#result .bib { order: 1; } #result .placing { order: 2; } #res-offline { order: 3; } #vs-card { order: 4; } #result .invite { order: 5; }
#result .board { order: 6; } #statline { order: 7; } #result .ad-box { order: 8; } #result .dare-card { order: 9; } #result .foot { order: 10; }
.invite { display: flex; gap: 14px; align-items: stretch; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--r); padding: 14px; }
.invite-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.invite-copy b { font: 900 26px/1 var(--num); text-transform: uppercase; }
.invite-copy span { color: var(--ink-2); font-size: 14px; line-height: 1.3; }
.invite-copy .btn { margin-top: auto; padding: 14px; font-size: 17px; }
.invite-copy .linkbtn { align-self: center; margin-top: 2px; }
.dare-card .opt h3 { margin: 0 0 2px; font: 900 26px/1 var(--num); text-transform: uppercase; }

/* v22: one result card — score, place and the challenge button together */
#result .bib { order: 1; transform: none; padding-bottom: 20px; }
@keyframes stamp { from { transform: scale(1.08); opacity: 0; } to { transform: none; opacity: 1; } }
.bib .placing { margin-top: 14px; padding: 14px 18px 0; border-top: 2px dashed rgba(0,0,0,.14); }
.bib .placing .big, [data-theme] .bib .placing .big { color: inherit; font-size: 40px; }
.bib .placing p, [data-theme] .bib .placing p { color: inherit; opacity: .68; }
.bib-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 18px 0; }
.bib-actions .btn { width: 100%; }
.bib-actions .linkbtn { color: inherit; opacity: .75; }

/* ------------------------------------------------ competitions (league or World Cup–style cup) */
.rows li.pad.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rows li.pad.two .btn { padding: 12px 8px; font-size: 15px; }
.seg-label { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; border: 2px solid var(--rule); background: var(--paper); border-radius: 10px; padding: 10px 4px; font-weight: 700; font-size: 15px; }
.seg button.on { background: var(--lane); color: var(--lane-ink); border-color: var(--lane); }
.sheet p.seg-help { font-size: 14px; margin-top: -2px; }
.comp-sheet { max-height: 92dvh; overflow-y: auto; }
.team-list { display: grid; gap: 6px; }
.sheet .team-list input { font-size: 17px; padding: 11px 14px; }
.comp .k-today, .comp .k-join { display: flex; flex-direction: column; gap: 8px; }
.k-actions { display: flex; flex-direction: column; gap: 10px; }
.k-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.k-match { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px 10px; }
.k-round { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--bib); margin-bottom: 8px; text-align: center; }
.k-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.k-vs i { font-style: normal; font-weight: 800; color: var(--ink-2); font-size: 14px; }
.k-vs .side { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; padding: 6px 4px; border-radius: 10px; }
.k-vs .side b { font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-vs .side small { color: var(--ink-2); font-size: 12px; }
.k-vs .side .sc { font: 900 48px/1 var(--num); font-variant-numeric: tabular-nums; }
.k-vs .side.me { background: var(--lane-soft); }
.k-vs .side.won .sc { color: var(--win); }
.k-state { text-align: center; font-size: 13px; color: var(--ink-2); margin-top: 6px; font-weight: 600; }
.k-champ { text-align: center; background: var(--lane); color: var(--lane-ink); border-radius: var(--r); padding: 20px 16px; }
.k-champ span { font-weight: 800; text-transform: uppercase; font-size: 13px; letter-spacing: .1em; }
.k-champ b { display: block; font: 900 46px/1 var(--num); text-transform: uppercase; margin: 6px 0 2px; }
.k-champ em { font-style: normal; font-weight: 700; }
#k-body { display: flex; flex-direction: column; gap: 18px; }
#k-body:empty { display: none; }
.k-h { padding: 12px 16px 8px; font: 900 22px/1 var(--num); text-transform: uppercase; }
.k-table .th, .k-table .tr { display: grid; grid-template-columns: 20px minmax(0, 1fr) 24px 24px 24px 24px 34px; gap: 4px; padding: 8px 16px; align-items: center; font-size: 15px; }
.k-table .th { font-size: 12px; color: var(--ink-2); font-weight: 700; text-transform: uppercase; padding: 0 16px 4px; }
.k-table .th span:nth-child(n+3), .k-table .tr span:nth-child(n+3), .k-table .tr b { text-align: center; }
.k-table .tr + .tr { border-top: 1px solid var(--row-rule, #eef0f2); }
.k-table .tr .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.k-table .tr b { font: 900 20px/1 var(--num); }
.k-table .tr.me { background: var(--lane); color: var(--lane-ink); }
.k-table .tr em { font-style: normal; color: var(--win); }
.k-table .tr.me em { color: inherit; }
.k-results { border-top: 1px solid var(--row-rule, #eef0f2); padding: 6px 0 10px; }
.k-r { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 5px 16px; font-size: 14px; }
.k-bracket .k-r { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.k-bracket { padding-bottom: 10px; }
.k-r .d { font-size: 11px; color: var(--ink-2); font-weight: 700; }
.k-r .a, .k-r .b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-r .a { text-align: right; } .k-r .b { text-align: left; }
.k-r b { font: 800 18px/1 var(--num); min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.k-r .w { font-weight: 800; }
.k-r.now b { color: var(--bib); }
.k-r b.when { font: 600 13px/1 var(--text); color: var(--ink-2); }
.k-rh { padding: 10px 16px 2px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--ink-2); letter-spacing: .05em; }
.team-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-pick { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.team-pick b { font: 900 24px/1 var(--num); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-pick span { font-size: 13px; color: var(--ink-2); }

/* ------------------------------------------------ brand deals (kept small: one line, one box) */
.presented { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; text-decoration: none; color: var(--bg-ink-2); font-size: 14px; min-width: 0; }
.presented .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand, var(--lane)); flex: none; }
.presented b { font: 900 17px/1 var(--num); text-transform: uppercase; color: var(--bg-ink); letter-spacing: .02em; white-space: nowrap; }
.presented .pb { white-space: nowrap; }
.presented .pl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.presented .go { font: 900 18px/1 var(--num); color: var(--bg-ink); }
.presented.open-slot { opacity: .6; font-size: 13px; }
.presented.open-slot b { font-size: 14px; color: var(--bg-ink-2); }
.presented.open-slot .go { color: var(--bg-ink-2); }
#result #res-presented { margin-top: -6px; }
.featured { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; color: var(--ink); }
.fr-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px 6px; }
.fr-head span { font: 900 20px/1 var(--num); text-transform: uppercase; }
.fr-head small { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.fr { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; background: none; border: 0; border-top: 1px solid var(--row-rule); text-align: left; color: inherit; }
.fr-bar { width: 6px; align-self: stretch; border-radius: 3px; background: var(--brand); flex: none; }
.fr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fr-main b { font-size: 16px; }
.fr-main small { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-side { flex: none; font: 900 20px/1 var(--num); }
.fr-side.join { font: 800 13px/1 var(--text); padding: 8px 12px; border-radius: 999px; background: var(--brand); color: #fff; }
.fr-side.won { font: 800 13px/1 var(--text); color: var(--win); }
.dots { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; }
.dots i.on { background: var(--brand, var(--lane)); border-color: var(--brand, var(--lane)); }
.k-sponsor { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--paper);
  border: 2px solid var(--brand); text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.k-sponsor b { font: 900 17px/1 var(--num); text-transform: uppercase; color: var(--brand); }
.k-reward .rw { background: var(--paper); border: 1px solid var(--rule); border-left: 8px solid var(--brand); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.rw-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.rw-what { font: 900 34px/1 var(--num); text-transform: uppercase; color: var(--brand); }
.rw p { margin: 0; color: var(--ink-2); } .rw p b { color: var(--ink); }
.rw.won { border-left-color: var(--win); }
.rw-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 2px dashed var(--ink); border-radius: 10px; }
.rw-code code { font: 900 30px/1 var(--num); letter-spacing: .06em; }
.rw .btn.go { text-align: center; text-decoration: none; }

/* the score stays on top: "presented by" sits right under it, brand challenges go after the ad */
#result #res-presented { order: 1; }
#result #res-featured { order: 9; }

/* ------------------------------------------------ business: plans, branding, organizer tools */
#result .pro-link { order: 8; align-self: center; margin-top: -8px; }
.k-logo { display: block; height: 52px; max-width: 180px; object-fit: contain; margin-bottom: 10px; }
.comp.branded .kind, #comp.branded .kind { color: var(--org); }
.k-welcome { margin: 8px 0 0 !important; color: var(--bg-ink) !important; font-weight: 600; }
.k-prize { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--org, var(--yellow, #f2c230)); }
.k-prize span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.k-prize b { font: 900 20px/1 var(--num); text-transform: uppercase; }
.k-cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--rule); color: var(--ink); }
.k-cap b { display: block; font-size: 16px; } .k-cap span { display: block; font-size: 14px; color: var(--ink-2); }
.k-cap .btn { width: auto; flex: none; padding: 12px 18px; font-size: 16px; }
.k-org { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; color: var(--ink); padding-bottom: 14px; }
.k-org .tiles { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px 4px; }
.k-org .tiles div { text-align: center; padding: 6px 2px; }
.k-org .tiles b { display: block; font: 900 30px/1 var(--num); }
.k-org .tiles span { font-size: 12px; color: var(--ink-2); }
.org-plan { margin: 6px 16px 10px; padding: 8px 12px; border-radius: 8px; background: var(--row-rule); font-size: 14px; font-weight: 700; text-align: center; }
.org-plan.paid { background: var(--win); color: #fff; }
.org-actions { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
.org-actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.org-actions .btn { padding: 12px 8px; font-size: 15px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.plan { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 12px; border: 2px solid var(--rule); background: var(--paper); color: var(--ink); text-align: center; }
.plan .pn { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.plan b { font: 900 32px/1 var(--num); }
.plan small { font-size: 12px; color: var(--ink-2); }
.plan .pp { font-size: 12px; font-weight: 700; margin-top: 4px; }
.plan.on { border-color: var(--lane); box-shadow: inset 0 0 0 1px var(--lane); }
.sheet input[type=color] { height: 48px; padding: 4px; }
.btn-video { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn-video .rec { width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); animation: pulse 1.6s ease-in-out infinite; }
.bib-actions { display: flex; flex-direction: column; gap: 10px; }
.setup-privacy { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
