/* Roomful Mystery's live game (v2.0): the host's setup, joining, the phones (with the host's bar), the TV and the results.
   Built on the v2 design system in site.css (rf- classes, --rf- tokens); this file lays out only what is Mystery's own
   (mg- classes). Characters carry a shape and a tint, so nobody is told apart by color alone; crossed-out suspects carry
   an x and aria-pressed. Text on phones is never below 15 px; on the TV never below 28 px. Classes only: the CSP allows
   no inline styles (numbers a script owns are custom properties set from JS). css/mystery.css (the content pages and the
   print kit) is not touched by v2. Loaded on /mystery/host, tv, join, play and results. */

/* ---------- room-v2 stand-in (P5b, until P5a's css/room-v2.css is on these pages; the integrator may drop it then) ---------- */
body.rf-app .landing-top, body.rf-app .site-foot { display: none; }
body.rf-app { overflow-x: hidden; }
.rf-apppage, .rf-apppage > main { max-width: none; margin: 0; padding: 0; }
.rf-away { display: flex; flex-direction: column; gap: 20px; flex: 1; text-align: center; }
.rf-away-mid { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; }
.rf-away-mid .rf-ring--lg { width: 168px; height: 168px; }
.rf-away-mid .rf-ring--lg .rf-ring-num { font-size: 48px; }
.rf-away-who { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--rf-primary); }
.rf-resume { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background: rgba(11, 20, 80, 0.88); color: var(--rf-white); text-align: center; padding: 24px; --rf-ghost: var(--rf-muted-room); --rf-fg: var(--rf-white); }
.rf-resume .rf-title { margin: 0; }
.rf-nextgame { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rf-nextgame .rf-section-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.rf-nextgame .rf-gamestrip { margin-right: 0; }
.rf-sheet-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rf-sheet .rf-label { display: flex; align-items: center; gap: 8px; margin: 0; }
.rf-display-pair { display: flex; flex-direction: column; gap: 20px; width: min(100%, 760px); }
.rf-tv .rf-display-pair .rf-code-input { min-height: 1.4em; font-size: clamp(64px, 6vw, 160px); }
.rf-tv .rf-display-pair label { font-size: var(--rf-fs-label); }
.rf-tv .rf-display-pair .rf-error { font-size: var(--rf-fs-small); }
.rf-qr-box > canvas.qr { width: 100%; height: 100%; border-radius: 0; }

/* ---------- shared bits ---------- */
.mystery-screen { min-width: 0; }
.rf-hostbar .rf-ring-num { font-size: 13px; letter-spacing: -0.02em; }
.mg-grow { flex: 1; margin: 0; }
.mg-center { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.mg-center > .rf-icon { width: 56px; height: 56px; }
.mg-center h1, .mg-center p, .mg-center-text { margin: 0; text-align: center; }
.mg-cluster { justify-content: center; }
.mg-who { display: flex; align-items: center; gap: 12px; }
.mg-who b, .mg-who h1, .mg-who h2 { margin: 0; overflow-wrap: anywhere; }
.mg-note { margin: 0; color: var(--rf-muted); }
.mg-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; color: var(--rf-muted); text-align: center; }
.mg-missing { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font-weight: 700; color: var(--rf-primary); }
.mg-story { margin: 0; font-size: 18px; line-height: 1.5; text-wrap: pretty; }
.mg-line { margin: 0; font-size: 19px; font-style: italic; font-weight: 650; }
.mg-prompt { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--rf-cream); color: var(--rf-ink); font-weight: 750; }
.mg-prompt .rf-icon { flex: none; margin-top: 2px; }
.mg-cast { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-cast-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 18px; background: var(--rf-panel); color: var(--rf-fg); }
.mg-cast-card.is-mine { outline: 3px solid var(--rf-primary); }
.mg-cast-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mg-cast-text strong { font-size: 17px; }
.mg-by, .mg-costume { font-size: 14px; font-weight: 700; color: var(--rf-muted); }
.mg-about { font-size: 15px; }
.mg-clues, .mg-evidence { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-clue, .mg-evidence li { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 18px; background: var(--rf-cream); color: var(--rf-ink); }
.mg-clue.is-new { outline: 3px solid var(--rf-primary); outline-offset: 2px; }
.mg-clue-round { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--rf-muted-cream); }
.mg-clue-round .rf-icon { width: 16px; height: 16px; }
.mg-clue-from { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; }
.mg-clue-from .rf-avatar { width: 20px; height: 20px; }
.mg-clue-text { font-size: 17px; line-height: 1.4; }
.mg-tally { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-tally li { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(60px, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border-radius: 16px; background: var(--rf-panel); font-weight: 700; }
.mg-tally li.is-culprit { background: var(--rf-primary); color: var(--rf-ink); --rf-track: rgba(11, 20, 80, 0.25); }
.mg-who { min-width: 0; }
.mg-tally .mg-who { overflow-wrap: anywhere; }
.mg-bar { display: block; height: 10px; border-radius: 999px; background: var(--rf-track); overflow: hidden; }
.mg-bar i { display: block; height: 100%; width: calc(var(--rf-p, 0) * 100%); border-radius: inherit; background: currentColor; }
.mg-n { min-width: 2ch; text-align: right; }
.mg-more { border-top: 2px solid var(--rf-panel-line, transparent); padding-top: 8px; }
.mg-more > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 800; cursor: pointer; list-style: none; }
.mg-more > summary::-webkit-details-marker { display: none; }
.mg-more[open] { display: flex; flex-direction: column; gap: 12px; }
.mg-tvurl { margin: 0; font-size: 26px; font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.mg-sheet .rf-code--sm { align-self: center; }
.mg-kick { width: 44px; height: 44px; min-height: 44px; padding: 0; }

/* ---------- setup (cream) ---------- */
.mg-setup .rf-title { font-size: 28px; white-space: nowrap; }
.mg-field { display: flex; flex-direction: column; gap: 8px; }
.mg-field h2 { margin: 0; }
.mg-scripts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mg-script {
  appearance: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px;
  border: var(--rf-line) solid var(--rf-outline); border-radius: 20px; background: var(--rf-white); color: var(--rf-ink); box-shadow: var(--rf-press-sm);
  font: inherit; text-align: left; cursor: pointer; touch-action: manipulation;
}
.mg-script[aria-pressed="true"] { background: var(--rf-game); outline: 3px solid var(--rf-blue); outline-offset: 2px; }
.mg-script-name { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.mg-script-premise { font-size: 15px; line-height: 1.35; }
.mg-script-meta { font-size: 14px; font-weight: 700; color: var(--rf-muted-cream); }
.mg-script[aria-pressed="true"] .mg-script-meta { color: var(--rf-ink); }
.mg-toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 700; }
.mg-toggle input { width: 24px; height: 24px; flex: none; accent-color: var(--rf-blue); }
.mg-tvcard { 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); text-decoration: none; }
.mg-tvcard-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--rf-night); color: var(--rf-white); }
.mg-tvcard-text { display: flex; flex-direction: column; font-size: 15px; }
.mg-tvcard-text span { color: var(--rf-link-cream); font-weight: 700; }
.mg-setup .tv-help-link { margin: 0; font-size: 15px; }

/* ---------- join ---------- */
.mg-join-title { margin: 24px 0 0; font-size: 44px; }
.mg-join-note { margin: 0; color: var(--rf-muted); }
.mg-join .rf-error:empty { display: none; }

/* ---------- phones ---------- */
.mg-phone { overflow-x: hidden; }
.mg-top .mg-me { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 18px; }
.mg-top .mg-me b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8px; text-align: center; }
.mg-hero p, .mg-hero h1 { margin: 0; }
.mg-hero-name { overflow-wrap: anywhere; }
.mg-costume { display: inline-flex; align-items: center; gap: 6px; }
.mg-invite .rf-code > span { height: 76px; font-size: 52px; }
.mg-players .rf-list-row { gap: 8px; }
.mg-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mg-tabbody { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.mg-tabs { position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: auto; padding: 6px;
  border-radius: 22px; background: var(--rf-outline); }
.mg-tab { appearance: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 4px 2px; border: 0; border-radius: 16px;
  background: transparent; color: var(--rf-white); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.mg-tab .rf-icon { width: 22px; height: 22px; }
.mg-tab[aria-selected="true"] { background: var(--rf-primary); color: var(--rf-ink); }
.mg-charcard { gap: 12px; }
.mg-charcard .rf-title { font-size: 26px; }
.mg-peekbox { display: flex; flex-direction: column; gap: 10px; }
.mg-secret { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 16px; background: var(--rf-ink); color: var(--rf-white); --rf-muted: var(--rf-muted-room); }
.mg-secret p { margin: 0; }
.mg-secret-text { font-size: 17px; font-weight: 650; }
.mg-secret.covered { display: none; }
.mg-peek { touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-suspects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-suspect { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border: var(--rf-line) solid var(--rf-outline);
  border-radius: 18px; background: var(--rf-white); color: var(--rf-ink); font: inherit; font-weight: 800; text-align: left; cursor: pointer; }
.mg-suspect-name { flex: 1; }
.mg-suspect.is-out { opacity: 0.6; }
.mg-suspect.is-out .mg-suspect-name { text-decoration: line-through; }
.mg-choices .rf-answer { min-height: 64px; gap: 12px; font-size: 18px; }
.mg-choice.is-crossed .rf-answer-text { text-decoration: line-through; opacity: 0.7; }
.mg-reasons > button { min-height: 48px; text-align: left; padding: 8px 14px; }
.mg-voted, .mg-count { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; font-weight: 700; }
.mg-answer { gap: 8px; }
.mg-answer p { margin: 0; }
.mg-bigev .mg-story { font-size: 22px; font-weight: 700; }
.mg-winner { margin: 0 -16px; border-radius: 0 0 36px 36px; }
.mg-phone.phase-ended { gap: 16px; }
.mg-phone.phase-ended .rf-verdict { margin-top: 4px; }
.mg-phone .rf-verdict-title { font-size: 40px; }
.mg-phone .rf-verdict-badge { width: 72px; height: 72px; }

/* ---------- results (cream) ---------- */
.mg-result-line { margin: 0; text-align: center; font-size: 20px; font-weight: 800; }
.mg-res-card { gap: 8px; padding: 16px; }
.mg-res-card p { margin: 0; }
.mg-results .mg-clue { background: var(--rf-cream); }
.mg-results .mg-tally li { background: var(--rf-cream); color: var(--rf-ink); }

/* ---------- the TV: display only, large type ---------- */
/* v2.2 (FIX-C, QA-C #1/#2): every size on the stage is "design size x --mg-s". mystery-host.js fit() steps --mg-s down
   until the screen fits (a TV can't scroll); text never goes under --mg-floor = 2.6vh (28 px on a 1080p TV, the same
   physical size on a 720p one). Sizes are design px at 1920 wide (vw), as in site.css's .rf-tv scale. */
.mg-tv {
  --mg-s: 1; --mg-floor: 2.6vh;
  --rf-fs-display: max(var(--mg-floor), calc(min(6.25vw, 180px) * var(--mg-s)));
  --rf-fs-title: max(var(--mg-floor), calc(min(3.75vw, 108px) * var(--mg-s)));
  --rf-fs-body: max(var(--mg-floor), calc(min(1.875vw, 54px) * var(--mg-s)));
  --rf-fs-small: max(var(--mg-floor), calc(min(1.56vw, 46px) * var(--mg-s)));
  --rf-fs-label: max(var(--mg-floor), calc(min(1.46vw, 42px) * var(--mg-s)));
  font-size: var(--rf-fs-body);
}
.mg-tv.rf-tv-stage { gap: calc(min(2.2vw, 64px) * var(--mg-s)); padding: calc(min(2.9vw, 84px) * var(--mg-s)) calc(min(4.6vw, 132px) * var(--mg-s)) calc(min(3.3vw, 96px) * var(--mg-s)); }
.mg-tv .rf-tv-bar .rf-pill, .mg-tv .rf-tv-bar .rf-codepill { min-height: calc(min(3.125vw, 90px) * var(--mg-s)); font-size: var(--rf-fs-small); }
.mg-tv .is-off { display: none !important; }
.mg-tv h1, .mg-tv h2, .mg-tv p { margin: 0; }
.mg-tv-pair-mid { display: flex; flex-direction: column; gap: clamp(20px, 2vw, 56px); margin: auto 0; }
.mg-tv-lobby { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "join qr" "people people"; gap: clamp(24px, 2.5vw, 72px); align-items: center; flex: 1; }
.mg-tv-join { grid-area: join; display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 46px); }
.mg-tv-premise { max-width: 32em; font-size: var(--rf-fs-body); color: var(--rf-muted); }
.mg-tv-lobby .rf-qr { grid-area: qr; margin: 0; }
.mg-tv-people { grid-area: people; align-self: end; }
.mg-tv-split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: calc(min(3vw, 88px) * var(--mg-s)); flex: 1; align-items: start; }
.mg-tv-main, .mg-tv-side { display: flex; flex-direction: column; gap: calc(min(1.5vw, 44px) * var(--mg-s)); min-width: 0; }
.mg-tv-pager { display: flex; flex-direction: column; gap: calc(min(0.8vw, 24px) * var(--mg-s)); }
.mg-tv-pagenum { font-weight: 700; opacity: 0.8; }
.mg-tv-side .rf-label { display: flex; align-items: center; gap: 0.4em; }
.mg-tv-title { overflow-wrap: anywhere; }
.mg-tv-story { font-size: max(var(--mg-floor), calc(min(2.4vw, 68px) * var(--mg-s))); line-height: 1.35; text-wrap: pretty; }
.mg-tv-story--mid { font-size: max(var(--mg-floor), calc(min(2vw, 58px) * var(--mg-s))); }
.mg-tv-story--long { font-size: max(var(--mg-floor), calc(min(1.65vw, 48px) * var(--mg-s))); line-height: 1.3; }
.mg-tv-line { font-size: max(var(--mg-floor), calc(min(2.8vw, 80px) * var(--mg-s))); font-style: italic; font-weight: 700; }
.mg-tv-prompt { display: flex; align-items: center; gap: 0.5em; padding: 0.5em 0.8em; border-radius: 0.6em; background: var(--rf-cream); color: var(--rf-ink); font-size: max(var(--mg-floor), calc(min(2.1vw, 60px) * var(--mg-s))); font-weight: 800; }
.mg-tv-evidence { padding: 0.6em 0.8em; border-radius: 0.5em; background: var(--rf-cream); color: var(--rf-ink); font-size: max(var(--mg-floor), calc(min(3.3vw, 96px) * var(--mg-s))); font-weight: 800; line-height: 1.2; }
.mg-tv-who .rf-avatar--lg { width: calc(min(9vw, 260px) * var(--mg-s)); height: calc(min(9vw, 260px) * var(--mg-s)); }
.mg-tv .rf-ring.mg-tv-ring { width: max(120px, calc(min(16vw, 460px) * var(--mg-s))); height: max(120px, calc(min(16vw, 460px) * var(--mg-s))); }
.mg-tv .rf-ring.mg-tv-ring .rf-ring-num { font-size: max(var(--mg-floor), calc(min(4.5vw, 130px) * var(--mg-s))); }
.mg-tv-paused { display: inline-flex; align-items: center; gap: 0.4em; align-self: flex-start; padding: 0.2em 0.7em; border-radius: 999px; background: var(--rf-primary); color: var(--rf-ink); font-weight: 800; }
.mg-tv-voted { font-size: var(--rf-fs-title); font-weight: 800; }
.mg-tv .mg-cast-card { padding: 0.4em 0.5em; border-radius: 0.5em; gap: 0.5em; }
.mg-tv .mg-cast-card .rf-avatar { width: 1.3em; height: 1.3em; }
.mg-tv .mg-cast { gap: calc(min(0.6vw, 16px) * var(--mg-s)); }
.mg-tv.phase-vote .mg-tv-main .mg-cast { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mg-tv .mg-cast-text strong { font-size: max(var(--mg-floor), calc(min(1.8vw, 52px) * var(--mg-s))); }
.mg-tv .mg-by, .mg-tv .mg-about { font-size: var(--rf-fs-label); }
.mg-tv .mg-about { display: none; }
.mg-tv .mg-clue, .mg-tv .mg-evidence li { padding: 0.4em 0.6em; border-radius: 0.5em; gap: 0.2em; }
.mg-tv .mg-clue-round, .mg-tv .mg-clue-from { font-size: var(--rf-fs-label); }
.mg-tv .mg-clue-round .rf-icon, .mg-tv .mg-clue-from .rf-avatar { width: 1em; height: 1em; }
.mg-tv .mg-clue-text { font-size: max(var(--mg-floor), calc(min(1.5vw, 44px) * var(--mg-s))); line-height: 1.3; }
.mg-tv .mg-tally li { min-height: 2em; padding: 0 0.6em; border-radius: 0.5em; font-size: max(var(--mg-floor), calc(min(1.9vw, 56px) * var(--mg-s))); gap: 0.5em; }
.mg-tv .rf-standings { gap: calc(min(0.73vw, 21px) * var(--mg-s)); }
.mg-tv .rf-row { min-height: calc(min(4.6vw, 132px) * var(--mg-s)); font-size: max(var(--mg-floor), calc(min(2.08vw, 60px) * var(--mg-s))); }
.mg-tv .mg-tally .rf-avatar { width: 1.1em; height: 1.1em; }
.mg-tv .mg-bar { height: 0.35em; }
.mg-tv .rf-pill.mg-tv-away { background: var(--rf-pink); color: var(--rf-ink); font-weight: 800; }
@media (max-width: 900px) {
  .mg-tv-split { grid-template-columns: 1fr; }
  .mg-tv-lobby { grid-template-columns: 1fr; grid-template-areas: "join" "qr" "people"; }
}
@media (min-width: 760px) {
  .mg-scripts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.mg-phone .rf-verdict-badge .rf-icon { width: 40px; height: 40px; }
.mg-join .rf-code-input { min-height: 72px; font-size: 44px; font-weight: 800; letter-spacing: 0.3em; }
html:has(.mg-tabs) { scroll-padding-bottom: 96px; }   /* focus and scrollIntoView keep clear of the sticky tab bar */
.mg-winner > .rf-icon { width: 64px; height: 64px; color: var(--rf-primary); }
