:root {
  --bg: #0a0c12;
  --bg-elev: #0f1524;
  --text: #e6edf3;
  --muted: #a6b0c1;
  --primary: #8b5cf6;
  --primary-strong: #6d28d9;
  --accent: #22d3ee;
  --danger: #ff4d6d;
  --ok: #22e3a4;
  --card: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.1);
  --shadow: 0 18px 50px rgba(0,0,0,0.45);
  --theme-transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Era-themed color schemes */
.era-80s-90s {
  --primary: #ff00ff;
  --accent: #00ffff;
  --ok: #39ff14;
  --danger: #ff1493;
  --bg: #0a0215;
  --bg-elev: #1a0a2e;
  --card-border: rgba(255, 0, 255, 0.3);
}

.era-2000s {
  --primary: #00ff41;
  --accent: #00d4ff;
  --ok: #39ff14;
  --danger: #ff2e2e;
  --bg: #000a05;
  --bg-elev: #001a0f;
  --card-border: rgba(0, 255, 65, 0.3);
}

.era-2010s {
  --primary: #3b82f6;
  --accent: #06b6d4;
  --ok: #10b981;
  --danger: #ef4444;
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --card-border: rgba(59, 130, 246, 0.2);
}

.era-2020s {
  --primary: #ec4899;
  --accent: #f59e0b;
  --ok: #8b5cf6;
  --danger: #ef4444;
  --bg: #1a0b1e;
  --bg-elev: #2d1b35;
  --card-border: rgba(236, 72, 153, 0.3);
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  position: relative;
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Neon grid + glow overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(34,211,238,0.05), rgba(139,92,246,0.05)),
    radial-gradient(1200px 800px at 80% -10%, rgba(139,92,246,0.25), transparent 60%),
    radial-gradient(1200px 800px at 10% 110%, rgba(34,211,238,0.18), transparent 60%),
    repeating-linear-gradient(to right, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 24px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 1px, transparent 1px, transparent 24px);
  pointer-events: none;
  z-index: 0;
}

.app { max-width: 1000px; margin: 0 auto; padding: 24px; }
.app-header, .app-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header { padding: 8px 0 18px; flex-wrap: wrap; }
.app-header h1 { margin: 0; font-size: 36px; letter-spacing: 0.4px; text-shadow: 0 2px 18px rgba(139,92,246,0.45); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { height: 100px; max-height: 100px; width: auto; display: block; object-fit: contain; }
.app-footer { margin-top: 24px; color: var(--muted); font-size: 14px; }
.header-right { display: flex; gap: 8px; align-items: center; }

/* Hero */
.hero { position: relative; padding: 16px; border-radius: 14px; border: 1px solid var(--card-border); background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)); box-shadow: 0 10px 30px rgba(0,0,0,0.25); margin-bottom: 14px; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: -2px; pointer-events: none; background: conic-gradient(from 180deg at 50% 50%, rgba(139,92,246,0.18), rgba(34,211,238,0.18), transparent 30%); filter: blur(16px); opacity: 0.6; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; color: #e9e5ff; background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 4px 12px rgba(139,92,246,0.35); }
.hero-title { margin: 8px 0 4px; }
.hero-sub { margin: 0; }
.text-gradient { background: linear-gradient(90deg, #c4b5fd, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(6px);
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 280ms ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }

.lead { color: var(--muted); margin-top: 6px; font-size: 15px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 999px; border: 1px solid var(--card-border); background: rgba(255,255,255,0.06); box-shadow: 0 0 0 0 rgba(139,92,246,0.0); transition: box-shadow 120ms ease, background 120ms ease; }
.chip:hover { background: rgba(255,255,255,0.1); box-shadow: 0 0 16px rgba(139,92,246,0.25); }

.options { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.options label { display: inline-flex; gap: 8px; align-items: center; background: rgba(255,255,255,0.05); padding: 8px 10px; border-radius: 12px; border: 1px solid var(--card-border); }

.switch { cursor: pointer; }

.actions { display: flex; gap: 10px; margin-top: 16px; }

button {
  appearance: none;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
button:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(139,92,246,0.25); }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, var(--primary), var(--primary-strong)); border-color: transparent; box-shadow: 0 10px 30px rgba(139,92,246,0.35); }
button.ghost { background: transparent; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.score-chip { background: linear-gradient(90deg, rgba(139,92,246,0.2), rgba(34,211,238,0.2)); border: 1px solid rgba(139,92,246,0.5); color: #dfe4ff; padding: 6px 10px; border-radius: 999px; font-size: 14px; box-shadow: inset 0 0 8px rgba(139,92,246,0.2); }

.quiz-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.progress { width: 100%; height: 12px; background: rgba(255,255,255,0.06); border: 1px solid var(--card-border); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); box-shadow: 0 0 12px rgba(34,211,238,0.35); }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.timer { background: rgba(255,255,255,0.06); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--card-border); }

.era-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  animation: era-pulse 2s ease-in-out infinite;
}

@keyframes era-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); }
  50% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.7), 0 0 40px rgba(34, 211, 238, 0.3); }
}

/* Power-ups */
.powerups {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.powerups-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
}

.powerup-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11px;
  min-width: 70px;
}

.powerup-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(139, 92, 246, 0.3));
}

.powerup-btn:active:not(:disabled) {
  transform: translateY(0);
}

.powerup-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--muted);
  background: rgba(255,255,255,0.05);
}

.powerup-btn.used {
  opacity: 0.3;
  border-color: var(--muted);
  background: rgba(255,255,255,0.02);
  cursor: not-allowed;
}

.powerup-icon {
  font-size: 20px;
}

.powerup-name {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Visual countdown bar */
.timebar { width: 100%; height: 8px; background: rgba(255,255,255,0.06); border: 1px solid var(--card-border); border-radius: 999px; overflow: hidden; display: none; margin-top: 6px; }
.timebar .bar { height: 100%; background: linear-gradient(90deg, var(--danger), var(--accent)); transition: width 1s linear; }

.question { display: flex; flex-direction: column; gap: 14px; }
.q-title { font-size: 20px; margin: 6px 0; text-shadow: 0 1px 10px rgba(34,211,238,0.18); }
.q-quote { font-style: italic; padding: 10px 12px; border-left: 3px solid var(--primary); background: rgba(255,255,255,0.05); border-radius: 8px; }
.q-image { width: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; border: 1px solid var(--card-border); background: #0d1420; display: grid; place-items: center; }
.q-image img { width: 100%; height: 100%; object-fit: cover; }

.answers { display: grid; grid-template-columns: 1fr; gap: 10px; }
.answer-btn { text-align: left; background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)); border: 1px solid var(--card-border); }
.answer-btn[aria-pressed="true"] { outline: 2px solid var(--primary); box-shadow: 0 0 18px rgba(139,92,246,0.25); }
.answer-btn.correct { outline: 2px solid var(--ok); box-shadow: 0 0 18px rgba(34,227,164,0.25); }
.answer-btn.incorrect { outline: 2px solid var(--danger); box-shadow: 0 0 18px rgba(255,77,109,0.2); }

.inline-answer { display: inline-flex; gap: 8px; align-items: center; }
.inline-answer input[type="number"] { width: 110px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: rgba(255,255,255,0.08); color: var(--text); }

/* In-question explanation */
.question-explanation {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid var(--primary);
  background: rgba(139, 92, 246, 0.12);
  animation: explanationSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-explanation.correct {
  border-left-color: var(--ok);
  background: rgba(34, 227, 164, 0.12);
}

.question-explanation.incorrect {
  border-left-color: var(--accent);
  background: rgba(34, 211, 238, 0.12);
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary);
}

.question-explanation.correct .explanation-header {
  color: var(--ok);
}

.question-explanation.incorrect .explanation-header {
  color: var(--accent);
}

.explanation-icon {
  font-size: 20px;
}

.explanation-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explanation-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

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

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0 12px; }
.stat { background: rgba(255,255,255,0.06); border: 1px solid var(--card-border); border-radius: 12px; padding: 12px; text-align: center; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; margin-top: 4px; }

.review { margin-top: 24px; display: none; }
.review.active { display: block; }

.review-item {
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.review-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.review-item.correct-answer {
  border-left: 4px solid var(--ok);
}

.review-item.wrong-answer {
  border-left: 4px solid var(--danger);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.review-question-num {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

.review-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.review-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  text-transform: uppercase;
}

.review-badge.easy { background: rgba(34, 227, 164, 0.2); color: var(--ok); }
.review-badge.medium { background: rgba(255, 193, 7, 0.2); color: #ffb800; }
.review-badge.hard { background: rgba(255, 77, 109, 0.2); color: var(--danger); }
.review-badge.era { background: rgba(139, 92, 246, 0.2); color: var(--primary); }

.review-question-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  line-height: 1.5;
}

.review-quote {
  font-style: italic;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}

.review-image {
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
}

.review-image img {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  cursor: pointer;
  transition: transform 0.2s;
}

.review-image img:hover {
  transform: scale(1.02);
}

.review-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.review-choice {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-choice.selected {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

.review-choice.correct-choice {
  border-color: var(--ok);
  background: rgba(34, 227, 164, 0.1);
}

.review-choice.wrong-choice {
  border-color: var(--danger);
  background: rgba(255, 77, 109, 0.1);
}

.review-choice-icon {
  font-size: 18px;
  min-width: 24px;
}

.review-choice-text {
  flex: 1;
}

.review-answer-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
  font-size: 14px;
}

.review-answer-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-answer-line.your { color: var(--danger); }
.review-answer-line.correct { color: var(--ok); }
.review-answer-line.points { color: var(--accent); font-weight: 600; }

.review-explanation {
  margin-top: 12px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.1);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.review-explanation-label {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-item .your { color: var(--danger); }
.review-item .correct { color: var(--ok); }

/* Light theme */
.light {
  --bg: #f6f8fb;
  --bg-elev: #ffffff;
  --text: #0b1020;
  --muted: #5b6472;
  --card: rgba(0,0,0,0.03);
  --card-border: rgba(0,0,0,0.08);
  --shadow: 0 8px 24px rgba(0,0,0,0.12);
  background: radial-gradient(1200px 800px at 10% 10%, #ffffff 0%, #f6f8fb 50%, #eef2f8 100%);
}

/* CRT Effect */
body.crt-mode::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100vh;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9998;
  animation: crt-flicker 0.15s infinite;
}

body.crt-mode::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100vh;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
  z-index: 9997;
}

@keyframes crt-flicker {
  0% { opacity: 0.97; }
  50% { opacity: 1; }
  100% { opacity: 0.97; }
}

body.crt-mode {
  animation: crt-jitter 0.3s infinite;
}

@keyframes crt-jitter {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-0.5px, 0.5px); }
  50% { transform: translate(0.5px, -0.5px); }
  75% { transform: translate(-0.5px, -0.5px); }
}

/* Accessibility */
button:focus-visible, .chip:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Combo counter */
.combo-counter {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(255, 165, 0, 0.15), rgba(255, 69, 0, 0.15));
  border: 2px solid rgba(255, 140, 0, 0.4);
  border-radius: 999px;
  font-weight: 700;
  transition: all 0.3s ease;
  animation: combo-pop 0.4s ease;
}

.combo-counter.big {
  transform: scale(1.15);
  border-color: rgba(255, 140, 0, 0.8);
  box-shadow: 0 0 25px rgba(255, 140, 0, 0.5);
}

.combo-fire {
  font-size: 20px;
  animation: fire-flicker 0.5s ease infinite alternate;
}

.combo-value {
  font-size: 24px;
  color: #ff8c00;
  text-shadow: 0 0 10px rgba(255, 140, 0, 0.6);
}

.combo-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text);
  opacity: 0.8;
}

@keyframes combo-pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fire-flicker {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(5deg); }
}

/* Celebration animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-0.5deg); }
  75% { transform: translateX(4px) rotate(0.5deg); }
}

@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 227, 164, 0.4); transform: scale(1); }
  50% { box-shadow: 0 0 40px rgba(34, 227, 164, 0.6); transform: scale(1.02); }
}

.celebrate-shake {
  animation: shake 0.5s ease-in-out;
}

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary);
  animation: confetti-fall 3s linear forwards;
}

.answer-btn.correct {
  animation: pulse-glow 0.6s ease-out;
}

/* Image zoom modal */
.image-zoom-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 200ms ease;
}

.image-zoom-modal.active {
  display: flex;
}

.image-zoom-modal img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.q-image {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.q-image:hover {
  transform: scale(1.02);
}

/* Achievement Badges */
.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
  justify-content: center;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.1));
  border: 2px solid var(--primary);
  border-radius: 16px;
  min-width: 120px;
  animation: badge-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-appear {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.badge-item.gold {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.badge-item.silver {
  border-color: #c0c0c0;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
}

.badge-item.bronze {
  border-color: #cd7f32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
}

.badge-icon {
  font-size: 48px;
  margin-bottom: 8px;
  animation: badge-bounce 2s ease-in-out infinite;
}

@keyframes badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.badge-title {
  font-weight: bold;
  font-size: 14px;
  color: var(--text);
  text-align: center;
}

.badge-desc {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

/* Leaderboard */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.leaderboard-item.rank-1 {
  border-color: #ffd700;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
}

.leaderboard-item.rank-2 {
  border-color: #c0c0c0;
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.1), rgba(192, 192, 192, 0.05));
}

.leaderboard-item.rank-3 {
  border-color: #cd7f32;
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), rgba(205, 127, 50, 0.05));
}

.leaderboard-rank {
  font-weight: bold;
  font-size: 20px;
  min-width: 40px;
  text-align: center;
}

.leaderboard-item.rank-1 .leaderboard-rank { color: #ffd700; }
.leaderboard-item.rank-2 .leaderboard-rank { color: #c0c0c0; }
.leaderboard-item.rank-3 .leaderboard-rank { color: #cd7f32; }

.leaderboard-player {
  flex: 1;
  font-weight: 500;
  margin-left: 12px;
}

.leaderboard-score {
  font-weight: bold;
  font-size: 20px;
  color: var(--primary);
}

.leaderboard-details {
  font-size: 12px;
  color: var(--muted);
  margin-left: 12px;
}

/* Stats page history */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.history-item {
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-number {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

.history-date {
  font-size: 13px;
  color: var(--muted);
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.history-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-value {
  font-size: 18px;
  font-weight: 600;
}

.history-value.excellent { color: var(--ok); }
.history-value.good { color: var(--accent); }
.history-value.okay { color: var(--muted); }

.history-name {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--muted);
}

/* Mobile tweaks */
@media (max-width: 700px) {
  .app { padding: 12px; }

  /* Header */
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0 16px;
  }
  .app-header h1 { font-size: 24px; }
  .brand .logo { height: 48px; max-height: 48px; }
  .header-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .score-chip {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }

  /* Buttons - larger touch targets */
  button, .ghost {
    padding: 14px 18px !important;
    font-size: 16px;
    min-height: 48px;
    min-width: 48px;
  }

  button.primary {
    padding: 16px 24px !important;
  }

  .actions {
    flex-direction: column;
    gap: 12px;
  }

  .actions button {
    width: 100%;
  }

  /* Questions */
  .q-title {
    font-size: 18px;
    line-height: 1.5;
  }

  .q-quote {
    font-size: 16px;
    padding: 12px;
  }

  /* Answer choices - bigger touch targets */
  .q-choice {
    padding: 16px !important;
    min-height: 56px;
  }

  .choice-text {
    font-size: 16px;
  }

  /* Input fields */
  input[type="number"],
  input[type="text"],
  select,
  textarea {
    font-size: 16px !important;
    padding: 14px 12px !important;
    min-height: 48px;
  }

  /* Stats grid */
  .stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .stat {
    padding: 10px;
  }

  .stat .value {
    font-size: 20px;
  }

  /* Grid layouts */
  .grid.two {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Chips */
  .chips {
    gap: 6px;
  }

  .chip {
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Power-ups */
  .powerups {
    flex-wrap: wrap;
    padding: 10px;
  }

  .powerup-btn {
    min-width: 80px;
    padding: 10px 14px;
  }

  /* Leaderboard */
  .leaderboard-item {
    padding: 12px;
    gap: 10px;
  }

  .leaderboard-rank {
    font-size: 18px;
    min-width: 40px;
  }

  .leaderboard-score {
    font-size: 18px;
  }

  /* Review items */
  .review-item {
    padding: 16px;
  }

  .review-badges {
    flex-wrap: wrap;
  }

  .review-choices {
    gap: 10px;
  }

  .review-choice {
    padding: 12px;
  }

  /* Achievements */
  .achievements {
    gap: 10px;
  }

  .badge-item {
    padding: 12px;
    min-width: 100px;
  }

  /* History stats */
  .history-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Timer and meta */
  .meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .timer {
    order: -1;
    width: 100%;
    text-align: center;
    padding: 8px;
    font-size: 18px;
  }

  .era-indicator {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* Images */
  .q-image img,
  .review-image img {
    max-width: 100%;
  }

  /* Footer */
  .app-footer {
    font-size: 12px;
    text-align: center;
    padding: 12px 0;
  }

  /* Combo counter */
  .combo-counter {
    padding: 8px 12px;
  }

  .combo-value {
    font-size: 22px;
  }

  /* Modal */
  .image-zoom-modal img {
    max-width: 95vw;
    max-height: 95vh;
  }
}

/* Tablet tweaks */
@media (min-width: 701px) and (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  button {
    padding: 12px 18px;
  }

  .q-choice {
    padding: 14px;
  }
}
