/* ShuttleIQ athlete app. Every colour, radius and space comes from the design-system tokens
   (/design-system/tokens.css); this file only lays them out for a phone-first app. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--surface-0); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--surface-0); color: var(--ink); font-family: var(--font-text);
  font-size: 16px; line-height: 24px; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
h1 { font-size: 28px; line-height: 34px; }
h2 { font-size: 20px; line-height: 28px; }
h3 { font-size: 16px; line-height: 22px; }
a { color: var(--brand); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius-sm); }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; line-height: 20px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

/* frame */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface-0) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.top__who { font-size: 13px; color: var(--ink-muted); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; margin: 0 auto;
  padding: var(--space-4) max(16px, env(safe-area-inset-right, 0px)) var(--space-8) max(16px, env(safe-area-inset-left, 0px)); outline: none; }
.notice { margin: var(--space-3) auto 0; max-width: 640px; width: calc(100% - 32px); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-1); font-size: 14px; line-height: 20px; }
.notice--warn { border-color: var(--warn); }
.notice--bad { border-color: var(--critical); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface-1); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--ink-muted); text-decoration: none;
  font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs svg .fill { fill: currentColor; stroke: none; }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs a[data-tab="new"][aria-current="page"] svg .fill { fill: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  max-width: calc(100vw - 32px); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); background: var(--surface-2);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-card); font-size: 14px; }
.toast.is-error { border-color: var(--critical); }

/* building blocks */
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.card--flat { background: transparent; border-style: dashed; }
.card--accent { border-color: var(--brand); background: var(--brand-tint); }
.card--warn { border-color: var(--warn); }
.row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-4);
  border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--danger { border-color: var(--critical); color: var(--critical); }
.btn--small { min-height: 36px; padding: 0 var(--space-3); font-size: 14px; }
.btn--block { width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field input, .field select { min-height: 48px; padding: 0 var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--surface-0); color: var(--ink); width: 100%; }
.field input::placeholder { color: var(--ink-disabled); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-0); border: 1px solid var(--line); }
.seg button { min-height: 40px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.switch { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong);
  position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink-muted); transition: transform .15s; }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { transform: translateX(18px); background: var(--on-brand); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong);
  font-size: 12px; line-height: 20px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.pill--good::before { background: var(--good); }
.pill--brand::before { background: var(--brand); }
.pill--warn::before { background: var(--warn); }
.pill--bad::before { background: var(--critical); }
.pill--plain::before { display: none; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li + li { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; color: var(--ink); text-decoration: none; min-width: 0; }
.item__when { flex: none; width: 52px; text-align: center; border-radius: var(--radius-md); background: var(--surface-2); padding: 6px 0; }
.item__when b { display: block; font-family: var(--font-mono); font-size: 18px; line-height: 22px; }
.item__when span { font-size: 11px; line-height: 14px; text-transform: uppercase; color: var(--ink-muted); }
.item__main { flex: 1; min-width: 0; }
.item__main { display: flex; flex-direction: column; gap: 4px; }
.item__main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__main .row { gap: var(--space-2); }
.item__chev { color: var(--ink-disabled); }
.empty { text-align: center; padding: var(--space-6) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }
.progress { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* sign-in */
.hero { padding: var(--space-6) 0 var(--space-2); display: flex; flex-direction: column; gap: var(--space-2); }
.hero h1 { font-size: 34px; line-height: 40px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.account { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); text-align: left; padding: var(--space-3);
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-0); cursor: pointer; width: 100%; }
.account:hover { border-color: var(--brand); }
.account .avatar { grid-row: span 2; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; color: var(--brand); flex: none; }

/* session */
.match { display: flex; flex-direction: column; gap: var(--space-1); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-2); }
.versus .side { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 24px; min-width: 0; overflow-wrap: anywhere; }
.versus .side:last-child { text-align: right; }
.versus .score { font-family: var(--font-mono); font-size: 28px; line-height: 32px; color: var(--accent); }
.stages { display: flex; flex-direction: column; gap: var(--space-2); }
.stage { display: grid; grid-template-columns: 20px 1fr; gap: 2px var(--space-2); align-items: start; }
.stage i { width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: var(--ink-disabled); }
.stage.is-ok i { background: var(--good); }
.stage.is-unavailable i { background: var(--warn); }
.stage.is-failed i { background: var(--critical); }
.stage.is-running i, .stage.is-queued i { background: var(--brand); animation: pulse 1.2s infinite; }
.stage small { grid-column: 2; color: var(--ink-muted); font-size: 13px; line-height: 18px; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .stage i { animation: none !important; } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.player { width: 100%; border-radius: var(--radius-md); background: #000; display: block; max-height: 56vh; }
.bars { display: flex; flex-direction: column; gap: var(--space-2); }
.bar { display: grid; grid-template-columns: 96px 1fr 28px; gap: var(--space-2); align-items: center; font-size: 14px; }
.bar__track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar__track { display: block; }
.bar__fill { display: block; height: 100%; border-radius: 5px; }
.bar b { font-family: var(--font-mono); text-align: right; }
.rally { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-0); cursor: pointer; text-align: left; width: 100%; }
.rally[aria-pressed="true"] { border-color: var(--brand); }
.shots { display: flex; flex-wrap: wrap; gap: 6px; }
.shot { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 13px; line-height: 20px;
  background: var(--surface-2); border: 1px solid transparent; }
.shot--estimate { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.shot--hidden { color: var(--ink-muted); background: transparent; border: 1px dashed var(--line); }
.shot__dot { width: 8px; height: 8px; border-radius: 50%; }
.court-wrap { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.court-wrap > * { max-width: 360px; width: 100%; }

/* record */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps span { height: 4px; border-radius: 2px; background: var(--surface-2); }
.steps span.is-done { background: var(--brand); }
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.picker label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); min-height: 112px;
  border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); background: var(--surface-0); cursor: pointer; font-weight: 700; text-align: center; padding: var(--space-3); }
.picker label:hover, .picker label:focus-within { border-color: var(--brand); }
.picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picker svg { width: 32px; height: 32px; fill: none; stroke: var(--brand); stroke-width: 1.8; }
.calib { position: relative; width: 100%; border-radius: var(--radius-md); overflow: hidden; background: #000; touch-action: manipulation; }
.calib video { display: block; width: 100%; height: 100%; }
.calib svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.calib .poly { fill: color-mix(in srgb, var(--court-fill) 45%, transparent); stroke: var(--court-line); stroke-width: 2; vector-effect: non-scaling-stroke; }
.calib .mark circle { fill: var(--accent); stroke: var(--on-accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.calib .mark text { fill: var(--on-accent); font-family: var(--font-mono); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.calib-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px var(--space-3); font-size: 13px; }
.calib-legend span.is-next { color: var(--accent); font-weight: 700; }
.calib-legend span.is-done { color: var(--ink-muted); text-decoration: line-through; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .grid2, .picker { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 80px 1fr 24px; }
}

/* corrections, notes, coach sharing */
.rally__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); width: 100%;
  min-height: 44px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rally:has(.rally__head[aria-pressed="true"]) { border-color: var(--brand); }
button.shot { cursor: pointer; font: inherit; font-size: 13px; color: inherit; min-height: 32px; }
.editor { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md);
  background: var(--surface-0); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface-1); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--surface-2); font-weight: 700; }
.seg--small button { min-height: 36px; font-size: 13px; padding: 0 10px; }
.select--small { min-height: 36px; border-radius: var(--radius-sm); background: var(--surface-0); color: var(--ink); border: 1px solid var(--line-strong); padding: 0 8px; }
.item--note { align-items: flex-start; }
.item--note .linkish { min-width: 48px; min-height: 32px; }
textarea { width: 100%; min-height: 64px; padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--surface-0); color: var(--ink); font: inherit; resize: vertical; }
#coach-link { width: 100%; min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--surface-0); color: var(--ink); font: inherit; font-size: 13px; }
.issues { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.callout { display: grid; gap: 4px; padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--warn, var(--line-strong)); background: var(--surface-0); }
.insight h3 { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-muted); font-weight: 600; }
.report .score { font-size: 22px; font-weight: 800; margin: 0; }
@media print {
  .top, #tabs, .no-print, #toast, #maintenance { display: none !important; }
  body { background: #fff !important; color: #111 !important; }
  .card, .report .stats > * { break-inside: avoid; background: #fff !important; color: #111 !important; border-color: #ccc !important; }
  .view { max-width: none; padding: 0; }
  .muted { color: #555 !important; }
}
.table-wrap { overflow-x: auto; }
.table-wrap .table { min-width: 600px; }
@media print { .table-wrap .table { min-width: 0; } }
@media print { .table-wrap { overflow: visible; } }

/* languages (PRD F-17): Bahasa Indonesia and Bahasa Melayu run up to ~30% longer than English,
   so labels wrap onto a second line instead of overflowing or being cut off */
.btn { padding-top: 6px; padding-bottom: 6px; text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.row--between { flex-wrap: wrap; }
/* segmented controls: equal widths while they fit; a long label breaks between words, and on a
   narrow phone the options wrap onto a second row instead of splitting a word */
.seg { display: flex; flex-wrap: wrap; }
.seg > button { flex: 1 1 0; min-width: min-content; padding: 4px 8px; line-height: 18px; }
.rally__head { flex-wrap: wrap; }
.tabs a span { max-width: 100%; padding: 0 2px; text-align: center; line-height: 14px; overflow-wrap: anywhere; }
.toast { text-align: center; }
.lang-row { justify-content: flex-end; }
.lang-switch { min-width: 156px; }
.lang-switch button { min-height: 32px; letter-spacing: 0.04em; }

/* release QA: long words wrap, pills never squeeze text, touch targets ≥ 44 px */
.item__main, .item__main *, .card p, .report td { overflow-wrap: anywhere; min-width: 0; }
.item > .pill { flex: 0 1 auto; max-width: 45%; white-space: normal; text-align: center; }
.btn--small, .chip, .seg--small button, .select--small, button.shot { min-height: 44px; }
.linkish { min-height: 44px; display: inline-flex; align-items: center; }
.item--note .linkish { min-width: 48px; }

/* ---------- group play ("mabar") ---------- */
.seg > a.seg__tab { flex: 1 1 0; min-width: min-content; padding: 4px 8px; }
.seg a.seg__tab { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: var(--radius-pill); color: var(--ink-muted); font-weight: 700; text-decoration: none; }
.seg a.seg__tab[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }
.table-wrap .table--fit { min-width: 0; }
.table--fit td, .table--fit th { white-space: nowrap; }
.table--fit td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
.form { display: flex; gap: 3px; }
.form__dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 700; color: var(--on-brand); }
.form__dot--w { background: var(--good); }
.form__dot--l { background: var(--critical); }
.scoreboard { display: flex; flex-direction: column; gap: var(--space-3); min-height: calc(100dvh - 120px); }
.sb__court { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); flex: 1; min-height: 52vh; }
@media (orientation: portrait) and (max-width: 560px) { .sb__court { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
.sb__side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-3);
  border: 2px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); color: var(--ink); font: inherit; min-width: 0; }
button.sb__side { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button.sb__side:active { transform: scale(.99); background: var(--surface-2); }
.sb__side.is-serving { border-color: var(--accent); }
.sb__side.is-winner { border-color: var(--good); background: var(--brand-tint); }
.sb__names { font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.sb__score { font-family: var(--font-mono); font-size: clamp(56px, min(22vw, 28vh), 160px); line-height: 1; color: var(--ink); }
.sb__side.is-serving .sb__score { color: var(--accent); }
.sb__meta { color: var(--ink-muted); text-align: center; min-height: 1.2em; }
.sb__banner { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--brand-tint); border: 1px solid var(--brand); font-weight: 700; text-align: center; }
.field--grow { flex: 1 1 140px; }
@media (max-height: 520px) and (orientation: landscape) { .scoreboard { min-height: 0; gap: var(--space-2); } .sb__court { min-height: 56vh; } .sb__side { padding: var(--space-2); gap: 4px; } }

/* ---------- sign-in, install, tips ---------- */
.phone-row { gap: var(--space-2); align-items: stretch; flex-wrap: nowrap; }
.phone-row select { min-width: 0; max-width: 46vw; }
.or { text-align: center; margin: 0; }
.tip { margin: 0; padding: var(--space-2) var(--space-3); border-left: 3px solid var(--accent); background: var(--surface-0); border-radius: var(--radius-md); }
#install-card .row { margin-top: var(--space-2); }
.beta-tag { margin-left: 6px; padding: 1px 6px; border-radius: var(--radius-pill); border: 1px solid var(--accent); color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.legal ul { padding-left: 1.1em; margin: 0; }
.legal h2 { font-size: 17px; }

/* ---- record and score: camera preview above the live score */
.rec__stage { position: relative; overflow: hidden; border-radius: var(--radius-lg); background: #000; }
.rec__preview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.rec__timer { position: absolute; top: var(--space-2); left: var(--space-2); display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 14px; }
.recorder.is-recording .rec__timer::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); animation: rec-blink 1s steps(2) infinite; }
@keyframes rec-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .recorder.is-recording .rec__timer::before { animation: none; } }
.scoreboard--compact .sb__court { min-height: 0; }
.scoreboard--compact .sb__side { min-height: 112px; }

/* statistics from the live score */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--space-2); }
.tile { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.tile__value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.weeks { display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--space-1); align-items: end; height: 120px; }
.weeks__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.weeks__bar { width: 100%; max-width: 28px; min-height: 2px; background: var(--line); border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; overflow: hidden; }
.weeks__won { width: 100%; background: var(--good); }
.weeks__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: 10px; }
#match-stats th[scope=row] { font-weight: 500; text-align: left; }
.queue__n { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.item--stack { flex-wrap: wrap; gap: var(--space-2); }
.seg__tab { min-width: 0; }
.check__mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; color: var(--on-brand); flex: none; }
.check__mark--ok { background: var(--good); }
.check__mark--bad { background: var(--critical); }
.check__mark--warn { background: var(--warn); }
.reel__preview { width: 100%; border-radius: var(--radius-md); background: #000; }
.reel__preview--tall { max-width: 280px; aspect-ratio: 9 / 16; margin: 0 auto; display: block; }
.reel__preview--wide { aspect-ratio: 16 / 9; }
.join__qr { width: 100%; max-width: 320px; height: auto; image-rendering: pixelated; border-radius: 8px; align-self: center; }

/* tournaments: rounds of fixture cards; a knockout scrolls sideways as a bracket */
.fx-rounds { display: flex; flex-direction: column; gap: var(--space-4); }
.fx-rounds--bracket { flex-direction: row; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: var(--space-2); }
.fx-rounds--bracket .fx-round { flex: 0 0 min(260px, 80vw); scroll-snap-align: start; }
.fx-rounds--bracket .fx-list { flex: 1; justify-content: space-around; }
.fx-round { display: flex; flex-direction: column; gap: var(--space-2); }
.fx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.fx { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); }
.fx[data-status="ready"] { border-color: var(--brand); }
.fx[data-status="live"] { border-color: var(--critical); }
.fx[data-status="bye"], .fx[data-status="waiting"] { background: transparent; border-style: dashed; }
.fx__lines { display: flex; flex-direction: column; gap: 4px; }
.fx__entry { display: flex; align-items: center; gap: var(--space-2); min-width: 0; min-height: 24px; }
.fx__seed { flex: none; width: 24px; text-align: center; font-size: 12px; line-height: 20px; color: var(--ink-muted); border-radius: var(--radius-sm); background: var(--surface-2); }
.fx__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx__score { flex: none; }
.fx__entry.is-winner .fx__name { font-weight: 700; }
.fx__entry.is-out { color: var(--ink-muted); }
.fx__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
#cup-count.is-bad { color: var(--critical); }

/* first-run language choice: big targets, each name in its own language */
#language-picker { padding-top: var(--space-6); }
.lang-title { display: block; }
.lang-title--more { font-size: 18px; line-height: 24px; color: var(--ink-muted); font-weight: 600; }
.lang-choice { flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: var(--space-3) var(--space-4); text-align: left; }
.lang-choice__name { font-size: 18px; font-weight: 700; }
.lang-choice__prompt { opacity: 0.8; }

/* QA at phone width in Indonesian and Malay (longer words) */
.table--fit tbody th { white-space: normal; overflow-wrap: break-word; text-align: left; }
.table--fit td:nth-child(2) { overflow-wrap: break-word; min-width: 8ch; }
.seg[role="tablist"] { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.seg[role="tablist"]::-webkit-scrollbar { display: none; }
.seg[role="tablist"] > a.seg__tab { flex: 1 0 auto; padding: 4px 10px; }
.seg > button { min-height: 44px; }
.queue-out, .week-step { min-width: 44px; }
.item > .pill { max-width: 40%; }
.item > .pill { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
/* match statistics: two team columns always visible; long labels and names wrap */
#match-stats { table-layout: fixed; width: 100%; }
#match-stats th, #match-stats td { white-space: normal; overflow-wrap: anywhere; }
#match-stats tbody th { width: 40%; }
/* a five-column table on a phone: tighter cells so the last column shows */
@media (max-width: 420px) {
  .table--fit th, .table--fit td { padding: 6px 4px; }
  .seg[role="tablist"] > a.seg__tab { padding: 4px 8px; font-size: 14px; }
}
