/* Overdrive Scout */
body.scout { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(112px + var(--safe-b)); overscroll-behavior-y: none; }
body.scout[data-stage="gate"], body.scout[data-stage="loading"] { padding-bottom: 0; }
/* the venue behind every screen, softened and washed in ink so the interface stays legible */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--ink); }
.backdrop::before { content: ''; position: absolute; inset: -24px; background: url('../assets/stadium-wide.jpg') center / cover no-repeat; filter: blur(5px) saturate(0.9); }
.backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 14, 16, 0.78) 0%, rgba(13, 14, 16, 0.9) 45%, rgba(13, 14, 16, 0.95) 100%); }
body[data-stage="gate"] .backdrop::after { background: linear-gradient(90deg, rgba(13, 14, 16, 0.93) 0%, rgba(13, 14, 16, 0.78) 50%, rgba(13, 14, 16, 0.55) 100%); }
@media (max-width: 767px), (max-width: 1024px) and (orientation: portrait) { .backdrop::before { background-image: url('../assets/stadium-tall.jpg'); } }
/* the frame handed over by the landing page, fading into the app */
.handoff { position: fixed; inset: 0; z-index: 200; background: center / cover no-repeat; pointer-events: none; transition: opacity 1.1s var(--ease), filter 1.1s var(--ease); }
.handoff.out { opacity: 0; filter: blur(14px) brightness(0.6); }

.boot { min-height: 80vh; display: grid; place-items: center; align-content: center; gap: 14px; color: var(--muted); }
.noscript { padding: 40px 20px; text-align: center; }
.muted { color: var(--muted); }
.pad { padding: 18px 2px; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.row.start { justify-content: flex-start; }
.row.end { justify-content: flex-end; }

/* ------------------------------------------------------------------ gates (sign-in, terms, team) */
.gate { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: center; gap: 64px;
  width: min(1100px, 100%); margin: 0 auto; padding: calc(56px + var(--safe-t)) 28px calc(40px + var(--safe-b)); }
.gate:has(> .gate-card:only-child), .gate.setup-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.gate-intro h1 { margin: var(--s-4) 0 var(--s-5); font: 400 clamp(54px, 7vw, 96px)/0.96 var(--serif); letter-spacing: -0.024em; }
.gate-intro h1 em { color: var(--od-2); }
.gate-intro .lede { margin: 0; max-width: 460px; color: #d6d0c5; font-size: 17px; line-height: 1.7; }
.gate-card { width: min(440px, 100%); padding: 32px 30px 28px; border-radius: 18px; }
.gate-card h1 { margin: 10px 0 12px; font: 400 clamp(36px, 6vw, 48px)/1.05 var(--serif); }
.gate-card h2 { margin: 0 0 8px; font: 400 30px/1.1 var(--serif); }
.gate-card .sub { margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
.gate-mark { width: 40px; height: 40px; margin: 0 0 22px; }
.gate-mark svg { width: 100%; height: 100%; }
.fine { margin: 18px 0 0; color: var(--faint); font-size: 13px; line-height: 1.6; }
.fine a { color: var(--muted); text-underline-offset: 3px; }
.fine.demo { color: var(--od-2); }
.gate-links { grid-column: 1 / -1; display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; }
.gate-links a { color: var(--muted); text-decoration: none; transition: color 0.3s var(--ease); }
.gate-links a:hover { color: var(--text); }
.doc-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.agree { display: flex; gap: 12px; align-items: flex-start; text-align: left; margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14.5px; line-height: 1.55; color: #ddd7cc; }
.agree input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--od); }
.gate-card .b-ghost { margin-top: 14px; }

.setup-wrap { align-content: start; padding-top: calc(80px + var(--safe-t)); }
.setup-head { text-align: center; max-width: 560px; }
.setup-head .gate-mark { margin: 0 auto 18px; }
.setup-head h1 { margin: var(--s-3) 0; font: 400 clamp(38px, 6vw, 58px)/1 var(--serif); letter-spacing: -0.02em; }
.setup-head .sub { color: var(--muted); line-height: 1.6; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 16px; width: 100%; justify-content: center; }
.setup { display: grid; gap: 14px; align-content: start; padding: 28px; }
.setup h2 { margin: 0; font: 400 28px/1.1 var(--serif); }
.setup .sub { margin: -4px 0 4px; color: var(--muted); font-size: 14.5px; }

/* ------------------------------------------------------------------ top bar and tabs */
.topbar { gap: 6px; padding: 0 8px 0 16px; background: var(--pane-strong); }
.topbar .brand { margin-right: 0; }
.brand-t { font: 400 22px/1 var(--serif); }
.team-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; min-width: 0; height: 34px; padding: 0 12px 0 4px; margin-left: 6px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.team-pill b { padding: 5px 8px; border-radius: 6px; background: var(--cream); color: var(--ink); font: 500 12px/1 var(--mono); }
.team-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 40px; margin-left: auto; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-weight: 500; font-size: 13.5px; transition: border-color 0.3s var(--ease); }
.event-btn:hover { border-color: var(--line-2); }
.event-btn span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-btn .chev { width: 15px; height: 15px; }
.sync { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--green); }
.sync[data-state="waiting"] { color: var(--gold); }
.sync[data-state="error"] { color: var(--danger); }
.sync[data-state="busy"] svg { animation: pulse 1.2s ease-in-out infinite; }
.sync span { position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: var(--ink); font: 600 10px/17px var(--mono); }
.sync span:empty { display: none; }
@keyframes pulse { 50% { opacity: 0.35; } }
.avatar-btn, .avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--line-2); border-radius: 50%; background: var(--ink-3); font: 400 16px/1 var(--serif); color: var(--text); }
.avatar { width: 34px; height: 34px; font-size: 15px; }

.tabbar { top: auto; bottom: calc(14px + var(--safe-b)); width: min(560px, calc(100% - 20px)); height: 64px; padding: 6px; gap: 2px; justify-content: space-between; background: var(--pane-strong); border-radius: 16px; }
.tab { flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; height: 52px; border: 0; border-radius: 11px; background: transparent; color: var(--faint); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; transition: background-color 0.35s var(--ease), color 0.35s var(--ease); }
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); background: rgba(242, 237, 227, 0.08); }
.tab[aria-current="page"] svg { color: var(--od-2); }

/* ------------------------------------------------------------------ views */
#app { position: relative; z-index: 1; }
.view { width: min(980px, 100%); margin: 0 auto; padding: calc(100px + var(--safe-t)) var(--gutter) var(--s-6); display: grid; gap: var(--s-4); animation: odRise 0.6s var(--ease); }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 2px 6px; }
.view-head h1 { margin: 10px 0 0; font: 400 clamp(38px, 5.4vw, 56px)/1 var(--serif); letter-spacing: -0.005em; }
.card { display: grid; gap: 18px; }
.card-t { margin: 0; font: 400 24px/1.15 var(--serif); }
.card .sub { margin: -10px 0 0; color: var(--muted); font-size: 14.5px; }
.sec-t { margin: 14px 2px 0; font: 500 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.fld { display: grid; gap: 0; min-width: 0; }
.fld-sw { align-self: end; }
.switch .sw-l { display: grid; gap: 2px; padding: 10px 0; }
.switch .sw-l b { font-weight: 500; font-size: 14.5px; }
.switch .sw-l small { color: var(--faint); font-size: 12.5px; }
.sw-grid { gap: 10px; }

.setup-card .seg { margin-bottom: 10px; }
.num-step { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; height: 50px; border-radius: var(--r-sm); padding: 2px; background: rgba(21, 22, 26, 0.85); border: 1px solid var(--line); }
.num-step .b { height: 44px; width: 44px; }
.num-in { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; text-align: center; font: 400 26px/1 var(--serif); }

/* the live tally and phase switch stay under the top bar while you scout */
.live { position: sticky; top: calc(80px + var(--safe-t)); z-index: 10; display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: var(--pane-strong); border: 1px solid var(--line); backdrop-filter: var(--frost); -webkit-backdrop-filter: var(--frost); }
body[data-alliance="red"] .scout-view .live { border-color: rgba(216, 67, 78, 0.55); }
body[data-alliance="blue"] .scout-view .live { border-color: rgba(67, 112, 224, 0.6); }
.tally { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 8px 0; }
.tally-l { display: grid; gap: 4px; min-width: 0; }
.tally-t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally-c { color: var(--muted); font: 400 11px/1 var(--mono); letter-spacing: 0.06em; }
.tally-r { display: flex; align-items: baseline; gap: 6px; }
.tally-n { font: 400 44px/1 var(--serif); font-variant-numeric: tabular-nums; }
.tally-r small { color: var(--muted); font: 500 11px var(--mono); }
.seg.phase button { height: 46px; font-size: 15px; }
.counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.counters.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.station button[aria-pressed="true"] { background: var(--od); color: #fff; }
.submit-bar { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 8px; }
.submit-bar .b-od { height: 56px; }
body.scout .toast { bottom: calc(96px + var(--safe-b)); }

/* lists */
.rlist { display: grid; gap: 0; }
.ritem { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ritem:first-child { border-top: 1px solid var(--line); }
.ritem.col { display: grid; gap: 6px; padding: 14px 4px; }
.rrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rmain { display: grid; gap: 2px; flex: 1; min-width: 0; }
.rmain b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmain small { color: var(--muted); font-size: 13px; }
.rpts { margin-left: auto; font: 400 20px var(--serif); white-space: nowrap; }
.rdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rdot.red { background: var(--red); }
.rdot.blue { background: var(--blue); }
.quote { margin: 0; padding: 4px 0 4px 14px; border-left: 2px solid var(--od); color: #d6d0c5; font: italic 400 17px/1.5 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-pick { flex: 1; display: grid; gap: 2px; text-align: left; border: 0; background: transparent; padding: 6px 0; }
.ev-pick b { font-weight: 600; }
.ev-pick small { color: var(--muted); }
.ev-pick.on b::after { content: '  · current'; color: var(--od-2); font: 500 11px var(--mono); }

/* rankings: a ruled table, not cards */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat-row .tile { background: none; border: 0; border-radius: 0; padding: 18px 16px 16px 2px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.stat-row .tile + .tile { border-left: 1px solid var(--line); padding-left: 16px; }
.stat-row .tile b { display: block; font: 400 38px/1 var(--serif); font-variant-numeric: tabular-nums; }
.stat-row .tile span { display: block; margin-top: 8px; color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.tools { display: flex; gap: 10px; align-items: center; }
.tools .grow { flex: 1; }
.tools .field { min-height: 46px; }
.field.sel { position: relative; padding-right: 36px; }
.field.sel .chev { position: absolute; right: 14px; width: 16px; height: 16px; }
.rank-list, .pick-list { display: grid; gap: 0; }
.rank, .pick { display: grid; grid-template-columns: 34px minmax(70px, 1fr) minmax(60px, 1.4fr) repeat(4, 74px) 110px; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; text-align: left; transition: background-color 0.3s var(--ease); }
.rank:first-child, .pick:first-child { border-top: 1px solid var(--line); }
.rank:hover { background: rgba(242, 237, 227, 0.04); }
.rk { font: 400 12px var(--mono); color: var(--muted); }
.rank:nth-child(1) .rk { color: var(--od-2); }
.rt, .rs { display: grid; gap: 3px; min-width: 0; }
.rt b { font: 400 26px/1 var(--serif); }
.rt small, .rs small { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs b { font: 600 16px/1 var(--font); font-variant-numeric: tabular-nums; }
.rbar { height: 3px; border-radius: 2px; background: rgba(242, 237, 227, 0.08); overflow: hidden; }
.rbar i { display: block; height: 100%; background: var(--od); }
.spark { width: 110px; height: 32px; fill: none; stroke: var(--cream-2); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--od); stroke: none; }
.big-spark { border-radius: 12px; padding: 14px; }
.big-spark .spark { width: 100%; height: 90px; }
.pick { grid-template-columns: 34px 1fr auto auto auto auto; }
.pick.dnp { opacity: 0.55; }
.pick.dnp .rt b { text-decoration: line-through; text-decoration-thickness: 1px; }
.chip.static { display: inline-flex; align-items: center; cursor: default; }
.pit-sum p { margin: 0; color: #d6d0c5; }

.code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 14px 14px 20px; border-radius: 12px; }
.code { font-size: clamp(22px, 5vw, 28px); font-weight: 500; letter-spacing: 0.24em; margin-right: auto; user-select: all; -webkit-user-select: all; }
.empty { justify-items: start; padding: 36px 30px; }
.empty h2 { margin: 0; font: 400 34px/1.1 var(--serif); }
.empty .sub { margin: 0; }
.empty-ico { color: var(--od-2); }
.empty-ico svg { width: 26px; height: 26px; }
.foot-links { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; padding: 14px; font-size: 13px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.back { justify-self: start; }
.rot { transform: rotate(-90deg); }

.sheet { position: relative; }
.sheet.wide { width: min(720px, 100%); }
.sheet-x { position: absolute; top: 16px; right: 16px; z-index: 3; }
.sheet h2 { padding-right: 40px; }
.sheet-body { display: grid; gap: 12px; }
.sheet .field { min-height: 50px; }

@media (max-width: 1024px) {
  .gate { grid-template-columns: minmax(0, 1fr); gap: 36px; align-content: center; }
  .rank { grid-template-columns: 30px minmax(60px, 1fr) minmax(40px, 1fr) 70px 90px; }
  .rank .hide-s { display: none; }
  .spark { width: 84px; }
}
@media (max-width: 767px) {
  .topbar .brand-t, .team-pill span { display: none; }
  .team-pill { padding: 0; margin-left: 2px; }
  .event-btn span { max-width: 34vw; }
  .setup-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row .tile:nth-child(3) { border-left: 0; padding-left: 2px; }
  .stat-row .tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid2 { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr; }
  .counters.two { grid-template-columns: 1fr 1fr; }
  .counters.two .stepper { grid-template-columns: 44px 1fr 62px; }
  .rank { grid-template-columns: 26px minmax(60px, 1fr) 64px 84px; gap: 8px; }
  .rank .rbar { display: none; }
  .pick { grid-template-columns: 26px 1fr auto auto auto; }
  .pick .b-ghost.sm:not(.icon), .pick .b-danger.sm { grid-column: 2 / -1; grid-row: 2; justify-self: start; }
  .view { padding-left: var(--s-4); padding-right: var(--s-4); }
  .live { top: calc(72px + var(--safe-t)); }
  .gate { padding-left: 20px; padding-right: 20px; }
  .gate-intro h1 { font-size: clamp(48px, 13vw, 64px); }
}
@media (max-width: 380px) {
  .tab span { display: none; }
  .tabbar { height: 58px; }
  .tab { height: 46px; }
}

/* ------------------------------------------------------------------ review fixes */
/* the tab bar keeps its own transition name so it never collides with the top bar during page transitions */
.tabbar { view-transition-name: od-tabbar; }
.view { min-width: 0; overflow-x: clip; }
/* list rows wrap their actions under the name on narrow screens instead of widening the page */
.ritem { flex-wrap: wrap; }
.ritem .rmain { min-width: 140px; }
@media (max-width: 479px) { .ritem > .b:not(.icon) { order: 5; } .ritem .rmain { flex-basis: calc(100% - 60px); } }
/* submit stays in reach while scrolling the match form */
.submit-bar.sticky { position: sticky; bottom: calc(90px + var(--safe-b)); z-index: 9; padding: 8px; margin: 8px calc(-1 * var(--s-2)) 0; border-radius: 16px; background: var(--pane-strong); border: 1px solid var(--line); backdrop-filter: var(--frost); -webkit-backdrop-filter: var(--frost); }
.submit-bar.one { grid-template-columns: 1fr; }
/* the toast sits at the top while scouting so it never covers the counters being tapped */
body.scout .toast { top: calc(78px + var(--safe-t)); bottom: auto; transform: translate(-50%, -12px); }
body.scout .toast.show { transform: translate(-50%, 0); }
/* no show: scoring switched off */
.is-noshow .counters, .is-noshow .phase, .is-noshow .counters + .card, .is-noshow .sec-t, .is-noshow .counters.two { opacity: 0.32; pointer-events: none; filter: grayscale(1); transition: opacity 0.4s var(--ease); }
.counters, .counters + .card { transition: opacity 0.4s var(--ease); }
/* team detail */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-5); margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: var(--s-3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; font: 500 13px var(--mono); font-variant-numeric: tabular-nums; }
@media (max-width: 479px) { .kv { grid-template-columns: 1fr; } }
.counters.two .stepper .mid b { white-space: normal; }

/* ------------------------------------------------------------------ design review: motion */
/* segmented controls: one thumb slides to the choice */
.seg.thumb { position: relative; gap: 0; isolation: isolate; }
.seg.thumb::before { content: ''; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n, 2)); border-radius: 9px; background: var(--cream);
  opacity: var(--on, 1); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.42s var(--ease-out), background-color 0.3s var(--ease-out), opacity 0.25s var(--ease-out); }
.seg.thumb button, .seg.thumb button[aria-pressed="true"], .seg.red.thumb button[aria-pressed="true"], .seg.blue.thumb button[aria-pressed="true"] { background: transparent; transition: color 0.3s var(--ease-out); }
.seg.thumb button[aria-pressed="true"] { color: var(--ink); }
.seg.red.thumb::before { background: var(--red); } .seg.blue.thumb::before { background: var(--blue); }
.seg.red.thumb button[aria-pressed="true"], .seg.blue.thumb button[aria-pressed="true"] { color: #fff; }
.seg.station.thumb::before { background: var(--cream); } .seg.station.thumb button[aria-pressed="true"] { color: var(--ink); }
/* tab bar: an indicator glides under the active tab */
.tabbar { position: fixed; isolation: isolate; }
.tab-ind { position: absolute; z-index: -1; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / var(--n, 5)); border-radius: 11px; background: rgba(242, 237, 227, 0.09);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.45s var(--ease-out); }
.tab[aria-current="page"] { background: transparent; }
.tab svg { transition: transform 0.35s var(--ease-out), color 0.3s var(--ease-out); }
.tab[aria-current="page"] svg { transform: translateY(-1px); }
/* views: enter from the side you moved towards, children staggered */
@keyframes viewFwd { from { opacity: 0; transform: translateX(28px); } }
@keyframes viewBack { from { opacity: 0; transform: translateX(-28px); } }
@keyframes kidRise { from { opacity: 0; transform: translateY(12px); } }
#app[data-dir="fwd"] > .view { animation: viewFwd 0.42s var(--ease-out); }
#app[data-dir="back"] > .view { animation: viewBack 0.42s var(--ease-out); }
.view > * { animation: kidRise 0.55s var(--ease-out) backwards; }
.view > :nth-child(2) { animation-delay: 0.05s; } .view > :nth-child(3) { animation-delay: 0.1s; } .view > :nth-child(4) { animation-delay: 0.15s; }
.view > :nth-child(5) { animation-delay: 0.2s; } .view > :nth-child(n+6) { animation-delay: 0.25s; }
.view > .live, .view > .submit-bar.sticky { animation: none; }
/* gates: card contents arrive in reading order */
.gate-card > *, .setup-head > *, .setup-grid > * { animation: kidRise 0.7s var(--ease-out) backwards; }
.gate-card > :nth-child(2), .setup-head > :nth-child(2) { animation-delay: 0.07s; } .gate-card > :nth-child(3), .setup-head > :nth-child(3) { animation-delay: 0.14s; }
.gate-card > :nth-child(4), .setup-grid > :nth-child(1) { animation-delay: 0.21s; } .gate-card > :nth-child(n+5), .setup-grid > :nth-child(2) { animation-delay: 0.28s; }
/* counters: the cell flashes the accent on +1, values roll (JS) */
.stepper .inc { position: relative; overflow: hidden; }
.stepper .inc::after { content: ''; position: absolute; inset: 0; background: var(--od); opacity: 0; pointer-events: none; }
.stepper.bump .inc { background: rgba(242, 237, 227, 0.04); }
.stepper.bump .inc::after { animation: incFlash 0.42s var(--ease-out); }
@keyframes incFlash { 0% { opacity: 0.22; } 100% { opacity: 0; } }
.stepper .val { display: inline-block; }
.tally-r { position: relative; }
.float-chip { position: absolute; right: 2px; bottom: 100%; font: 500 12px/1 var(--mono); color: var(--od-2); pointer-events: none; white-space: nowrap; }
/* data: bars grow from the left, sparklines draw */
.rbar i { width: 100%; transform: scaleX(var(--w, 0)); transform-origin: left; animation: barGrow 0.8s var(--ease-out) var(--d, 0ms) backwards; }
@keyframes barGrow { from { transform: scaleX(0); } }
.spark polyline { stroke-dasharray: 400; stroke-dashoffset: 0; animation: sparkDraw 0.9s var(--ease-out) 0.25s backwards; }
@keyframes sparkDraw { from { stroke-dashoffset: 400; } }
.spark circle { animation: kidRise 0.4s var(--ease-out) 0.9s backwards; }
/* sync icon spins while uploading */
#tb-sync[data-state="busy"] svg { animation: odSpin 1.2s linear infinite; }

/* ------------------------------------------------------------------ design review: layout fixes */
.live { top: calc(76px + var(--safe-t)); }
.live::before { content: ''; position: absolute; left: -14px; right: -14px; bottom: 100%; height: 26px; pointer-events: none; background: linear-gradient(rgba(13, 14, 16, 0.96), rgba(13, 14, 16, 0)); }
@media (max-width: 767px) { .live { top: calc(68px + var(--safe-t)); } }
.submit-bar.sticky { margin-inline: 0; animation: kidRise 0.45s var(--ease-out); }
/* one value colour; the kind of count is a rule on the left */
.stepper.od .inc .val, .stepper.gold .inc .val, .stepper.bad .inc .val { color: var(--text); }
.stepper.gold { box-shadow: inset 3px 0 0 var(--gold), var(--top-light); }
.stepper.bad { box-shadow: inset 3px 0 0 var(--danger), var(--top-light); }
.setup-grid { align-items: start; }
.gate-card .err:empty, .setup .err:empty { display: none; }
.doc-links { display: grid; grid-template-columns: 1fr 1fr; }
.view-head { align-items: last baseline; }
.big-spark { border: 0; background: none; padding: 0; }
.big-spark .spark { height: 64px; }
.team-pill b { background: none; color: var(--od-2); padding: 0 2px 0 0; font: 500 12px/1 var(--mono); letter-spacing: 0.08em; }
.switch { min-height: 64px; }
.grid2 { align-items: stretch; }
.field:has(textarea) { position: relative; }
.field:has(textarea) .suf { position: absolute; right: 14px; bottom: 10px; }
.rate button { font: 500 13px var(--mono); }
.tools .b { height: 46px; }
.tools .grow { flex: 1.6; }
@media (min-width: 768px) and (max-width: 1024px) { .rank { grid-template-columns: 30px 120px 1fr 70px 90px; } }
@media (max-width: 479px) {
  .gate-card { background: none; border: 0; box-shadow: none; padding: 8px 0; }
  .tab:not([aria-current="page"]) span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .seg.thumb::before, .tab-ind { transition: none; }
  #app > .view, .view > *, .gate-card > *, .setup-head > *, .setup-grid > *, .rbar i, .spark polyline, .spark circle, .submit-bar.sticky { animation: none !important; }
}
.tabbar { gap: 0; }
/* round 2: submit lives in the tally; denser counters and always-labelled tabs on phones */
.tally { gap: 10px; }
.tally-r { margin-left: auto; }
.tally-go { flex: none; }
.lnk-row { all: unset; display: grid; gap: 2px; cursor: pointer; min-width: 0; }
.lnk-row:focus-visible { outline: 2px solid var(--od-2); outline-offset: 3px; border-radius: 4px; }
@media (max-width: 479px) {
  .tab:not([aria-current="page"]) span { display: block; }
  .tab span { font-size: 10.5px; }
  .stepper { min-height: 60px; }
  .stepper .val { font-size: 30px; }
  .tally-n { font-size: 38px; }
  .tally-go span { display: none; }
  .tally-go { width: 44px; padding: 0; }
}

/* ---- round 2 */
/* ink bands behind the floating bars, so scrolled content never shows around them */
body.scout[data-stage="app"]::before { content: ''; position: fixed; z-index: 45; left: 0; right: 0; top: 0; height: calc(72px + var(--safe-t)); pointer-events: none; background: linear-gradient(180deg, rgba(13, 14, 16, 0.97) 82%, rgba(13, 14, 16, 0)); }
@media (max-width: 767px) { body.scout[data-stage="app"]::before { height: calc(64px + var(--safe-t)); } }
body.scout[data-stage="app"] #app::after { content: ''; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: calc(96px + var(--safe-b)); pointer-events: none; background: linear-gradient(0deg, rgba(13, 14, 16, 0.97) 60%, rgba(13, 14, 16, 0)); }
.live { top: calc(72px + var(--safe-t)); }
.live::before { display: none; }
@media (max-width: 767px) { .live { top: calc(64px + var(--safe-t)); } }
/* short screens (landscape phones, keyboard open): the tally scrolls with the page */
@media (max-height: 560px) { .live { position: static; } }
.view { scroll-padding-top: 220px; }
html { scroll-padding-top: 210px; scroll-padding-bottom: 110px; }
/* sheets: opaque, no blur, transform-only entrance (no see-through frames) */
.sheet { background: #121316; backdrop-filter: none; -webkit-backdrop-filter: none; }
/* toast above the top bar, briefly */
body.scout .toast { top: calc(12px + var(--safe-t)); z-index: 95; }
/* landing hand-off: opacity only */
.handoff.out { filter: none; }

/* ---- round 3: layout audit (collisions, clipping, tap targets) */
/* toast: takes over the top bar's own frame for a moment, rather than half-covering the event and sync buttons */
body.scout .toast { top: calc(14px + var(--safe-t)); width: min(1180px, calc(100% - 28px)); max-width: none; min-height: 56px; display: flex; align-items: center; justify-content: center;
  padding: 8px 20px; border-radius: 14px; text-align: center; line-height: 1.4; background: #121316; backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (max-width: 767px) { body.scout .toast { top: calc(10px + var(--safe-t)); width: calc(100% - 20px); min-height: 52px; padding: 8px 16px; } }
/* touch: the logo and the account button are full-size targets (the mark stays where it was) */
@media (pointer: coarse) {
  .topbar .brand { min-width: 40px; min-height: 44px; justify-content: center; margin-left: -7px; }
  .avatar-btn { width: 40px; height: 40px; }
}
@media (max-width: 767px) { .event-btn { gap: 6px; padding: 0 10px; } }
.num-in { height: 44px; }
/* notes: the character count sits under the text, clear of the words and the resize grip */
.field:has(textarea) { flex-direction: column; align-items: stretch; gap: 0; }
.field:has(textarea) textarea { flex: none; }
.field:has(textarea) .suf { position: static; align-self: flex-end; margin: 0 0 10px; }
/* fouls: side by side only where the labels fit */
@media (max-width: 419px) {
  .counters.two { grid-template-columns: 1fr; }
  .counters.two .stepper { grid-template-columns: 54px 1fr 76px; }
}
/* the smallest phones kept the active tab's label hidden while showing the others */
@media (max-width: 380px) { .tab span, .tab:not([aria-current="page"]) span { display: block; } }
/* pick rows: one column per control, so remove never wraps under the name */
.pick { grid-template-columns: 34px minmax(0, 1fr) repeat(5, auto); }
@media (max-width: 767px) {
  .pick { grid-template-columns: 26px minmax(0, 1fr) repeat(4, auto); column-gap: 4px; row-gap: 2px; }
  .pick .rt small { white-space: normal; }
}
/* member rows on phones: role buttons first, remove last */
@media (max-width: 479px) { .ritem:has(> .b:not(.icon)) > .b.icon { order: 6; } }
.foot-links { padding-block: 4px; gap: 0 14px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.sync { flex: none; }
/* the toast only fades: a sliding frame would half-cover the bar on its way out */
body.scout .toast, body.scout .toast.show { transform: translateX(-50%); }

/* ---- round 3: one left/right edge per view (no 2 px text insets), controls that line up */
body.scout .lab, body.scout label.lab { margin-left: 0; }
body.scout .help, body.scout .err { margin-left: 0; margin-right: 0; }
.sec-t { margin-inline: 0; }
.view-head { margin-inline: 0; }
.pad { padding-inline: 0; }
.rank, .pick { padding-inline: 0; }
.ritem { padding-inline: 0; }
.ritem.col { padding-inline: 0; }
.stat-row .tile { padding-left: 0; }
.stat-row .tile + .tile { padding-left: 16px; }
@media (max-width: 767px) { .stat-row .tile:nth-child(3) { padding-left: 0; } }
/* vertical rhythm and gaps on the --s-* scale */
.view-head { margin-block: var(--s-2); }
.sec-t { margin-top: var(--s-3); }
body.scout .err { margin-top: var(--s-2); }
.card { gap: var(--s-4); }
.row, .sheet .row, .tools, .submit-bar, .counters, .code-box { gap: var(--s-3); }
.row, .sheet .row { margin-top: var(--s-4); }
/* clear form and submit are one row of equal buttons */
.submit-bar > .b { height: 56px; }
/* side by side (tablet and up): a toggle beside a labelled control matches that control, edge to edge */
/* a field cell never spreads spare height between its label and control (that pushed Robot 8 px below Match) */
.fld { align-content: start; }
.grid2 > .fld-sw { align-content: end; }
@media (min-width: 768px) {
  .grid2 > .fld-sw { align-self: end; }
  .grid2 > .fld-sw > .switch { height: 50px; min-height: 0; }
  .grid2 > .fld-sw .sw-l { padding: 0; line-height: 1.3; }
}
/* phones: the DNP text button sits on the name's edge, not its own padding */
@media (max-width: 767px) { .pick .b-ghost.sm:not(.icon) { margin-left: -14px; } }

/* ---- round 3: motion. Rows and lower sections rise in as they scroll into view (compositor-only: transform + opacity) */
@keyframes odReveal { from { opacity: 0; transform: translateY(16px); } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .view > :nth-child(n+4):not(.live):not(.sticky),
    .rank-list > .rank, .pick-list > .pick, .sheet .rlist > .ritem {
      animation: odReveal linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; animation-delay: 0s;
    }
  }
}
/* sheets: their contents settle in reading order just behind the sheet itself */
@media (prefers-reduced-motion: no-preference) {
  .sheet > h2, .sheet > .sub, .sheet-body > * { animation: kidRise 0.5s var(--ease-out) backwards; }
  .sheet > .sub { animation-delay: 0.04s; } .sheet-body > :nth-child(1) { animation-delay: 0.08s; } .sheet-body > :nth-child(2) { animation-delay: 0.12s; } .sheet-body > :nth-child(n+3) { animation-delay: 0.16s; }
}
