/* Crowd Quest — bright, playful, readable across a room.
   (Deliberately NOT the gothic candlelight theme — that stays TrackXP TTRPG's.) */

:root {
  --bg: #140b2e;
  --bg-2: #1d1240;
  --panel: #241751;
  --panel-2: #2d1d63;
  --line: #453578;
  --text: #f4f0ff;
  --muted: #b3a8d9;
  --gold: #ffcf5c;
  --coral: #ff6b6b;
  --teal: #2ee6c8;
  --violet: #a78bfa;
  --danger: #ff5470;
  --ok: #4ade80;
  --warrior: #ff6b6b;
  --rogue: #2ee6c8;
  --bard: #ffcf5c;
  --mage: #a78bfa;
  --radius: 16px;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a1a5e 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .btn, .code-input { font-family: var(--font-display); }
button { font: inherit; cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

/* ---------- landing ---------- */
.landing-wrap { max-width: 640px; margin: 0 auto; padding: 42px 20px 28px; display: flex; flex-direction: column; gap: 20px; min-height: 100dvh; }
.landing-hero { text-align: center; position: relative; }
.hero-mark {
  width: 96px; height: 96px; animation: bob 2.8s ease-in-out infinite;
  filter: drop-shadow(0 6px 22px rgba(255, 107, 107, .3));
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-9px) rotate(5deg); } }
.chip-mark { width: 18px; height: 18px; vertical-align: -4px; margin-right: 2px; }
.game-logo { display: flex; flex-direction: column; line-height: .92; margin: 8px 0 14px; letter-spacing: .02em; }
.gl-crowd { font-size: clamp(40px, 9vw, 64px); font-weight: 700; color: var(--text); }
.gl-quest {
  font-size: clamp(52px, 12vw, 86px); font-weight: 700;
  background: linear-gradient(100deg, var(--gold), var(--coral) 55%, var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); font-size: 16px; }
.tagline strong { color: var(--text); }
.landing-actions { display: flex; flex-direction: column; gap: 12px; }
.landing-footer { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; }
.landing-footer a { color: var(--muted); } .landing-footer b { color: var(--gold); }
.landing-footer-meta { display: block; margin-top: 4px; opacity: .8; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 3px; opacity: .5; animation: fall 9s linear infinite; }
.confetti i:nth-child(1) { left: 6%;  background: var(--coral);  animation-delay: 0s; }
.confetti i:nth-child(2) { left: 16%; background: var(--teal);   animation-delay: 1.2s; }
.confetti i:nth-child(3) { left: 26%; background: var(--gold);   animation-delay: 2.4s; }
.confetti i:nth-child(4) { left: 36%; background: var(--violet); animation-delay: .7s; }
.confetti i:nth-child(5) { left: 48%; background: var(--teal);   animation-delay: 3.4s; }
.confetti i:nth-child(6) { left: 58%; background: var(--coral);  animation-delay: 1.9s; }
.confetti i:nth-child(7) { left: 68%; background: var(--gold);   animation-delay: 4.2s; }
.confetti i:nth-child(8) { left: 78%; background: var(--violet); animation-delay: .3s; }
.confetti i:nth-child(9) { left: 88%; background: var(--teal);   animation-delay: 2.9s; }
.confetti i:nth-child(10){ left: 95%; background: var(--coral);  animation-delay: 5s; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.landing-wrap, .panel { position: relative; z-index: 1; }

/* ---------- panels & forms ---------- */
.panel { max-width: 560px; margin: 0 auto; padding: 28px 20px 40px; }
.panel.narrow { max-width: 480px; }
.panel h2 { font-size: 28px; margin-bottom: 6px; }
.btn-back { background: none; border: none; color: var(--muted); font-size: 15px; margin-bottom: 14px; }
label { display: block; margin: 16px 0 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
input[type="text"] {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 17px; outline: none;
}
input[type="text"]:focus { border-color: var(--teal); }
.code-input { text-transform: uppercase; letter-spacing: .35em; font-size: 24px !important; text-align: center; }
.error { color: var(--danger); margin-top: 10px; min-height: 1.2em; font-weight: 700; }
.hint { color: var(--muted); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; border-radius: 14px; padding: 12px 18px; font-weight: 600; font-size: 17px;
  background: var(--panel-2); color: var(--text); transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn small { font-size: 12px; font-weight: 400; opacity: .75; font-family: var(--font-body); }
.btn-big { width: 100%; padding: 16px 18px; font-size: 20px; }
.btn-primary { background: linear-gradient(100deg, var(--gold), #ffb14e); color: #3a2400; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-join { background: linear-gradient(100deg, var(--teal), #24bfd8); color: #003a33; }
.btn-ghosted { background: transparent; border: 2px solid var(--line); color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; flex-direction: row; gap: 6px; }
.btn.danger { background: #4a1030; color: #ffb3c7; }

/* ---------- quest picker / mode picker ---------- */
.quest-list { display: flex; flex-direction: column; gap: 10px; }
.quest-card {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.quest-card.selected { border-color: var(--gold); background: var(--panel-2); }
.qc-art { font-size: 34px; }
.qc-body strong { display: block; font-family: var(--font-display); font-size: 17px; }
.qc-body .qc-desc { color: var(--muted); font-size: 13px; }
.qc-meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.qc-premium { color: var(--gold); }
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  text-align: left; padding: 12px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--panel); color: var(--text); display: flex; flex-direction: column; gap: 4px;
}
.mode-card.selected { border-color: var(--teal); background: var(--panel-2); }
.mode-card strong { font-family: var(--font-display); }
.mode-card span { font-size: 12.5px; color: var(--muted); }
#btn-create-game { margin-top: 20px; }

/* ---------- TrackXP hub banners ---------- */
.txp-account { margin: 4px 0; }
.txp-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.txp-seal {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(135deg, var(--teal), var(--violet)); color: #10082b; font-weight: 900; font-size: 13px;
}
.txp-pitch { flex: 1; min-width: 160px; font-size: 14px; }
.txp-pitch small { display: block; color: var(--muted); }
.txp-cta-row { display: flex; align-items: center; gap: 10px; }
.txp-signup {
  background: linear-gradient(100deg, var(--teal), #24bfd8); color: #003a33;
  padding: 9px 14px; border-radius: 10px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.txp-user strong { color: var(--gold); }
.txp-tag { margin-left: auto; font-size: 12px; color: var(--muted); }
.txp-guest-note { color: var(--muted); font-size: 13px; }

/* =========================================================
   BIG SCREEN
   ========================================================= */
.screen.big { display: none; flex-direction: column; min-height: 100dvh; }
.screen.big.active { display: flex; }
.big-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1.5px solid var(--line); background: rgba(20, 11, 46, .7);
}
.brand-chip { font-family: var(--font-display); color: var(--muted); font-size: 14px; }
.brand-chip b { color: var(--gold); }
.beat-chip { font-family: var(--font-display); background: var(--panel); padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.omen-chip { background: #3a2a12; color: var(--gold); padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.big-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.room-pill { background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.room-pill strong { color: var(--gold); letter-spacing: .12em; }
.room-pill.small { font-size: 12px; }

.bs-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 14px; }
.bs-quest-title { font-size: clamp(26px, 4vw, 44px); }
.bs-join-line { color: var(--muted); font-size: clamp(15px, 2vw, 22px); }
.bs-join-line strong { color: var(--teal); }
/* the join "screen": a framed panel that spotlights the code + QR across the room */
.bs-join-frame {
  display: flex; align-items: center; gap: clamp(20px, 4vw, 48px);
  padding: clamp(18px, 3vw, 34px) clamp(24px, 4vw, 52px);
  background: linear-gradient(180deg, rgba(45, 29, 99, .55), rgba(20, 11, 46, .8));
  border: 2.5px solid rgba(255, 207, 92, .45); border-radius: 26px;
  box-shadow: 0 0 0 1px rgba(255, 207, 92, .12), 0 0 44px rgba(255, 207, 92, .14),
              inset 0 0 60px rgba(255, 207, 92, .05);
}
.bs-join-left { text-align: center; }
.bs-code-hero {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .28em;
  font-size: clamp(56px, 10vw, 110px); color: var(--gold); line-height: 1.05;
  text-shadow: 0 0 34px rgba(255, 207, 92, .35);
}
.bs-qr {
  width: clamp(140px, 17vw, 210px); height: clamp(140px, 17vw, 210px); flex: none;
  background: #0d0720; border: 1.5px solid rgba(255, 207, 92, .4);
  border-radius: 16px; padding: 10px;
}
.bs-qr svg { width: 100% !important; height: 100% !important; display: block; }
.bs-qr:empty { display: none; }
@media (max-width: 640px) { .bs-join-frame { flex-direction: column; } }
.bs-chip-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 900px; }
.bs-player-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel);
  border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 17px; font-weight: 700;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.bs-player-chip .cls { font-size: 20px; }
.bs-player-chip.l-fight { border-color: var(--warrior); }
.bs-player-chip.l-sneak { border-color: var(--rogue); }
.bs-player-chip.l-talk { border-color: var(--bard); }
.bs-player-chip.l-weird { border-color: var(--mage); }
.verified-spark { color: var(--gold); }

/* live beat */
#bs-play { justify-content: flex-start; padding-top: 3vh; overflow-y: auto; min-height: 0; }
.bs-stage { overflow-y: auto; min-height: 0; }
.bs-scene { max-width: 1100px; }
.bs-art { font-size: clamp(64px, 10vw, 120px); line-height: 1; filter: drop-shadow(0 6px 24px rgba(0,0,0,.4)); }
.bs-beat-title { font-size: clamp(24px, 3.4vw, 40px); color: var(--gold); margin: 8px 0 4px; }
.bs-narration { font-size: clamp(18px, 2.4vw, 30px); line-height: 1.5; max-width: 950px; margin: 0 auto; }
/* once choosing/rolling/resolving starts, the scene condenses to a header line so
   votes / dice / outcomes own the screen — full narration already had its moment
   (and stays as captions on every phone) */
#bs-play.compact .bs-art { font-size: clamp(30px, 4vw, 44px); display: inline-block; vertical-align: middle; margin-right: 10px; filter: none; }
#bs-play.compact .bs-beat-title { display: inline-block; vertical-align: middle; margin: 0; font-size: clamp(20px, 2.6vw, 30px); }
#bs-play.compact .bs-narration { display: none; }
#bs-play.compact .bs-phase { margin-top: 10px; }
.bs-phase { width: min(1000px, 94vw); margin-top: 18px; }
.timer-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.timerbar { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; flex: 1; }
.timerbar i { display: block; height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .25s linear; }
/* couch-legible seconds next to the bar — phones already had one */
.bs-countdown {
  font-family: var(--font-display); font-weight: 700; line-height: 1;
  font-size: clamp(22px, 3.4vh, 36px); color: var(--teal);
  min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums;
}
.bs-countdown.urgent { color: var(--coral); animation: pulse .8s ease-in-out infinite; }

/* choose fills the TV — vote bars scale with viewport height instead of
   leaving two thirds of a 1080p screen empty */
.vote-rows { display: flex; flex-direction: column; gap: clamp(10px, 2vh, 22px); }
.vote-row { display: grid; grid-template-columns: clamp(44px, 5.5vh, 68px) 1fr clamp(60px, 8vh, 96px); align-items: center; gap: 12px; }
.vote-row .vr-emoji { font-size: clamp(26px, 4.4vh, 46px); }
.vr-bar { position: relative; height: clamp(40px, 7vh, 74px); background: var(--panel); border-radius: 14px; overflow: hidden; }
.vr-bar i { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 14px; transition: width .35s ease; opacity: .85; }
.vr-fight i { background: var(--warrior); } .vr-sneak i { background: var(--rogue); }
.vr-talk i { background: var(--bard); } .vr-weird i { background: var(--mage); }
.vr-bar span { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 18px; font-weight: 800; font-size: clamp(14px, 2.8vh, 28px); text-shadow: 0 1px 4px rgba(0,0,0,.55); }
.vr-count { font-family: var(--font-display); font-size: clamp(24px, 4.2vh, 44px); text-align: right; }
.bs-phase-label { font-family: var(--font-display); font-size: clamp(18px, 2.4vw, 26px); color: var(--teal); margin-bottom: 10px; }

/* roll-phase story context — the chosen path + stakes stay on the TV */
.bs-chosen { font-family: var(--font-display); font-size: clamp(22px, 3.8vh, 40px); color: var(--text); margin-bottom: 6px; }
.bs-chosen b { color: var(--gold); }
.bs-chosen .ic { width: 1.05em; height: 1.05em; }
.bs-stakes { color: var(--muted); font-style: italic; font-size: clamp(15px, 2.2vh, 23px); max-width: 900px; margin: 0 auto clamp(12px, 2.4vh, 26px); }
.bs-manual-hint { margin-top: 16px; color: var(--muted); font-size: clamp(14px, 1.9vh, 19px); }
.bs-manual-hint b { color: var(--gold); }
#bs-skip.armed { background: #4a2a10; color: var(--gold); box-shadow: 0 0 0 1.5px var(--gold); }

.roll-flurry { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 60px; }
/* the standard-beat flurry is the roll phase's main act — chip up for the couch */
.roll-flurry.flurry-big { gap: clamp(10px, 1.8vh, 18px); min-height: 120px; align-content: flex-start; }
.roll-flurry.flurry-big .roll-chip { font-size: clamp(17px, 2.9vh, 30px); padding: clamp(8px, 1.5vh, 15px) clamp(14px, 2.2vh, 24px); border-radius: 16px; }
.roll-chip {
  font-family: var(--font-display); background: var(--panel); border: 2px solid var(--line);
  border-radius: 12px; padding: 8px 14px; font-size: clamp(15px, 1.9vw, 21px);
  animation: pop .3s cubic-bezier(.2, 1.6, .4, 1);
}
.roll-chip .rc-total { font-size: 1.25em; font-weight: 700; }
.roll-chip.ok { border-color: var(--ok); } .roll-chip.bad { border-color: var(--line); opacity: .8; }
.roll-chip.crit { border-color: var(--gold); background: #3a2a12; box-shadow: 0 0 18px rgba(255,207,92,.45); }
.roll-chip.fumble { border-color: var(--danger); background: #3a1020; }

.outcome-card { max-width: 950px; margin: 0 auto; animation: pop .4s cubic-bezier(.2,1.5,.4,1); }
.outcome-tier { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 5vw, 54px); letter-spacing: .04em; }
.outcome-tier.triumph { color: var(--ok); } .outcome-tier.messy { color: var(--gold); } .outcome-tier.disaster { color: var(--danger); }
.outcome-text { font-size: clamp(17px, 2.2vw, 27px); margin: 10px 0 6px; }
.outcome-flavor { color: var(--violet); font-style: italic; font-size: clamp(14px, 1.8vw, 20px); }
.outcome-wilds { margin-top: 10px; color: var(--muted); font-size: clamp(13px, 1.6vw, 18px); }
.outcome-wilds b { color: var(--teal); }
.outcome-hearts { margin-top: 8px; font-size: clamp(13px, 1.7vw, 18px); color: var(--coral); }

/* fill-in-the-blank judging — entries as big tappable cards */
/* two-up above ~7 entries so a 12-card crowd sample still fits one TV screen */
.judge-grid { display: grid; grid-template-columns: 1fr; gap: 10px; max-width: 900px; margin: 0 auto; }
.judge-grid:has(.judge-card:nth-child(7)) { grid-template-columns: 1fr 1fr; max-width: 1200px; }
.judge-card {
  background: var(--panel); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 16px 20px; color: var(--text); text-align: left;
  font-family: var(--font-display); font-size: clamp(16px, 2.2vw, 26px); font-weight: 500;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.judge-card:not(:disabled):hover { border-color: var(--gold); background: var(--panel-2); }
.judge-card:disabled { cursor: default; }
.judge-card .jc-author { display: block; margin-top: 4px; font-family: var(--font-body); font-size: clamp(12px, 1.5vw, 15px); color: var(--gold); font-weight: 700; }

/* boss finale — the slumber bar */
.slumber { max-width: 750px; margin: 0 auto 14px; }
.slumber-label { font-family: var(--font-display); color: var(--violet); font-size: clamp(14px, 1.9vw, 20px); margin-bottom: 6px; }
.slumber-bar { height: 26px; border-radius: 999px; background: var(--panel); overflow: hidden; border: 1.5px solid var(--line); }
.slumber-bar i { display: block; height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.2, 1, .4, 1);
  background: linear-gradient(90deg, var(--violet), #6d28d9); box-shadow: 0 0 18px rgba(167, 139, 250, .5); }
.slumber-num { font-family: var(--font-display); color: var(--muted); margin-top: 6px; font-size: clamp(13px, 1.7vw, 18px); }
.slumber-hint { color: var(--teal); font-size: clamp(12px, 1.5vw, 16px); margin-top: 6px; }

/* boss attack menu — two buttons, one decision */
.boss-moves { display: flex; flex-direction: column; gap: 10px; }
.boss-move {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  padding: 16px 14px; border-radius: 16px; border: 2.5px solid var(--line);
  background: var(--panel); color: var(--text); font-family: var(--font-display);
  font-weight: 600; font-size: 18px;
}
.boss-move small { font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: var(--muted); }
.boss-move.sig { border-color: rgba(255, 107, 107, .55); background: #33162e; }
.boss-move:active { transform: scale(.97); }

.bs-spotlight {
  position: fixed; left: 50%; top: 16%; transform: translateX(-50%);
  background: var(--panel-2); border: 2px solid var(--gold); color: var(--text);
  border-radius: 16px; padding: 14px 26px; font-family: var(--font-display);
  font-size: clamp(17px, 2.4vw, 28px); box-shadow: 0 10px 40px rgba(0,0,0,.5); z-index: 40;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); max-width: 90vw;
}
.bs-spotlight.fumble { border-color: var(--danger); }
.bs-spotlight.ghost { border-color: var(--violet); }

.bs-party {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 10px 16px 14px; border-top: 1.5px solid var(--line); background: rgba(20,11,46,.7);
}
.party-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700;
  background: var(--panel); border-radius: 999px; padding: 4px 12px; border: 1.5px solid var(--line);
}
.party-chip .hearts { color: var(--coral); letter-spacing: .05em; }
.party-chip.ghost { opacity: .55; filter: grayscale(.7); }
.party-chip .glory { color: var(--gold); font-size: 12px; }
.party-chip.offline { opacity: .4; }

/* pre-game how-to slides */
.howto-card {
  max-width: 900px; padding: clamp(24px, 4vw, 48px) clamp(28px, 5vw, 64px);
  background: linear-gradient(180deg, rgba(45, 29, 99, .55), rgba(20, 11, 46, .8));
  border: 2.5px solid var(--line); border-radius: 26px;
  animation: pop .4s cubic-bezier(.2, 1.5, .4, 1);
}
.howto-icon { font-size: clamp(56px, 9vw, 96px); line-height: 1.1; }
.howto-title { font-size: clamp(26px, 4.2vw, 46px); color: var(--gold); margin: 10px 0 8px; }
.howto-text { font-size: clamp(17px, 2.3vw, 28px); line-height: 1.5; color: var(--text); }
.howto-dots { display: flex; gap: 10px; }
.howto-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.howto-dots i.on { background: var(--gold); transform: scale(1.25); }

/* ending */
.ending-card { max-width: 950px; }
.ending-eyebrow { color: var(--muted); font-size: clamp(14px, 1.8vw, 19px); letter-spacing: .2em; text-transform: uppercase; }
.ending-title { font-size: clamp(32px, 5.4vw, 60px); color: var(--gold); margin: 6px 0 10px; }
.ending-text { font-size: clamp(16px, 2.1vw, 26px); }
.ending-stats { margin-top: 14px; color: var(--muted); font-size: clamp(14px, 1.7vw, 19px); }
.ending-board { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.ending-mvp { margin-top: 12px; font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 30px); color: var(--teal); }

/* =========================================================
   PHONE
   ========================================================= */
.screen.phone { display: none; flex-direction: column; min-height: 100dvh; }
.screen.phone.active { display: flex; }
.ph-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1.5px solid var(--line); }
.class-chip { font-family: var(--font-display); font-weight: 600; padding: 4px 12px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line); font-size: 14px; }
.class-chip.l-fight { border-color: var(--warrior); } .class-chip.l-sneak { border-color: var(--rogue); }
.class-chip.l-talk { border-color: var(--bard); } .class-chip.l-weird { border-color: var(--mage); }
.hearts { color: var(--coral); font-size: 18px; letter-spacing: .08em; }
.ph-top .room-pill { margin-left: auto; }
.ph-main { flex: 1; display: flex; flex-direction: column; padding: 16px; overflow-y: auto; }
.ph-card { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; text-align: center; }
.ph-eyebrow { color: var(--muted); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; }
.ph-big-art { font-size: 64px; }
.ph-title { font-family: var(--font-display); font-size: 24px; color: var(--gold); }
.ph-text { font-size: 15px; color: var(--muted); }
.ph-caption { font-size: 14.5px; color: var(--text); background: var(--panel); border-radius: 12px; padding: 12px; text-align: left; }

.class-card { background: var(--panel); border: 2.5px solid var(--line); border-radius: 20px; padding: 22px 16px; }
.class-card .cc-emoji { font-size: 62px; }
.class-card h3 { font-size: 28px; margin: 6px 0 2px; }
.class-card .cc-hint { color: var(--muted); font-size: 15px; }
.class-card .cc-special { margin-top: 10px; font-size: 13.5px; color: var(--violet); }
.class-card.l-fight { border-color: var(--warrior); } .class-card.l-sneak { border-color: var(--rogue); }
.class-card.l-talk { border-color: var(--bard); } .class-card.l-weird { border-color: var(--mage); }

.approach-grid { display: flex; flex-direction: column; gap: 10px; }
.approach-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 15px 14px; font-size: 16.5px; font-weight: 700; color: var(--text);
}
.approach-btn .ap-emoji { font-size: 26px; }
.approach-btn.mine { box-shadow: inset 0 0 0 2px rgba(255,255,255,.06); }
.approach-btn.k-fight.selected { border-color: var(--warrior); background: #3d1b2c; }
.approach-btn.k-sneak.selected { border-color: var(--rogue); background: #103a38; }
.approach-btn.k-talk.selected { border-color: var(--bard); background: #3a2a12; }
.approach-btn.k-weird.selected { border-color: var(--mage); background: #2a1c4e; }
.approach-btn .ap-lane { margin-left: auto; font-size: 11px; color: var(--gold); white-space: nowrap; }
.wild-input { margin-top: 8px; }
.ph-timer { font-family: var(--font-display); font-size: 15px; color: var(--teal); }

.roll-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
/* the TrackXP d20: tap to roll → tumble → land */
.die-roll-btn {
  background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: pulse 1.4s ease-in-out infinite;
}
.die-roll-btn .die-cta { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--gold); }
.die-roll-btn .die-hex text { font-size: 13px; }
.die-hex { width: 170px; height: 170px; filter: drop-shadow(0 12px 34px rgba(255, 207, 92, .3)); }
.die-wrap { display: inline-block; }
.die-wrap.tumbling .die-hex { animation: tumble .55s linear infinite; }
@keyframes tumble {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(.92) translateY(-6px); }
  50% { transform: rotate(180deg) scale(1.04); }
  75% { transform: rotate(270deg) scale(.95) translateY(4px); }
  100% { transform: rotate(360deg) scale(1); }
}
.die-wrap.landed .die-hex { animation: land .5s cubic-bezier(.2, 1.6, .4, 1); }
.die-wrap.landed .die-num { font-size: 26px; }
.die-wrap.landed.crit .die-hex { filter: drop-shadow(0 0 34px rgba(255, 207, 92, .8)); }
.die-wrap.landed.fumble .die-hex { filter: drop-shadow(0 0 26px rgba(255, 84, 112, .7)) grayscale(.3); }
@keyframes land { from { transform: rotate(220deg) scale(.5); } to { transform: rotate(0) scale(1); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.my-roll { font-family: var(--font-display); }
.my-roll .die-hex { width: 130px; height: 130px; }
.my-roll.ok .die-num { fill: var(--ok); } .my-roll.bad .die-num { fill: var(--danger); }
.my-roll .mr-note { font-size: 16px; color: var(--muted); }
.my-roll .mr-crit { color: var(--gold); font-size: 22px; }

/* lobby class picker — the deal is a default, not a destiny */
.class-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.class-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel); color: var(--muted); font-family: var(--font-display); font-size: 12.5px;
}
.class-pick-btn span { font-size: 22px; }
.class-pick-btn.selected { color: var(--text); background: var(--panel-2); }
.class-pick-btn.l-fight.selected { border-color: var(--warrior); }
.class-pick-btn.l-sneak.selected { border-color: var(--rogue); }
.class-pick-btn.l-talk.selected { border-color: var(--bard); }
.class-pick-btn.l-weird.selected { border-color: var(--mage); }

.ph-achievement { font-size: 14.5px; color: var(--gold); background: rgba(255, 207, 92, .08); border: 1px solid rgba(255, 207, 92, .3); border-radius: 10px; padding: 8px 12px; }

/* ending awards — the laugh track, revealed one by one */
.award-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.award-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border: 2px solid rgba(255, 207, 92, .35); border-radius: 16px;
  padding: 14px 22px; min-width: 150px; opacity: 0;
  animation: award-pop .5s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
@keyframes award-pop { from { opacity: 0; transform: scale(.4) rotate(-6deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
.award-chip .aw-icon { font-size: clamp(28px, 4vw, 44px); }
.award-chip .aw-title { font-family: var(--font-display); color: var(--gold); font-size: clamp(14px, 1.8vw, 19px); }
.award-chip .aw-name { font-weight: 800; font-size: clamp(14px, 1.8vw, 19px); }
.award-chip .aw-detail { color: var(--muted); font-size: clamp(11px, 1.3vw, 14px); max-width: 230px; }

.special-btn {
  width: 100%; background: linear-gradient(100deg, #6d28d9, var(--violet)); color: #fff;
  border-radius: 14px; padding: 12px;
}
.special-btn.armed { background: linear-gradient(100deg, var(--gold), #ffb14e); color: #3a2400; }
.special-btn:disabled { opacity: .35; }
.ph-foot { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.ph-status { text-align: center; color: var(--muted); font-size: 13px; min-height: 1.2em; }

.ghost-veil { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(180deg, rgba(80, 60, 160, .18), rgba(20, 11, 46, .5)); }
.ghost-note { font-size: 15px; color: var(--violet); }

.xp-award { font-family: var(--font-display); font-size: 24px; color: var(--ok); }
.xp-award small { display: block; font-size: 13px; color: var(--muted); font-family: var(--font-body); }
/* host XP chip on the big-screen ending */
.ending-card .xp-award { margin-top: 14px; font-size: clamp(22px, 3vh, 32px); }
.ending-card .xp-award small { font-size: clamp(12px, 1.6vh, 15px); }

/* ---------- TrackXP global session chip (txp-session.js appends it to <body>) ---------- */
.txp-session-chip { position: fixed; top: 12px; right: 12px; z-index: 90; }
.txp-session-chip a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 15px; border-radius: 999px;
  background: var(--panel); border: 1.5px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 700;
  text-decoration: none; transition: border-color .15s;
}
.txp-session-chip a:hover { border-color: var(--teal); color: var(--text); }
.txp-session-chip.signed-in a { border-color: rgba(255, 207, 92, .55); }
.txp-session-chip.signed-in strong { color: var(--gold); font-family: var(--font-display); }
/* in-game surfaces have their own chrome — the floating chip would collide with
   the big-screen header / phone vitals bar */
body.in-game .txp-session-chip { display: none; }
@media (max-width: 560px) {
  .txp-session-chip { top: 8px; right: 8px; }
  .txp-session-chip a { padding: 5px 11px; font-size: 12px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel-2); border: 1.5px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 11px 18px; font-size: 15px; z-index: 60; max-width: 92vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}

@media (max-width: 720px) {
  .mode-picker { grid-template-columns: 1fr; }
  .big-top { flex-wrap: wrap; }
}


/* ---------- Font Awesome Pro sprite icons (icons.svg) ---------- */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; fill: currentColor; }
.ic-heart { color: var(--danger); }
.ic-gold { color: var(--gold); }
.glory .ic { color: var(--gold); width: .85em; height: .85em; }
.hearts .ic { color: var(--danger); }
.ph-big-art .ic { color: var(--gold); }
.cc-emoji .ic, #howto-icon .ic { color: var(--gold); }
.vr-emoji .ic, .ap-emoji .ic { width: 1.1em; height: 1.1em; }
.verified-spark .ic { color: var(--teal); width: .8em; height: .8em; }

.name-link { color: inherit; text-decoration: none; }
.name-link:hover { text-decoration: underline; }

/* crowd-voted blanks */
.blank-vote-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.blank-vote { text-align: left; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; cursor: pointer; }
.blank-vote.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.blank-vote .bv-author { display: block; margin-top: 4px; font-size: 12.5px; color: var(--gold); font-weight: 700; }
.muted-line { opacity: .65; font-size: 13.5px; }
.judge-card { position: relative; }
.judge-card .jc-votes { position: absolute; top: 10px; right: 40px; color: var(--coral); font-weight: 800; }
.judge-card.leading { border-color: var(--gold); }
.judge-card .jc-remove { position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 4px; }
.judge-card .jc-remove:hover { color: var(--danger); }

.chip-kick { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 2px; margin-left: 4px; }
.chip-kick:hover { color: var(--danger); }
.chip-kick .ic { width: .8em; height: .8em; }

/* ---------- campaign runs ---------- */

/* run-length picker (host setup) — three-up on desktop, stacked on phones */
.mode-picker.tri { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .mode-picker.tri { grid-template-columns: 1fr; } }

/* quest-card extras: tone badge + villain tease */
.qc-tone {
  font-family: var(--font-body); font-size: 11px; font-weight: 800; vertical-align: 2px;
  color: var(--violet); background: rgba(167, 139, 250, .14);
  border: 1px solid rgba(167, 139, 250, .4); border-radius: 999px; padding: 1px 8px; margin-left: 6px;
  white-space: nowrap; display: inline-block; /* never wrap mid-badge */
}
.qc-villain { display: block; color: var(--coral); font-size: 12px; margin-top: 2px; }

/* story tokens — the run's memory, chips in the big-screen header */
.bs-tokens { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.token-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: #3a2a12; color: var(--gold); border: 1.5px solid rgba(255, 207, 92, .45);
  border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700;
}
.token-chip.fresh { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.outcome-token { margin-top: 8px; font-family: var(--font-display); color: var(--gold); font-size: clamp(16px, 2.1vw, 25px); }

/* countdown beats: the whole timer runs red-alert for the entire vote */
.timerbar.rush { box-shadow: 0 0 14px rgba(255, 84, 112, .55); animation: pulse .8s ease-in-out infinite; }
.timerbar.rush i { background: linear-gradient(90deg, var(--coral), var(--danger)); }

/* tempting-offer ballot (accept/refuse) */
.vr-accept i { background: var(--gold); }
.vr-refuse i { background: var(--teal); }
.approach-btn.k-accept.selected { border-color: var(--gold); background: #3a2a12; }
.approach-btn.k-refuse.selected { border-color: var(--teal); background: #103a38; }

/* boss-intro spotlights: token callbacks glitter, the offer's price looms */
.bs-spotlight.token { border-color: var(--gold); background: #3a2a12; box-shadow: 0 0 28px rgba(255, 207, 92, .4); }
.bs-spotlight.price { border-color: var(--danger); background: #3a1020; }

/* credits phase — Line of the Night gallery on the TV */
.credits-title { font-size: clamp(28px, 4.6vw, 52px); color: var(--gold); }
.credits-grid { display: grid; grid-template-columns: 1fr; gap: 12px; width: min(950px, 94vw); margin: 0 auto; }
.credits-grid:has(.credits-card:nth-child(5)) { grid-template-columns: 1fr 1fr; width: min(1200px, 94vw); }
.credits-card {
  position: relative; background: var(--panel); border: 2.5px solid var(--line); border-radius: 16px;
  padding: 18px 22px; text-align: left; font-family: var(--font-display); font-weight: 500;
  font-size: clamp(17px, 2.4vw, 28px);
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.credits-card.leading { border-color: var(--gold); }
.credits-card .cr-author { display: block; margin-top: 6px; font-family: var(--font-body); font-size: clamp(12px, 1.5vw, 16px); color: var(--gold); font-weight: 700; }
.credits-card .cr-votes { position: absolute; top: 10px; right: 14px; color: var(--coral); font-weight: 800; font-size: clamp(14px, 2vw, 22px); }

/* crews — squads of strangers with a shared name */
.crew-chip {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px;
  background: var(--panel); border: 2px solid var(--violet); border-radius: 999px; padding: 6px 14px;
}
.crew-chip small { color: var(--muted); font-weight: 400; }
.bs-crew-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 900px; }
.bs-crew-row .crew-chip { font-size: 17px; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
.crew-box { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.crew-mini {
  background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 700; padding: 3px 10px;
}
.crew-mini:active { transform: scale(.95); }
.crew-pick { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.crew-opt {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-weight: 700; font-size: 15px;
}
.crew-opt small { color: var(--muted); font-weight: 400; }

/* ending extras: token strip, crew personas (unranked!), the fails reel, LotN */
.ending-tokens {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
  color: var(--muted); font-size: clamp(14px, 1.8vw, 20px);
}
.ending-tokens .token-chip { font-size: clamp(13px, 1.7vw, 18px); }
.ending-crews, .ending-fails { margin-top: 14px; }
.ec-title { font-family: var(--font-display); color: var(--teal); font-size: clamp(16px, 2.2vw, 24px); margin-bottom: 4px; }
.ec-line { font-size: clamp(14px, 1.9vw, 21px); } /* every crew equal — no podium, no ordering */
.ef-line { font-size: clamp(13px, 1.7vw, 19px); color: var(--muted); }
.ef-line b { color: var(--text); }
.lotn-marquee {
  margin: 16px auto 0; max-width: 900px;
  background: #3a2a12; border: 2.5px solid var(--gold); border-radius: 18px; padding: 14px 22px;
  font-family: var(--font-display); font-size: clamp(17px, 2.6vw, 30px);
  box-shadow: 0 0 30px rgba(255, 207, 92, .25);
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.lotn-marquee b { color: var(--gold); }
.ph-card .lotn-marquee { font-size: 16px; padding: 12px 14px; margin-top: 4px; }
.ph-crew-line { font-size: 15px; color: var(--violet); }

/* =========================================================
   PLAY PATTERNS — timing / mash / sequence / sort
   (phone runs the mini-interaction, the TV shows the collective side)
   ========================================================= */
.bs-play-label { font-family: var(--font-display); font-size: clamp(24px, 4.2vw, 50px); color: var(--gold); margin-bottom: clamp(10px, 2vh, 22px); }

/* --- timing: shared sweep bar. The marker's position is set by rAF from the
   window clock (NO CSS keyframes) so every phone + the TV agree. --- */
.pt-bar {
  position: relative; height: 64px; border-radius: 16px;
  background: var(--bg-2); border: 2px solid var(--line); overflow: hidden;
  touch-action: manipulation;
}
.pt-zone {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(46, 230, 200, .42), rgba(46, 230, 200, .16));
  border-left: 2px solid var(--teal); border-right: 2px solid var(--teal);
}
.pt-marker {
  position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; border-radius: 3px;
  background: var(--gold); box-shadow: 0 0 12px rgba(255, 207, 92, .8);
}
.pt-bar.locked { border-color: var(--teal); }
.pt-bar.locked .pt-marker { background: var(--teal); box-shadow: 0 0 14px rgba(46, 230, 200, .9); }
.pt-tap-btn {
  width: 100%; margin-top: 10px; padding: 24px; border: none; border-radius: 20px;
  font-family: var(--font-display); font-weight: 700; font-size: 30px; letter-spacing: .04em;
  background: linear-gradient(100deg, var(--gold), #ffb14e); color: #3a2400;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.pt-tap-btn:active { transform: scale(.96); }
.bs-pt-bar { height: clamp(52px, 10vh, 104px); width: min(900px, 92vw); margin: 0 auto clamp(10px, 2vh, 20px); border-radius: 22px; }

/* --- mash: one giant button; the pump is the game --- */
.pm-btn {
  width: min(64vw, 240px); aspect-ratio: 1; border-radius: 50%; margin: 6px auto;
  border: none; background: linear-gradient(135deg, var(--coral), #d9376e); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 36px; letter-spacing: .04em;
  box-shadow: 0 10px 34px rgba(255, 107, 107, .45), inset 0 -6px 0 rgba(0, 0, 0, .18);
  transition: transform .06s; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.pm-btn:active { transform: scale(.9); }
.pm-btn:disabled { opacity: .35; transform: none; }
.pm-count { font-family: var(--font-display); font-size: 46px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.pm-count.pop { animation: pm-pop .18s ease-out; }
@keyframes pm-pop { 50% { transform: scale(1.3); } }
.pm-bar { width: min(64vw, 240px); height: 12px; margin: 0 auto; border-radius: 999px; background: var(--panel); border: 1.5px solid var(--line); overflow: hidden; }
.pm-bar i { display: block; height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--coral), var(--gold)); transition: width .15s ease; }

/* big-screen party mash bar — lurches as batched updates land */
.bs-mash { width: min(900px, 92vw); margin: 0 auto; }
.bs-mash-bar { position: relative; height: clamp(34px, 6vh, 60px); border-radius: 999px; background: var(--bg-2); border: 2px solid var(--line); }
.bs-mash-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--gold));
  box-shadow: 0 0 18px rgba(255, 107, 107, .5);
  transition: width .3s cubic-bezier(.2, 1.4, .4, 1); /* the lurch */
}
.bs-mash-bar i.over { background: linear-gradient(90deg, var(--gold), var(--ok)); box-shadow: 0 0 26px rgba(74, 222, 128, .6); }
.bs-mash-target { position: absolute; top: -9px; bottom: -9px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(255, 207, 92, .7); }
.bs-mash-num { display: inline-block; margin-top: 10px; font-family: var(--font-display); font-size: clamp(24px, 4.4vh, 46px); color: var(--gold); font-variant-numeric: tabular-nums; }
.bs-mash-num.pop { animation: pm-pop .2s ease-out; }

/* --- sequence: the secret goes up HUGE on the TV; phones are the keypad --- */
.bs-seq { display: flex; flex-wrap: wrap; gap: clamp(14px, 3vw, 40px); justify-content: center; align-items: center; margin: clamp(8px, 1.5vh, 16px) 0; }
.bs-seq-glyph { font-size: clamp(64px, 12vw, 150px); line-height: 1.1; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .4)); animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.bs-seq-hint { color: var(--muted); font-size: clamp(14px, 2vh, 20px); }
.pq-strip { display: flex; gap: 8px; justify-content: center; }
.pq-slot {
  width: 52px; height: 52px; border-radius: 12px; border: 2px dashed var(--line);
  background: var(--bg-2); display: grid; place-items: center; font-size: 26px;
}
.pq-slot.filled { border-style: solid; border-color: var(--teal); background: var(--panel-2); animation: pop .25s cubic-bezier(.2, 1.6, .4, 1); }
.pq-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pq-key {
  font-size: 40px; padding: 16px 8px; border-radius: 16px;
  border: 2.5px solid var(--line); background: var(--panel);
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.pq-key:active { transform: scale(.94); border-color: var(--teal); }
.pq-back { background: var(--panel-2); color: var(--muted); }

/* --- sort: two-column chip grid + LOCK IN (answers stay hidden till resolve) --- */
.ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ps-chip {
  min-height: 64px; padding: 14px 10px; border-radius: 14px;
  border: 2.5px solid var(--line); background: var(--panel); color: var(--text);
  font-weight: 700; font-size: 15.5px; touch-action: manipulation;
}
.ps-chip:active { transform: scale(.97); }
.ps-chip.selected { border-color: var(--gold); background: #3a2a12; box-shadow: inset 0 0 0 1px var(--gold); }
.ps-chip:disabled { opacity: .6; }

/* =========================================================
   NIGHT FORMAT — the authored show run-sheet
   (spooky-comedy showtime: candlelight accents on the same playful palette)
   ========================================================= */

/* quest-card badge */
.qc-live {
  font-family: var(--font-body); font-size: 11px; font-weight: 800; vertical-align: 2px;
  color: var(--coral); background: rgba(255, 107, 107, .14);
  border: 1px solid rgba(255, 107, 107, .5); border-radius: 999px; padding: 1px 8px; margin-left: 6px;
  white-space: nowrap; display: inline-block;
}

/* the Midnight Clock — header chip, pulses red when it rises */
.night-clock {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px;
}
.night-clock .nc-icon { font-size: 16px; }
.night-clock .nc-pips { display: inline-flex; gap: 4px; }
.night-clock .nc-pip { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-2); border: 1.5px solid var(--line); }
.night-clock .nc-pip.on { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 8px rgba(255, 84, 112, .7); }
.night-clock .nc-label { color: var(--muted); font-weight: 700; white-space: nowrap; }
.night-clock.pulse { animation: clock-pulse 1.1s ease-out; }
@keyframes clock-pulse {
  0% { transform: scale(1); border-color: var(--line); }
  25% { transform: scale(1.18); border-color: var(--danger); box-shadow: 0 0 26px rgba(255, 84, 112, .8); }
  100% { transform: scale(1); }
}
.nc-mini { font-size: 14px; letter-spacing: .12em; color: var(--danger); white-space: nowrap; }

/* scene header */
#bs-night { justify-content: flex-start; padding-top: 3vh; }
.n-scene-head { display: flex; align-items: baseline; gap: 14px; justify-content: center; flex-wrap: wrap; }
.n-scene-art { font-size: clamp(34px, 5vw, 56px); line-height: 1; }
.n-scene-title { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 42px); color: var(--gold); }
.n-scene-count { color: var(--muted); font-size: clamp(12px, 1.5vw, 16px); }

/* host speech bubbles — big sequential lines the whole bar reads along with */
.host-lines { display: flex; flex-direction: column; gap: clamp(10px, 1.8vh, 18px); max-width: 1000px; margin: 0 auto; }
.host-bubble {
  display: flex; gap: 14px; align-items: flex-start; text-align: left;
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px 18px 18px 4px;
  padding: clamp(12px, 2vh, 20px) clamp(16px, 2.4vh, 26px);
  font-family: var(--font-display); font-size: clamp(18px, 2.6vh, 30px); line-height: 1.4;
  opacity: 0; animation: bubble-in .5s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.host-bubble .hb-face { font-size: 1.3em; line-height: 1; flex: none; }
/* the Maestro speaks — villain flair */
.host-bubble.villain { background: #2a1030; border-color: var(--coral); box-shadow: 0 0 22px rgba(255, 107, 107, .22); }
.host-bubble.villain .hb-text { color: #ffd9d9; }
/* the ≤25-word situation line — staging directions, not host speech */
.n-screen-text {
  margin: clamp(12px, 2vh, 20px) auto 0; max-width: 850px;
  color: var(--teal); font-style: italic; font-size: clamp(15px, 2.2vh, 22px);
  border-left: 3px solid var(--teal); padding-left: 14px; text-align: left;
}
.n-prompt { font-family: var(--font-display); font-size: clamp(18px, 2.8vh, 32px); max-width: 900px; margin: 0 auto 10px; }

/* option cards — benefit and price carry EQUAL weight: every choice costs */
.n-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: clamp(10px, 1.6vh, 16px); max-width: 1100px; margin: 0 auto; }
.n-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--panel); border: 2.5px solid var(--line); border-radius: 18px;
  padding: clamp(12px, 2vh, 22px) clamp(10px, 1.6vh, 18px); color: var(--text);
  font-family: var(--font-display); animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.n-opt .n-opt-art { font-size: clamp(28px, 4.4vh, 46px); line-height: 1.1; }
.n-opt .n-opt-label { font-weight: 700; font-size: clamp(15px, 2.3vh, 24px); }
/* trade-off lines: same size, same weight — only the hue differs */
.n-opt .n-benefit, .n-opt .n-price {
  font-family: var(--font-body); font-weight: 700; font-size: clamp(12px, 1.7vh, 16px); line-height: 1.35;
}
.n-opt .n-benefit { color: var(--ok); }
.n-opt .n-price { color: var(--danger); }
.n-opt .n-opt-count {
  position: absolute; top: 8px; right: 12px; color: var(--gold);
  font-size: clamp(16px, 2.6vh, 28px); font-weight: 700; font-variant-numeric: tabular-nums;
}
button.n-opt { cursor: pointer; }
button.n-opt:active { transform: scale(.97); }
button.n-opt.selected { border-color: var(--gold); background: #3a2a12; box-shadow: 0 0 0 1.5px var(--gold); }
button.n-opt:disabled { opacity: .45; cursor: default; }
/* argue: locked preview — the argument is the game */
.n-opt.locked { opacity: .55; filter: grayscale(.35); }
.n-opt .n-lock { position: absolute; top: 8px; left: 12px; font-size: 16px; }
.argue-banner {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .05em;
  font-size: clamp(26px, 4.6vh, 52px); color: var(--coral); margin-bottom: clamp(10px, 2vh, 20px);
  animation: pulse .9s ease-in-out infinite;
}
.argue-banner b { color: var(--gold); font-variant-numeric: tabular-nums; min-width: 1.6em; }

/* reveal: the communal die */
.n-die { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 10px; }
.n-die .die-hex { width: clamp(110px, 18vh, 180px); height: clamp(110px, 18vh, 180px); animation: land .5s cubic-bezier(.2, 1.6, .4, 1); }
.n-die.high .die-num { fill: var(--ok); }
.n-die.low .die-num { fill: var(--danger); }
.n-die.high .die-hex { filter: drop-shadow(0 0 30px rgba(74, 222, 128, .55)); }
.n-die.low .die-hex { filter: drop-shadow(0 0 26px rgba(255, 84, 112, .55)); }
.n-die-verdict { font-family: var(--font-display); font-size: clamp(14px, 2vh, 20px); letter-spacing: .14em; color: var(--muted); }
.n-die.high .n-die-verdict { color: var(--ok); }
.n-die.low .n-die-verdict { color: var(--danger); }
.n-die-line b { color: var(--gold); }
.n-die-line.high b { color: var(--ok); } .n-die-line.low b { color: var(--danger); }
.ritual-die { margin: clamp(8px, 1.5vh, 16px) auto; animation: pulse 1s ease-in-out infinite; }
.ritual-die .die-hex { width: clamp(140px, 26vh, 240px); height: clamp(140px, 26vh, 240px); filter: drop-shadow(0 0 34px rgba(255, 207, 92, .5)); }

/* the cold-open item wall */
.n-wall { display: flex; flex-wrap: wrap; gap: clamp(10px, 1.6vh, 18px); justify-content: center; margin-top: clamp(12px, 2vh, 22px); }
.n-wall-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px;
  padding: 12px 18px; min-width: 110px; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.n-wall-item .nw-art { font-size: clamp(30px, 5vh, 52px); line-height: 1.1; }
.n-wall-item .nw-label { font-family: var(--font-display); font-size: clamp(13px, 1.8vh, 18px); }
.n-wall-item .nw-count { color: var(--muted); font-weight: 800; font-size: clamp(13px, 1.8vh, 18px); }
.n-wall-item.top { border-color: var(--gold); background: #3a2a12; box-shadow: 0 0 20px rgba(255, 207, 92, .35); }
.n-wall-item.top .nw-count { color: var(--gold); }

/* the chant — call-and-response karaoke, huge */
.chant-banner {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .08em;
  font-size: clamp(20px, 3.4vh, 38px); color: var(--teal); margin-bottom: clamp(10px, 2vh, 20px);
}
.chant-banner.louder { color: var(--danger); animation: chant-shake .4s linear infinite; font-size: clamp(26px, 4.6vh, 52px); }
.chant-lines { display: flex; flex-direction: column; gap: clamp(10px, 2vh, 24px); }
.chant-line {
  font-family: var(--font-display); font-weight: 700; line-height: 1.15;
  font-size: clamp(30px, 6.4vh, 72px); color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 207, 92, .35);
  opacity: 0; animation: bubble-in .5s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
.chant-lines.louder .chant-line { color: var(--danger); text-shadow: 0 0 34px rgba(255, 84, 112, .5); animation: bubble-in .4s cubic-bezier(.2,1.4,.4,1) forwards, chant-shake .35s linear infinite .5s; }
@keyframes chant-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-.4deg); }
  75% { transform: translateX(4px) rotate(.4deg); }
}
.ph-chant .chant-line { font-size: clamp(24px, 7.4vw, 34px); }

/* secret roles — the dimmed candle scene */
.n-secret-scene { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: clamp(20px, 4vh, 44px); }
.n-candle { font-size: clamp(70px, 14vh, 140px); animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { filter: drop-shadow(0 0 24px rgba(255, 207, 92, .5)); opacity: 1; }
  42% { filter: drop-shadow(0 0 10px rgba(255, 207, 92, .25)); opacity: .85; }
  60% { filter: drop-shadow(0 0 30px rgba(255, 207, 92, .6)); opacity: 1; }
  78% { filter: drop-shadow(0 0 8px rgba(255, 207, 92, .2)); opacity: .8; }
}
.n-secret-hint { color: var(--muted); font-style: italic; font-size: clamp(16px, 2.6vh, 26px); max-width: 700px; }

/* the bow — spotlight on one hero */
.n-bow {
  font-family: var(--font-display); font-size: clamp(26px, 4.6vh, 54px);
  padding: clamp(16px, 3vh, 30px) clamp(24px, 4vh, 46px);
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 207, 92, .18), transparent 70%), var(--panel);
  border: 2.5px solid var(--gold); border-radius: 22px;
  box-shadow: 0 0 44px rgba(255, 207, 92, .25);
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.n-bow b { color: var(--gold); }

/* scene-transition title card */
.night-scenecard {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(10, 5, 24, .88); animation: scenecard-fade 2.6s ease forwards;
}
.nsc-inner { text-align: center; animation: pop .5s cubic-bezier(.2, 1.5, .4, 1); }
.nsc-art { font-size: clamp(90px, 20vh, 200px); line-height: 1.1; filter: drop-shadow(0 10px 40px rgba(0, 0, 0, .6)); }
.nsc-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 6vh, 64px); color: var(--gold); margin-top: 10px; }
@keyframes scenecard-fade { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* the private secret card — dark, candle-lit, phone only */
.night-secret {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(600px 500px at 50% 30%, rgba(58, 42, 18, .55), rgba(8, 4, 18, .96) 70%);
  animation: scenecard-in .35s ease;
}
@keyframes scenecard-in { from { opacity: 0; } }
.night-secret .ns-card {
  max-width: 420px; text-align: center; padding: 28px 22px;
  background: #1a0f33; border: 2px solid rgba(255, 207, 92, .5); border-radius: 20px;
  box-shadow: 0 0 50px rgba(255, 207, 92, .18), inset 0 0 40px rgba(0, 0, 0, .4);
  animation: pop .45s cubic-bezier(.2, 1.5, .4, 1);
}
.night-secret .ns-title { font-family: var(--font-display); font-size: 26px; color: var(--gold); margin-bottom: 10px; }
.night-secret .ns-text { font-size: 17px; line-height: 1.55; }
.night-secret .ns-tap { margin-top: 16px; color: var(--muted); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
/* possessed: deliciously conspiratorial */
.night-secret.possessed .ns-card { background: #240a2e; border-color: var(--coral); box-shadow: 0 0 60px rgba(255, 107, 107, .3), inset 0 0 40px rgba(0, 0, 0, .5); }
.night-secret.possessed .ns-title { color: var(--coral); }
.night-secret .ns-warn { margin-top: 12px; color: var(--coral); font-weight: 800; font-size: 14px; }

/* big-screen night-ending extras */
.ending-possessed { margin-top: 12px; font-family: var(--font-display); color: var(--coral); font-size: clamp(16px, 2.2vw, 26px); }

/* big-screen curse toast rides the spotlight queue */
.bs-spotlight.curse { border-color: var(--violet); background: #240a2e; box-shadow: 0 0 28px rgba(167, 139, 250, .4); }

/* phone ritual tap feedback */
.pm-btn.pop { animation: pm-pop .18s ease-out; }
