/* ============================================================
   ¿QUIÉN QUIERE SER MILLONARIO? — Pixel Art TV Edition
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323:wght@400&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Pixel palette */
  --px-black:   #0d0d0d;
  --px-navy:    #0a0a2e;
  --px-blue:    #1a1a6e;
  --px-purple:  #2d0a6e;
  --px-gold:    #ffd700;
  --px-gold2:   #ffaa00;
  --px-gold3:   #cc8800;
  --px-amber:   #ff8800;
  --px-white:   #f0f0f0;
  --px-silver:  #c0c0c0;
  --px-green:   #00e000;
  --px-red:     #e00000;
  --px-cyan:    #00ffff;
  --px-magenta: #ff00ff;
  --cf-orange:  #f38020;

  /* Pixel borders (box-shadow trick) */
  --px-border-gold: 0 0 0 3px var(--px-gold3), 0 0 0 6px var(--px-gold), 0 0 0 9px var(--px-gold3);
  --px-border-blue: 0 0 0 3px #0000aa, 0 0 0 6px #0000ff, 0 0 0 9px #0000aa;
  --px-glow-gold:   0 0 12px var(--px-gold), 0 0 28px var(--px-gold2), 0 0 48px var(--px-amber);
  --px-glow-cyan:   0 0 8px var(--px-cyan), 0 0 20px var(--px-cyan);

  --font-pixel: 'Press Start 2P', monospace;
  --font-vt:    'VT323', monospace;
}

/* ============================================================
   BASE
   ============================================================ */

html { image-rendering: pixelated; }

body {
  font-family: var(--font-pixel);
  background-color: var(--px-navy);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(45,10,110,.95) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(10,10,80,.8) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(30,10,80,.8) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--px-white);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 56px;
  /* CRT scanlines */
  position: relative;
}

/* Scanlines overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.18) 2px,
    rgba(0,0,0,.18) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Pixel grid */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,215,0,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,215,0,.025) 1px, transparent 1px);
  background-size: 8px 8px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   BACKGROUND AMBIENT
   ============================================================ */

.bg-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 50%, rgba(255,215,0,.06) 0%, transparent 65%),
    radial-gradient(ellipse 600px 400px at 80% 50%, rgba(0,100,255,.07) 0%, transparent 65%);
  animation: ambientPulse 6s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
  from { opacity: .6; }
  to   { opacity: 1; }
}

.spotlight { display: none; }

/* ============================================================
   FOOTER
   ============================================================ */

.cloudflare-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: rgba(0,0,0,.92);
  border-top: 2px solid var(--px-gold3);
  font-family: var(--font-vt);
  font-size: 1.15rem;
  color: var(--px-silver);
  z-index: 300;
  letter-spacing: 1px;
  image-rendering: auto;
}

.cloudflare-footer .heart { animation: heartbeat 1.5s ease-in-out infinite; }

@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}

.cloudflare-footer .cloudflare-text {
  color: var(--cf-orange);
  font-weight: 700;
}

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */

.language-switcher {
  position: fixed;
  top: 14px; right: 14px;
  display: flex;
  gap: 6px;
  z-index: 200;
}

.lang-btn {
  padding: 8px 14px;
  background: var(--px-blue);
  border: none;
  color: var(--px-silver);
  text-decoration: none;
  font-family: var(--font-pixel);
  font-size: .6rem;
  cursor: pointer;
  transition: background .1s, color .1s;
  letter-spacing: 1px;
  /* pixel border */
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.5), inset 2px 2px 0 rgba(255,255,255,.15);
  image-rendering: pixelated;
}

.lang-btn:hover,
.lang-btn.active {
  background: var(--px-gold3);
  color: var(--px-black);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.4), inset 2px 2px 0 rgba(255,255,255,.3), var(--px-glow-gold);
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   HOME PAGE
   ============================================================ */

.home-content {
  text-align: center;
  max-width: 680px;
  width: 100%;
  animation: fadeUp .4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.logo-container {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.logo {
  image-rendering: pixelated;
  filter: drop-shadow(0 0 12px var(--px-gold)) drop-shadow(0 0 28px var(--px-gold2));
}

.pulse {
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 10px var(--px-gold)) drop-shadow(0 0 24px var(--px-gold2)); }
  50%      { filter: drop-shadow(0 0 20px var(--px-gold)) drop-shadow(0 0 48px var(--px-amber)) drop-shadow(0 0 64px var(--px-gold)); }
}

/* Title */
.title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 2.8vw, 1.5rem);
  font-weight: 400;
  line-height: 2;
  margin-bottom: 10px;
  color: var(--px-gold);
  text-shadow: var(--px-glow-gold);
}

.glow { text-shadow: var(--px-glow-gold); }

.subtitle {
  font-family: var(--font-vt);
  font-size: 1.8rem;
  letter-spacing: 3px;
  color: var(--px-cyan);
  text-shadow: var(--px-glow-cyan);
  margin-bottom: 32px;
  text-transform: uppercase;
}

/* ============================================================
   PIXEL PANEL (generic glassmorphism-free, pixel box)
   ============================================================ */

.px-panel {
  background: var(--px-blue);
  border: none;
  padding: 20px;
  position: relative;
  /* Pixel border via outline layers */
  box-shadow:
    0 0 0 4px var(--px-gold3),
    0 0 0 8px var(--px-navy),
    0 0 0 10px var(--px-gold3),
    0 8px 32px rgba(0,0,0,.6);
}

/* ============================================================
   TURNSTILE
   ============================================================ */

.turnstile-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--px-blue);
  box-shadow:
    0 0 0 3px var(--px-gold3),
    0 0 0 6px var(--px-navy),
    0 0 0 8px var(--px-gold3);
}

.turnstile-hint {
  color: var(--px-cyan);
  font-family: var(--font-vt);
  font-size: 1.3rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ============================================================
   MENU BUTTONS
   ============================================================ */

.menu-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
}

/* ============================================================
   PIXEL BUTTONS
   ============================================================ */

.millionaire-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  font-family: var(--font-pixel);
  font-size: .75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
  position: relative;
  white-space: nowrap;
  image-rendering: pixelated;
  line-height: 1.6;
}

/* Active press effect */
.millionaire-btn:active {
  transform: translate(2px, 2px);
}

.btn-primary {
  background: var(--px-gold3);
  color: var(--px-black);
  box-shadow:
    inset -3px -3px 0 var(--px-amber),
    inset 3px 3px 0 rgba(255,255,180,.5),
    0 4px 0 var(--px-gold3),
    0 6px 0 rgba(0,0,0,.5),
    var(--px-glow-gold);
}

.btn-primary:hover {
  background: var(--px-gold);
  box-shadow:
    inset -3px -3px 0 var(--px-gold2),
    inset 3px 3px 0 rgba(255,255,220,.6),
    0 4px 0 var(--px-gold2),
    0 6px 0 rgba(0,0,0,.5),
    0 0 20px var(--px-gold), 0 0 40px var(--px-gold2);
}

.btn-secondary {
  background: var(--px-purple);
  color: var(--px-silver);
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.15),
    0 4px 0 rgba(0,0,0,.4),
    0 6px 0 rgba(0,0,0,.3),
    0 0 0 2px var(--px-gold3);
}

.btn-secondary:hover {
  background: #3d1a8e;
  color: var(--px-gold);
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.2),
    0 4px 0 rgba(0,0,0,.4),
    0 6px 0 rgba(0,0,0,.3),
    0 0 0 2px var(--px-gold),
    0 0 14px rgba(255,215,0,.3);
}

.btn-back {
  background: var(--px-blue);
  color: var(--px-silver);
  font-size: .65rem;
  padding: 12px 20px;
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,.4),
    inset 2px 2px 0 rgba(255,255,255,.1),
    0 3px 0 rgba(0,0,0,.4),
    0 0 0 2px rgba(255,255,255,.1);
}

.btn-back:hover {
  color: var(--px-gold);
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,.4),
    inset 2px 2px 0 rgba(255,255,255,.15),
    0 3px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold3);
}

/* ============================================================
   GAME LAYOUT
   ============================================================ */

.game-container {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  max-width: 1080px;
  margin: 62px auto 80px;
  padding: 0 16px;
  position: relative;
  z-index: 1;
  align-items: start;
}

.main-game { min-width: 0; }

/* ============================================================
   PRIZE LADDER
   ============================================================ */

.prize-ladder {
  background: var(--px-blue);
  box-shadow:
    0 0 0 3px var(--px-gold3),
    0 0 0 6px var(--px-navy),
    0 0 0 8px var(--px-gold3),
    0 4px 16px rgba(0,0,0,.5);
  padding: 12px 8px;
  position: sticky;
  top: 72px;
}

.ladder-title {
  font-family: var(--font-pixel);
  font-size: .55rem;
  font-weight: 400;
  color: var(--px-gold);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--px-gold3);
  text-shadow: var(--px-glow-gold);
}

.ladder-item {
  font-family: var(--font-vt);
  font-size: 1.1rem;
  color: rgba(192,192,192,.5);
  text-align: right;
  padding: 4px 6px;
  margin-bottom: 1px;
  letter-spacing: 1px;
}

.ladder-item.guaranteed {
  color: var(--px-gold2);
  border-right: 3px solid var(--px-gold3);
}

.ladder-item.active {
  background: var(--px-gold3);
  color: var(--px-black);
  font-size: 1.2rem;
  font-weight: 700;
  animation: ladderBlink .6s step-end infinite;
  padding: 5px 6px;
}

@keyframes ladderBlink {
  0%,100% { background: var(--px-gold3); color: var(--px-black); }
  50%      { background: var(--px-gold);  color: var(--px-black); }
}

.ladder-item.passed {
  color: rgba(192,192,192,.2);
  text-decoration: line-through;
  font-size: .8rem;
}

/* ============================================================
   SCOREBOARD
   ============================================================ */

.header {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.score-board {
  display: flex;
  align-items: stretch;
  background: var(--px-blue);
  width: 100%;
  max-width: 600px;
  box-shadow:
    0 0 0 3px var(--px-gold3),
    0 0 0 6px var(--px-navy),
    0 0 0 8px var(--px-gold3),
    var(--px-glow-gold);
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  flex: 1;
  gap: 4px;
}

.score-item:not(:last-child) {
  border-right: 3px solid var(--px-gold3);
}

.score-item.logo-small {
  flex: 0 0 auto;
  padding: 6px 14px;
}

.score-item .label {
  font-family: var(--font-pixel);
  font-size: .55rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--px-cyan);
}

.score-item .value {
  font-family: var(--font-vt);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--px-white);
  line-height: 1;
  letter-spacing: 1px;
}

.score-item .money {
  color: var(--px-gold);
  text-shadow: var(--px-glow-gold);
}

/* ============================================================
   LIFELINES
   ============================================================ */

.lifelines {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.lifeline-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--px-purple);
  border: none;
  color: var(--px-gold);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.15),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold3);
  image-rendering: pixelated;
}

.lifeline-btn .lifeline-icon {
  font-family: var(--font-pixel);
  font-size: .65rem;
  line-height: 1.3;
  text-align: center;
}

.lifeline-btn:hover:not(:disabled) {
  background: #4a1aaa;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.2),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold),
    var(--px-glow-gold);
  transform: translateY(-2px);
}

.lifeline-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow:
    inset -1px -1px 0 rgba(0,0,0,.4),
    inset 1px 1px 0 rgba(255,255,255,.15),
    0 1px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold3);
}

.lifeline-btn:disabled,
.lifeline-btn.used {
  opacity: .25;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(1);
}

/* ============================================================
   QUESTION PANEL
   ============================================================ */

.question-panel {
  background: var(--px-blue);
  padding: 28px 30px;
  margin-bottom: 12px;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 0 3px var(--px-gold3),
    0 0 0 6px var(--px-navy),
    0 0 0 8px var(--px-gold3),
    0 4px 24px rgba(0,0,0,.4);
  overflow: hidden;
}

/* Pixel corner decorations */
.question-panel::before,
.question-panel::after {
  content: '★';
  position: absolute;
  font-size: 1rem;
  color: var(--px-gold);
  text-shadow: var(--px-glow-gold);
  animation: starSpin 3s linear infinite;
}

.question-panel::before { top: 8px; left: 12px; }
.question-panel::after  { top: 8px; right: 12px; animation-direction: reverse; }

@keyframes starSpin {
  0%   { transform: rotate(0deg)   scale(1); }
  50%  { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

.question-panel h2 {
  font-family: var(--font-vt);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 400;
  color: var(--px-white);
  text-align: center;
  line-height: 1.5;
  letter-spacing: 1px;
  padding: 0 28px;
}

.question-panel .loading p {
  font-family: var(--font-vt);
  font-size: 1.5rem;
  color: var(--px-cyan);
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: blink 1s step-end infinite;
}

/* ============================================================
   OPTIONS
   ============================================================ */

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--px-purple);
  border: none;
  color: var(--px-white);
  cursor: pointer;
  font-family: var(--font-vt);
  font-size: 1.35rem;
  letter-spacing: .5px;
  text-align: left;
  min-height: 68px;
  transition: transform .08s, box-shadow .08s, background .1s;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.12),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 2px rgba(255,215,0,.2);
  image-rendering: pixelated;
  position: relative;
  overflow: hidden;
}

.option-btn:not(:disabled):hover {
  background: #3d1a8e;
  color: var(--px-gold);
  transform: translateY(-2px);
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.18),
    0 6px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold),
    0 0 16px rgba(255,215,0,.25);
}

.option-btn:not(:disabled):hover .option-letter {
  background: var(--px-gold3);
  color: var(--px-black);
}

.option-btn:not(:disabled):active {
  transform: translate(2px, 2px);
  box-shadow:
    inset -1px -1px 0 rgba(0,0,0,.4),
    inset 1px 1px 0 rgba(255,255,255,.12),
    0 1px 0 rgba(0,0,0,.4),
    0 0 0 2px var(--px-gold3);
}

.option-btn:disabled { cursor: not-allowed; }

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  min-width: 38px;
  background: var(--px-gold3);
  color: var(--px-black);
  font-family: var(--font-pixel);
  font-size: .75rem;
  flex-shrink: 0;
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,.3),
    inset 2px 2px 0 rgba(255,255,255,.3);
}

.option-text { flex: 1; line-height: 1.4; }

/* ─── Correct ─── */
.option-btn.correct {
  background: #004400;
  color: var(--px-green);
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(0,255,0,.2),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 3px var(--px-green),
    0 0 24px rgba(0,224,0,.5);
  animation: correctFlash .5s steps(2, end) 3;
}

.option-btn.correct .option-letter {
  background: var(--px-green);
  color: #000;
}

@keyframes correctFlash {
  0%,100% { background: #004400; }
  50%      { background: #006600; }
}

/* ─── Incorrect ─── */
.option-btn.incorrect {
  background: #440000;
  color: var(--px-red);
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,0,0,.2),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 3px var(--px-red),
    0 0 20px rgba(224,0,0,.4);
  animation: shakePixel .4s steps(4, end);
}

.option-btn.incorrect .option-letter {
  background: var(--px-red);
  color: #fff;
}

@keyframes shakePixel {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* ============================================================
   ACTION BUTTONS
   ============================================================ */

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ============================================================
   CONTENT PANEL
   ============================================================ */

.panel {
  background: var(--px-blue);
  padding: 32px;
  max-width: 760px;
  width: 100%;
  animation: fadeUp .4s ease both;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 4px var(--px-gold3),
    0 0 0 8px var(--px-navy),
    0 0 0 10px var(--px-gold3),
    0 8px 32px rgba(0,0,0,.5);
}

/* Pixel corner markers */
.panel::before {
  content: '◆ ─────────────────────── ◆';
  display: block;
  font-family: var(--font-vt);
  font-size: .9rem;
  color: var(--px-gold3);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 18px;
  overflow: hidden;
}

.panel h1 {
  font-family: var(--font-pixel);
  font-size: clamp(.9rem, 2vw, 1.2rem);
  font-weight: 400;
  color: var(--px-gold);
  margin-bottom: 20px;
  text-shadow: var(--px-glow-gold);
  line-height: 1.8;
}

.panel p {
  font-family: var(--font-vt);
  font-size: 1.35rem;
  line-height: 1.8;
  color: var(--px-white);
  margin-bottom: 10px;
  letter-spacing: .5px;
}

.panel ul { list-style: none; }

.panel li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 6px;
  background: rgba(255,255,255,.04);
  border-left: 4px solid var(--px-gold3);
  font-family: var(--font-vt);
  font-size: 1.3rem;
  line-height: 1.6;
  color: var(--px-white);
  transition: background .15s;
  letter-spacing: .5px;
}

.panel li:hover {
  background: rgba(255,215,0,.07);
  border-left-color: var(--px-gold);
}

.panel li strong { color: var(--px-gold); }

/* ============================================================
   ARCHITECTURE PANEL
   ============================================================ */

.architecture-panel {
  background: var(--px-blue);
  padding: 28px;
  max-width: 1080px;
  width: 100%;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 4px var(--px-gold3),
    0 0 0 8px var(--px-navy),
    0 0 0 10px var(--px-gold3),
    0 8px 32px rgba(0,0,0,.5);
}

.architecture-panel h1 {
  font-family: var(--font-pixel);
  font-size: clamp(.8rem, 1.5vw, 1rem);
  font-weight: 400;
  color: var(--px-gold);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.8;
  text-shadow: var(--px-glow-gold);
}

.mermaid {
  background: rgba(0,0,0,.4);
  padding: 20px;
  margin-bottom: 22px;
  overflow: auto;
  border-left: 4px solid var(--px-gold3);
}

/* ============================================================
   MODAL
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  animation: fadeIn .15s ease;
}

.modal.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--px-blue);
  padding: 36px 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow:
    0 0 0 4px var(--px-gold3),
    0 0 0 8px var(--px-navy),
    0 0 0 10px var(--px-gold3),
    var(--px-glow-gold);
  animation: modalPop .2s steps(4, end) both;
}

@keyframes modalPop {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
  font-family: var(--font-pixel);
  font-size: clamp(.9rem, 2.5vw, 1.3rem);
  font-weight: 400;
  color: var(--px-gold);
  margin-bottom: 14px;
  line-height: 1.8;
  text-shadow: var(--px-glow-gold);
}

.modal-content p {
  font-family: var(--font-vt);
  font-size: 1.35rem;
  line-height: 1.7;
  color: var(--px-silver);
  margin-bottom: 26px;
  letter-spacing: .5px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   AI CHAT FAB
   ============================================================ */

.chat-fab {
  position: fixed;
  bottom: 68px; right: 16px;
  width: 52px; height: 52px;
  background: var(--px-purple);
  border: none;
  color: var(--px-gold);
  cursor: pointer;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .08s;
  box-shadow:
    inset -3px -3px 0 rgba(0,0,0,.4),
    inset 3px 3px 0 rgba(255,255,255,.15),
    0 4px 0 rgba(0,0,0,.4),
    0 0 0 3px var(--px-gold3),
    var(--px-glow-gold);
  image-rendering: pixelated;
}

.chat-fab svg { width: 22px; height: 22px; }

.chat-fab:hover {
  background: #4a1aaa;
  transform: translateY(-2px);
}

.chat-fab:active { transform: translate(2px, 2px); }

.chat-fab.active {
  background: var(--px-gold3);
  color: var(--px-black);
}

.fab-pulse {
  position: absolute;
  inset: -4px;
  border: 3px solid var(--px-gold);
  animation: fabPulse 2s steps(4, end) infinite;
  pointer-events: none;
}

@keyframes fabPulse {
  0%   { opacity: .8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* ============================================================
   CHAT PANEL
   ============================================================ */

.chat-panel {
  position: fixed;
  bottom: 132px; right: 16px;
  width: 340px;
  max-width: calc(100vw - 28px);
  height: 460px;
  max-height: calc(100vh - 160px);
  background: var(--px-blue);
  z-index: 249;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 3px var(--px-gold3),
    0 0 0 6px var(--px-navy),
    0 0 0 8px var(--px-gold3),
    0 12px 32px rgba(0,0,0,.6);
  animation: chatIn .15s steps(4, end) both;
}

.chat-panel.hidden { display: none; }

@keyframes chatIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,215,0,.12);
  border-bottom: 3px solid var(--px-gold3);
  flex-shrink: 0;
}

.chat-avatar {
  width: 36px; height: 36px;
  background: var(--px-gold3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.3), inset 2px 2px 0 rgba(255,255,200,.3);
  flex-shrink: 0;
  image-rendering: pixelated;
}

.chat-avatar svg { width: 18px; height: 18px; color: var(--px-black); }

.chat-title { flex: 1; min-width: 0; }

.chat-title h3 {
  font-family: var(--font-pixel);
  font-size: .65rem;
  font-weight: 400;
  color: var(--px-gold);
  text-shadow: var(--px-glow-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status {
  font-family: var(--font-vt);
  font-size: 1rem;
  color: var(--px-green);
  letter-spacing: 1px;
}

.chat-close-btn {
  width: 28px; height: 28px;
  background: var(--px-purple);
  border: none;
  color: var(--px-silver);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.4), inset 2px 2px 0 rgba(255,255,255,.1);
  transition: background .1s;
}

.chat-close-btn:hover {
  background: var(--px-red);
  color: #fff;
  transform: rotate(90deg);
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--px-gold3) var(--px-navy);
}

.chat-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: msgIn .1s steps(2, end) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-message.user-message { flex-direction: row-reverse; }

.message-avatar {
  width: 28px; height: 28px;
  min-width: 28px;
  background: var(--px-purple);
  border: 2px solid var(--px-gold3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.user-message .message-avatar {
  background: var(--px-blue);
  border-color: var(--px-cyan);
}

.message-bubble {
  max-width: 80%;
  padding: 9px 13px;
  font-family: var(--font-vt);
  font-size: 1.15rem;
  line-height: 1.5;
}

.ai-message .message-bubble {
  background: rgba(255,215,0,.08);
  border-left: 3px solid var(--px-gold3);
  color: var(--px-white);
}

.user-message .message-bubble {
  background: rgba(0,255,255,.07);
  border-right: 3px solid var(--px-cyan);
  color: var(--px-white);
}

.message-bubble p { margin: 0; }

.chat-message.error .message-bubble { border-color: var(--px-red); background: rgba(224,0,0,.1); }
.chat-message.upgrade .message-bubble { border-color: var(--px-gold); background: rgba(255,215,0,.1); }

/* Typing */
.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }

.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--px-gold);
  animation: typePx 1.2s steps(2, end) infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: .3s; }
.typing-indicator span:nth-child(3) { animation-delay: .6s; }

@keyframes typePx {
  0%,100% { opacity: .2; }
  50%      { opacity: 1; }
}

/* Input */
.chat-input-container {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: rgba(0,0,0,.3);
  border-top: 3px solid var(--px-gold3);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 9px 12px;
  background: var(--px-navy);
  border: 2px solid var(--px-gold3);
  color: var(--px-white);
  font-family: var(--font-vt);
  font-size: 1.15rem;
  resize: none;
  outline: none;
  transition: border-color .1s;
  line-height: 1.4;
}

#chat-input:focus { border-color: var(--px-gold); }
#chat-input::placeholder { color: rgba(192,192,192,.35); }

.chat-send-btn {
  width: 38px; height: 38px;
  background: var(--px-gold3);
  border: none;
  color: var(--px-black);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset -2px -2px 0 rgba(0,0,0,.3),
    inset 2px 2px 0 rgba(255,255,200,.3);
  transition: background .1s, transform .08s;
}

.chat-send-btn svg { width: 15px; height: 15px; }

.chat-send-btn:hover { background: var(--px-gold); }
.chat-send-btn:active { transform: translate(1px, 1px); }
.chat-send-btn:disabled { opacity: .3; cursor: not-allowed; transform: none; }

/* ============================================================
   PRICING
   ============================================================ */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.plan-card {
  background: var(--px-purple);
  padding: 20px 16px;
  text-align: center;
  box-shadow:
    0 0 0 3px var(--px-gold3),
    inset -3px -3px 0 rgba(0,0,0,.3),
    inset 3px 3px 0 rgba(255,255,255,.1);
}

.plan-card h3 {
  font-family: var(--font-pixel);
  font-size: .55rem;
  color: var(--px-gold);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.plan-card .price {
  font-family: var(--font-vt);
  font-size: 1.4rem;
  color: var(--px-white);
  margin-bottom: 12px;
}

.plan-card ul { list-style: none; margin-bottom: 16px; }

.plan-card li {
  font-family: var(--font-vt);
  padding: 4px 0;
  color: var(--px-silver);
  font-size: .9rem;
  border-bottom: 1px dashed rgba(255,215,0,.15);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--px-navy); }
::-webkit-scrollbar-thumb { background: var(--px-gold3); }
::-webkit-scrollbar-thumb:hover { background: var(--px-gold); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .game-container {
    grid-template-columns: 1fr;
    margin-top: 56px;
    padding: 0 8px;
    gap: 8px;
  }

  .prize-ladder {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: static;
    padding: 8px;
    gap: 2px;
    order: -1;
  }

  .ladder-title { grid-column: 1 / -1; }

  .ladder-item {
    text-align: center;
    border-right: none;
    font-size: .75rem;
    padding: 3px 2px;
    border-bottom: 1px solid rgba(255,215,0,.1);
  }

  .score-board { flex-wrap: wrap; }
  .score-item { padding: 8px 10px; }
  .score-item .value { font-size: 1.4rem; }

  .options-grid { grid-template-columns: 1fr; gap: 6px; }
  .option-btn { min-height: 54px; font-size: 1rem; }

  .panel { padding: 20px 16px; }

  .chat-fab { bottom: 64px; right: 10px; }
  .chat-panel { bottom: 120px; right: 6px; left: 6px; width: auto; height: 50vh; }
}

@media (max-width: 480px) {
  .title { font-size: .8rem; }
  .menu-buttons { grid-template-columns: 1fr; gap: 8px; }
  .lifelines { gap: 6px; }
  .lifeline-btn { width: 52px; height: 52px; }
  .question-panel { padding: 20px 16px; }
  .question-panel h2 { font-size: 1.25rem; }
  .millionaire-btn { font-size: .62rem; padding: 14px 16px; }
}
