/* Shared TV view: 10-foot text sizes and layout fill. Loaded last. */
/* Every rule is limited to the TV view: .shared-stage (the game on the TV), the top bar next to it, and the lobby
   that shows the join QR code (.room-join exists only on the TV device). Phone and desktop player screens keep
   their rules. Lengths use --tvu: 1px on a 1920x1080 screen, scaled with the window. Text never goes under
   24px at 1080p or 18px at 720p. */
@media (min-width: 900px) and (min-height: 500px) {
  .game-shell:has(> .shared-stage) {
    --tvu: min(calc(100vh / 1080), calc(100vw / 1920));
    --tv-xs: max(18px, calc(26 * var(--tvu)));
    --tv-sm: max(20px, calc(30 * var(--tvu)));
    --tv-md: max(22px, calc(36 * var(--tvu)));
    --tv-lg: max(26px, calc(44 * var(--tvu)));
  }

  /* ---------- Top bar: the join code stays the biggest thing in it ---------- */
  .game-shell:has(> .shared-stage) > .topbar .topbar-room { font-size: var(--tv-xs) !important; gap: calc(14 * var(--tvu)); }
  .game-shell:has(> .shared-stage) > .topbar .topbar-room > span { font-size: var(--tv-xs) !important; }
  .game-shell:has(> .shared-stage) > .topbar .topbar-room strong { font-size: max(30px, calc(48 * var(--tvu))) !important; }

  /* ---------- Stage: fills the window under the top bar ---------- */
  .game-shell > .shared-stage { flex: 1 1 0 !important; min-height: 0 !important; display: flex !important; flex-direction: column; box-sizing: border-box; padding: calc(14 * var(--tvu)) calc(30 * var(--tvu)) calc(26 * var(--tvu)) !important; }
  .shared-stage .shared-layout { flex: 1 1 0; width: 100%; max-width: none; height: auto !important; min-height: 0 !important; margin: 0; gap: 0; }
  .shared-stage .shared-columns { flex: 1 1 0; min-height: 0 !important; grid-template-columns: minmax(0, 1fr) minmax(360px, 27%); grid-template-rows: minmax(0, 1fr); gap: calc(26 * var(--tvu)); }
  .shared-stage .shared-main-content { min-height: 0; box-sizing: border-box; padding: calc(34 * var(--tvu)) calc(46 * var(--tvu)) !important; border-radius: calc(34 * var(--tvu)); place-items: center stretch; }
  .shared-stage .shared-main-content > * { max-width: none; min-height: 0; }
  .shared-stage .shared-kicker { font-size: var(--tv-sm) !important; margin: 0 0 calc(14 * var(--tvu)) !important; }
  .shared-stage .shared-hint { font-size: var(--tv-md) !important; margin: 0; }

  /* ---------- Leaderboard ---------- */
  .shared-stage .shared-sidebar { box-sizing: border-box; padding: calc(30 * var(--tvu)) calc(28 * var(--tvu)) !important; gap: calc(16 * var(--tvu)) !important; border-radius: calc(34 * var(--tvu)); }
  .shared-stage .shared-sidebar > .shared-kicker { margin: 0 !important; }
  .shared-stage .shared-sidebar .shared-score-list { gap: calc(10 * var(--tvu)) !important; }
  /* Up to 8 players: two lines per player. Line 1 is the name and the score. Line 2 is the score bar, and while
     points land it shows "+15 Correct" in full instead (it used to squeeze the name to a few pixels). */
  .shared-stage .shared-sidebar .shared-score { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-rows: auto calc(30 * var(--tvu)); align-items: center; column-gap: calc(12 * var(--tvu)); row-gap: 0 !important; font-size: max(22px, calc(34 * var(--tvu))) !important; line-height: 1.15; padding: calc(8 * var(--tvu)) calc(16 * var(--tvu)) calc(6 * var(--tvu)) !important; border-radius: calc(18 * var(--tvu)); position: relative; }
  .shared-stage .shared-sidebar .shared-score > .shared-rank { grid-area: 1 / 1 / 3 / 2; width: auto; min-width: .9em; }
  .shared-stage .shared-sidebar .shared-score > .avatar { grid-area: 1 / 2 / 3 / 3; width: calc(54 * var(--tvu)) !important; height: calc(54 * var(--tvu)) !important; }
  .shared-stage .shared-sidebar .shared-score > .shared-player-name { grid-area: 1 / 3 / 2 / 4; }
  .shared-stage .shared-sidebar .shared-score > b { grid-area: 1 / 4 / 2 / 5; font-size: 1.15em; }
  .shared-stage .shared-sidebar .shared-score > .shared-score-track { grid-area: 2 / 3 / 3 / 5; height: max(5px, calc(8 * var(--tvu))); }
  .shared-stage .shared-sidebar .shared-score > .shared-score-delta { grid-area: 2 / 3 / 3 / 5; justify-self: start; width: 0; min-width: 100%; box-sizing: border-box; font-size: var(--tv-xs); line-height: 1.1; }
  .shared-stage .shared-sidebar .shared-score > .shared-score-delta small { font-size: 1em; opacity: 1; }
  .shared-stage .shared-sidebar .shared-score.is-awarding > .shared-score-track { visibility: hidden; }
  /* 9 or more players: one tight line per player, the score bar runs along the bottom edge of the row. */
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) { gap: calc(6 * var(--tvu)) !important; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score { grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-rows: auto; font-size: var(--tv-xs) !important; padding: calc(4 * var(--tvu)) calc(12 * var(--tvu)) calc(9 * var(--tvu)) !important; column-gap: calc(9 * var(--tvu)); border-radius: calc(12 * var(--tvu)); }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .shared-rank { grid-area: 1 / 1; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .avatar { grid-area: 1 / 2; width: calc(32 * var(--tvu)) !important; height: calc(32 * var(--tvu)) !important; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .shared-player-name { grid-area: 1 / 3; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .shared-score-delta { grid-area: 1 / 4; font-size: 1em; width: auto; min-width: 0; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > b { grid-area: 1 / 5; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .shared-score-track { grid-area: auto; position: absolute; left: calc(12 * var(--tvu)); right: calc(12 * var(--tvu)); bottom: calc(3 * var(--tvu)); height: max(3px, calc(4 * var(--tvu))); visibility: visible; }
  .shared-stage .shared-sidebar .shared-score-list:has(> :nth-child(9)) > .shared-score > .shared-score-delta small { display: none; }

  /* Progress while a question runs */
  .shared-stage .shared-progress { margin: 0; }
  .shared-stage .shared-progress > strong { font-size: var(--tv-lg); line-height: 1.15; }
  .shared-stage .shared-progress-track { height: calc(20 * var(--tvu)); margin: calc(18 * var(--tvu)) 0; }
  .shared-stage .shared-finish-list { gap: calc(14 * var(--tvu)); }
  .shared-stage .shared-finish-list .avatar { width: calc(68 * var(--tvu)) !important; height: calc(68 * var(--tvu)) !important; }
  .shared-stage .shared-finish-list:has(> :nth-child(11)) .avatar { width: calc(52 * var(--tvu)) !important; height: calc(52 * var(--tvu)) !important; }
  .shared-stage .shared-finish-list > span { opacity: .45; }
  .shared-stage .shared-rapid-progress { gap: calc(14 * var(--tvu)); margin-top: calc(18 * var(--tvu)); }
  .shared-stage .shared-rapid-player { font-size: var(--tv-sm); grid-template-columns: minmax(0, 1fr) minmax(calc(110 * var(--tvu)), 1.1fr) auto; gap: calc(12 * var(--tvu)); }
  .shared-stage .shared-five-segments i { height: calc(22 * var(--tvu)); }
  .shared-stage .shared-rapid-progress:has(> :nth-child(9)) { gap: calc(5 * var(--tvu)); }
  .shared-stage .shared-rapid-progress:has(> :nth-child(9)) > .shared-rapid-player { font-size: var(--tv-xs); }

  /* ---------- Question ---------- */
  .shared-stage .shared-main-content:has(> .shared-question) { place-items: stretch !important; }
  .shared-stage .shared-question { display: flex; flex-direction: column; justify-content: space-between; gap: calc(18 * var(--tvu)); height: 100%; min-height: 0; }
  .shared-stage .shared-question > * { flex: none; }
  .shared-stage .shared-question > .shared-kicker { margin: 0 !important; }
  .shared-stage .shared-question > .shared-topic-chip { font-size: var(--tv-sm); }
  .shared-stage .shared-question > h1 { font-size: calc(70 * var(--tvu)) !important; line-height: 1.08 !important; margin: 0 auto !important; max-width: none; text-wrap: balance; }
  .shared-stage .shared-question > .ad-answered { height: calc(72 * var(--tvu)); min-height: 0; margin: 0; }
  .shared-stage .shared-question > .ad-answered .avatar { width: calc(64 * var(--tvu)) !important; height: calc(64 * var(--tvu)) !important; }
  /* Answers: one row of 2 is tall, 2 rows share more height, 3 rows take what is left. They shrink before anything is cut. */
  .shared-stage .shared-question > .shared-options { flex: 0 1 calc(230 * var(--tvu)); min-height: 0; margin: 0 !important; gap: calc(22 * var(--tvu)); grid-auto-rows: minmax(0, 1fr); }
  .shared-stage .shared-question > .shared-options:has(> :nth-child(3)) { flex-basis: calc(400 * var(--tvu)); }
  .shared-stage .shared-question > .shared-options:has(> :nth-child(5)) { flex-basis: calc(520 * var(--tvu)); }
  .shared-stage .shared-question .shared-option { min-height: 0 !important; padding: calc(12 * var(--tvu)) calc(30 * var(--tvu)) !important; gap: calc(26 * var(--tvu)); font-size: max(24px, calc(46 * var(--tvu))) !important; line-height: 1.1; border-radius: calc(26 * var(--tvu)) !important; }
  .shared-stage .shared-question .shared-option b { min-width: 1.5em; padding: .12em 0; border-radius: calc(14 * var(--tvu)); flex: none; }
  .shared-stage .shared-question > .shared-hint { font-size: var(--tv-lg) !important; }
  /* Timer: the bar with the seconds beside it (the number sat under the bar, inside its clipping box). */
  .shared-stage .shared-timer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: calc(22 * var(--tvu)); width: 100%; max-width: calc(1000 * var(--tvu)); height: auto !important; margin: 0 auto !important; overflow: visible; background: none !important; border-radius: 0; }
  .shared-stage .shared-timer::before { content: ""; grid-area: 1 / 1; height: calc(22 * var(--tvu)); border-radius: 99px; background: var(--ad-night-3); }
  .shared-stage .shared-timer-fill { grid-area: 1 / 1; height: calc(22 * var(--tvu)); border-radius: 99px; }
  .shared-stage .shared-timer strong { grid-area: 1 / 2; position: static !important; margin: 0; min-width: 2.6em; text-align: right; font-size: var(--tv-lg); line-height: 1; font-variant-numeric: tabular-nums; }
  /* Map-pin question: the map takes the height that is left. */
  .shared-stage .shared-question > .shared-geo-board { flex: 1 1 0; min-height: 0; width: 100%; max-width: none; margin: 0; display: flex; justify-content: center; }
  .shared-stage .shared-question > .shared-geo-board .geo-map { height: 100%; max-height: none; min-height: 0; aspect-ratio: 1.62; max-width: 100%; display: flex; flex-direction: column; }
  .shared-stage .shared-question > .shared-geo-board .geo-map > svg { flex: 1 1 0; width: 100% !important; height: auto !important; min-height: 0 !important; max-height: none !important; aspect-ratio: auto !important; }

  /* ---------- Reveal (the shared answer table and answer cards) ---------- */
  .shared-stage .shared-main-content:has(.ad-reveal) { padding: calc(30 * var(--tvu)) calc(40 * var(--tvu)) !important; place-items: stretch !important; align-content: stretch !important; }
  .shared-stage .shared-main-content > .review-with-votes { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); gap: 0; }
  .shared-stage .shared-main-content .ad-reveal { width: 100%; max-width: none; height: 100%; min-height: 0; box-sizing: border-box; margin: 0; padding: 0; gap: calc(22 * var(--tvu)) !important; }
  .shared-stage .shared-main-content .ad-reveal > * { flex: none; }
  .shared-stage .shared-main-content .ad-reveal-question { font-size: calc(54 * var(--tvu)) !important; line-height: 1.08 !important; text-wrap: balance; }
  /* The table takes the height the question and the answers leave, and its rows share it. */
  .shared-stage .shared-main-content .ad-reveal > .ad-results { flex: 1 1 0; min-height: 0; width: 100%; max-width: none; margin: 0; display: flex; flex-direction: column; justify-content: safe center; }
  .shared-stage .ad-results-label { height: auto !important; min-height: 1.3em; margin: 0 0 calc(8 * var(--tvu)) 2px; font-size: var(--tv-xs) !important; line-height: 1.3; align-items: baseline; flex: none; }
  .shared-stage .ad-results-label > span, .shared-stage .ad-results-label > .ad-results-answer { font-size: var(--tv-sm) !important; line-height: 1.3; }
  .shared-stage .ad-times { --tv-row-count: var(--rows); --ad-row-step: clamp(calc(42 * var(--tvu)), calc(420 * var(--tvu) / var(--tv-row-count)), calc(92 * var(--tvu))); flex: none; }
  .shared-stage .ad-times.is-split { --tv-row-count: var(--half); }
  .shared-stage .ad-time-row { gap: calc(18 * var(--tvu)); padding: 0 calc(18 * var(--tvu)); border-radius: calc(14 * var(--tvu)); grid-template-columns: minmax(calc(170 * var(--tvu)), calc(330 * var(--tvu))) minmax(40px, 1fr) auto minmax(calc(120 * var(--tvu)), max-content) minmax(0, max-content) calc(40 * var(--tvu)) minmax(calc(84 * var(--tvu)), max-content); }
  /* 9 or more players: two columns of rows. The time bar goes, so the name keeps its room. */
  .shared-stage .ad-times.is-split .ad-time-row { gap: calc(10 * var(--tvu)); padding: 0 calc(10 * var(--tvu)); grid-template-columns: minmax(0, 1fr) 0 auto max-content minmax(0, max-content) calc(30 * var(--tvu)) minmax(calc(58 * var(--tvu)), max-content); }
  .shared-stage .ad-times.is-split .ad-time-row .ad-time-track { display: none; }
  .shared-stage .ad-times.is-split .ad-time-row :is(.ad-time-who b, .ad-time-value, .ad-time-points) { font-size: clamp(var(--tv-xs), calc(var(--ad-row-step) * .46), calc(30 * var(--tvu))) !important; }
  .shared-stage .ad-times.is-split .ad-time-row .ad-time-who { gap: calc(10 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-times.is-split .ad-slots { gap: calc(4 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-times.is-split .ad-slots i { width: calc(20 * var(--tvu)); height: calc(20 * var(--tvu)); border-radius: calc(5 * var(--tvu)); }
  .shared-stage .shared-main-content .ad-reveal:has(.ad-times.is-split) .ad-reveal-question { font-size: calc(44 * var(--tvu)) !important; }
  .shared-stage .ad-time-row :is(.ad-time-who b, .ad-time-value, .ad-time-points) { font-size: clamp(var(--tv-xs), calc(var(--ad-row-step) * .5), calc(42 * var(--tvu))) !important; line-height: 1.15; }
  .shared-stage .ad-time-row :is(small, .ad-time-detail) { font-size: var(--tv-xs) !important; line-height: 1.15; }
  .shared-stage .ad-time-row .ad-time-who { gap: calc(14 * var(--tvu)); }
  .shared-stage .ad-time-row .ad-time-who .avatar { width: calc(var(--ad-row-step) * .62) !important; height: calc(var(--ad-row-step) * .62) !important; flex: none; }
  .shared-stage .ad-time-row .ad-time-track { height: calc(14 * var(--tvu)); border-radius: 99px; }
  .shared-stage .ad-time-row .ad-time-mark svg { width: calc(30 * var(--tvu)); height: calc(30 * var(--tvu)); }
  /* A wrong answer was 45% see-through, which put its name under 4.5:1. */
  .shared-stage .ad-time-row.is-wrong { opacity: .72; }
  /* Answer cards under the table */
  .shared-stage .ad-reveal .ad-options { gap: calc(20 * var(--tvu)); margin: calc(14 * var(--tvu)) 0 0 !important; padding: 0; }
  .shared-stage .ad-reveal .ad-options .answer-option { min-height: calc(92 * var(--tvu)) !important; padding: calc(10 * var(--tvu)) calc(24 * var(--tvu)) !important; gap: calc(22 * var(--tvu)); font-size: max(22px, calc(38 * var(--tvu))) !important; border-radius: calc(22 * var(--tvu)) !important; }
  .shared-stage .ad-reveal .ad-options .answer-option .option-key { width: 1.5em !important; height: 1.5em !important; min-width: 0; font-size: .9em !important; flex: none; }
  .shared-stage .ad-reveal .ad-options .answer-option.is-dim { opacity: .72 !important; }
  .shared-stage .ad-reveal .ad-options .ad-option-tick svg { width: calc(36 * var(--tvu)); height: calc(36 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-options .ad-option-pieces .ad-piece, .shared-stage .ad-reveal .ad-options .ad-option-pieces .ad-piece > svg { width: calc(40 * var(--tvu)) !important; height: calc(40 * var(--tvu)) !important; }
  @supports (height: 1cqh) {
    .shared-stage .shared-main-content .ad-reveal > .ad-results { container-type: size; }
    .shared-stage .shared-main-content .ad-reveal > .ad-results > .ad-times { --ad-row-step: clamp(calc(42 * var(--tvu)), calc((100cqh - 1.3 * var(--tv-sm) - 8 * var(--tvu)) / var(--tv-row-count)), calc(92 * var(--tvu))); }
  }

  /* Reveal, other question kinds */
  .shared-stage .ad-reveal :is(.ad-options, .ad-cards) { width: 100%; max-width: none; }
  .shared-stage .ad-reveal .ad-note { font-size: var(--tv-xs); }
  .shared-stage .ad-reveal :is(.ad-word, .ad-order-tile) { font-size: var(--tv-xs); }
  .shared-stage .ad-reveal .ad-hints i { width: calc(14 * var(--tvu)); height: calc(20 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-slots { gap: calc(6 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-slots i { width: calc(30 * var(--tvu)); height: calc(30 * var(--tvu)); border-radius: calc(8 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-card { min-height: calc(92 * var(--tvu)); padding: calc(10 * var(--tvu)) calc(24 * var(--tvu)); gap: calc(20 * var(--tvu)); border-radius: calc(22 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-card-label { font-size: var(--tv-md); }
  .shared-stage .ad-reveal .ad-card .ad-word { font-size: var(--tv-md); gap: calc(6 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-card.is-dim { opacity: .72; }
  .shared-stage .ad-reveal .ad-card-tick svg { width: calc(36 * var(--tvu)); height: calc(36 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-card-pieces.is-above { height: calc(52 * var(--tvu)) !important; }
  .shared-stage .ad-reveal .ad-card-pieces .ad-piece, .shared-stage .ad-reveal .ad-card-pieces .ad-piece > svg { width: calc(40 * var(--tvu)) !important; height: calc(40 * var(--tvu)) !important; }
  .shared-stage .ad-reveal :is(.ad-rapid-count, .ad-rapid-yours) { font-size: var(--tv-sm); }
  .shared-stage .ad-reveal .ad-rapid-picker button { font-size: var(--tv-xs); min-height: calc(52 * var(--tvu)); padding: 0 calc(18 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-rapid-question { gap: calc(16 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-order-truth { gap: calc(10 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-order-num { font-size: var(--tv-sm); }
  .shared-stage .ad-reveal .ad-order-text { font-size: var(--tv-md); line-height: 1.15; }
  /* Number line: lanes, pieces and guesses at TV size */
  /* A lane is 78 units tall for up to 3 stacked guesses. More lanes share 220 units, and the pieces overlap. */
  .shared-stage .ad-reveal .ad-number-line { --tv-lane: clamp(calc(22 * var(--tvu)), calc(220 * var(--tvu) / var(--lanes)), calc(78 * var(--tvu))); --tv-piece: clamp(calc(34 * var(--tvu)), calc(var(--tv-lane) * 1.25), calc(46 * var(--tvu))); height: calc(84 * var(--tvu) + var(--lanes) * var(--tv-lane)); margin: 0 calc(40 * var(--tvu)) calc(76 * var(--tvu)) !important; }
  .shared-stage .ad-reveal .ad-line-axis { bottom: calc(24 * var(--tvu)); height: calc(6 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-line-guess { bottom: calc(34 * var(--tvu) + var(--lane) * var(--tv-lane)); gap: 0; }
  .shared-stage .ad-reveal .ad-line-guess .ad-piece > svg { width: var(--tv-piece) !important; height: var(--tv-piece) !important; }
  .shared-stage .ad-reveal .ad-line-value { font-size: var(--tv-xs); line-height: 1.1; color: var(--ad-ink); }
  .shared-stage .ad-reveal .ad-line-truth { bottom: calc(10 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-line-truth i { width: calc(8 * var(--tvu)); height: calc(56 * var(--tvu) + var(--lanes) * var(--tv-lane)); }
  .shared-stage .ad-reveal .ad-line-truth b { font-size: calc(56 * var(--tvu)); }
  /* Map pin: map and table side by side, both the full height */
  .shared-stage .ad-reveal > .ad-geo-layout { flex: 1 1 0; min-height: 0; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-rows: minmax(0, 1fr); gap: calc(30 * var(--tvu)); align-items: stretch; }
  .shared-stage .ad-reveal .ad-geo-map, .shared-stage .ad-reveal .ad-geo-map .geo-map { height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .shared-stage .ad-reveal .ad-geo-map .geo-map > svg { flex: 1 1 0; width: 100% !important; height: auto !important; min-height: 0 !important; max-height: none !important; aspect-ratio: auto !important; }
  .shared-stage .ad-reveal .ad-geo-side { min-height: 0; gap: calc(14 * var(--tvu)); }
  .shared-stage .ad-reveal .ad-geo-side > * { flex: none; }
  .shared-stage .ad-reveal .ad-geo-side > .ad-reveal-question { font-size: calc(48 * var(--tvu)) !important; }
  .shared-stage .ad-reveal .ad-geo-answer { font-size: var(--tv-md); text-align: left; }
  .shared-stage .ad-reveal .ad-geo-side > .ad-results { flex: 1 1 0; min-height: 0; width: 100%; max-width: none; margin: 0; display: flex; flex-direction: column; justify-content: flex-start; }
  .shared-stage .ad-kind-geo .ad-times, .shared-stage .ad-kind-geo .ad-times.is-split { --tv-row-count: var(--rows); height: calc(var(--rows) * var(--ad-row-step)); }
  .shared-stage .ad-kind-geo .ad-time-row, .shared-stage .ad-kind-geo .ad-times.is-split .ad-time-row { left: 0; right: 0; width: auto; transform: translateY(calc(var(--pos) * var(--ad-row-step))); gap: calc(12 * var(--tvu)); padding: 0 calc(12 * var(--tvu)); grid-template-columns: minmax(0, 1fr) 0 0 max-content max-content calc(30 * var(--tvu)) minmax(calc(60 * var(--tvu)), max-content) !important; }
  .shared-stage .ad-kind-geo .ad-time-row :is(.ad-time-who b, .ad-time-value, .ad-time-points) { font-size: clamp(var(--tv-xs), calc(var(--ad-row-step) * .44), calc(30 * var(--tvu))) !important; }
  @supports (height: 1cqh) {
    .shared-stage .ad-reveal .ad-geo-side > .ad-results { container-type: size; }
    .shared-stage .ad-reveal .ad-geo-side > .ad-results > .ad-times { --ad-row-step: clamp(calc(42 * var(--tvu)), calc((100cqh - 1.3 * var(--tv-sm) - 8 * var(--tvu)) / var(--tv-row-count)), calc(80 * var(--tvu))); }
  }

  /* ---------- Countdown ring, headings and chips shared by the map screens ---------- */
  .shared-stage .stage-timer .timer { width: calc(96 * var(--tvu)) !important; height: calc(96 * var(--tvu)) !important; flex: 0 0 calc(96 * var(--tvu)) !important; }
  .shared-stage .stage-timer .timer span { font-size: max(22px, calc(42 * var(--tvu))) !important; }
  .shared-stage .stage-timer-caption { font-size: var(--tv-xs); }
  .shared-stage .eyebrow { font-size: var(--tv-sm) !important; }
  .shared-stage .stage-title { font-size: calc(76 * var(--tvu)) !important; }
  .shared-stage .topic-chip { font-size: var(--tv-xs); padding: calc(8 * var(--tvu)) calc(22 * var(--tvu)) calc(8 * var(--tvu)) calc(16 * var(--tvu)); }
  .shared-stage .shared-topic-chip { font-size: var(--tv-sm); }

  /* ---------- Map panel: claim, target, intermission ---------- */
  .shared-stage .shared-main-content:has(> :is(.shared-map-panel, .topic-tv, .land-screen, .shared-end)) { place-items: stretch !important; }
  .shared-stage .shared-map-panel { display: flex; flex-direction: column; align-items: center; gap: calc(14 * var(--tvu)); height: 100%; min-height: 0; }
  .shared-stage .shared-map-panel > * { flex: none; margin: 0 !important; }
  .shared-stage .shared-map-panel > h1 { font-size: calc(76 * var(--tvu)) !important; line-height: 1.08 !important; }
  .shared-stage .shared-map-panel > .shared-map-board { flex: 1 1 0; min-height: 0; width: 100%; max-width: none; height: auto !important; }

  /* ---------- Topic naming ---------- */
  .shared-stage .topic-tv { height: 100%; min-height: 0; gap: calc(14 * var(--tvu)); }
  .shared-stage .topic-tv > * { flex: none; }
  .shared-stage .topic-tv > .shared-kicker { margin: 0 !important; }
  .shared-stage .topic-tv > h1 { font-size: calc(72 * var(--tvu)); gap: calc(18 * var(--tvu)); }
  .shared-stage .topic-tv > h1 .avatar { width: calc(72 * var(--tvu)) !important; height: calc(72 * var(--tvu)) !important; }
  .shared-stage .topic-tv > .topic-tv-grid { flex: 1 1 0; min-height: 0; margin: 0; grid-template-columns: minmax(0, 1fr) calc(470 * var(--tvu)); grid-template-rows: minmax(0, 1fr); gap: calc(34 * var(--tvu)); }
  .shared-stage .topic-tv .shared-map-board { height: 100% !important; max-width: none; min-height: 0; margin: 0; }
  .shared-stage .topic-tv-side { gap: calc(18 * var(--tvu)); min-height: 0; }
  .shared-stage .topic-tv .topic-options { gap: calc(14 * var(--tvu)); }
  .shared-stage .topic-tv .topic-option { min-height: 0; padding: calc(16 * var(--tvu)) calc(22 * var(--tvu)); gap: calc(18 * var(--tvu)); border-radius: calc(22 * var(--tvu)); }
  .shared-stage .topic-tv .topic-option-copy { gap: calc(4 * var(--tvu)); }
  .shared-stage .topic-tv .topic-option-copy b { font-size: var(--tv-md); }
  .shared-stage .topic-tv .topic-option-copy small { font-size: var(--tv-xs); line-height: 1.2; opacity: 1; }
  .shared-stage .topic-tv .topic-option-bonus { font-size: var(--tv-sm); }
  .shared-stage .topic-tv .topic-option.is-dimmed { opacity: .6; }
  .shared-stage .topic-tv-note { font-size: var(--tv-xs); line-height: 1.3; }

  /* ---------- Map with a side panel: pick order, battle ready, battle result ---------- */
  .shared-stage .shared-main-content .land-screen { display: flex !important; flex-direction: column !important; height: 100%; min-height: 0; gap: calc(12 * var(--tvu)); }
  .shared-stage .shared-main-content .land-screen > * { flex: none; }
  .shared-stage .shared-main-content .land-screen > .land-header { margin: 0 !important; padding: 0 !important; gap: calc(6 * var(--tvu)); }
  .shared-stage .shared-main-content .land-screen > .land-layout { flex: 1 1 0; height: auto !important; min-height: 0 !important; margin: 0 !important; grid-template-columns: minmax(0, 1fr) calc(520 * var(--tvu)) !important; grid-template-rows: minmax(0, 1fr) !important; gap: calc(30 * var(--tvu)) !important; align-items: center !important; }
  .shared-stage .shared-main-content .land-screen .land-layout > .land-map-slot { height: 100% !important; max-height: 100% !important; min-height: 0 !important; align-self: stretch !important; }
  .shared-stage .shared-main-content .land-screen .land-layout > .land-map-slot > svg { width: 100% !important; height: 100% !important; max-height: 100% !important; }
  .shared-stage .shared-main-content .land-screen .land-sidecar { width: auto !important; max-width: none !important; max-height: 100%; font-size: var(--tv-xs) !important; padding: calc(22 * var(--tvu)) !important; gap: calc(14 * var(--tvu)) !important; border-radius: calc(26 * var(--tvu)) !important; box-sizing: border-box; }
  .shared-stage .shared-main-content .land-sidecar .battle-pair { column-gap: calc(12 * var(--tvu)) !important; }
  .shared-stage .shared-main-content .land-sidecar .battle-pair .land-player-avatar { width: calc(62 * var(--tvu)) !important; height: calc(62 * var(--tvu)) !important; }
  .shared-stage .shared-main-content .land-sidecar .battle-pair .land-player-identity { height: auto !important; min-height: calc(62 * var(--tvu)) !important; gap: calc(10 * var(--tvu)) !important; }
  .shared-stage .shared-main-content .land-sidecar .land-player-name { font-size: var(--tv-sm) !important; }
  /* The beaten player's name faded to 35%, about 3:1. It stays at 70% and takes the muted colour. An !important value outranks the keyframe. */
  .shared-stage .battle-pair.has-outcome .battle-loser .land-player-name { opacity: .7 !important; }
  .shared-stage .shared-main-content .land-sidecar .land-panel-kicker { font-size: var(--tv-xs) !important; }
  .shared-stage .shared-main-content .land-sidecar .land-panel-description { font-size: var(--tv-sm) !important; line-height: 1.25 !important; }

  /* ---------- Round intro ---------- */
  .shared-stage .intro-screen { gap: calc(26 * var(--tvu)) !important; }
  .shared-stage .intro-screen > .stage-title { font-size: calc(96 * var(--tvu)) !important; }
  .shared-stage .intro-screen > .format-icon { zoom: 1.35; }
  @media (min-height: 900px) and (min-width: 1600px) { .shared-stage .intro-screen > .format-icon { zoom: 2; } }
  /* Quick 5 results: the table and the current question sit in the middle of the panel. */
  .shared-stage .shared-main-content .ad-reveal.ad-kind-rapid { justify-content: center; gap: calc(44 * var(--tvu)) !important; }

  /* ---------- Game over ---------- */
  .shared-stage .shared-end { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: calc(22 * var(--tvu)); height: 100%; min-height: 0; }
  .shared-stage .shared-end > * { flex: none; margin: 0 !important; }
  .shared-stage .shared-end > h1 { font-size: calc(110 * var(--tvu)) !important; line-height: 1.04 !important; }
  .shared-stage .shared-end .highlight-reel { width: 100%; max-width: calc(1060 * var(--tvu)); padding: calc(24 * var(--tvu)) calc(30 * var(--tvu)) calc(50 * var(--tvu)); gap: calc(16 * var(--tvu)); border-radius: calc(28 * var(--tvu)); }
  .shared-stage .shared-end .hl-progress i { height: calc(6 * var(--tvu)); }
  .shared-stage .shared-end .hl-clip { gap: calc(30 * var(--tvu)); }
  .shared-stage .shared-end .hl-kicker { font-size: var(--tv-xs); }
  .shared-stage .shared-end .hl-title { font-size: var(--tv-lg); }
  .shared-stage .shared-end .hl-detail { font-size: var(--tv-sm); line-height: 1.25; color: #dccdee; }
  .shared-stage .shared-end .hl-hint { display: none; }
  .shared-stage .shared-end-buttons { gap: calc(20 * var(--tvu)); }
  .shared-stage .shared-end-buttons > button { font-size: var(--tv-sm) !important; min-height: calc(76 * var(--tvu)); padding: calc(12 * var(--tvu)) calc(34 * var(--tvu)) !important; }

  .shared-stage .ad-reveal .ad-order-step { min-height: calc(76 * var(--tvu)); padding: calc(10 * var(--tvu)) calc(22 * var(--tvu)); gap: calc(20 * var(--tvu)); border-radius: calc(20 * var(--tvu)); box-sizing: border-box; }
  .shared-stage .ad-reveal .ad-order-num { width: 1.7em; height: 1.7em; flex: none; line-height: 1; }
  /* The key that steps through the highlights sits in the corner of the card, at TV size. */
  .shared-stage .shared-end .highlight-reel[data-hotkey]::after { position: absolute; right: calc(24 * var(--tvu)); bottom: calc(12 * var(--tvu)); margin: 0; font-size: var(--tv-xs); opacity: 1; color: #dccdee; }
}

/* ==================== TV lobby ====================
   .room-join (QR code plus room code) is rendered only on the device that is the TV, so these rules never reach a
   player's lobby. The page is laid out on a 1280x720 canvas with 18px as the smallest text, then enlarged with
   zoom on bigger screens (1.45 at 1080p gives 26px). Join panel on the right, settings on the left. */
@media (min-width: 900px) and (min-height: 500px) {
  .game-shell:has(.room-join) > .topbar .profile-top-button { font-size: max(18px, calc(100vh / 1080 * 26)) !important; }
  .main-stage > .lobby:has(.room-join) { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: repeat(30, auto) 1fr; column-gap: 28px; row-gap: 0; align-items: start; width: 100%; max-width: 1200px; margin-inline: auto; box-sizing: border-box; }
  .main-stage > .lobby:has(.room-join) > * { grid-column: 1; min-width: 0; margin: 0 0 10px !important; }
  .main-stage > .lobby:has(.room-join) *:not(svg, svg *) { font-size: 18px !important; }
  /* Join panel: heading, QR code, room code. It stays in view while the settings scroll. */
  .main-stage > .lobby:has(.room-join) > .lobby-heading { grid-column: 2; grid-row: 1 / -1; position: sticky; top: 0; flex-direction: column; align-items: stretch; gap: 10px; margin: 0 !important; }
  .main-stage > .lobby:has(.room-join) > .lobby-heading > .stage-title { font-size: 40px !important; text-align: center; margin: 0; }
  .main-stage > .lobby:has(.room-join) .room-join { width: 100%; gap: 10px; }
  .main-stage > .lobby:has(.room-join) .room-join-qr { width: 100%; height: auto; aspect-ratio: 1; max-width: none; box-sizing: border-box; }
  .main-stage > .lobby:has(.room-join) .room-code { width: 100%; box-sizing: border-box; flex-wrap: wrap; gap: 2px 10px; padding: 8px 10px; height: auto; min-height: 0; }
  .main-stage > .lobby:has(.room-join) .room-code > b { font-size: 40px !important; line-height: 1.1; }
  /* The join instruction leads the settings column. */
  .main-stage > .lobby:has(.room-join) > .subtitle { order: -1; font-size: 21px !important; line-height: 1.3 !important; color: var(--ad-ink, #f7f2ff) !important; }
  .main-stage > .lobby:has(.room-join) .shared-lobby-mode { padding: 10px 16px; gap: 2px; }
  .main-stage > .lobby:has(.room-join) .shared-lobby-mode label { font-size: 21px !important; }
  .main-stage > .lobby:has(.room-join) .shared-lobby-mode p { line-height: 1.3; }
  .main-stage > .lobby:has(.room-join) .start-game .primary { font-size: 22px !important; }
  /* Start game and Leave lobby stay on screen while the page scrolls. */
  .main-stage > .lobby:has(.room-join) > .lobby-bottom { position: sticky; bottom: 0; z-index: 5; margin: 0 !important; padding: 8px 0; background: var(--ad-night, #150b26); }
  @media (min-width: 1500px) and (min-height: 840px) { .main-stage > .lobby:has(.room-join) { zoom: 1.2; } }
  @media (min-width: 1800px) and (min-height: 1000px) { .main-stage > .lobby:has(.room-join) { zoom: 1.45; } }
  @media (min-width: 2400px) and (min-height: 1350px) { .main-stage > .lobby:has(.room-join) { zoom: 1.9; } }
  @media (min-width: 3600px) and (min-height: 2000px) { .main-stage > .lobby:has(.room-join) { zoom: 2.9; } }

  /* Seats: avatar on the left, name and role beside it, host buttons on their own line (they broke one letter per line). */
  .main-stage > .lobby:has(.room-join) .lobby-players { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)) !important; gap: 10px !important; }
  .main-stage > .lobby:has(.room-join) .lobby-players > .lobby-player { display: grid; grid-template-columns: 60px minmax(0, 1fr); grid-auto-rows: auto; column-gap: 12px; row-gap: 2px; align-items: center; align-content: start; justify-items: start; text-align: left; min-height: 0 !important; height: auto; padding: 10px 12px !important; }
  .main-stage > .lobby:has(.room-join) .lobby-player > :is(.avatar, .empty-avatar) { grid-column: 1; grid-row: 1 / span 2; width: 60px !important; height: 60px !important; }
  .main-stage > .lobby:has(.room-join) .lobby-player > strong, .main-stage > .lobby:has(.room-join) .lobby-player > .lobby-seat-name { grid-column: 2; grid-row: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
  .main-stage > .lobby:has(.room-join) .lobby-player > span:not(.empty-avatar, .reroll-note) { grid-column: 2; grid-row: 2; line-height: 1.25; }
  .main-stage > .lobby:has(.room-join) .lobby-player:has(> .player-mute-button) > strong { padding-right: 34px; box-sizing: border-box; }
  .main-stage > .lobby:has(.room-join) .lobby-player > .lobby-player-admin { grid-column: 1 / -1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin: 6px 0 0; justify-content: flex-start; }
  .main-stage > .lobby:has(.room-join) .lobby-player-admin > button { white-space: nowrap; min-height: 40px; padding: 4px 12px; flex: 0 0 auto; width: auto; }
  /* Empty seats were 72% see-through, 4.4:1. */
  .main-stage > .lobby:has(.room-join) .lobby-player.empty-seat { opacity: 1; }
  .main-stage > .lobby:has(.room-join) .lobby-player.empty-seat > :is(strong, span:not(.empty-avatar)) { color: var(--ad-muted, #c3b3da); }
  /* TV mode switch on one line */
  .main-stage > .lobby:has(.room-join) .shared-lobby-mode { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 18px; }
  /* Bots, tiles and map on one line beside a smaller map preview */
  .main-stage > .lobby:has(.room-join) .lobby-config-grid { grid-template-columns: minmax(0, 1fr) 200px; gap: 12px; align-items: stretch; }
  .main-stage > .lobby:has(.room-join) .lobby-options { flex-wrap: wrap; align-items: flex-end; gap: 8px 22px; }
  .main-stage > .lobby:has(.room-join) .lobby-map-preview { padding: 6px 10px; min-height: 0; }
  .main-stage > .lobby:has(.room-join) .lobby-map-preview-board { height: 84px; min-height: 0; }

  .main-stage > .lobby:has(.room-join) .lobby-options { align-self: center; }
  .main-stage > .lobby:has(.room-join) .lobby-map-preview { height: 96px; box-sizing: border-box; align-self: center; }
  .main-stage > .lobby:has(.room-join) .lobby-map-preview-board { flex: 1 1 0; height: auto !important; min-height: 0 !important; }
  /* More settings: timers three to a row with full labels, one bot seat per line. */
  .main-stage > .lobby:has(.room-join) .duration-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 8px 18px !important; }
  .main-stage > .lobby:has(.room-join) .duration-grid label { grid-template-columns: minmax(0, 1fr) 64px auto !important; gap: 8px !important; align-items: center; }
  .main-stage > .lobby:has(.room-join) .duration-grid label > span { overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.15; }
  .main-stage > .lobby:has(.room-join) .duration-grid input { width: 64px !important; height: 40px !important; min-height: 40px !important; box-sizing: border-box; }
  .main-stage > .lobby:has(.room-join) .bot-difficulty-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 8px !important; }
  .main-stage > .lobby:has(.room-join) .bot-seat-config { flex-wrap: wrap; gap: 8px 22px !important; padding: 8px 12px !important; }
  .main-stage > .lobby:has(.room-join) .bot-seat-config > strong { flex: 0 0 auto; }
  .main-stage > .lobby:has(.room-join) .bot-difficulty { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px !important; min-width: 0; }
  .main-stage > .lobby:has(.room-join) .bot-difficulty label { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; width: auto; min-width: 0; white-space: nowrap; }
  .main-stage > .lobby:has(.room-join) .bot-difficulty input { width: 76px !important; min-width: 76px; height: 40px; box-sizing: border-box; }
  .main-stage > .lobby:has(.room-join) .bot-difficulty select { width: auto !important; min-width: 200px; max-width: 100%; height: 40px; box-sizing: border-box; }
}
