@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo.woff2') format('woff2');
  font-weight: 500 800;
  font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/fonts/spectral-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/fonts/spectral-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('/fonts/spectral-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --void: #04060f;
  --deep-1: #16295e;
  --deep-2: #0a1436;
  --panel-bg-1: rgba(13, 23, 58, 0.92);
  --panel-bg-2: rgba(6, 10, 28, 0.95);
  --gold: #f0c75e;
  --gold-bright: #ffe08a;
  --green: #5fd67a;
  --red: #e0604f;
  --text: #eef1fb;
  --muted: #8d9ac4;
  --muted-dim: #5a6893;
  --border-blue: rgba(111, 140, 220, 0.5);

  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce: cubic-bezier(0.3, 1.6, 0.4, 1);
  --t-fast: 0.15s;
  --t-medium: 0.4s;
  --t-slow: 0.6s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(120% 90% at 50% -10%, var(--deep-1) 0%, var(--deep-2) 42%, var(--void) 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center;
}

h1, h2, h3, .display-font { font-family: var(--font-display); }

@keyframes page-fade-in { from { opacity: 0; } to { opacity: 1; } }
body { animation: page-fade-in var(--t-slow) var(--ease-out); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Signature atmosphere (used on /display, lighter touches elsewhere) ---------- */

@keyframes spotlightDrift { 0% { transform: translate(-3%, -2%) scale(1); } 50% { transform: translate(3%, 2%) scale(1.06); } 100% { transform: translate(-3%, -2%) scale(1); } }
@keyframes raySweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes vignetteBreath { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.85; } }
@keyframes heartbeat { 0%, 100% { opacity: 0.25; transform: scale(1); } 12% { opacity: 0.5; transform: scale(1.015); } 24% { opacity: 0.3; } 36% { opacity: 0.45; } 50% { opacity: 0.25; } }

@keyframes flashGold { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }
@keyframes flashRed { 0% { opacity: 0; } 10% { opacity: 0.9; } 55% { opacity: 0.5; } 100% { opacity: 0; } }
@keyframes burstRing { 0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.9; } 100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; } }

.flash-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 6; opacity: 0; }
.flash-overlay.warm { background: radial-gradient(70% 60% at 50% 50%, rgba(95,214,122,0.35), rgba(240,199,94,0.18) 55%, transparent 80%); animation: flashGold 1.6s ease-out both; }
.flash-overlay.cold { background: radial-gradient(120% 100% at 50% 50%, rgba(224,96,79,0.16) 30%, rgba(90,16,10,0.55) 100%); animation: flashRed 2.4s ease-out both; }

.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; background: radial-gradient(85% 70% at 50% 60%, transparent 30%, rgba(2,3,8,0.72) 100%); transition: opacity 0.6s ease; }
.vignette.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Reveal / transition keyframes ---------- */

@keyframes fadeUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }
.rise-in { animation: fadeUp 0.5s var(--ease-out) both; }

@keyframes questionIn { 0% { opacity: 0; transform: translateY(34px) scale(0.97); filter: blur(6px); } 60% { filter: blur(0); } 100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }
.stage-enter { animation: questionIn 0.7s 0.1s var(--ease-out) both; }
@keyframes stage-out { 0% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); } 100% { opacity: 0; transform: scale(0.92) translateY(-10px); filter: blur(6px); } }
.stage-exit { animation: stage-out 0.38s var(--ease-in) forwards; }

.tile-cascade { animation: fadeUp 0.5s var(--ease-out) both; }
.tile-cascade:nth-child(1) { animation-delay: 0.05s; }
.tile-cascade:nth-child(2) { animation-delay: 0.16s; }
.tile-cascade:nth-child(3) { animation-delay: 0.27s; }
.tile-cascade:nth-child(4) { animation-delay: 0.38s; }

@keyframes banner-in { 0% { opacity: 0; transform: scale(0.6); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
.banner-in { animation: banner-in 0.7s var(--ease-bounce) forwards; }

@keyframes winnerGlow { 0%, 100% { text-shadow: 0 0 30px rgba(240,199,94,0.5); } 50% { text-shadow: 0 0 80px rgba(240,199,94,0.95), 0 0 24px rgba(255,255,255,0.4); } }

@keyframes disintegrate { 0% { opacity: 1; transform: scale(1) rotate(0deg); } 100% { opacity: 0; transform: scale(0.7) rotate(-4deg); filter: blur(4px); } }
.answer.disintegrating { animation: disintegrate 0.6s ease forwards; pointer-events: none; }

/* ---------- Panels ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel-bg-1), var(--panel-bg-2));
  border: 1px solid var(--border-blue);
  border-radius: 16px;
  padding: 1rem;
}

/* ---------- Answer tiles: pill bar + diamond letter badge ---------- */

.answer-grid {
  display: grid;
  /* --answer-col-w is set by equalizeAnswerWidths() in host.js/display.js to the widest of the
     four tiles' natural content width, so both columns always match the longest option — falls
     back to a plain 1fr/1fr split before JS has measured anything. */
  grid-template-columns: repeat(2, minmax(var(--answer-col-w, 0), 1fr));
  gap: 1.4rem;
  max-width: 1800px;
  margin: 0 auto;
}

.answer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.6rem 3rem 1.6rem 1.4rem;
  background: linear-gradient(180deg, rgba(13,23,58,0.9), rgba(6,10,28,0.9));
  border: 2px solid var(--border-blue);
  border-radius: 999px;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), border-color var(--t-medium) var(--ease-out), background var(--t-medium) var(--ease-out), box-shadow var(--t-medium) var(--ease-out), opacity 0.8s ease;
  user-select: none;
}

.answer:hover:not(.disabled):not(.pending) { transform: scale(1.015); border-color: var(--gold); box-shadow: 0 0 20px rgba(240, 199, 94, 0.3); }
.answer.disabled { visibility: hidden; }
.answer.selected { border-color: var(--gold); background: rgba(240, 199, 94, 0.12); }

@keyframes lockPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240,199,94,0.65), 0 0 34px rgba(240,199,94,0.35); } 50% { box-shadow: 0 0 0 7px rgba(240,199,94,0.12), 0 0 60px rgba(240,199,94,0.6); } }
.answer.locked { border-color: var(--gold); background: linear-gradient(180deg, rgba(122,92,16,0.95), rgba(74,54,8,0.95)); animation: lockPulse 1.6s ease-in-out infinite; }
.answer.locked .letter { background: var(--gold); color: #201a06; }

@keyframes correctFlash { 0%, 22%, 44% { filter: brightness(2.1); } 11%, 33%, 100% { filter: brightness(1); } }
@keyframes correctPop { 0% { transform: scale(1); } 18% { transform: scale(1.06); } 34% { transform: scale(0.99); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }
.answer.correct {
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(20,92,44,0.95), rgba(9,52,24,0.95));
  animation: correctFlash 1.8s ease both, correctPop 1.2s var(--ease-out) both;
}
.answer.correct .letter { background: var(--green); border-color: var(--green); color: #06230f; }

@keyframes wrongShake { 0%, 100% { transform: translateX(0); } 12% { transform: translateX(-14px); } 24% { transform: translateX(12px); } 36% { transform: translateX(-9px); } 48% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 72% { transform: translateX(2px); } }
.answer.wrong {
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(112,30,22,0.95), rgba(60,14,10,0.95));
  animation: wrongShake 0.7s ease both;
}
.answer.wrong .letter { background: var(--red); border-color: var(--red); color: #2b0803; }

.answer.dimmed { opacity: 0.35; }
.answer.pending { opacity: 0; pointer-events: none; }

.letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  flex-shrink: 0;
  transform: rotate(45deg);
  border: 3px solid var(--gold);
  border-radius: 14px;
  background: transparent;
}
.letter > span, .letter { font-family: var(--font-display); font-weight: 800; }
.letter-glyph { transform: rotate(-45deg); font-family: var(--font-display); font-weight: 800; color: var(--gold); font-size: 2.3rem; }
.answer.locked .letter-glyph, .answer.correct .letter-glyph, .answer.wrong .letter-glyph { color: inherit; }

/* ---------- Money ladder ---------- */

.ladder {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.ladder-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  color: var(--text);
  border: 2px solid transparent;
  transition: color var(--t-medium) var(--ease-out), background var(--t-medium) var(--ease-out), border-color var(--t-medium) var(--ease-out);
}
.ladder-row span:first-child { font-size: 0.85rem; color: var(--muted); text-align: left; }
.ladder-row span:last-child { text-align: right; }

.ladder-row.milestone span:last-child { color: var(--gold); }
.ladder-row.done { color: var(--muted-dim); }
.ladder-row.done span:first-child { color: var(--muted-dim); }
.ladder-row.current {
  background: var(--gold);
  color: #201a06;
}
.ladder-row.current span:first-child, .ladder-row.current span:last-child { color: #201a06; }

/* ---------- Sequential reveal placeholder ---------- */
/* .answer.pending already fully hidden (opacity:0) above — same box, invisible until revealed */

/* ---------- Sidebar: lifelines + ladder ---------- */

.sidebar-lifelines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(141, 154, 196, 0.2);
}
.sidebar-lifelines .label { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.2rem; }
.lifeline-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  border: 2px solid rgba(240, 199, 94, 0.7);
  background: rgba(240, 199, 94, 0.08);
  transition: color var(--t-medium) var(--ease-out), border-color var(--t-medium) var(--ease-out), background var(--t-medium) var(--ease-out), opacity var(--t-medium) var(--ease-out);
}
.lifeline-status .icon { font-size: 1.1rem; }
.lifeline-status.used {
  color: var(--muted-dim);
  border-color: rgba(141, 154, 196, 0.25);
  background: none;
  text-decoration: line-through;
  opacity: 0.6;
}

/* ---------- Audience vote bars (shared by display + host) ---------- */

.audience-bars { max-width: 560px; margin: 0 auto; width: 100%; }
.abar-row { display: grid; grid-template-columns: 44px 1fr 70px; align-items: center; gap: 16px; margin: 0.5rem 0; }
.abar-track { height: 26px; border-radius: 6px; background: rgba(255,255,255,0.06); overflow: hidden; }
@keyframes barGrow { from { width: 0; } }
.abar-fill { height: 100%; background: linear-gradient(90deg, #3f6ad8, #6f9bff); border-radius: 6px; width: 0%; animation: barGrow 0.9s var(--ease-out) both; transition: width 0.5s ease; }
.abar-pct { font-size: 1.1rem; font-weight: 700; text-align: right; color: var(--text); }
.abar-choice-text { margin: -0.3rem 0 0.5rem 60px; font-size: 0.85rem; color: var(--muted); }

/* ---------- Phone-a-friend ---------- */

.phone-panel {
  text-align: center;
  padding: 1rem;
  border-radius: 16px;
  border: 2px solid var(--gold);
  animation: heartbeat 1.6s ease-in-out infinite;
}
.phone-timer-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  color: var(--gold);
}
.phone-timer-num.low { color: var(--red); }

/* ---------- Buttons: hierarchy ---------- */

button { font-family: var(--font-body); }

.btn-primary {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  color: #201a06;
  background: var(--gold);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(240, 199, 94, 0.4);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.btn-primary:hover:not(:disabled) { background: var(--gold-bright); transform: translateY(-1px) scale(1.01); box-shadow: 0 0 36px rgba(240, 199, 94, 0.65); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.99); }
.btn-primary:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

.btn-lifeline {
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.btn-lifeline:hover:not(:disabled) { transform: translateY(-1px); }
.btn-lifeline:active:not(:disabled) { transform: translateY(0); }
.btn-lifeline:disabled { opacity: 0.4; cursor: default; border-color: rgba(141,154,196,0.25); color: var(--muted-dim); }
.btn-lifeline.used { opacity: 0.5; text-decoration: line-through; border-color: rgba(141,154,196,0.25); color: var(--muted-dim); }

.btn-caution {
  padding: 0.65rem 1.3rem;
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn-caution:hover:not(:disabled) { background: rgba(224, 96, 79, 0.12); transform: translateY(-1px); }
.btn-caution:active:not(:disabled) { transform: translateY(0); }
.btn-caution:disabled { opacity: 0.3; cursor: default; border-color: var(--muted-dim); color: var(--muted-dim); }

.btn-danger-ghost {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 2px solid rgba(141, 154, 196, 0.4);
  color: var(--muted);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.btn-danger-ghost:hover { background: rgba(141, 154, 196, 0.1); }

.btn-ghost-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out);
  padding: 0.4rem;
}
.btn-ghost-link:hover { color: var(--gold); }

/* legacy alias kept for any unmigrated usage */
button.action { padding: 0.6rem 1.2rem; border-radius: 8px; border: 1.5px solid var(--gold); background: transparent; color: var(--text); cursor: pointer; }
