/* Roomful v2.0: the umbrella site's in-room screens, shared by every game (P5a owns it; js/room.js uses it).
   body.rf-app: an app screen (join, lobby, card, host phone, TV, results): no site header or footer, the screen fills the
   window. The pieces js/room.js draws: the host menu's foot, "Host disconnected" (.rf-away), the automatic Resume
   (.rf-resume), the TV pairing screen (.rf-pair) and "Next game" (.rf-nextgame). Design-system classes are in site.css. */

body.rf-app { overflow-x: hidden; }
body.rf-app .page.gn { max-width: none; margin: 0; padding: 0; background: transparent; }
body.rf-app .landing-top, body.rf-app .site-foot { display: none; }
body.rf-app .page.gn > main { display: block; }   /* the shell's own <main> only (v2.0 integration: a screen's main.rf-screen keeps its flex column) */
body.rf-cream.rf-app { background: var(--rf-cream); color: var(--rf-ink); }
body.rf-room.rf-app { background: var(--rf-blue); color: var(--rf-white); }
body.rf-night.rf-app { background: var(--rf-night); color: var(--rf-white); }
.rf-app h1, .rf-app h2, .rf-app h3 { margin: 0; }
.rf-app .rf-screen { gap: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The host menu (js/room.js hostMenu) */
.rf-sheet-label { display: flex; align-items: center; gap: 8px; margin: 0; }
.rf-sheet-label .rf-icon { width: 18px; height: 18px; }
.rf-sheet-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 700; }

/* Host disconnected (mockup 11): a full screen over the player's own */
.rf-away {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; gap: 20px; overflow: auto;
  padding: max(14px, env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--rf-night); color: var(--rf-white);
}
.rf-away > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.rf-away .rf-pill .rf-icon { width: 16px; height: 16px; }
.rf-away-mid { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin-top: 24px; }
.rf-away-ring { position: relative; display: grid; place-items: center; }
.rf-away-ring .rf-ring { width: 168px; height: 168px; }
.rf-away-ring .rf-ring > svg { stroke-width: 3.5; }
.rf-away-ring .rf-ring-num { font-size: 52px; margin-top: 30px; }
.rf-away-icon { position: absolute; top: 34px; width: 34px; height: 34px; color: var(--rf-muted-room); }
.rf-away-mid .rf-title { font-size: 34px; }
.rf-away-sub { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.rf-away-hint { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--rf-primary); font-weight: 800; font-size: 15px; }
.rf-away-hint .rf-icon { width: 18px; height: 18px; }

/* Resuming in 3 (after a host takes over) */
.rf-resume {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 85;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 20px; border: var(--rf-line) solid var(--rf-ink); border-radius: 22px;
  background: var(--rf-primary); color: var(--rf-ink); box-shadow: var(--rf-press-sm) var(--rf-ink); max-width: calc(100vw - 32px);
}
.rf-resume-text { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 800; font-size: 18px; white-space: nowrap; }
.rf-resume-num { font-size: 26px; font-variant-numeric: tabular-nums; }

/* The TV pairing screen */
.rf-pair-stage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.rf-pair-logo { width: 64px; height: 64px; }
.rf-pair-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.rf-pair-tv { width: 72px; height: 72px; color: var(--rf-primary); }
.rf-pair { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(560px, 100%); }
.rf-pair .rf-field { width: 100%; }
.rf-pair .rf-code-input { text-align: center; letter-spacing: 0.3em; font-size: clamp(40px, 5vw, 96px); min-height: 1.6em; }
.rf-tv .rf-pair .rf-btn { font-size: clamp(22px, 1.6vw, 40px); }
.rf-pair .rf-error { min-height: 1.4em; }

/* Next game (mockup 14) */
.rf-nextgame { display: flex; flex-direction: column; gap: 10px; }
.rf-nextgame .rf-h2 { display: flex; align-items: center; gap: 8px; }
.rf-nextgame .rf-h2 .rf-icon { width: 22px; height: 22px; }

/* Final screens: the winner band reaches the edges of the phone */
.rf-app .rf-winner { margin-left: -16px; margin-right: -16px; margin-top: -14px; }
.rf-app .rf-screen { overflow-x: clip; }
.rf-app .rf-nextgame .rf-gamestrip { margin-right: -16px; padding-right: 16px; }
.rf-tv .rf-pair .rf-field label { font-size: var(--rf-fs-label); }
.page.gn .rf-label { font-size: var(--rf-fs-label); margin: 0; }
.page.gn .rf-title { font-size: var(--rf-fs-title); margin: 0; }
.page.gn .rf-display { font-size: var(--rf-fs-display); margin: 0; }
.page.gn .rf-h2 { font-size: 20px; margin: 0; }
.page.gn .rf-winner-name { font-size: var(--rf-fs-display); margin: 0; }
.rf-invite-url { overflow-wrap: anywhere; }

/* Thumb-first (P9, the viewport matrix): on a phone the setup's "Open the room" stays at the bottom of the screen while the
   options scroll (Bingo, Words: the button is the form's own child; Charades, Mystery: its row is), as Trivia's and Cards'
   setups do. */
@media (max-width: 767px) {
  body.rf-app form > .rf-stack:has(> #openRoom) {
    position: sticky; bottom: 0; z-index: 10; padding-top: 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to bottom, transparent, var(--rf-bg) 30%);
  }
  body.rf-app form > #openRoom { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 10; }
}
