/* ─────────────────────────────────────────────────────────────────────────
   Public Tournament Viewer (#tournament/{uuid}) — the spectator event page.
   Markup: scripts/tournament-viewer.js. Mobile-first, RTL-safe (logical
   properties only), built on tokens.css.

   Composition: one centred event column (max 1240px). A deep-green hero is
   the page's single bold element (title, live state, current round with
   round progress, live board counts); below it a segmented Games /
   Standings control, then an auto-fill grid of equal match tiles or a
   centred leaderboard. Everything else stays quiet: white tiles, soft
   borders, Keelo green only for live state and winners.
   ───────────────────────────────────────────────────────────────────────── */

/* Present whenever this sheet is applied; app.js checks it and loads the
   sheet itself if a stale cached index.html lacks the <link>. */
:root { --tv-viewer-css: 1; }

.tv-page {
  --tv-hero-bg:    var(--green-hero);
  --tv-hero-ink:   #FAF8F2;
  --tv-hero-muted: rgba(250, 248, 242, 0.70);
  --tv-hero-line:  rgba(250, 248, 242, 0.16);
  --tv-live:       #FF6B57;
  --tv-gold:       #C9962B;
  --tv-silver:     #9AA1A8;
  --tv-bronze:     #B87445;
  --tv-gutter:     clamp(16px, 3.5vw, 40px);

  box-sizing: border-box;
  width: 100%;
  max-width: calc(1240px + 2 * var(--tv-gutter));
  margin-inline: auto;
  padding-inline: var(--tv-gutter);
  padding-block: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.tv-page *,
.tv-page *::before,
.tv-page *::after { box-sizing: border-box; }

/* ── Live pulse (hero status, toolbar note) ── */
.tv-pulse {
  position: relative;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--tv-live);
  flex: 0 0 auto;
}
.tv-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: tvPulse 1.8s ease-out infinite;
}
@keyframes tvPulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* ── Hero ── */
.tv-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--tv-hero-bg);
  color: var(--tv-hero-ink);
  box-shadow: var(--shadow-lg);
}
/* A board's worth of squares, fading out from the far corner. */
.tv-hero::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  inline-size: min(460px, 70%);
  background: repeating-conic-gradient(rgba(250, 248, 242, 0.07) 0 25%, transparent 0 50%) 0 0 / 36px 36px;
  /* Opaque at the hero's inline-end edge, fading toward its centre. */
  -webkit-mask-image: linear-gradient(to right, #000, transparent 85%);
  mask-image: linear-gradient(to right, #000, transparent 85%);
  pointer-events: none;
}
[dir="ltr"] .tv-hero::before {
  -webkit-mask-image: linear-gradient(to left, #000, transparent 85%);
  mask-image: linear-gradient(to left, #000, transparent 85%);
}
.tv-hero > * { position: relative; min-width: 0; }
.tv-hero--completed,
.tv-hero--cancelled { --tv-hero-bg: #24372B; }

.tv-hero-main { display: flex; flex-direction: column; gap: var(--space-3); justify-content: center; }
.tv-hero-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tv-hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(250, 248, 242, 0.12);
  border: 1px solid var(--tv-hero-line);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.tv-hero-format {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tv-hero-muted);
}
.tv-hero .tv-title {
  margin: 0;
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--tv-hero-ink);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.tv-hero-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--tv-hero-muted);
  font-size: var(--text-sm);
}
.tv-hero-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.tv-hero-meta-item svg { inline-size: 15px; block-size: 15px; stroke: currentColor; flex: 0 0 auto; }
/* Manage entry — only rendered for a viewer the manager route admits
   (app.js tvLoadManageAccess). */
.tv-manage-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--tv-hero-line);
  background: rgba(250, 248, 242, 0.12);
  color: var(--tv-hero-ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}
.tv-manage-btn:hover { background: rgba(250, 248, 242, 0.2); }
.tv-manage-btn:focus-visible { outline: 2px solid var(--tv-hero-ink); outline-offset: 2px; }
.tv-manage-btn svg { inline-size: 15px; block-size: 15px; stroke: currentColor; flex: 0 0 auto; }

/* Side panel: current round + board counts. */
.tv-hero-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--tv-hero-line);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.tv-hero-stat-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tv-hero-muted);
}
.tv-hero-round-num { display: flex; align-items: baseline; gap: 8px; margin-block: 2px 10px; }
.tv-hero-round-num b {
  font-size: 3.2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.tv-hero-round-num span { font-size: var(--text-md); color: var(--tv-hero-muted); font-weight: 600; }

.tv-progress { display: flex; gap: 4px; }
.tv-progress-seg {
  flex: 1 1 0;
  block-size: 6px;
  border-radius: var(--radius-pill);
  background: rgba(250, 248, 242, 0.18);
}
.tv-progress-seg.is-done { background: rgba(250, 248, 242, 0.75); }
.tv-progress-seg.is-current { background: var(--green-cta); box-shadow: 0 0 0 3px rgba(34, 168, 81, 0.25); }
.tv-progress--bar { block-size: 6px; border-radius: var(--radius-pill); background: rgba(250, 248, 242, 0.18); overflow: hidden; }
.tv-progress--bar span { display: block; block-size: 100%; background: rgba(250, 248, 242, 0.75); border-radius: inherit; }

.tv-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--tv-hero-line);
  padding-top: var(--space-3);
}
.tv-hero-stat { display: flex; flex-direction: column; gap: 2px; padding-inline: 4px; }
.tv-hero-stat + .tv-hero-stat { border-inline-start: 1px solid var(--tv-hero-line); padding-inline-start: 12px; }
.tv-hero-stat b { font-size: 1.5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tv-hero-stat span { font-size: var(--text-xs); color: var(--tv-hero-muted); font-weight: 600; }
.tv-hero-stat.is-live b { color: #7BE3A0; }

.tv-hero-winner { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--tv-hero-line); padding-top: var(--space-3); }
.tv-hero-winner svg { inline-size: 28px; block-size: 28px; stroke: #F2C94C; flex: 0 0 auto; }
.tv-hero-winner b { display: block; font-size: var(--text-md); font-weight: 800; overflow-wrap: anywhere; }

/* ── Toolbar: segmented Games / Standings + live note ── */
.tv-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.tv-segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunk);
  border: 1px solid var(--border-soft);
}
.tv-seg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--muted);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tv-seg:hover { color: var(--text-strong); }
.tv-seg.is-active { background: var(--card); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.tv-seg:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.tv-seg-count {
  min-inline-size: 22px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(20, 20, 20, 0.06);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.tv-seg.is-active .tv-seg-count { background: var(--green-lite); color: var(--green-dark); }
.tv-live-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}

.tv-panel { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.tv-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.tv-section-head h2 { margin: 0; font-size: var(--text-md); font-weight: 800; color: var(--text-strong); }

/* ── Chips (.mgmt-badge hook, restyled for this light page) ── */
.tv-page .mgmt-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.tv-page .mgmt-badge .live-dot { inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; animation: tvBlink 1.6s ease-in-out infinite; }
@keyframes tvBlink { 50% { opacity: 0.3; } }
.tv-page .mgmt-badge.green { background: var(--green-lite); color: var(--green-dark); }
.tv-page .mgmt-badge.gray  { background: var(--bg-sunk); color: var(--muted); }
.tv-page .mgmt-badge.amber { background: #FCF1DC; color: #8A5E0E; }
.tv-page .mgmt-badge.red   { background: #FDE8E5; color: #C4321F; letter-spacing: 0.06em; }
.tv-page .mgmt-badge.blue  { background: #E6F1FA; color: var(--blue); }

/* ── Match tiles ── */
.tv-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}
.tv-game {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.tv-game:hover { box-shadow: var(--shadow-md); }
.tv-game--active { border-color: rgba(20, 122, 61, 0.35); box-shadow: 0 0 0 3px var(--green-tint), var(--shadow-sm); }
.tv-game--bye,
.tv-game--unplayed { background: var(--card-tint); }

.tv-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px 16px 10px;
}
.tv-game-board { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.tv-game-board b {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.tv-game-body {
  display: flex;
  flex-direction: column;
  margin: 0 10px 10px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border-soft);
}
.tv-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 2.6em;
  align-items: center;
  column-gap: 12px;
  min-block-size: 48px;
  padding-inline: 12px 8px;
}
.tv-player + .tv-player { border-top: 1px solid var(--border-soft); }
.tv-piece {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  border: 1.5px solid #1F1F1F;
}
.tv-piece--white { background: #FFFFFF; }
.tv-piece--black { background: #1F1F1F; }
.tv-name {
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Isolated so a Latin name can't reorder the row, while staying aligned
     with the page direction. */
  unicode-bidi: isolate;
}
/* Score box; scores like "2½" isolated LTR so RTL never shows "½2". */
.tv-pts {
  display: grid;
  place-items: center;
  block-size: 32px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  direction: ltr;
  unicode-bidi: isolate;
}
.tv-pts:empty::before { content: '–'; color: var(--faint); font-weight: 600; }
.tv-player.is-won .tv-name { font-weight: 800; color: var(--text-strong); }
.tv-player.is-won .tv-pts { background: var(--green-lite); color: var(--green-dark); }
.tv-player.is-lost .tv-name,
.tv-player.is-lost .tv-pts { color: var(--faint); }
.tv-game--final .tv-player:not(.is-won):not(.is-lost) .tv-pts { background: var(--bg-sunk); }
.tv-game--bye .tv-name,
.tv-game--unplayed .tv-name { color: var(--muted); }
.tv-game--bye .tv-pts:empty::before { content: ''; }

/* Broadcast footer — part of the tile, never louder than the players. */
.tv-game-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: auto;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border-soft);
}
.tv-watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  min-block-size: 34px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
  transition: background var(--dur-fast) var(--ease-out);
}
.tv-watch-btn svg { inline-size: 14px; block-size: 14px; stroke: currentColor; fill: currentColor; }
.tv-watch-btn:hover { background: var(--green-dark); }
.tv-watch-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* Share the game's watch link: a quiet round button beside Watch. */
.tv-watch-actions { display: inline-flex; align-items: center; gap: 6px; }
.tv-share-btn {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  color: var(--green);
  transition: background var(--dur-fast) var(--ease-out);
}
.tv-share-btn { background: var(--green-tint); border: 1px solid var(--green-lite); }
.tv-share-btn svg { inline-size: 16px; block-size: 16px; stroke: currentColor; fill: none; }
.tv-share-btn:hover { background: var(--green-lite); }
.tv-share-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* Copied (tvShareConfirm): the round button becomes a "✓ Link copied" pill. */
.tv-share-btn.is-copied {
  inline-size: auto;
  display: inline-flex;
  gap: 6px;
  padding-inline: 12px;
  border-radius: var(--radius-pill);
  background: var(--green);
  border-color: var(--green);
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  animation: tvShareCopied var(--dur-normal) var(--ease-out);
}
.tv-share-btn.is-copied svg { inline-size: 14px; block-size: 14px; }
@keyframes tvShareCopied { from { transform: scale(0.92); } }
@media (prefers-reduced-motion: reduce) {
  .tv-share-btn.is-copied,
  .tv-stream-btn.is-copied { animation: none; }
}

/* ── Team Round Robin: one panel per team match ── */
/* Match panels side by side (2 across on desktop); each match's boards
   stack in one column, so a 1–2-board match never leaves an empty row. */
.tv-matches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
  gap: 16px;
  align-items: start;
}
.tv-match .tv-games { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tv-match {
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  background: var(--bg-sunk);
  border: 1px solid var(--border-soft);
}
.tv-match-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding: 4px 8px 12px;
}
.tv-team { font-size: var(--text-md); font-weight: 800; color: var(--text-strong); overflow-wrap: anywhere; }
.tv-team:last-child { text-align: end; }
.tv-team.is-won { color: var(--green-dark); }
.tv-match-score {
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: var(--text-md);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tv-match-note { text-align: center; color: var(--muted); font-size: var(--text-sm); padding: var(--space-2) 0 var(--space-3); }

/* ── Standings ── */
.tv-board-card {
  inline-size: 100%;
  max-inline-size: 880px;
  margin-inline: auto;
  padding: var(--space-4) var(--space-4) var(--space-2);
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.tv-standings .tv-section-head { padding-inline: 4px; margin-bottom: var(--space-3); }
.tv-podium {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.tv-podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-3) 8px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border: 1px solid var(--border-soft);
  text-align: center;
  min-width: 0;
}
.tv-podium-place b { font-size: var(--text-base); font-weight: 800; color: var(--text-strong); overflow-wrap: anywhere; }
.tv-podium-place--1 { background: var(--green-tint); border-color: var(--green-lite); order: 2; padding-block: var(--space-4); }
.tv-podium-place--2 { order: 1; }
.tv-podium-place--3 { order: 3; }
.tv-podium-pts { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.tv-num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.tv-table-wrap { overflow-x: auto; }
.tv-standings-table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-base); }
.tv-standings-table th {
  padding: 0 10px 10px;
  text-align: start;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tv-standings-table td {
  padding: 11px 10px;
  border-top: 1px solid var(--border-soft);
  color: var(--text);
  white-space: nowrap;
}
.tv-standings-table tbody tr:hover td { background: var(--card-tint); }
.tv-standings-table tr.top3 td { background: rgba(240, 247, 242, 0.65); }
.tv-col-rank { inline-size: 3em; text-align: center !important; }
.tv-col-name { white-space: normal !important; font-weight: 600; min-width: 8em; }
.tv-standings-table tr.top3 .tv-col-name { font-weight: 800; color: var(--text-strong); }
.tv-col-num { text-align: end !important; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .tv-col-num { text-align: left !important; }
.tv-standings-table td.tv-col-num { color: var(--muted); }
.tv-standings-table td.tv-col-pts { color: var(--text-strong); font-weight: 800; font-size: 1.05rem; }
.tv-rank {
  display: inline-grid;
  place-items: center;
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tv-rank.is-gold   { background: var(--tv-gold);   color: #FFFFFF; }
.tv-rank.is-silver { background: var(--tv-silver); color: #FFFFFF; }
.tv-rank.is-bronze { background: var(--tv-bronze); color: #FFFFFF; }

/* ── Empty / loading / error ── */
.tv-empty,
.tv-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  inline-size: 100%;
  max-inline-size: 880px;
  margin-inline: auto;
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--muted);
}
.tv-empty svg,
.tv-state svg { inline-size: 28px; block-size: 28px; stroke: currentColor; }
.tv-empty p,
.tv-state p { margin: 0; }
.tv-state-title { margin: 0; font-size: var(--text-md); color: var(--text-strong); }
.tv-state-btn { max-width: 280px; margin-top: var(--space-2); }
.tv-state.is-loading { border: none; background: none; min-block-size: 50vh; justify-content: center; }
.tv-spinner {
  inline-size: 36px;
  block-size: 36px;
  border-radius: 50%;
  border: 3px solid var(--green-tint);
  border-top-color: var(--green);
  animation: tvSpin 0.8s linear infinite;
}
@keyframes tvSpin { to { transform: rotate(360deg); } }

/* ── Entry points (public card + details sheet) ── */
.tourn-project-btn.tv-entry-btn { color: var(--green-dark); }
.tv-entry-btn--sheet {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: var(--space-2);
}
/* .btn-primary gives its icon no size, so the play icon filled the whole
   button (a big green square on phones). */
.tv-entry-btn--sheet svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; }

/* ── Broadcast watch page (/tournament/{id}?watch={game}) ──
   Its own tab: only the stream, filling the window, with a slim bar under it
   — the game on the left, share + full screen at the bottom right (same
   corner in Hebrew and English, like a video player). No site chrome. */
body.tv-watch-mode { background: #000; }
body.tv-watch-mode :is(.topnav, .footer, .tabbar) { display: none; }
.tv-watch-page {
  block-size: 100vh;
  block-size: 100dvh;
  background: #000;
  color: #FFFFFF;
}
.tv-stream {
  block-size: 100%;
  display: flex;
  flex-direction: column;
}
.tv-watch-frame { flex: 1 1 auto; min-block-size: 0; }
.tv-watch-frame iframe {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  border: 0;
  background: #000;
}
.tv-stream-bar {
  flex: 0 0 auto;
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.tv-stream-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
  text-align: left;
}
.tv-stream-actions { flex: 0 0 auto; margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.tv-stream-btn {
  display: inline-grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  color: #FFFFFF;
  transition: background var(--dur-fast) var(--ease-out);
}
.tv-stream-btn svg { inline-size: 22px; block-size: 22px; stroke: currentColor; fill: none; }
.tv-stream-btn:hover { background: rgba(255, 255, 255, 0.14); }
.tv-stream-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
/* Copied (tvShareConfirm): the round button becomes a "✓ Link copied" pill. */
.tv-stream-btn.is-copied {
  inline-size: auto;
  display: inline-flex;
  gap: 6px;
  padding-inline: 14px;
  border-radius: var(--radius-pill);
  background: var(--green);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  animation: tvShareCopied var(--dur-normal) var(--ease-out);
}
.tv-stream-btn.is-copied svg { inline-size: 14px; block-size: 14px; }
/* Loading / waiting / not live / sign in / error: a centred message. */
.tv-stream-msg {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}
.tv-stream-msg .tv-stream-title { flex: 0 0 auto; font-size: var(--text-md); white-space: normal; text-align: center; }
.tv-stream-text { display: flex; align-items: center; gap: 10px; max-inline-size: 420px; color: rgba(255, 255, 255, 0.8); }
.tv-stream-cta {
  padding: 8px 18px;
  min-block-size: 38px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
}
.tv-stream-cta:hover { background: var(--green-dark); }
.tv-stream-link { color: rgba(255, 255, 255, 0.7); font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 3px; }
.tv-stream-link:hover { color: #FFFFFF; }
.tv-stream-cta:focus-visible,
.tv-stream-link:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.tv-stream .tv-spinner { border-color: rgba(255, 255, 255, 0.2); border-top-color: #FFFFFF; }
.tv-spinner--sm { inline-size: 16px; block-size: 16px; border-width: 2px; flex: 0 0 auto; }

/* ── Breakpoints ── */
@media (max-width: 560px) {
  .tv-hero { padding: var(--space-4); border-radius: var(--radius-lg); gap: var(--space-4); }
  .tv-hero-side { padding: var(--space-3); }
  .tv-hero-round-num b { font-size: 2.6rem; }
  .tv-segmented { inline-size: 100%; }
  .tv-seg { flex: 1 1 0; justify-content: center; }
  .tv-standings-table .tv-col-opt { display: none; }
  .tv-board-card { padding-inline: var(--space-3); }
  .tv-podium-place b { font-size: var(--text-sm); }
}
@media (min-width: 900px) {
  .tv-hero {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    padding: var(--space-6);
    gap: var(--space-6);
    align-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tv-pulse::after,
  .tv-page .mgmt-badge .live-dot,
  .tv-spinner { animation: none; }
}
