/* Statistically Speaking: the house style (shared with Bernoulli) plus the game-show set.
   Everything lives here; pages carry no inline styles. */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3348;
  --text: #e2e4ed;
  --text-muted: #8b8fa3;
  --primary: #6c63ff;
  --primary-hover: #5a52e0;
  --gold: #f5c518;
  --gold-hover: #e0b000;
  --gold-deep: #c9950a;
  --gold-ink: #6b4e00;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --curtain: #5c1540;
  --curtain-dark: #3f0d2c;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.navbar-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.navbar-brand:hover { text-decoration: none; }
.navbar-links { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.navbar-links a { color: var(--text-muted); font-size: 0.9rem; }
.navbar-links a:hover { color: var(--text); }
.navbar-sep { color: var(--text-muted); }
.navbar-who { color: var(--text-muted); font-size: 0.85rem; }

.container { max-width: 1040px; margin: 0 auto; padding: 2.5rem 1.5rem 3rem; }
.container-wide { max-width: 1240px; }
.container-narrow { max-width: 520px; }
.container-play { max-width: 760px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.card-title-row h3 { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  font-family: inherit;
  line-height: 1.6;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #111; }
.btn-gold { background: var(--gold); color: #111; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 2.2rem; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-muted); }
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(108,99,255,0.25); }
.code-input { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: var(--primary); flex: none; }
.form-group .check { align-items: flex-start; font-weight: 600; line-height: 1.35; }
.form-group .check input { margin-top: 0.2rem; }
.rule-form { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
tr:hover { background: var(--surface2); }
.table-scroll { overflow-x: auto; }

/* ── Alerts, badges, chips ──────────────────────────────────────────────── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-info { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.alert-gold { background: rgba(245,197,24,0.12); border: 1px solid rgba(245,197,24,0.3); color: #fde68a; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-lobby { background: var(--warning); color: #111; }
.badge-active { background: var(--success); color: #fff; }
.badge-ended { background: var(--text-muted); color: #fff; }
.badge-gold { background: var(--gold); color: #111; }
.badge-host { background: var(--gold); color: #111; }
.badge-contestant { background: var(--primary); color: #fff; }
.badge-watching { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.85rem; }
.chip.host { border-color: rgba(245,197,24,0.6); color: #fde68a; }
.chip.contestant { border-color: rgba(108,99,255,0.7); color: #c7c3ff; }
.chip.me { font-weight: 800; }

/* ── Join code ──────────────────────────────────────────────────────────── */
.code { font-family: 'SF Mono', 'Fira Code', monospace; font-weight: 700; letter-spacing: 0.08em; color: var(--primary); background: var(--bg); padding: 0.1rem 0.5rem; border-radius: 6px; }
.code-large { font-size: 1.35rem; letter-spacing: 0.15em; color: var(--gold); }

/* ── Grids and utilities ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 1.5rem; align-items: start; }
.row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.mt-1 { margin-top: 1rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 1rem; }
.nowrap { white-space: nowrap; }
.section-title { font-size: 0.95rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 1rem 0 1.25rem; }
.or-line { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: 0.9rem; margin: 1.75rem 0 1.25rem; }
.or-line::before, .or-line::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
@media (max-width: 820px) {
  .grid-2, .grid-3-2 { grid-template-columns: 1fr; }
}

/* ── Hero and lineup ────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 2.5rem 0 3rem; }
.hero-actions { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; margin-top: 2.25rem; }
.hero-note { color: var(--text-muted); font-size: 0.9rem; margin-top: 1.25rem; }
.marquee {
  display: inline-block;
  padding: 1.4rem 2.6rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #1f1a3a, #141127);
  border: 4px dotted var(--gold);
  box-shadow: 0 0 0 4px #141127, 0 0 24px rgba(245,197,24,0.25), var(--shadow);
  animation: marquee-glow 2.6s ease-in-out infinite;
}
.marquee h1 { font-size: 2.4rem; line-height: 1.15; letter-spacing: 0.01em; }
.marquee .tagline { color: var(--gold); font-weight: 700; margin-top: 0.35rem; font-size: 1.05rem; }
@keyframes marquee-glow {
  0%, 100% { box-shadow: 0 0 0 4px #141127, 0 0 18px rgba(245,197,24,0.2); }
  50% { box-shadow: 0 0 0 4px #141127, 0 0 40px rgba(245,197,24,0.5); }
}
.exp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.75rem; }
.exp-card { position: relative; display: flex; flex-direction: column; gap: 0.6rem; padding: 2rem; }
.exp-card .exp-emoji, .card .exp-emoji { font-size: 2rem; line-height: 1; }
.exp-card h3 { margin: 0; font-size: 1.25rem; }
.exp-card .exp-tagline { color: var(--gold); font-weight: 600; font-size: 0.95rem; }
.exp-card p { color: var(--text-muted); font-size: 0.95rem; flex: 1; }
.exp-card .exp-actions { display: flex; gap: 0.85rem; flex-wrap: wrap; margin-top: 1rem; }
.exp-card.coming-soon { border-style: dashed; opacity: 0.6; }

/* ── Student pages ──────────────────────────────────────────────────────── */
.student { padding-top: 1.5rem; }
.phase { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; text-align: center; }
[hidden] { display: none !important; }
#solo { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; text-align: center; padding-top: 0.5rem; }
#solo .summary-record { margin-top: 0.75rem; }
.phase h2 { font-size: 1.6rem; }
.phase > .sub { max-width: 36rem; }
.sub { color: var(--text-muted); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.round-head { display: flex; align-items: center; gap: 0.75rem; font-size: 1.05rem; font-weight: 800; flex-wrap: wrap; justify-content: center; }
.prompt { font-size: 1.25rem; font-weight: 800; min-height: 2.4em; max-width: 36rem; line-height: 1.4; animation: rise 0.4s cubic-bezier(0.2, 1.2, 0.4, 1); }
.panel { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }
.panel:empty { display: none; }
.toast-err { color: #fca5a5; font-size: 0.9rem; font-weight: 600; }
.nope {
  width: 100%; max-width: 36rem; margin: 0 auto; padding: 0.85rem 1.1rem; border-radius: 12px; font-weight: 700;
  background: rgba(239,68,68,0.14); border: 2px solid rgba(239,68,68,0.7); color: #fecaca;
  animation: rise 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.nope::before { content: '🚫 '; }
.question { font-weight: 800; font-size: 1.1rem; }
.vote { width: 100%; max-width: 480px; margin: 0 auto; display: grid; gap: 0.75rem; animation: rise 0.45s cubic-bezier(0.2, 1.2, 0.4, 1); }
.vote-btn {
  width: 100%; padding: 1rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.1rem; font-weight: 800; cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.vote-btn:hover { border-color: var(--primary); }
.vote-btn:active { transform: scale(0.98); }
.vote-btn[aria-pressed="true"] { background: rgba(108,99,255,0.2); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.25); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; animation: rise 0.45s cubic-bezier(0.2, 1.2, 0.4, 1); }
.btn-stay, .btn-switch { padding: 1.1rem 0.75rem; font-size: 1.15rem; font-weight: 800; border-radius: 14px; color: #fff; }
.btn-stay { background: var(--danger); }
.btn-switch { background: var(--success); }
.result { font-size: 1.35rem; font-weight: 900; padding: 1rem 1.25rem; border-radius: 12px; width: 100%; animation: truth-in 0.6s cubic-bezier(0.2, 1.3, 0.4, 1); }
.result.won { background: rgba(245,197,24,0.18); color: #fde68a; border: 2px solid var(--gold); }
.result.lost { background: rgba(139,143,163,0.15); color: var(--text-muted); border: 2px solid var(--border); }
.result small { display: block; font-weight: 500; font-size: 0.85rem; margin-top: 0.2rem; color: var(--text-muted); }
@keyframes truth-in { 0% { transform: scale(0.85) rotate(-2deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

/* ── Finding a table ────────────────────────────────────────────────────── */
.lobby-card { width: 100%; max-width: 600px; text-align: left; }
.lobby-card h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin: 1.5rem 0 0.75rem; }
.names { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.name-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 0.5rem 1.1rem;
  font-weight: 700; font-size: 0.95rem; color: var(--text); cursor: pointer; transition: border-color 0.15s, transform 0.1s;
}
.name-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.name-btn:active { transform: scale(0.97); }
.name-btn[disabled] { opacity: 0.5; cursor: default; transform: none; }
.my-table { background: rgba(108,99,255,0.12); border: 1px solid rgba(108,99,255,0.45); border-radius: 12px; padding: 1rem 1.25rem; display: grid; gap: 0.6rem; }
.my-table .names { margin-top: 0.2rem; }
.asked { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; color: var(--text-muted); font-size: 0.95rem; margin-top: 1rem; }
.ask {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; text-align: left;
  background: rgba(245,197,24,0.12); border: 1px solid rgba(245,197,24,0.5); border-radius: 12px;
  padding: 0.85rem 1.1rem; margin-bottom: 1rem; animation: rise 0.4s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.ask span { flex: 1; min-width: 10rem; }
#inbox { width: 100%; max-width: 600px; margin: 0 auto; }
.tbl { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem; }
.tbl + .tbl { margin-top: 0.75rem; }
.tbl-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.tbl .names, .tbl .chips { margin: 0.5rem 0; }
.tbl-status { font-size: 0.8rem; color: var(--text-muted); }
.tbl.playing { border-color: rgba(34,197,94,0.55); }
.tbl.looking { border-style: dashed; }

/* ── The room board (teacher and projector) ─────────────────────────────── */
.room-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.85rem; }
.room-board .tbl + .tbl { margin-top: 0; }
.room-board .tbl.looking { grid-column: 1 / -1; }
.room-mini { margin-top: 1rem; }

/* ── The stage ──────────────────────────────────────────────────────────── */
.stage {
  position: relative;
  width: 100%;
  padding: 2rem 1.25rem 1.25rem;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 15% -10%, rgba(255,255,255,0.14), transparent 45%),
    radial-gradient(ellipse at 85% -10%, rgba(255,255,255,0.14), transparent 45%),
    repeating-linear-gradient(90deg, var(--curtain-dark) 0 16px, var(--curtain) 16px 34px);
  box-shadow: inset 0 -36px 40px rgba(0,0,0,0.45), var(--shadow);
}
.stage::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12%;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,0.55)); pointer-events: none;
}
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 540px; margin: 0 auto; perspective: 900px; position: relative; z-index: 1; padding-bottom: 2rem; }
.door {
  position: relative; aspect-ratio: 5 / 8; background: none; border: 0; padding: 0; color: inherit;
  transform-style: preserve-3d; border-radius: 14px; cursor: default;
}
.door:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.door-room, .door-panel {
  position: absolute; inset: 0;
  border-radius: 42% 42% 10px 10px / 26% 26% 10px 10px;
  border: 3px solid var(--gold-deep);
}
.door-room {
  background: radial-gradient(ellipse at 50% 35%, #2b2050, #120c22 72%);
  display: grid; place-items: center; overflow: hidden;
  transition: background 0.5s, border-color 0.3s, box-shadow 0.3s;
}
.door-prize {
  font-size: clamp(2.2rem, 11vw, 4rem); line-height: 1;
  transform: scale(0); opacity: 0;
  transition: transform 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 0.35s, opacity 0.2s 0.35s;
}
.door.open .door-prize { transform: scale(1); opacity: 1; }
.door-panel {
  transform-origin: 0% 50%;
  transition: transform 0.85s cubic-bezier(0.45, 0, 0.2, 1), box-shadow 0.3s, border-color 0.3s;
  background: linear-gradient(135deg, #8a3fd1, #5b2aa6 55%, #3e1d78);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,0.06), inset 0 -14px 22px rgba(0,0,0,0.35), 0 6px 14px rgba(0,0,0,0.35);
  display: grid; place-items: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.door-panel::before {
  content: ''; position: absolute; inset: 13% 15%;
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 36% 36% 6px 6px / 22% 22% 6px 6px;
}
.door-num {
  font-size: clamp(1.7rem, 8.5vw, 2.8rem); font-weight: 900; color: var(--gold); line-height: 1;
  width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 50%;
  background: rgba(0,0,0,0.28); border: 2px solid rgba(245,197,24,0.55); text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  position: relative;
}
.door-knob {
  position: absolute; right: 11%; top: 52%; width: 11%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b0, var(--gold-deep)); box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.door.open .door-panel { transform: rotateY(-112deg); }
.door.selectable { cursor: pointer; }
.door.selectable .door-panel { animation: door-shimmer 2.2s ease-in-out infinite; }
.door.selectable:hover .door-panel, .door.selectable:focus-visible .door-panel { transform: rotateY(-20deg); animation: none; box-shadow: inset 0 0 0 6px rgba(255,255,255,0.06), 0 0 28px 6px rgba(245,197,24,0.5); }
@keyframes door-shimmer {
  0%, 100% { box-shadow: inset 0 0 0 6px rgba(255,255,255,0.06), inset 0 -14px 22px rgba(0,0,0,0.35), 0 0 0 0 rgba(245,197,24,0); }
  50% { box-shadow: inset 0 0 0 6px rgba(255,255,255,0.06), inset 0 -14px 22px rgba(0,0,0,0.35), 0 0 26px 5px rgba(245,197,24,0.45); }
}
.door.refusable { cursor: not-allowed; }
.door.nope .door-panel, .door.nope .door-room {
  animation: door-nope 0.6s ease-in-out, door-blink 0.6s ease-in-out;
}
@keyframes door-nope { 0%, 100% { transform: none; } 20% { transform: translateX(-6%) rotate(-3deg); } 40% { transform: translateX(6%) rotate(3deg); } 60% { transform: translateX(-4%) rotate(-2deg); } 80% { transform: translateX(4%) rotate(2deg); } }
@keyframes door-blink { 0%, 100% { border-color: var(--gold-deep); box-shadow: none; } 25%, 75% { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,0.85), 0 0 30px 8px rgba(239,68,68,0.5); } }
.door.pick .door-panel, .door.pick .door-room { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 34px 8px rgba(255,255,255,0.35); }
.door.boat-known .door-panel { background: linear-gradient(135deg, #a955ea, #6b35bf 55%, #4a2290); }
.door.won .door-room { background: radial-gradient(circle at 50% 40%, #fff3b0, var(--gold) 50%, var(--gold-deep)); border-color: #fff; }
.door.lost .door-room { background: radial-gradient(circle at 50% 40%, #3a3f52, #1c1f2b 75%); }
.door.open .door-prize.boat { animation: prize-bob 1.8s ease-in-out infinite 0.9s; }
.door.open .door-prize.goat { animation: goat-wobble 1.8s ease-in-out infinite 0.9s; }
@keyframes prize-bob { 0%, 100% { transform: scale(1) translateY(0) rotate(-4deg); } 50% { transform: scale(1.08) translateY(-7%) rotate(4deg); } }
@keyframes goat-wobble { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.door-tag {
  position: absolute; left: -10%; right: -10%; bottom: -1.65rem; text-align: center;
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.door.lost .door-tag { color: var(--text-muted); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti i { position: absolute; top: -14px; width: 8px; height: 14px; border-radius: 2px; animation: confetti-fall 2.6s ease-in forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(520px) rotate(720deg); opacity: 0; }
}

/* ── The record ─────────────────────────────────────────────────────────── */
.record { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.arm { text-align: center; padding: 1.1rem 1rem 1.6rem; border-radius: 12px; border: 2px solid; }
.arm.stay { border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.08); }
.arm.switch { border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.08); }
.arm h3 { margin: 0 0 0.1rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.arm .big { font-size: 2.4rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.arm.stay .big { color: #fca5a5; }
.arm.switch .big { color: #86efac; }
.arm .frac { font-size: 0.85rem; color: var(--text-muted); }
.bar { position: relative; height: 12px; border-radius: 999px; background: var(--surface2); margin-top: 0.7rem; }
.bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.3, 1); }
.arm.stay .bar-fill { background: linear-gradient(90deg, #b91c1c, var(--danger)); }
.arm.switch .bar-fill { background: linear-gradient(90deg, #15803d, var(--success)); }
.bar-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); transform: translateX(-50%); }
.bar-mark::after { content: attr(data-label); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.04em; white-space: nowrap; }
.record-foot { grid-column: 1 / -1; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

/* ── The chart ──────────────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; margin-top: 1rem; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .ref { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.chart .label { fill: var(--text-muted); font-size: 12px; font-family: inherit; }
.chart .label.strong { fill: var(--text); font-weight: 700; }
.chart .line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.stay { stroke: var(--danger); }
.chart .line.switch { stroke: var(--success); }
.chart .dot.stay { fill: var(--danger); }
.chart .dot.switch { fill: var(--success); }
.chart .legend { font-size: 12px; font-weight: 800; font-family: inherit; }
.chart .legend.stay { fill: #fca5a5; }
.chart .legend.switch { fill: #86efac; }
.chart .empty { fill: var(--text-muted); font-size: 14px; font-family: inherit; }

/* ── Beliefs ────────────────────────────────────────────────────────────── */
.beliefs { display: grid; gap: 0.6rem; }
.belief-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.75rem; align-items: center; }
.belief-row > span { font-weight: 700; font-size: 0.9rem; text-align: right; }
.belief-bar { display: flex; height: 26px; border-radius: 999px; overflow: hidden; background: var(--surface2); border: 1px solid var(--border); }
.belief-seg { display: grid; place-items: center; font-size: 0.8rem; font-weight: 800; color: #111; transition: width 0.5s; min-width: 0; overflow: hidden; }
.belief-seg.switch { background: var(--success); }
.belief-seg.stay { background: var(--danger); color: #fff; }
.belief-seg.same { background: var(--text-muted); }
.belief-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.belief-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; }
.belief-legend i.switch { background: var(--success); }
.belief-legend i.stay { background: var(--danger); }
.belief-legend i.same { background: var(--text-muted); }

/* ── Summary (end of show) ──────────────────────────────────────────────── */
.summary { width: 100%; text-align: left; }
.summary .stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 0.5rem; text-align: center; min-width: 0; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-card .stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-gold .stat-value { color: var(--gold); }
.summary .hook { color: var(--gold); font-weight: 700; font-size: 1.05rem; text-align: center; margin-bottom: 1rem; }
.games-list { font-size: 0.9rem; padding-left: 1.2rem; margin-bottom: 1rem; }
.games-list li { margin-bottom: 0.2rem; }
.summary-record { width: 100%; text-align: left; margin-top: 0.5rem; }
.summary, .summary-record { max-width: 600px; }

/* ── Projector ──────────────────────────────────────────────────────────── */
body.present { background: radial-gradient(ellipse at top, #1a1430, var(--bg) 60%); }
.pbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 1.05rem; font-weight: 700; }
.on-air { background: var(--danger); color: #fff; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 0.15rem 0.55rem; border-radius: 4px; margin-right: 0.4rem; animation: pulse 1.6s ease-in-out infinite; vertical-align: middle; }
.present-main { text-align: center; }
.present .phase { gap: 1.4rem; }
.present .phase h1 { font-size: 2.6rem; }
.live-head h1 { font-size: 2.2rem; }
.join-ways { display: flex; align-items: center; justify-content: center; gap: 2.5rem; flex-wrap: wrap; }
.join-big { font-size: 1.4rem; line-height: 1.4; }
.code-marquee {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 4.2rem; font-weight: 900; letter-spacing: 0.25em; color: var(--gold);
  border: 4px dotted var(--gold); border-radius: 18px; padding: 0.4rem 1.2rem 0.4rem 1.45rem; margin-top: 0.75rem; background: #141127;
  box-shadow: 0 0 0 4px #141127; animation: marquee-glow 2.6s ease-in-out infinite; display: inline-block;
}
.join-or { font-size: 1.4rem; color: var(--text-muted); }
.qr-card { background: #fff; padding: 0.75rem; border-radius: 12px; display: inline-block; }
.qr-card img { width: 220px; height: 220px; display: block; }
.joined { font-size: 1.25rem; color: var(--text-muted); }
.joined strong { color: var(--text); }
.present .record { width: 100%; max-width: 900px; margin: 0 auto; }
.present .arm .big { font-size: 4rem; }
.chart-large { max-width: 900px; margin: 0 auto; }
.statement { font-size: 1.35rem; max-width: 900px; margin: 0 auto; }
.beliefs-wide { width: 100%; max-width: 700px; margin: 0 auto; }
.beliefs-wide h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
.present .room-board { width: 100%; max-width: 1000px; margin: 0 auto; text-align: left; grid-template-columns: repeat(auto-fit, minmax(170px, 230px)); justify-content: center; }

/* ── QR dialog ──────────────────────────────────────────────────────────── */
.dialog { margin: auto; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); padding: 0; box-shadow: 0 10px 40px rgba(0,0,0,0.6); width: min(92vw, 440px); }
.dialog::backdrop { background: rgba(0,0,0,0.65); }
.dialog-body { padding: 1.5rem; text-align: center; display: grid; gap: 1rem; justify-items: center; }
.dialog-body h2 { margin: 0; }
.pick-list { display: grid; gap: 0.75rem; width: 100%; }
.pick-item {
  display: flex; align-items: center; gap: 1rem; text-align: left; padding: 0.9rem 1.1rem; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.1s;
}
.pick-item:hover { border-color: var(--gold); transform: translateY(-1px); text-decoration: none; }
.pick-glyph { font-size: 1.8rem; line-height: 1; }
.pick-text { display: grid; gap: 0.15rem; }

/* ── The playpen: a goat and a boat to poke while waiting ───────────────── */
.playpen { display: flex; justify-content: center; align-items: flex-end; gap: 2.5rem; padding: 0.5rem 0 0; }
.pet-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.bubble {
  min-height: 2.6rem; max-width: 13rem; padding: 0.45rem 0.8rem; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--border); font-size: 0.85rem; line-height: 1.3;
  opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; position: relative;
}
.bubble.show { opacity: 1; transform: none; }
.bubble.show::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px;
  background: inherit; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg);
}
.pet {
  font-size: 4rem; line-height: 1; height: 5.4rem; display: flex; align-items: center; padding: 0 0.6rem;
  border: 0; background: none; cursor: pointer; border-radius: 16px; transition: transform 0.15s;
}
.pet:hover { transform: scale(1.08); }
.pet:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
.pet.goat { animation: goat-wobble 2.4s ease-in-out infinite; }
.pet.boat { animation: prize-bob 2.2s ease-in-out infinite; }
.pet.goat.poke { animation: goat-poke 0.6s cubic-bezier(0.2, 1.3, 0.4, 1); }
.pet.boat.poke { animation: boat-poke 0.7s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes goat-poke { 0% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-38%) rotate(-18deg); } 65% { transform: translateY(0) rotate(12deg) scaleX(-1); } 100% { transform: none; } }
@keyframes boat-poke { 0% { transform: none; } 30% { transform: translateX(-14%) rotate(-10deg); } 60% { transform: translateX(14%) rotate(10deg) scale(1.1); } 100% { transform: none; } }
.playpen-count { margin-top: 0.25rem; }

/* ── Small screens and calm screens ─────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 1.25rem 1rem 2rem; }
  .card { padding: 1.25rem; }
  .exp-card { padding: 1.5rem; }
  .phase { gap: 1.25rem; }
  .marquee { padding: 1rem 1.3rem; }
  .marquee h1 { font-size: 1.6rem; }
  .present .phase h1 { font-size: 1.8rem; }
  .code-marquee { font-size: 2.4rem; }
  .present .arm .big { font-size: 2.4rem; }
  .doors { gap: 0.6rem; }
  .stage { padding: 1.5rem 0.9rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee, .code-marquee, .on-air, .pulse { animation: none; }
  .door.selectable .door-panel, .door.open .door-prize.boat, .door.open .door-prize.goat { animation: none; }
  .door-panel { transition-duration: 0.2s; }
  .door-prize { transition-delay: 0s; }
  .confetti { display: none; }
  .prompt, .vote, .choice, .result, .ask, .pet, .nope { animation: none; }
  .door.nope .door-panel, .door.nope .door-room { animation: door-blink 0.6s ease-in-out; }
}
