:root {
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --text: #1c2530;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #e2e8f0;
  --correct: #16a34a;
  --correct-bg: #dcfce7;
  --wrong: #dc2626;
  --wrong-bg: #fee2e2;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --correct-bg: #14532d;
    --wrong-bg: #7f1d1d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

h2#question-text {
  margin: 0 0 20px;
  font-size: 1.15rem;
  line-height: 1.5;
  font-weight: 600;
}

.subtitle {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#screen-start .card { text-align: center; }

.quiz-header {
  margin-bottom: 16px;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}

.score-live {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.source-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

.options-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  line-height: 1.45;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  gap: 10px;
}

.option:hover:not(.locked) {
  border-color: var(--primary);
}

.option .letter {
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.option.locked {
  cursor: default;
}

.option.selected-correct {
  background: var(--correct-bg);
  border-color: var(--correct);
}

.option.selected-wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
}

.option.reveal-correct {
  border-color: var(--correct);
  box-shadow: inset 0 0 0 1px var(--correct);
}

.quiz-footer {
  margin-top: 20px;
}

.result-score {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.result-percent {
  color: var(--muted);
  margin-bottom: 24px;
}

.review-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.review-item .review-q {
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.review-item .review-answer {
  font-size: 0.92rem;
  line-height: 1.4;
  margin-bottom: 4px;
}

.review-item .review-answer.correct { color: var(--correct); }
.review-item .review-answer.wrong { color: var(--wrong); }

.review-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 8px;
}

.review-badge.ok { background: var(--correct-bg); color: var(--correct); }
.review-badge.bad { background: var(--wrong-bg); color: var(--wrong); }
