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

:root {
  --bg-deep: #0a0e27;
  --bg-mid: #121a3a;
  --gold: #d4a017;
  --gold-light: #f0c040;
  --gold-glow: rgba(212, 160, 23, 0.35);
  --blue-accent: #1e3a8a;
  --blue-light: #3b82f6;
  --text: #e8eaf0;
  --text-muted: #8892b0;
  --correct: #22c55e;
  --wrong: #ef4444;
  --card-bg: rgba(18, 26, 58, 0.85);
  --border: rgba(212, 160, 23, 0.25);
  --radius: 12px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(30, 58, 138, 0.4) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(212, 160, 23, 0.08) 0%, transparent 60%),
    var(--bg-deep);
  z-index: -1;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 2rem 1.5rem;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Start Screen ── */

.logo-block {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.logo-ring {
  width: 120px;
  height: 120px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  position: relative;
  box-shadow: 0 0 40px var(--gold-glow), inset 0 0 30px rgba(212, 160, 23, 0.1);
  animation: pulse-ring 3s ease-in-out infinite;
}

.logo-ring::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--gold-light);
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 40px var(--gold-glow); }
  50% { box-shadow: 0 0 60px var(--gold-glow), 0 0 80px rgba(212, 160, 23, 0.15); }
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--gold-light);
  line-height: 1.2;
  text-shadow: 0 2px 20px var(--gold-glow);
}

.title span {
  color: var(--text);
  font-size: 0.85em;
}

.tagline {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
  margin-bottom: 2rem;
}

.start-form label {
  font-weight: 600;
  color: var(--gold);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.start-form input {
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.start-form input:focus {
  border-color: var(--gold);
}

.rules {
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.rules h3 {
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rules li {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-left: 1.2rem;
  position: relative;
}

.rules li::before {
  content: '★';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.7rem;
  top: 0.15rem;
}

/* ── Buttons ── */

.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.5rem;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #b8860b 100%);
  color: #1a1000;
  box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--gold-glow);
}

.btn-quit {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--gold-light);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

.btn-quit:hover {
  border-color: var(--gold);
  background: rgba(212, 160, 23, 0.1);
}

/* ── Game Screen ── */

#game-screen {
  justify-content: flex-start;
  padding-top: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.contestant-info {
  display: flex;
  flex-direction: column;
}

.contestant-info .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contestant-info .name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
}

.timer-wrap {
  position: relative;
  width: 52px;
  height: 52px;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 3;
}

.timer-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  transition: stroke 0.3s;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.timer-text.urgent {
  color: var(--wrong);
}

.game-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  width: 100%;
}

/* ── Prize Ladder ── */

.prize-ladder {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.prize-ladder h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.75rem;
  text-align: center;
}

.prize-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prize-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.prize-list li.checkpoint {
  border-left: 2px solid var(--gold);
}

.prize-list li .level {
  width: 1.4rem;
  text-align: center;
  font-weight: 700;
  opacity: 0.6;
}

.prize-list li.current {
  background: rgba(212, 160, 23, 0.2);
  color: var(--gold-light);
  font-weight: 700;
  box-shadow: 0 0 12px var(--gold-glow);
}

.prize-list li.passed {
  color: var(--correct);
  opacity: 0.7;
}

/* ── Question Area ── */

.question-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.q-num {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.current-prize {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold-light);
  text-shadow: 0 0 20px var(--gold-glow);
}

.question-box {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.question-text {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  width: 100%;
}

/* ── Options ── */

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(212, 160, 23, 0.08);
}

.option-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.option-btn.hidden-option {
  opacity: 0.2;
  pointer-events: none;
}

.opt-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(212, 160, 23, 0.15);
  color: var(--gold-light);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.option-btn.correct {
  border-color: var(--correct);
  background: rgba(34, 197, 94, 0.15);
  animation: flash-correct 0.5s ease;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.15);
  animation: shake 0.4s ease;
}

@keyframes flash-correct {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.5); }
}

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

/* ── Lifelines ── */

.lifelines {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.lifeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 1rem;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  transition: border-color 0.2s, opacity 0.2s;
}

.lifeline:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-light);
}

.lifeline.used,
.lifeline:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.lifeline-icon {
  font-size: 1.3rem;
}

.lifeline-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  animation: slide-up 0.3s ease;
}

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

.lifeline-panel h4 {
  color: var(--gold-light);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.phone-message {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}

.phone-note {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.audience-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audience-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.5rem;
}

.aud-label {
  font-weight: 700;
  color: var(--gold);
}

.aud-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.aud-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-light), var(--gold));
  border-radius: 5px;
  transition: width 0.8s ease;
}

.aud-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Result Screen ── */

.result-card {
  text-align: center;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.result-card h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold-light);
  margin-bottom: 0.75rem;
}

.result-message {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.result-amount {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.result-amount strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--gold-light);
  margin-top: 0.25rem;
  text-shadow: 0 0 20px var(--gold-glow);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .prize-ladder {
    position: static;
    order: -1;
  }

  .prize-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .prize-list li {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .prize-list li .level {
    display: none;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .question-box {
    padding: 1.25rem;
  }
}
