:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --correct: #22c55e;
  --wrong: #ef4444;
  --radius: 0.5rem;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#app {
  width: 100%;
  max-width: 40rem;
}

/* ── Home ─────────────────────────────────────────────── */

.home { text-align: center; }

.home h1 { font-size: 2rem; margin-bottom: 0.5rem; }

.subtitle { color: var(--text-dim); margin-bottom: 2rem; }

.card-grid { display: grid; gap: 1rem; }

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 1.125rem;
  padding: 1.5rem;
  text-align: center;
  transition: background 0.15s;
  width: 100%;
}

.category-card:hover { background: var(--surface-hover); }

/* ── Quiz ─────────────────────────────────────────────── */

.quiz { display: flex; flex-direction: column; gap: 1.5rem; }

.progress {
  color: var(--text-dim);
  font-size: 0.875rem;
  text-align: right;
}

.question { font-size: 1.25rem; line-height: 1.5; }

.answers { display: grid; gap: 0.75rem; }

.answer-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.875rem 1rem;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}

.answer-btn:hover:not(:disabled) { background: var(--surface-hover); }

.answer-btn:disabled { cursor: default; }

.answer-btn.correct {
  background: color-mix(in srgb, var(--correct) 20%, var(--surface));
  border-color: var(--correct);
}

.answer-btn.wrong {
  background: color-mix(in srgb, var(--wrong) 20%, var(--surface));
  border-color: var(--wrong);
}

/* ── Result ───────────────────────────────────────────── */

.result { text-align: center; }

.result h1 { font-size: 2rem; margin-bottom: 1.5rem; }

.score {
  color: var(--accent);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.score-label { color: var(--text-dim); margin-bottom: 2rem; }

.play-again-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.875rem 2rem;
  transition: background 0.15s;
}

.play-again-btn:hover { background: var(--accent-hover); }

/* ── Error / loading ──────────────────────────────────── */

.error { color: var(--wrong); text-align: center; }

.loading { color: var(--text-dim); text-align: center; }

/* ── Mobile ───────────────────────────────────────────── */

@media (max-width: 360px) {
  .home h1 { font-size: 1.5rem; }
  .question { font-size: 1rem; }
  .score { font-size: 2rem; }
  .category-card { padding: 1rem; }
}
