:root {
  --bg: #0a0e27;
  --bg-card: #141b3d;
  --gold: #f5c542;
  --gold-dim: #c9a227;
  --blue: #1e3a8a;
  --blue-light: #3b82f6;
  --correct: #10b981;
  --wrong: #ef4444;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --ladder-active: #f5c542;
  --ladder-safe: #10b981;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at center, #1a2150 0%, #0a0e27 70%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Home ---- */
.home {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  text-align: center;
}

.logo {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f5c542, #fff3c4, #f5c542);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.4rem;
}

.tagline {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.term-card {
  display: block;
  background: var(--bg-card);
  border: 2px solid #2a3560;
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  margin: 0 auto 1rem;
  max-width: 420px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.term-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245, 197, 66, 0.15);
}

.term-card h2 {
  color: var(--gold);
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.term-card p { color: var(--muted); font-size: 0.95rem; }

.lang-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.lang-btn {
  background: transparent;
  border: 1px solid #3b4568;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.lang-btn.active {
  background: var(--gold);
  color: #0a0e27;
  border-color: var(--gold);
}

/* ---- Game layout ---- */
.game {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  gap: 1.25rem;
}

.game.active {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .game.active {
    grid-template-columns: 1fr 220px;
    align-items: start;
  }
}

.stage {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid #2a3560;
  padding: 1.25rem 1.25rem 1.5rem;
}

.q-number {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.question {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.45;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

.options {
  display: grid;
  gap: 0.65rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #0f1535;
  border: 2px solid #2a3560;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: start;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.option:hover:not(:disabled) {
  border-color: var(--gold);
  background: #1a2148;
}

.option .letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #0a0e27;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.option.correct {
  border-color: var(--correct);
  background: rgba(16, 185, 129, 0.18);
}

.option.wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.18);
}

.option.dimmed {
  opacity: 0.35;
  pointer-events: none;
}

.option:disabled { cursor: default; }

/* Lifelines */
.lifelines {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
  justify-content: center;
}

.life-btn {
  background: linear-gradient(180deg, #2a3560, #1a2148);
  border: 2px solid var(--gold-dim);
  color: var(--gold);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.life-btn:hover:not(:disabled) { transform: scale(1.04); }

.life-btn.used {
  opacity: 0.35;
  text-decoration: line-through;
  cursor: default;
  border-color: #3b4568;
  color: var(--muted);
}

/* Ladder */
.ladder-wrap {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid #2a3560;
  padding: 1rem;
}

.ladder-wrap h3 {
  color: var(--gold);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.ladder {
  list-style: none;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.25rem;
}

.ladder li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.ladder li.current {
  background: var(--gold);
  color: #0a0e27;
  font-weight: 800;
}

.ladder li.safe {
  color: var(--ladder-safe);
  font-weight: 600;
}

.ladder li.passed {
  color: var(--text);
  opacity: 0.7;
}

/* Overlays */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.88);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.modal h2 {
  color: var(--gold);
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
}

.modal p { color: var(--muted); margin-bottom: 1.25rem; line-height: 1.5; }

.modal .prize {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 1rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.btn {
  background: var(--gold);
  color: #0a0e27;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.3rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn.secondary {
  background: transparent;
  border: 2px solid #3b4568;
  color: var(--text);
}

.audience-bars {
  margin: 1rem 0;
  text-align: start;
}

.audience-bars .bar-row {
  display: grid;
  grid-template-columns: 28px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.audience-bars .track {
  height: 12px;
  background: #0f1535;
  border-radius: 6px;
  overflow: hidden;
}

.audience-bars .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 6px;
  transition: width 0.6s ease;
}

.friend-tip {
  background: #0f1535;
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0 1.25rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.5;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.walk-btn {
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.back-home {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-home:hover { color: var(--gold); }
