/* Roomful Trivia v2.0 game screens (package P4): play.html (join, lobby, questions, answers, final, host bar and menu),
   host.html (phone-first host setup, the read-only TV display at /tv). Layout only: every color, size and component
   comes from P1's design system in site.css (rf- classes, --rf- tokens). Prefix tg- ("trivia game"). Mobile-first:
   the base rules are a 390px phone; wider screens add min-width queries; the TV display uses .rf-tv. No inline style
   anywhere (CSP): the few numbers a script owns are custom properties. */

/* ---------- shared ---------- */
.tg-center { text-align: center; justify-content: center; }
.tg-center-row { justify-content: center; }
.tg-app [hidden] { display: none !important; }
.tg-app .rf-topbar .rf-cluster { flex-wrap: nowrap; }
.tg-wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.tg-topbar-gap { width: 44px; display: flex; justify-content: flex-end; }
.tg-count { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tg-app .rf-push { width: 100%; }
.tg-phone { position: relative; }
.tg-phone > * { min-width: 0; }

/* ---------- join (mockup 05) ---------- */
.tg-join { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.tg-join-body { gap: 18px; }
.tg-join-title { font-size: 44px; line-height: 1; }
.tg-code-game { display: flex; align-items: center; gap: 6px; min-height: 24px; margin: 0; color: var(--rf-primary); font-weight: 700; }
.tg-code-game a { color: var(--rf-primary); }
.tg-name-input { min-height: 68px; font-size: 26px; font-weight: 800; }
.tg-team-btn { justify-content: flex-start; text-align: left; }
.tg-team-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- player lobby (mockup 06) ---------- */
.tg-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding-top: 8px; }
.tg-hero-disc {
  display: grid; place-items: center; width: 240px; height: 240px; max-width: 70vw; max-height: 70vw; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.tg-hero-disc .rf-avatar--xl { width: 60%; height: 60%; }
.tg-hero-name { margin-top: -28px; font-size: 44px; overflow-wrap: anywhere; }
.tg-hostline, .tg-tvline { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--rf-muted); font-weight: 700; }
.tg-rules { color: var(--rf-muted); font-size: 15px; }
.tg-rules summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.tg-rules p { margin: 0 0 8px; }
.tg-rules-text { font-size: 16px; margin: 0; }
.tg-teamlines { list-style: none; margin: 0; padding: 0; gap: 8px; }
.tg-teamlines .rf-chip { width: fit-content; max-width: 100%; }

/* ---------- host lobby (mockup 08) ---------- */
.tg-invite-card { gap: 14px; }
.tg-invite-card .rf-code > span { background: var(--rf-white); }
.tg-settings { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font-weight: 700; color: var(--rf-muted); }
.tg-settings a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- playing: the top, the question, the answers (mockups 09, 12) ---------- */
.tg-me { gap: 8px; }
.tg-me-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-size: 18px; }
.tg-me-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-ring-idle { display: inline-grid; place-items: center; color: var(--rf-white); }
.tg-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tg-host-score { margin-left: auto; }
.tg-q { margin: 0; }
.tg-clues { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; font-size: 18px; font-weight: 600; }
.tg-worth, .tg-hint { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; }
.tg-thumb { gap: 14px; }
.tg-number-row { display: flex; align-items: center; gap: 10px; }
.tg-number { min-height: 72px; font-size: 32px; font-weight: 800; text-align: center; }
.tg-unit { font-size: 20px; font-weight: 800; white-space: nowrap; }
.tg-paused { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 12px 16px; border-radius: 18px; background: var(--rf-panel); font-weight: 700; }
.tg-locked { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font-size: 20px; font-weight: 800; }
.tg-lock-badge { width: 88px; height: 88px; }
.tg-lock-badge .rf-icon { width: 48px; height: 48px; }
.tg-mine { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.tg-teampick .rf-small { margin: 0; text-align: center; }
body.typing .tg-phone .rf-push { margin-top: 0; }   /* the keyboard is up: keep the box right under the question */

/* ---------- the answer (mockup 13) ---------- */
.tg-verdict { gap: 12px; }
.tg-verdict .rf-verdict-title { font-size: clamp(44px, 14vw, 64px); }
.tg-answer-pill { min-height: 48px; font-size: 20px; max-width: 100%; white-space: normal; text-align: left; }
.tg-answer-pill .rf-avatar { width: 22px; height: 22px; }
.tg-next-hint {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; margin: 0; padding: 0 18px;
  border-radius: 18px; background: var(--rf-panel); font-weight: 800;
}
/* Short phones (360x640, iPhone 13's 664 px of browser): a right answer adds the "In 2.1 seconds" line and a long answer
   pill wraps under the points, which pushed the rating row below the fold (e2e-rating, P9). A smaller badge and title
   and tighter gaps keep the verdict, 3 standings rows and the rating row on one screen. */
@media (max-height: 760px) {
  .tg-verdict { gap: 8px; }
  .tg-verdict .rf-verdict-badge { width: 64px; height: 64px; border-width: 3px; }
  .tg-verdict .rf-verdict-badge .rf-icon { width: 36px; height: 36px; }
  .tg-verdict .rf-verdict-title { font-size: clamp(36px, 11vw, 48px); }
  .tg-verdict .tg-center-row { gap: 8px; }
  .tg-answer-pill { min-height: 40px; font-size: 18px; }
}

/* ---------- the host bar, menu and hand-off (mockups 09, 10) ---------- */
.tg-app .rf-hostbar { margin: 0 -4px; }
.tg-handoff-head { display: flex; align-items: center; gap: 8px; margin: 0; }
.tg-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tg-tvbox { padding: 14px; border: 2px solid var(--rf-line-cream); border-radius: 18px; background: var(--rf-white); }
.tg-tvbox-step { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.tg-tvurl { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.tg-tvbox .rf-code--sm > span { background: var(--rf-cream); }

/* ---------- v2.9: "Phones + a TV" (the host lobby's first card) and the lead sweep ---------- */
.tg-tvcard { gap: 10px; border: 3px solid var(--rf-primary); }
.tg-tvcard.is-on { border-color: var(--rf-good); }
.tg-tvcard-head { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 700; }
.tg-tvcard-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--rf-primary); color: var(--rf-white); }
.tg-tvcard.is-on .tg-tvcard-icon { background: var(--rf-good); }
.tg-tvcard-icon .rf-icon { width: 26px; height: 26px; }
.tg-tvcard-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tg-tvcard-url { font-size: clamp(18px, 5.6vw, 26px); font-weight: 800; overflow-wrap: anywhere; }
.tg-tvcard-step { display: flex; flex-direction: column; gap: 6px; margin: 0; font-weight: 700; }
.tg-tvcard-step .rf-code > span { background: var(--rf-cream); }
.tg-tvcard-live { margin: 0; font-weight: 700; }
.tg-tvcard-live.is-on b { display: inline-flex; align-items: center; gap: 4px; color: var(--rf-good); }
.tg-tvcard .rf-btn--link { align-self: flex-start; min-height: 44px; padding: 0; }
/* A scheduled change (Next, everyone answered, Start) takes effect 1.5 s after the tap, on every screen at once: the bar fills meanwhile. */
.tg-sweep { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px 16px; border-radius: 18px; background: var(--rf-panel); font-weight: 800; text-align: center; }
.tg-sweep-bar, .tv-sweep-bar { --rf-p: 0; display: block; height: 8px; border-radius: var(--rf-r-pill); background: var(--rf-track); overflow: hidden; }
.tg-sweep-bar > i, .tv-sweep-bar > i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--rf-primary); transform-origin: left center; transform: scaleX(var(--rf-p)); }
.tv-sweep { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 0.3em; padding: 0.5em 4vw 0.8em; font-size: clamp(22px, 1.6vw, 48px); font-weight: 800; text-align: center; }
.tv-sweep-bar { height: clamp(10px, 0.8vw, 24px); }
/* v2.9 (A4): the TV's pair screen says how to start a game when there is none yet */
.tv-pair-help { max-width: 30em; margin: 0; font-size: clamp(26px, 1.7vw, 50px); line-height: 1.35; color: var(--rf-muted); }
.tv-pair-help b { color: var(--rf-fg); }

/* ---------- the host left (mockup 11) and Resuming ---------- */
.tg-away { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.tg-away-mid { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding-top: 24px; }
.tg-away-ring { position: relative; display: grid; place-items: center; }
.tg-away-ring .rf-ring--lg { width: 176px; height: 176px; }
.tg-away-ring .rf-ring--lg .rf-ring-num { font-size: 48px; margin-top: 30px; }
.tg-away-icon { position: absolute; top: 40px; color: var(--rf-muted); }
.tg-away-who { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.tg-claim-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--rf-primary); font-weight: 700; }
.tg-resume {
  position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(11, 20, 80, 0.92); color: var(--rf-white);
}
.tg-resume-num { font-size: 120px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---------- final (mockup 14): cream page, blue band ---------- */
.tg-winner { padding-top: max(20px, env(safe-area-inset-top, 0px)); }
.tg-winner-meta { background: var(--rf-night); }
.tg-myplace { margin: 0; color: var(--rf-muted); }
.tg-final { padding-top: 20px; gap: 16px; max-width: 560px; }
.tg-record { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 800; }
/* Review M1: the v1 .record-line is yellow (made for the blue TV); on the cream final page it is ink, with the star in yellow. */
.tg-final .tg-record.record-line { color: var(--rf-ink); }
.tg-final .tg-record .rf-icon { color: #9a6f00; }
.tg-addscore-row { display: flex; gap: 8px; }
.tg-final .rf-btn-row > .rf-waiting { justify-content: center; }
.tg-final-links { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; }
.tg-final-links a { min-height: 44px; display: inline-flex; align-items: center; }
.tg-nextgame { display: flex; flex-direction: column; gap: 10px; }
.tg-nextgame .rf-h2 { display: flex; align-items: center; gap: 6px; }

/* No TV in this game: a laptop or tablet uses more of the screen. */
@media (min-width: 760px) {
  body.tg-wide .tg-phone { max-width: 760px; }
  .tg-hero-disc { width: 260px; height: 260px; }
}

/* ======================================================================================================================
   host.html: the phone-first host setup (mockup 07) on cream
   ====================================================================================================================== */
.tg-setup { gap: 18px; }
.tg-setup-head { display: flex; align-items: center; gap: 12px; }
.tg-setup-head h1 { flex: 1; }
.tg-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tg-mode {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 120px; padding: 16px;
  border: var(--rf-line) solid var(--rf-ink); border-radius: 22px; background: var(--rf-white); color: var(--rf-ink); box-shadow: 0 5px 0 var(--rf-ink);
  font-size: 20px; font-weight: 800; line-height: 1.1; cursor: pointer;
}
.tg-mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg-mode .rf-avatar { width: 36px; height: 36px; }
.tg-mode:has(input:checked) { background: var(--rf-tile); outline: 3px solid var(--rf-link-cream); outline-offset: 3px; }
.tg-mode:has(input:checked) .rf-avatar { fill: var(--rf-ink); }
.tg-mode:has(input:focus-visible) { outline: 3px solid var(--rf-link-cream); outline-offset: 3px; }
.tg-mode-blurb { font-size: 14px; font-weight: 600; color: var(--rf-muted-cream); }
.tg-mode:has(input:checked) .tg-mode-blurb { color: var(--rf-ink); }
.tg-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-cat {
  appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 10px; border: var(--rf-line) solid var(--rf-ink);
  border-radius: var(--rf-r-pill); background: var(--rf-white); color: var(--rf-ink); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.tg-cat .rf-icon { width: 20px; height: 20px; }
.tg-cat[aria-pressed="true"] { background: var(--rf-yellow); font-weight: 800; }
.tg-cat--more { border-style: dashed; border-color: var(--rf-muted-cream); color: var(--rf-muted-cream); background: transparent; }
.tg-catgroup { display: flex; flex-direction: column; gap: 8px; }
.tg-catgroup h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.tg-catgroup h3 .rf-btn--link { min-height: 36px; padding: 0 6px; font-size: 14px; }
.tg-tvnote {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--rf-line-cream); border-radius: 18px;
  background: var(--rf-white); color: var(--rf-ink);
}
.tg-tvnote-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--rf-ink); color: var(--rf-white); }
.tg-tvnote b { display: block; }
.tg-more summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 800; }
.tg-more[open] { display: flex; flex-direction: column; gap: 14px; }
.tg-setup .theme-picker { flex-wrap: wrap; }
.tg-note { margin: 0; min-height: 1.4em; font-weight: 700; color: var(--rf-muted-cream); }
.tg-setup-go { position: sticky; bottom: 0; padding: 10px 0 max(10px, env(safe-area-inset-bottom, 0px)); background: linear-gradient(to bottom, rgba(255, 246, 229, 0), var(--rf-cream) 30%); }
@media (min-width: 760px) {
  .tg-setup { max-width: 760px; }
  .tg-modes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ======================================================================================================================
   host.html at /tv (or ?display=1): the read-only TV display (mockups 17-20). Nothing here looks tappable.
   ====================================================================================================================== */
.tv-brand { width: clamp(56px, 3.75vw, 108px); height: clamp(56px, 3.75vw, 108px); flex: none; }
.tv-pair { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(20px, 2vw, 56px); text-align: center; }
.tv-pair form { display: flex; flex-direction: column; align-items: center; gap: 24px; width: min(100%, 900px); }
.tv-pair .rf-code-input { min-height: 1.4em; max-width: 6em; font-size: clamp(72px, 7vw, 200px); border-radius: 0.2em; }
/* The pairing form is the TV's only input, shown once before the game: a real button, TV-sized. */
.tv-pair .rf-btn { min-height: clamp(64px, 4.5vw, 128px); font-size: clamp(28px, 1.9vw, 54px); padding: 0 1.2em; border-radius: 0.6em; }
.tv-pair .rf-error { font-size: clamp(28px, 1.6vw, 46px); }
.tv-lobby { flex: 1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: clamp(32px, 3.3vw, 96px); }
.tv-lobby-left { display: flex; flex-direction: column; gap: clamp(24px, 2.2vw, 64px); min-width: 0; }
.tv-lobby-url { margin: 0; font-size: clamp(32px, 2.5vw, 72px); font-weight: 800; }
.tv-lobby-url span { color: var(--rf-muted); font-weight: 700; }
.tv-lobby-right { display: flex; justify-content: center; }
.tv-steps { display: flex; gap: clamp(20px, 1.9vw, 56px); flex-wrap: wrap; }
.tv-steps .rf-tv-hint { color: var(--rf-muted); }
.tv-host { display: inline-flex; align-items: center; gap: 0.4em; color: var(--rf-primary); font-weight: 800; }
.tv-main { flex: 1; display: flex; flex-direction: column; gap: clamp(20px, 2vw, 56px); min-height: 0; }
.tv-q { margin: 0; }
.tv-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.tv-foot .rf-ring { flex: none; }
.tv-clues { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 0.3em; font-size: clamp(32px, 2.3vw, 66px); font-weight: 700; }
.tv-clues li.is-later { color: var(--rf-muted); list-style: none; }
.tv-big-hint { display: inline-flex; align-items: center; gap: 0.5em; margin: 0; font-size: clamp(32px, 2.5vw, 72px); font-weight: 800; color: var(--rf-muted); }
.tv-reveal { flex: 1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(32px, 3.3vw, 96px); align-items: start; }
.tv-reveal-left { display: flex; flex-direction: column; gap: clamp(20px, 2vw, 56px); min-width: 0; }
.tv-truth {
  display: flex; align-items: center; gap: 0.5em; padding: 0.35em 0.6em; border-radius: 0.5em; background: var(--rf-tile, var(--rf-yellow)); color: var(--rf-ink);
  font-size: clamp(48px, 4.4vw, 128px); font-weight: 800; line-height: 1.05;
}
.tv-truth .rf-shape { width: 1.1em; height: 1.1em; }
.tv-truth-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tv-truth-mark { display: grid; place-items: center; width: 1.3em; height: 1.3em; flex: none; border-radius: 50%; background: var(--rf-good); border: 0.06em solid var(--rf-ink); }
.tv-truth-mark .rf-icon { width: 0.75em; height: 0.75em; stroke-width: 3; }
.tv-fact {
  display: flex; align-items: flex-start; gap: 0.6em; margin: 0; padding: 0.7em 0.9em; border-radius: 0.7em; background: var(--rf-cream); color: var(--rf-ink);
  font-size: clamp(28px, 1.9vw, 54px); font-weight: 700; line-height: 1.25;
}
.tv-fact .rf-icon { flex: none; margin-top: 0.1em; }
.tv-who { display: flex; flex-wrap: wrap; gap: 0.4em 0.9em; font-size: clamp(28px, 1.67vw, 48px); font-weight: 800; }
.tv-who span { display: inline-flex; align-items: center; gap: 0.3em; }
.tv-who .is-miss { opacity: 0.45; }
.tv-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3em; font-size: clamp(28px, 1.9vw, 54px); font-weight: 700; }
.tv-board li { display: flex; gap: 0.6em; }
.tv-board .tv-board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-board .tv-board-gain { color: var(--rf-good); font-weight: 800; }
.tv-board .is-truth { color: var(--rf-primary); font-weight: 800; }
.tv-scores-head { display: flex; align-items: center; gap: 0.4em; color: var(--rf-primary); }
.tv-final { flex: 1; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 3.3vw, 96px); align-items: end; }
.tv-final-left { display: flex; flex-direction: column; gap: clamp(20px, 2vw, 56px); min-width: 0; }
.tv-final .rf-podium-step { box-shadow: none; border: 0; padding: 0.5em 0.3em; font-size: clamp(28px, 1.9vw, 54px); }
.tv-final .rf-podium-step .rf-avatar { width: 2.2em; height: 2.2em; }
.tv-final .rf-podium-place { font-size: 2em; }
.tv-final .rf-podium-pts { font-size: 0.9em; }
.tv-final .rf-podium-step--1 { min-height: 9em; }
.tv-final .rf-podium-step--2 { min-height: 7em; }
.tv-final .rf-podium-step--3 { min-height: 5.5em; }
.tv-final-right { display: flex; flex-direction: column; gap: clamp(20px, 2vw, 56px); }
.tv-scan { display: flex; flex-direction: column; align-items: center; gap: 0.5em; padding: 0.8em; border-radius: 0.8em; background: var(--rf-cream); color: var(--rf-ink); text-align: center; font-size: clamp(28px, 1.9vw, 54px); font-weight: 800; }
.tv-scan .rf-qr-box { width: clamp(180px, 15vw, 440px); height: clamp(180px, 15vw, 440px); }
.tv-scan-code { font-size: 1.6em; letter-spacing: 0.12em; }
.tv-games { display: flex; flex-wrap: wrap; gap: 0.4em; font-size: clamp(28px, 1.67vw, 48px); }
.tv-games .rf-tv-tile { background: var(--rf-game); color: var(--rf-ink); }
.tv-paused { display: inline-flex; align-items: center; gap: 0.5em; }
.tv-ready { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(20px, 2vw, 56px); text-align: center; }
.rf-tv .rf-rise { animation-duration: 0.5s; }
@media (max-width: 900px) {
  .tv-lobby, .tv-reveal, .tv-final { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- fixes found in the screenshots ---------- */
.tg-app .rf-answer-text { max-width: 100%; overflow-wrap: break-word; hyphens: manual; }
.tg-phone .rf-answers.tg-long .rf-answer { font-size: clamp(17px, 5vw, 21px); }
.rf-tv .rf-answers.tg-long .rf-answer { font-size: clamp(36px, 2.9vw, 84px); }
.tg-mode-blurb { display: block; margin-top: 4px; }
/* The phone's final page only (v2.0 P11, review H1): the TV stage is a main[data-screen="final"] too. */
#phoneMain[data-screen="final"] { padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px)); max-width: 560px; gap: 0; }
#phoneMain[data-screen="final"] .tg-winner { border-radius: 0 0 36px 36px; }
.tv-reveal .rf-question { font-size: clamp(36px, 2.9vw, 84px); max-width: 100%; }
.tv-truth-text { overflow-wrap: break-word; hyphens: manual; }
.tv-counts { display: flex; flex-wrap: wrap; gap: 0.5em; font-size: clamp(28px, 1.9vw, 54px); }
.tv-count { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.2em 0.6em; border-radius: 999px; background: var(--rf-tile); color: var(--rf-ink); opacity: 0.55; }
.tv-count.is-right { opacity: 1; }
.tv-count .rf-shape { width: 0.9em; height: 0.9em; }
body.typing .rf-hostbar--sticky { position: static; }   /* the keyboard is up: the question goes to the top, not under the bar */
.tg-tvnote .tv-help-link { margin: 4px 0 0; font-size: 15px; }
.tg-tvnote .tv-help-link a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--rf-link-cream); font-weight: 700; }
.tg-phone .rf-answers.tg-long .rf-answer { font-size: clamp(17px, 5.2vw, 22px); }
.tg-phone .rf-answers.tg-xlong .rf-answer { font-size: clamp(15px, 4.4vw, 18px); }
.tv-q--sm { font-size: clamp(40px, 3.1vw, 90px); }
.tv-wiki { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 2.5vw, 72px); align-items: start; }
.rf-tv .tv-wiki .rf-answer { min-height: clamp(72px, 9vh, 150px); font-size: clamp(32px, 2.4vw, 70px); }
.tv-who .rf-avatar { width: 1.1em; height: 1.1em; }
.tv-who .rf-icon { width: 1em; height: 1em; }
/* P1's .rf-input (0,1,0) loses to v1's input[type="text"] (0,1,1): restate it here until P1 raises it. */
.tg-app input.rf-input, .tg-app select.rf-input {
  min-height: 56px; padding: 0 16px; border: var(--rf-line) solid var(--rf-outline); border-radius: 16px;
  background: var(--rf-white); color: var(--rf-ink); font: inherit; font-size: 20px; font-weight: 600;
}
.tg-app input.rf-code-input { min-height: 72px; text-align: center; font-size: 44px; font-weight: 800; letter-spacing: 0.3em; padding-left: 0.3em; text-transform: uppercase; }
.tg-app input.tg-name-input { min-height: 68px; font-size: 26px; font-weight: 800; }
.tg-app input.tg-number { min-height: 72px; font-size: 32px; font-weight: 800; text-align: center; }
.rf-tv .tv-pair input.rf-code-input { min-height: 1.4em; max-width: 6em; font-size: clamp(72px, 7vw, 200px); border-radius: 0.2em; }
.tg-app input.rf-input::placeholder { color: #6b72a6; }

/* ======================================================================================================================
   v2.2 (FIX-A, QA-A play-test)
   ====================================================================================================================== */
/* #3: the TV can't scroll. js/host.js fit() lays a screen that is taller than the window out in a bigger box and scales it
   down (--tv-fit), so a 720p TV, a long question or a 12-player final page always fits. */
#tv.rf-tv-stage {
  position: fixed; top: 0; left: 0; min-height: 0;
  width: calc(100vw / var(--tv-fit, 1)); height: calc(100vh / var(--tv-fit, 1)); height: calc(100dvh / var(--tv-fit, 1));
  transform: scale(var(--tv-fit, 1)); transform-origin: 0 0;
}
.tv-final .rf-podium-name { overflow-wrap: anywhere; white-space: normal; }
.tv-rest { margin: 0; }
.tv-moved .rf-qr-box { width: clamp(160px, 13vw, 400px); height: clamp(160px, 13vw, 400px); }
.tv-moved .tv-scan-code { font-size: 2.2em; }
.tv-moved-site { font-size: 0.7em; font-weight: 700; overflow-wrap: anywhere; }
/* #19: a 14-letter name gets more room on the TV (the scoreboard and the podium) before it is cut. */
.rf-tv .rf-row-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.05; }

/* #7: the host moved to another game (players' final page). */
.tg-moved { display: flex; flex-direction: column; gap: 12px; }
.tg-moved-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; font-weight: 800; }
.tg-moved-code { font-size: 26px; letter-spacing: 0.12em; }
.tg-namehint { margin: 0; min-height: 1.2em; }

/* #16: one phone for everyone ("together") is never shown on a TV: no TV note on the setup. */
.tg-setup:has(#modeSeg button:nth-child(3)[aria-pressed="true"]) #tvNote { display: none; }

/* #20: the verdict's "pop" never makes the page wider than the phone. */
.tg-app #phoneMain { overflow-x: clip; }

/* #19: names in standings: the "· you" and a 14-letter name share the row; let a long one take two lines. */
.tg-phone .rf-standings .rf-row-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.1; }
.tg-phone .rf-row { flex-wrap: nowrap; }

/* #5, #18: the main buttons on short phones. The host's Start and Next stay at the bottom of the screen (sticky); on a
   final page the buttons come right after the standings. */
#phoneMain[data-screen="hostlobby"] > .rf-push:last-child,
#phoneMain[data-screen="reveal"] #nextBig {
  position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 5;
}
#phoneMain[data-screen="hostlobby"] > .rf-push:last-child { padding-top: 8px; background: linear-gradient(to bottom, transparent, var(--rf-bg, var(--rf-blue)) 14px); }
#phoneMain[data-screen="final"] .tg-final > * { order: 3; }
#phoneMain[data-screen="final"] .tg-final > #finalStandings { order: 0; }
#phoneMain[data-screen="final"] .tg-final > .rf-btn-row, #phoneMain[data-screen="final"] .tg-final > #differentGame,
#phoneMain[data-screen="final"] .tg-final > #movedCard, #phoneMain[data-screen="final"] .tg-final > .quick-again { order: 1; }
#phoneMain[data-screen="final"] .tg-final > .rf-done-row { order: 2; }   /* Done right under them (the host's Next game row after) */
.tg-meta { flex-wrap: nowrap; }
.tg-meta #qCount { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-meta .rf-pill { flex: none; }
@media (max-height: 700px) {
  .tg-phone.rf-screen, #phoneMain.rf-screen { gap: 12px; }
  .tg-phone .tg-q { font-size: clamp(20px, 6.2vw, 24px); }
  .tg-phone .rf-answers { gap: 10px; }
  .tg-phone .rf-answers:not(.rf-answers--list) .rf-answer { min-height: 84px; padding: 12px; gap: 6px; border-radius: 20px; font-size: clamp(17px, 5.2vw, 21px); }
  .tg-phone .rf-answers:not(.rf-answers--list) .rf-answer .rf-shape { width: 30px; height: 30px; }
  .tg-phone .rf-answers--list .rf-answer { min-height: 56px; padding: 8px 14px; font-size: 18px; }
  .tg-phone .tg-thumb { gap: 10px; }
  .tg-phone .tg-timer { margin: 0; }
  .tg-phone .rf-hostbar { min-height: 56px; padding: 6px; }
  .tg-phone .rf-hostbar-btn { width: 44px; height: 44px; }
  .tg-phone .rf-hostbar-btn--go { width: 50px; }
  .tg-phone .rf-row { min-height: 46px; }
  .tg-phone .rf-row--lead, .tg-phone .rf-row.is-me { min-height: 48px; }
  .tg-phone .rf-rate button { width: 48px; height: 48px; }
  /* the final page's blue band, smaller */
  #phoneMain[data-screen="final"] .tg-winner { gap: 6px; padding-bottom: 16px; }
  #phoneMain[data-screen="final"] .tg-winner .rf-avatar--lg { width: 72px; height: 72px; }
  #phoneMain[data-screen="final"] .rf-winner-name { font-size: 40px; }
  #phoneMain[data-screen="final"] .tg-final { padding-top: 12px; gap: 10px; }
  #phoneMain[data-screen="final"] .rf-standings--compact .rf-row { min-height: 44px; }
  /* the host's lobby: a smaller code and QR */
  #phoneMain[data-screen="hostlobby"] .tg-invite-card { gap: 8px; padding: 12px; }
  #phoneMain[data-screen="hostlobby"] .rf-qr-box { width: 96px; height: 96px; }
}
.tg-me-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.rf-tv .rf-row-name { overflow: visible; line-height: 1.15; }
#hostMenu .rf-list-title { white-space: normal; overflow-wrap: anywhere; overflow: visible; }
/* #19: a 14-letter name with a 14-letter team: two lines rather than cut off */
.tg-me-name > span#meName { white-space: normal; overflow-wrap: anywhere; line-height: 1.1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tg-meta #qCount { white-space: normal; overflow: visible; }
.tg-phone .rf-chips .rf-chip-name { white-space: normal; overflow-wrap: anywhere; overflow: visible; line-height: 1.1; }
/* #18: Teams: "Lock in" stays on screen under a long question */
#phoneMain[data-screen="question"] .tg-teampick {
  position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 5; padding: 8px; border-radius: 18px; background: var(--rf-bg);
}
/* While typing (keyboard up), room below the box, so the page can always bring the question to the top (the short-screen
   rules above made some screens too short to scroll that far). */
body.typing #phoneMain.tg-phone { padding-bottom: 50vh; }
