/* ============================================================
   FOOS APP — the product's one stylesheet (NORTH_STAR §2–§4, §11).
   Loads after web/tokens.css and legacy/app-aliases.css. Components come from the
   North Star kit (docs/web-app-mockups/v2/ns.css, Part 2); the product's existing
   components (bracket page, sheets, score sheet, notifications, /play, feed) are
   redrawn here on the same tokens until their phases rebuild them.
   ============================================================ */

/* bracket geometry, until B4's board replaces the tree */
:root { --match-w: 240px; --conn-w: 34px; --conn-thick: 2px; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.foos-app {
  margin: 0; min-height: 100vh;
  font-family: var(--font); font-stretch: var(--wdth-read); font-weight: 400;
  font-size: var(--fs-body); line-height: 1.5;
  color: var(--ink); background: var(--surface-0);
  font-synthesis: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* element resets carry no specificity, so every component class wins over them */
:where(.foos-app) :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin: 0; }
:where(.foos-app) p { text-wrap: pretty; }
:where(.foos-app) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.foos-app) button { background: none; border: 0; padding: 0; cursor: pointer; }
:where(.foos-app) a { color: inherit; text-decoration: none; }
:where(.foos-app) img { max-width: 100%; }
:where(.foos-app) time { font-variant-numeric: tabular-nums; }
.foos-app :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.foos-app ::selection { background: var(--highlight); color: var(--on-highlight); }
[hidden] { display: none !important; }

.visually-hidden, .vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nm, .team-nm { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Type roles (§2.1) ---------- */
.t-call, .t-score, .t-display, .t-stat, .t-headline, .t-figure, .t-name, .t-body, .t-meta, .t-plate {
  font-family: var(--font); font-style: normal;
}
.t-call     { font-stretch: var(--wdth-live); font-weight: 900; font-size: var(--fs-call);
              line-height: 0.88; letter-spacing: -0.01em; text-transform: uppercase; }
.t-score    { font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-score);
              line-height: 1; font-variant-numeric: tabular-nums; }
.t-display  { font-stretch: var(--wdth-name); font-weight: 800; font-size: var(--fs-display);
              line-height: 1; letter-spacing: -0.01em; }
.t-stat     { font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-stat);
              line-height: 1; font-variant-numeric: tabular-nums; }
.t-headline { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-headline); line-height: 1.1; }
.t-figure   { font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure);
              line-height: 1; font-variant-numeric: tabular-nums; }
.t-name     { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.t-body     { font-stretch: var(--wdth-read); font-weight: 400; font-size: var(--fs-body); line-height: 1.5; }
.t-meta     { font-stretch: var(--wdth-read); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; }
.t-plate    { font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1.2;
              text-transform: uppercase; letter-spacing: var(--track-plate); text-wrap: balance; }
.c-ink { color: var(--ink); } .c-ink-2 { color: var(--ink-2); } .c-live { color: var(--live); }
.c-win { color: var(--win); } .c-gold { color: var(--gold); } .c-alert { color: var(--alert); }

/* ---------- Icons (§2.4) ---------- */
.icon { display: block; width: 24px; height: 24px; flex: none; color: inherit; }
.icon--20 { width: 20px; height: 20px; }
.icon--16 { width: 16px; height: 16px; }

/* ---------- Wordmark (§2.1): FOOS APP set in type ---------- */
.wordmark {
  font-family: var(--font); font-stretch: var(--wdth-plate); font-weight: 800; font-size: 16px;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; white-space: nowrap; color: var(--ink);
}
.wordmark--20 { font-size: 20px; }

/* ---------- Buttons (§4 Controls). The old names map onto the kit's four. ---------- */
.btn {
  --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 20px; border-radius: var(--radius-control);
  font-family: var(--font); font-stretch: var(--wdth-read); font-weight: 600; font-size: 16px; line-height: 1;
  color: var(--btn-fg); background: transparent; border: 1.5px solid transparent;
  white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
  text-decoration: none; transition: transform var(--dur-press) ease-out;
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 20px; height: 20px; }
.btn--lg { height: var(--btn-h-lg); }
.btn--compact, .btn-sm { height: var(--tap); padding: 0 16px; font-size: 15px; }
.btn--block, .btn-block { display: flex; width: 100%; }
.btn--primary, .btn-primary { --btn-fg: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.btn--secondary, .btn-secondary { border-color: var(--line-strong); }
.btn--tertiary, .btn-ghost {
  height: auto; min-height: var(--tap); padding: 0; border: 0; border-radius: 0;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.btn--destructive, .btn-danger { --btn-fg: var(--alert); border-color: var(--line-strong); }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"], .btn.is-disabled { opacity: 0.4; pointer-events: none; }
.btn.is-busy, .btn[aria-busy="true"] { opacity: 1; pointer-events: none; cursor: progress; }
.btn--field-primary { --btn-fg: var(--field); background: var(--field-ink); border-color: var(--field-ink); }
.btn--field-secondary { --btn-fg: var(--field-ink); border-color: var(--field-ink); }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap); border-radius: var(--radius-control); color: var(--ink);
  -webkit-tap-highlight-color: transparent; transition: transform var(--dur-press) ease-out;
}
.icon-btn:active { transform: scale(0.97); }
.badge {
  position: absolute; top: 3px; left: 25px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: var(--radius-full);
  background: var(--ink); color: var(--on-ink);
  font-family: var(--font); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  letter-spacing: 0.04em; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface-0);
}

/* ---------- Inputs (§4) ---------- */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-weight: 600; font-size: var(--fs-meta); line-height: 1.35; color: var(--ink); }
.input {
  width: 100%; height: var(--btn-h); padding: 0 14px;
  background: var(--surface-1); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-control);
  font-family: var(--font); font-size: var(--fs-body); font-weight: 400;
}
.input::placeholder { color: var(--ink-2); opacity: 1; }
.input.is-error, .input[aria-invalid="true"] { border-color: var(--alert); }
.input-hint { font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; color: var(--ink-2); }
.input-error { font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; color: var(--alert); }
.input-error:empty { display: none; }
/* the sign-in code: its digits in Figure, spaced so they read as a code (§9.16) */
.input.input--code {
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure);
  font-variant-numeric: tabular-nums; letter-spacing: 0.3em;
}

/* ---------- Sign in (§9.16): /login, the sign-in sheet, inline ---------- */
.signin { display: flex; flex-direction: column; gap: 16px; }
.signin[hidden] { display: none; }
.signin__head { display: flex; flex-direction: column; gap: 6px; }
.signin__sub { color: var(--ink-2); }
.signin__links { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.signin__wait { color: var(--ink-2); }
.signin__links [hidden] { display: none; }
.signin > .btn--tertiary { align-self: center; }
.sheet-body > .signin-flow:first-child { padding-right: 0; }
.signin__head .t-headline { text-wrap: balance; }
.signin-flow--sheet .signin__head { padding-right: 40px; }
.login { width: 100%; max-width: 480px; margin: 0 auto; padding: 24px 0 40px; }
@media (min-width: 1024px) { .login { padding-top: 88px; } }

/* ---------- Plates, LIVE, the ball ---------- */
.plate, .pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px;
  border-radius: var(--radius-plate); background: var(--surface-2); color: var(--ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1;
  letter-spacing: var(--track-plate); text-transform: uppercase; white-space: nowrap;
}
.plate--gold, .pill.gold { color: var(--gold); }
.plate--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill.open { color: var(--win); }
.pill.soon, .pill.done { color: var(--ink-2); }
/* LIVE is a dot and a Plate in red, nothing else: no fill, no border (§2.2) */
.live, .pill.live {
  display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 0; background: none;
  color: var(--live); white-space: nowrap;
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1;
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.live-dot, .pill.live .dot {
  display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--live); animation: foos-pulse var(--dur-pulse) ease-in-out infinite;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ball { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.table-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border-radius: var(--radius-plate); background: var(--field); color: var(--field-ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1;
  letter-spacing: var(--track-plate); text-transform: uppercase; white-space: nowrap;
}
@keyframes foos-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Filter chips: a row of controls, the chosen one in ink */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; white-space: nowrap;
  border-radius: var(--radius-control); border: 1.5px solid var(--line-strong); background: transparent;
  color: var(--ink); font-weight: 600; font-size: var(--fs-meta); line-height: 1;
}
.chip.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* ---------- Avatars (§2.5): a photo or a monogram, never a colour ---------- */
.avatar {
  --av: 40px;
  position: relative; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: var(--av); height: var(--av); border-radius: 50%;
  background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font); font-stretch: var(--wdth-name); font-weight: 800;
  font-size: max(12px, calc(var(--av) * 0.4)); line-height: 1; letter-spacing: 0; text-transform: uppercase;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm, .avatar--32 { --av: 32px; }
.avatar.xs, .avatar--24 { --av: 24px; }
.avatar.lg, .avatar--64 { --av: 64px; }
.avatar--96 { --av: 96px; }
.avatar--you { outline: 2px solid var(--highlight); outline-offset: 2px; }
.avatar-stack { display: flex; flex-shrink: 0; }
.avatar-stack .avatar { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 2px var(--surface-1); }
.avatar-stack .avatar + .avatar { margin-left: -4px; }

.you {
  background: var(--highlight); color: var(--on-highlight); padding: 0 4px; border-radius: var(--radius-plate);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- Cards, sections, rows ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 16px; margin-bottom: 12px;
}
.card-tight { padding: 4px 16px; }
h1.page-title {
  font-family: var(--font); font-stretch: var(--wdth-name); font-weight: 800;
  font-size: var(--fs-display); line-height: 1; letter-spacing: -0.01em; margin: 8px 0 20px;
}
.section-label {
  display: flex; align-items: center; gap: 8px; min-height: 32px; margin: 24px 0 8px;
  color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  line-height: 1.2; letter-spacing: var(--track-plate); text-transform: uppercase;
}
.section-label .rule { flex: 1; }
.section-label .section-link {
  color: var(--ink); font-stretch: var(--wdth-read); font-weight: 500; font-size: var(--fs-meta);
  letter-spacing: 0; text-transform: none; text-decoration: underline; text-underline-offset: 3px;
}
.num, .stat .num {
  font-stretch: var(--wdth-live); font-weight: 800; font-variant-numeric: tabular-nums;
}
.row-item {
  display: flex; align-items: center; gap: 12px; min-height: var(--row-h); padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.row-sub { display: block; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; }
.row-item .pill { flex: 0 0 auto; }
.row-chev { color: var(--ink-2); }

.stat-band {
  display: flex; border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; background: var(--surface-1);
}
.stat { flex: 1; text-align: center; padding: 14px 6px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .num { font-size: var(--fs-stat); }
.stat .lbl {
  color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  letter-spacing: var(--track-plate); text-transform: uppercase;
}

/* ---------- Empty state (§2.3): the rod, a headline, a line, one action ---------- */
.empty {
  max-width: 320px; margin: 0 auto; padding: 32px 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.card.empty { max-width: none; padding: 32px 16px; }
.rod-empty { display: block; width: 160px; height: 40px; color: var(--line-strong); margin-bottom: 24px; }
.empty h2, .empty__title {
  font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-headline); line-height: 1.1;
  text-wrap: balance;
}
.empty p, .empty__sub {
  margin-top: 8px; max-width: 320px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35;
}
.empty .btn { margin-top: 20px; }
.empty .btn + .btn { margin-top: 8px; }

/* ---------- Skeletons: a flat surface that breathes, no shimmer gradient ---------- */
.skel { display: block; background: var(--surface-2); border-radius: var(--radius-control); animation: foos-breathe 1.6s ease-in-out infinite; }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.short { width: 45%; }
.skel-line.mid { width: 70%; }
@keyframes foos-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.live-patched { animation: foos-patch-flash 600ms var(--ease-out) 1; }
@keyframes foos-patch-flash { from { background-color: var(--surface-2); } to { background-color: transparent; } }

/* ============================================================
   THE SHELL (§3)
   ============================================================ */

.frame { min-height: 100vh; }
.frame__col { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* Header: 56px, wordmark left, search and bell right */
.app-header {
  position: sticky; top: 0; z-index: 50; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: var(--header-h); padding: 0 6px 0 16px;
  background: var(--surface-0); border-bottom: 1px solid var(--line);
}
.app-header__actions { display: flex; align-items: center; margin-left: auto; }
.app-header__signin { margin-right: 10px; }

/* Status strip: 40px under the header, only while the connection is down */
.strip {
  position: sticky; top: var(--header-h); z-index: 49; flex: none;
  display: flex; align-items: center; gap: 10px; min-height: var(--strip-h); padding: 8px 16px;
  background: var(--surface-2); color: var(--ink); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35;
}
.strip .icon { width: 20px; height: 20px; color: var(--ink-2); }
.strip__note { color: var(--ink-2); }

/* Content column */
.cols { flex: 1; min-width: 0; }
.shell { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 16px 16px 48px; }
.shell.wide { max-width: none; }
.shell.ctx-public, .shell.ctx-poster { max-width: none; padding: 0 0 48px; }

.site-legal {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 24px 16px 32px;
  color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35;
}
.site-legal a { text-decoration: underline; text-underline-offset: 3px; }

/* Tab bar: 64px, five tabs, the ball under the active label */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface-1); border-top: 1px solid var(--line);
}
.tabbar__item {
  position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center;
  padding-top: 6px; gap: 4px; color: var(--ink-2); -webkit-tap-highlight-color: transparent;
}
.tabbar__item .icon, .tabbar__item .avatar { width: 24px; height: 24px; }
.tabbar__item .avatar { --av: 24px; font-size: 12px; }
.tabbar__label {
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1;
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.foos-app .tabbar__item[aria-current="page"] { color: var(--ink); }
.tabbar__item[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; top: calc(6px + 24px + 4px + var(--fs-plate) + 4px);
  width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--ink);
}
/* the ball rolls between tabs on navigation (Roll motion); ball_roll_controller moves it */
.tabbar__ball {
  position: absolute; left: 0; top: calc(6px + 24px + 4px + var(--fs-plate) + 4px);
  width: 10px; height: 10px; border-radius: 50%; background: var(--ink); pointer-events: none;
}
.tabbar.is-rolling .tabbar__item[aria-current="page"]::after { visibility: hidden; }
.tabbar__ball.is-rolling { transition: transform var(--dur-roll) var(--ease-roll); }

body.foos-app.is-signed-in { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body.foos-app.is-signed-in.has-playbar { padding-bottom: calc(var(--tabbar-h) + var(--playbar-h) + env(safe-area-inset-bottom)); }

/* Nav rail (desktop only) */
.navrail { display: none; }

/* Tonight rail (≥1280 only) */
.tonight { display: none; }
.tonight__title {
  color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  line-height: 1.2; letter-spacing: var(--track-plate); text-transform: uppercase; margin-bottom: 8px;
}
.tonight__section { display: flex; flex-direction: column; }
.tonight__record { margin-top: 8px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.tonight .match-card { width: 100%; }
.tonight .match-card + .match-card { margin-top: 8px; }

/* Event card (§4): date block + name + venue */
.event-card {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--ink);
}
.event-card + .event-card { margin-top: 8px; }
.event-card__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event-card__name { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.event-card__meta { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; }
.date-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
  width: 56px; height: 64px; border-radius: var(--radius-control); background: var(--surface-2); color: var(--ink);
}
.date-block .t-stat { margin: 2px 0; }
.date-block--live { background: var(--field); color: var(--field-ink); }
.list-row {
  display: flex; align-items: center; gap: 12px; min-height: var(--row-h); padding: 8px 0;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.list-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row__title { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.list-row__meta { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; }

@media (min-width: 1024px) {
  body.foos-app.is-signed-in, body.foos-app.is-signed-in.has-playbar { padding-bottom: 0; }
  .tabbar { display: none; }

  .frame.has-nav { display: grid; grid-template-columns: var(--rail-nav) minmax(0, 1fr); }
  .navrail {
    position: sticky; top: 0; align-self: start; display: flex; flex-direction: column;
    height: 100vh; padding: 22px 16px 20px; background: var(--surface-0); border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .navrail .wordmark { font-size: 20px; padding: 6px 12px 26px; }
  .navrail__nav { display: flex; flex-direction: column; }
  .navrail__item {
    position: relative; display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 12px 0 32px;
    border-radius: var(--radius-control); color: var(--ink-2);
    font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2;
  }
  .navrail__item .icon { width: 20px; height: 20px; }
  .navrail__item .avatar { --av: 20px; font-size: 12px; }
  .foos-app .navrail__item[aria-current="page"] { color: var(--ink); }
  .navrail__item[aria-current="page"]::before {
    content: ""; position: absolute; left: 10px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
    border-radius: 50%; background: var(--ink);
  }
  .navrail__divider { height: 1px; background: var(--line); margin: 16px 12px; }
  .navrail__cta { margin: 0 12px; }
  .navrail__foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 0; }
  .navrail__foot a, .navrail__foot button {
    text-align: left; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; padding: 6px 0;
  }
  .navrail__foot form { margin: 0; }

  /* the rail carries the wordmark; the top bar keeps search and bell */
  .frame.has-nav .app-header__brand { display: none; }
  .app-header { padding: 0 16px 0 24px; }
  .shell { padding: 24px 24px 48px; }
}

@media (min-width: 1280px) {
  .cols.has-tonight {
    display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-tonight);
    grid-template-areas: "main bar" "main rail"; grid-template-rows: auto 1fr;
  }
  .cols.has-tonight::before { content: ""; grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--line); }
  .cols.has-tonight > .shell { grid-area: main; }
  .cols.has-tonight > .playbar { grid-area: bar; margin: 24px 24px 0; }
  .cols.has-tonight > .tonight {
    grid-area: rail; display: flex; flex-direction: column; gap: 24px; padding: 24px;
    position: sticky; top: var(--header-h); align-self: start;
  }
}

/* ---------- Play Bar (§9.3). B3 rebuilds it; B2 gives it the look ---------- */
.playbar {
  position: fixed; left: 0; right: 0; z-index: 55;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  height: var(--playbar-h); padding: 0 8px 0 16px;
  background: var(--surface-2); color: var(--ink); border-top: 1px solid var(--line);
}
.playbar .pulse { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.playbar .pb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.playbar .pb-kicker {
  color: var(--ink-2); white-space: nowrap; overflow: hidden;
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1.2;
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.playbar .pb-kicker:empty { display: none; }
.playbar .pb-line {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
  font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2;
}
.playbar .pb-btn {
  flex: none; display: inline-flex; align-items: center; height: var(--tap); padding: 0 16px;
  border-radius: var(--radius-control); background: var(--ink); color: var(--on-ink);
  font-weight: 600; font-size: 15px; line-height: 1;
}
.playbar .pb-chime {
  flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap);
  border-radius: var(--radius-control); color: var(--ink-2);
}
.playbar .pb-chime .icon { width: 20px; height: 20px; }
.playbar .pb-chime .pb-chime__on { display: none; }
.playbar .pb-chime[aria-pressed="true"] .pb-chime__on { display: block; }
.playbar .pb-chime[aria-pressed="true"] .pb-chime__off { display: none; }
/* You're up: the field */
.playbar.is-now { background: var(--field); color: var(--field-ink); border-top-color: var(--field); }
.playbar.is-now .pulse { background: var(--field-ink); }
.playbar.is-now .pb-kicker, .playbar.is-now .pb-line, .playbar.is-now .pb-chime { color: var(--field-ink); }
.playbar.is-now .pb-btn { background: var(--field-ink); color: var(--field); }
.playbar.is-now :focus-visible { outline-color: var(--field-ink); }
@media (min-width: 1024px) {
  .playbar {
    position: static; margin: 24px 24px 0; border-top: 0; border-radius: var(--radius-card);
  }
}
/* In the 320px Tonight column the line gets its own row; the action sits under it. */
@media (min-width: 1280px) {
  .cols.has-tonight > .playbar { flex-wrap: wrap; height: auto; padding: 12px 8px 12px 16px; row-gap: 12px; }
  .cols.has-tonight > .playbar .pb-text { flex: 1 1 calc(100% - 22px); }
  .cols.has-tonight > .playbar .pb-btn { flex: 1; justify-content: center; }
}

/* ---------- Toasts (§3): bottom-centre above the bars; desktop bottom-right ---------- */
.toast-dock {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 120;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
body.is-signed-in .toast-dock { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }
body.is-signed-in.has-playbar .toast-dock { bottom: calc(var(--tabbar-h) + var(--playbar-h) + env(safe-area-inset-bottom) + 16px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; min-height: 48px; max-width: 480px; padding: 12px 16px;
  background: var(--surface-1); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-control);
  font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; box-shadow: var(--shadow-1); text-align: left;
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--dur-slot) var(--ease-out), transform var(--dur-slot) var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }
.toast.error, .toast--error { border: 1.5px solid var(--alert); }
@media (min-width: 1024px) {
  .toast-dock, body.is-signed-in .toast-dock, body.is-signed-in.has-playbar .toast-dock {
    left: auto; right: 24px; bottom: 24px; align-items: flex-end; padding: 0;
  }
}

/* ============================================================
   MATCH TAKEOVER (§9.2 look; B3 rebuilds the moment)
   ============================================================ */
.takeover {
  position: fixed; inset: 0; z-index: 100;
  width: 100%; max-width: none; height: 100%; max-height: none;
  border: none; padding: 28px; margin: 0;
  background: var(--field); color: var(--field-ink);
  flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow-y: auto;
  --ink: var(--field-ink); --ink-2: var(--field-ink-2); --line: var(--field-line); --line-strong: var(--field-line);
  --surface-1: var(--field-deep); --surface-2: var(--field-deep); --on-ink: var(--field); --live: var(--field-live);
}
.takeover[open] { display: flex; }
.takeover::backdrop { background: var(--field); }
.takeover .glow { display: none; }
.takeover .kicker {
  display: flex; align-items: flex-start; gap: 10px; color: var(--field-ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1.2;
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.takeover .kicker .dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 0.1em; border-radius: 50%; background: var(--field-ink); }
.takeover h1 {
  font-stretch: var(--wdth-live); font-weight: 900; font-size: var(--fs-call); line-height: 0.88;
  letter-spacing: -0.01em; text-transform: uppercase; margin: 16px 0 8px;
}
.takeover .sub { color: var(--field-ink-2); font-size: var(--fs-body); max-width: 420px; }
.takeover .to-actions { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.takeover .to-more { margin-top: 14px; }
.takeover .btn-primary { --btn-fg: var(--field); background: var(--field-ink); border-color: var(--field-ink); }
.vs-card {
  width: 100%; max-width: 420px; margin: 24px 0; padding: 16px;
  background: var(--field-deep); border-radius: var(--radius-card); text-align: left;
}
.vs-card .vs-label {
  color: var(--field-ink-2); padding: 0 4px 6px;
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.vs-team { display: flex; align-items: center; gap: 12px; padding: 10px 4px; }
.vs-team .nm { flex: 1; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.vs-mid {
  display: flex; align-items: center; gap: 12px; color: var(--field-ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate);
}
.vs-mid .rule { flex: 1; height: 1px; background: var(--field-line); }
.takeover[open] .kicker, .takeover[open] h1, .takeover[open] .vs-card, .takeover[open] .to-actions {
  animation: foos-slot var(--dur-slot) var(--ease-snap) both;
}
.takeover[open] h1 { animation-name: foos-call-scale; animation-duration: var(--dur-call); }
@keyframes foos-slot { from { transform: translateY(-40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes foos-call-scale { from { transform: scale(1.06); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================
   /play (B3 rebuilds it as "Your night"; B2 gives it the look)
   ============================================================ */
.play-block {
  margin-top: 12px; padding: 16px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card);
}
.play-block.is-now { border: 1.5px solid var(--ink); }
.play-block .pb-title {
  margin-bottom: 8px; color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.play-block.is-now .pb-title { color: var(--ink); }
.opp-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opp-line .nm { flex: 1; min-width: 0; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; white-space: normal; }
.play-actions { display: flex; gap: 8px; margin-top: 12px; }
.play-actions .btn { flex: 1; }
.play-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta);
}
.play-foot .link { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.play-foot b { color: var(--ink); }
.play-attention { border: 1.5px solid var(--ink); }
.play-attention .pulse { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.day-cell { text-align: center; min-width: 52px; }
.day-cell .day {
  color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.day-cell .day.today { color: var(--ink); }
.day-cell .at { font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure); font-variant-numeric: tabular-nums; }
.medal {
  flex: none; min-width: 44px; color: var(--ink);
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure); font-variant-numeric: tabular-nums;
}
.medal.is-first { color: var(--gold); }

/* ============================================================
   HOME (B7 rebuilds it; B2 gives it the look)
   ============================================================ */
.feed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.feed-head .who { flex: 1; min-width: 0; }
.feed-head .name { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.feed-head .ctx { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.feed-media {
  position: relative; aspect-ratio: 3 / 2; margin: 10px 0; overflow: hidden;
  border-radius: var(--radius-card); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.feed-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-title { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; margin-bottom: 4px; }
.feed-body { color: var(--ink-2); font-size: var(--fs-body); }
.feed-footnote { text-align: center; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); padding: 8px 0 12px; }
.feed-footnote a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.feed-actions { display: flex; gap: 20px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); padding-top: 8px; }
.feed-actions span { display: flex; align-items: center; gap: 6px; }
.feed-actions .liked { color: var(--ink); }

/* Live Now: a row of tournament cards. Text never sits on a picture. */
.rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.live-tile {
  flex: none; min-width: 240px; max-width: 280px; min-height: 96px; padding: 12px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--ink);
}
.thumb-label { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.thumb-sub { color: var(--ink-2); font-stretch: var(--wdth-read); font-weight: 500; font-size: var(--fs-meta); }

/* ============================================================
   THE TOURNAMENT PAGE (B4 rebuilds it as the board; B2 gives it the look)
   ============================================================ */
.tourney-header { position: relative; display: grid; }
.tourney-header__main, .tourney-header__champ { grid-area: 1 / 1; }
.th-title { display: flex; align-items: flex-start; gap: 10px; }
.th-title h1 {
  flex: 1; min-width: 0; overflow-wrap: anywhere;
  font-stretch: var(--wdth-name); font-weight: 800; font-size: var(--fs-display); line-height: 1; letter-spacing: -0.01em;
}
.th-title .pill { flex: 0 0 auto; margin-top: 6px; }
.th-title .th-state { flex: 0 0 auto; margin-top: 6px; color: var(--ink-2); white-space: nowrap; }
.th-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; margin-top: 8px;
  color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35;
}
.th-meta a { min-width: 0; overflow-wrap: anywhere; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.th-meta .sep { color: var(--ink-2); }
.tourney-header .chip-row { flex-wrap: wrap; overflow: visible; margin-top: 12px; }
.tourney-header .chip {
  min-height: 24px; height: 24px; padding: 0 8px; border: 0; border-radius: var(--radius-plate);
  background: var(--surface-2); color: var(--ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.th-organizers { display: flex; align-items: center; gap: 9px; margin-top: 12px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.th-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 44px; align-items: center; }
.th-actions .btn { flex: 1 1 auto; }
@media (min-width: 1280px) {
  .tourney-header__main { display: flex; gap: 24px; align-items: center; }
  .th-block { flex: 1; min-width: 0; }
  .th-actions { margin-top: 0; flex: 0 0 auto; }
  .th-actions .btn { flex: 0 0 auto; }
}

/* Your line (§9.4) */
.your-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.yl-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.yl-text { flex: 1; min-width: 180px; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.yl-sub { display: block; margin-top: 2px; color: var(--ink-2); font-stretch: var(--wdth-read); font-weight: 500; font-size: var(--fs-meta); line-height: 1.35; }
.yl-actions { display: flex; gap: 8px; flex-shrink: 0; }
.your-line.is-now { border: 1.5px solid var(--ink); }
.your-line.is-now .yl-dot, .your-line.is-deck .yl-dot { background: var(--ink); }
.your-line.is-waiting .yl-dot { background: var(--ink-2); }

.bracket-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }

/* The trees: round columns with 2px right-angled connectors */
.bracket-viewport { position: relative; width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 2px 0 12px; }
.bracket-grid {
  display: flex; align-items: stretch; min-width: max-content;
  transform: scale(var(--bracket-scale, 1)); transform-origin: top left;
}
.bracket-round { display: flex; flex-direction: column; flex: 0 0 auto; }
.bracket-round__header {
  position: sticky; left: 0; padding: 10px 0; text-align: center; white-space: nowrap; color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.bracket-round__matches { display: flex; flex-direction: column; flex: 1; justify-content: space-around; }
.bracket-match-wrapper { position: relative; flex: 1; display: flex; align-items: center; justify-content: flex-start; min-height: 0; }
.bracket-round--first .bracket-match-wrapper { flex: 1 0 auto; padding: 6px 0; }
.bracket-match-wrapper .match-card { flex-shrink: 0; position: relative; z-index: 2; }
.connector--in { flex-shrink: 0; width: var(--conn-w); height: var(--conn-thick); background: var(--conn-line); }
.connector--out { position: relative; flex-shrink: 0; width: var(--conn-w); height: 100%; }
.connector__h { position: absolute; left: 0; top: 50%; width: 100%; height: var(--conn-thick); background: var(--conn-line); transform: translateY(-50%); }
.bracket-match--odd .connector__v { position: absolute; right: 0; top: 50%; width: var(--conn-thick); height: calc(50% + 1px); background: var(--conn-line); }
.bracket-match--even .connector__v { position: absolute; right: 0; bottom: 50%; width: var(--conn-thick); height: calc(50% + 1px); background: var(--conn-line); }
.bracket-match-wrapper:only-child .connector__v { display: none; }

/* The match card (§4.2) */
.match-card {
  display: block; width: var(--match-w); padding: 0; text-align: left; color: var(--ink);
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card);
  overflow: hidden; transition: transform var(--dur-press) ease-out;
}
button.match-card:active { transform: scale(0.985); }
.mc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 32px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); line-height: 1;
  letter-spacing: var(--track-plate); text-transform: uppercase; white-space: nowrap;
}
.mc-label { min-width: 0; overflow: hidden; text-overflow: clip; }
.mc-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.mc-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mc-live { color: var(--live); }
.mc-live .dot { background: var(--live); animation: foos-pulse var(--dur-pulse) ease-in-out infinite; }
.mc-void { color: var(--alert); }
.mc-teams { display: block; }
.mc-team { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 12px; }
.mc-team + .mc-team { border-top: 1px solid var(--line); }
.mc-seed {
  flex: 0 0 16px; width: 16px; text-align: center; color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); font-variant-numeric: tabular-nums;
}
.mc-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2;
}
.mc-name.is-tbd { color: var(--ink-2); font-stretch: var(--wdth-read); font-weight: 500; font-size: var(--fs-meta); }
.mc-g {
  flex: 0 0 24px; width: 24px; text-align: center; color: var(--ink-2);
  font-stretch: var(--wdth-name); font-weight: 800; font-size: var(--fs-figure); line-height: 1; font-variant-numeric: tabular-nums;
}
.mc-g.is-won { color: var(--ink); }
.mc-w {
  flex: 0 0 24px; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: var(--radius-plate); background: var(--ink); color: var(--on-ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
}
.mc-forfeit { flex: 0 0 auto; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.mc-you, .mc-iron {
  display: inline-flex; align-items: center; height: 20px; margin-left: 6px; padding: 0 6px; vertical-align: 0.1em;
  border-radius: var(--radius-plate); background: var(--surface-2); color: var(--ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: 11px; letter-spacing: var(--track-plate); text-transform: uppercase;
}
.mc-you { background: var(--highlight); color: var(--on-highlight); }
.mc-team.loss .mc-name { color: var(--ink-2); font-weight: 500; }
.mc-team.win .mc-name { color: var(--ink); }
.match-card.is-ghost .mc-teams, .match-card.is-void .mc-teams { opacity: 0.5; }
.match-card.is-bye .mc-teams { opacity: 0.65; }
.match-card.your-match { border-color: var(--ink); box-shadow: 0 0 0 0.5px var(--ink); }
.match-card.is-found { box-shadow: 0 0 0 2px var(--ink); }

/* Grand Finals panel */
.gf-panel { padding: 16px; background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: var(--radius-card); color: var(--ink); }
.gf-legs { display: flex; flex-wrap: wrap; gap: 12px; }
.gf-leg { min-width: 0; }
.gf-reset-note {
  margin-bottom: 12px; padding: 10px 12px; background: var(--surface-2); color: var(--ink);
  border-radius: var(--radius-control); font-weight: 600; font-size: var(--fs-meta);
}
@media (min-width: 900px) { .gf-panel { max-width: 800px; margin-left: auto; margin-right: auto; } }

/* Match grids (round robin, qualifying) */
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.match-grid .match-card { width: 100%; }
@media (max-width: 520px) { .match-grid { grid-template-columns: 1fr; } }
.byes-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.byes-strip .byes-label { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.byes-strip .chip { min-height: 24px; padding: 0 8px; border: 0; background: var(--surface-2); border-radius: var(--radius-plate); font-size: var(--fs-plate); }
.rounds-collapse > summary, .roster-more > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none;
  color: var(--ink); font-weight: 600; font-size: var(--fs-meta); text-decoration: underline; text-underline-offset: 3px;
}
.rounds-collapse > summary::-webkit-details-marker, .roster-more > summary::-webkit-details-marker { display: none; }
.rounds-collapse > summary::before, .roster-more > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--dur-slot) var(--ease-out);
}
.rounds-collapse[open] > summary::before, .roster-more[open] > summary::before { transform: rotate(45deg); }

/* Standings table (§4.7) */
.stand-wrap { overflow-x: auto; max-height: 520px; overflow-y: auto; }
.stand-table { width: 100%; border-collapse: collapse; font-size: var(--fs-meta); }
.stand-table thead th {
  position: sticky; top: 0; z-index: 1; padding: 8px 10px; text-align: left;
  background: var(--surface-1); color: var(--ink-2); border-bottom: 1px solid var(--line);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.stand-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.stand-table tbody tr:last-child td { border-bottom: none; }
.stand-table th.num, .stand-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.stand-table td.rank {
  width: 42px; text-align: center; color: var(--ink);
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure); font-variant-numeric: tabular-nums;
}
.stand-table td.who { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); }
.stand-table td.num.strong { font-weight: 800; }
.stand-table tr.is-advancing td:first-child { box-shadow: inset 3px 0 0 var(--win); }
.stand-table tr.is-you td { background: var(--surface-2); }
.stand-table tr.is-you td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
.stand-table tr.is-out td { color: var(--ink-2); }
.stand-table tr.is-out td.who { font-weight: 500; }
.tag {
  display: inline-flex; align-items: center; height: 20px; margin-left: 6px; padding: 0 6px; white-space: nowrap;
  border-radius: var(--radius-plate); background: var(--surface-2); color: var(--ink);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: 11px; letter-spacing: var(--track-plate); text-transform: uppercase;
}
.tag-adv { color: var(--win); }
.tag-out { color: var(--ink-2); }
.tag-you { background: var(--highlight); color: var(--on-highlight); }

/* Below-tree sections */
.rank-cell {
  flex: 0 0 36px; text-align: center; color: var(--ink);
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure); font-variant-numeric: tabular-nums;
}
.standings-group {
  margin: 0; padding: 16px 0 4px; color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.standings-group:first-child { padding-top: 4px; }
.row-item.is-out .row-title { color: var(--ink-2); font-weight: 500; }
.podium-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 16px; }
.podium-cell {
  flex: 1; min-width: 0; text-align: center; padding: 16px 8px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card);
}
.podium-cell.place-1 { order: 2; padding: 20px 10px; border: 1.5px solid var(--gold-fill); }
.podium-cell.place-2 { order: 1; }
.podium-cell.place-3 { order: 3; }
.podium-cell .medal-label {
  color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate);
  letter-spacing: var(--track-plate); text-transform: uppercase;
}
.podium-cell.place-1 .medal-label { color: var(--gold); }
.podium-cell .who { margin-top: 6px; overflow-wrap: anywhere; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
.podium-cell .pts { margin-top: 4px; font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-figure); font-variant-numeric: tabular-nums; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.fact {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card);
}
.fact .lbl { color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase; }
.fact .val { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2; }
@media (min-width: 1280px) {
  .below-tree-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

/* ============================================================
   SHEETS (§9.5): a bottom sheet on a phone, a centred 480px dialog from 1024px
   ============================================================ */
.sheet-dialog {
  position: fixed; inset: auto 0 0 0; z-index: 130;
  width: 100%; max-width: 100%; margin: 0; max-height: 92dvh; padding: 0;
  border: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--surface-1); color: var(--ink); box-shadow: var(--shadow-2); overflow: hidden;
}
.sheet-dialog[open] { display: flex; flex-direction: column; animation: foos-sheet-in var(--dur-sheet-in) var(--ease-out) both; }
.sheet-dialog::backdrop { background: var(--scrim); }
.sheet-dialog.is-closing { animation: none; transform: translateY(105%); transition: transform var(--dur-sheet-out) var(--ease-in); }
.sheet-dialog.is-shaking { animation: foos-shake 200ms var(--ease-out) 1; }
.sheet-grab { position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-strong); }
.sheet-close {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-1); color: var(--ink);
}
.sheet-close:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.sheet-body {
  display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-body > :first-child, .sheet-body .ss-head { padding-right: 40px; }
.notif-sheet .sheet-body > turbo-frame { padding-right: 0; }
@keyframes foos-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes foos-dialog-in { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes foos-shake {
  0% { transform: translateX(0); } 20% { transform: translateX(-6px); } 45% { transform: translateX(6px); }
  70% { transform: translateX(-4px); } 100% { transform: translateX(0); }
}
@media (min-width: 1024px) {
  .sheet-dialog {
    inset: 0; margin: auto; height: fit-content; width: 480px; max-width: calc(100vw - 32px); max-height: 88vh;
    border: 1px solid var(--line); border-radius: var(--radius-card);
  }
  .sheet-dialog[open] { animation: foos-dialog-in var(--dur-slot) var(--ease-out) both; }
  .sheet-dialog.is-closing { transform: scale(0.97); opacity: 0; transition: transform var(--dur-sheet-out) var(--ease-in), opacity var(--dur-sheet-out) var(--ease-in); }
  .sheet-grab { display: none; }
  .sheet-body { padding: 20px; }
}

/* Notifications (§9.1): a sheet on a phone, a 400px popover under the bell on desktop */
.notif-head { display: flex; align-items: center; gap: 12px; min-height: 32px; margin-bottom: 8px; padding-right: 40px; }
.notif-title { flex: 1; margin: 0; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-headline); line-height: 1.1; }
.notif-mark-form { margin: 0; }
.notif-mark {
  min-height: 44px; padding: 0 4px; color: var(--ink); font-weight: 600; font-size: var(--fs-meta);
  text-decoration: underline; text-underline-offset: 3px;
}
.notif-rows { list-style: none; margin: 0 -16px; padding: 0; }
.notif-row { position: relative; border-top: 1px solid var(--line); }
.notif-row:first-child { border-top: none; }
.notif-form { margin: 0; }
.notif-link {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 64px;
  padding: 12px 16px 12px 24px; text-align: left; color: var(--ink);
}
.notif-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.notif-link.is-static { cursor: default; }
.notif-glyph { flex: 0 0 20px; margin-top: 1px; color: var(--ink-2); }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-sentence {
  font-size: var(--fs-body); line-height: 1.35; font-weight: 400;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-time { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.notif-row.is-unread .notif-sentence { font-weight: 600; }
.notif-row.is-unread::before { content: ""; position: absolute; left: 9px; top: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.notif-empty { text-align: center; max-width: 320px; margin: 24px auto 8px; }
.notif-empty-title { font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-headline); line-height: 1.1; margin: 0 0 8px; }
.notif-empty-sub { color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); margin: 0; }
.notif-page { max-width: 560px; margin: 0 auto; }
.notif-page .notif-rows { margin: 0; }
@media (min-width: 1024px) {
  .notif-sheet { inset: calc(var(--header-h) + 4px) 16px auto auto; margin: 0; width: 400px; max-height: 70vh; }
  .notif-sheet::backdrop { background: transparent; }
  .notif-sheet .sheet-body { padding: 16px; }
}

/* ---------- Score sheet (§9.5 look; B3 rebuilds it as the Tally) ---------- */
.ss-head { display: flex; align-items: center; gap: 10px; }
.ss-head h3 { flex: 1; min-width: 0; margin: 0; font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-headline); line-height: 1.1; }
.ss-format { margin: 4px 0 8px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.ss-status { margin: 4px 0 12px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.ss-note, .ss-by { margin-top: 12px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.ss-games { margin-top: 12px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); font-variant-numeric: tabular-nums; }
.ss-skeleton { display: grid; gap: 10px; padding: 6px 0 4px; }
.ss-error {
  display: block; margin: 0 0 12px; padding: 10px 12px;
  border: 1.5px solid var(--alert); border-radius: var(--radius-control); color: var(--alert);
  font-weight: 500; font-size: var(--fs-meta); line-height: 1.35;
}
.score-teams { display: grid; gap: 8px; }
.score-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 16px; text-align: left;
  background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: var(--radius-control);
  transition: transform var(--dur-press) ease-out;
}
button.score-row:active { transform: scale(0.97); }
.score-row .team {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-stretch: var(--wdth-name); font-weight: 700; font-size: var(--fs-name); line-height: 1.2;
}
.score-row.winner { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.score-row.is-loss .team { color: var(--ink-2); font-weight: 500; }
.score-row .tally {
  min-width: 30px; text-align: right;
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-stat); line-height: 1; font-variant-numeric: tabular-nums;
}
.pick-mark {
  position: relative; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--line-strong);
}
.score-pick.winner .pick-mark { background: var(--on-ink); box-shadow: none; }
.score-pick.winner .pick-mark::after {
  content: ""; position: absolute; left: 10px; top: 6px; width: 6px; height: 11px;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg);
}
.score-games { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 8px 12px; align-items: center; margin-top: 16px; }
.score-games.is-single { grid-template-columns: 1fr 1fr; }
.score-games .sg-head {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: var(--ink-2);
  font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); text-transform: uppercase;
}
.sg-row { display: contents; }
.sg-label { color: var(--ink-2); font-stretch: var(--wdth-plate); font-weight: 700; font-size: var(--fs-plate); letter-spacing: var(--track-plate); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 8px; }
.st-btn {
  display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-control); color: var(--ink);
  font-stretch: var(--wdth-live); font-weight: 800; font-size: 20px; line-height: 1;
  transition: transform var(--dur-press) ease-out;
}
.st-btn:active { transform: scale(0.97); }
.st-val {
  width: 46px; min-width: 30px; text-align: center; background: transparent; border: none; color: var(--ink);
  font-stretch: var(--wdth-live); font-weight: 800; font-size: var(--fs-stat); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.st-val::-webkit-outer-spin-button, .st-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.is-popping { animation: foos-pop-scale var(--dur-slot) var(--ease-out) 1; }
@keyframes foos-pop-scale { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.ss-actions { margin-top: 16px; }
.ss-body .btn-block + .btn-block { margin-top: 8px; }
.score-conflict { padding: 16px; background: var(--surface-2); border-radius: var(--radius-card); }
.score-conflict .sc-copy { margin: 12px 0; font-weight: 600; font-size: var(--fs-meta); }
.ss-mini { display: flex; justify-content: center; }
.ss-mini .match-card { width: 100%; max-width: var(--match-w); }
.score-admin { margin-top: 16px; border-top: 1px solid var(--line); }
.score-admin > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none;
  color: var(--ink); font-weight: 600; font-size: var(--fs-meta);
}
.score-admin > summary::-webkit-details-marker { display: none; }
.admin-grid, .admin-picker, .admin-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-confirm { padding: 10px 0 4px; }
.admin-confirm-copy { margin-bottom: 10px; font-weight: 600; font-size: var(--fs-meta); }
.admin-note { margin-top: 10px; color: var(--ink-2); font-weight: 500; font-size: var(--fs-meta); }
.match-card.is-just-saved .mc-team.win { animation: foos-row-win 600ms var(--ease-out) 1; }
.match-card.is-just-saved .mc-g { animation: foos-pop-scale var(--dur-slot) var(--ease-out) 1; }
@keyframes foos-row-win { from { background-color: var(--surface-2); } to { background-color: transparent; } }

/* ============================================================
   Reduced motion: Pulse stops, transforms become fades or nothing
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .live-dot, .pill.live .dot, .mc-live .dot, .skel, .live-patched { animation: none; }
  .btn:active, .icon-btn:active, .st-btn:active, button.match-card:active, button.score-row:active { transform: none; }
  .tabbar__ball.is-rolling { transition: none; }
  .takeover[open] .kicker, .takeover[open] h1, .takeover[open] .vs-card, .takeover[open] .to-actions { animation: foos-fade 120ms linear both; }
  .sheet-dialog[open] { animation: foos-fade 120ms linear both; }
  .sheet-dialog.is-closing { transform: none; opacity: 0; transition: opacity 120ms linear; }
  .sheet-dialog.is-shaking, .is-popping, .match-card.is-just-saved .mc-team.win, .match-card.is-just-saved .mc-g { animation: none; }
  .toast { transform: none; }
}
@keyframes foos-fade { from { opacity: 0; } to { opacity: 1; } }
