/* Demo Quiz — single light theme with one accent color (indigo). */

:root {
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1f2430;
  --text-muted: #5b6172;
  --border: #e3e5ee;
  --correct: #15803d;
  --correct-bg: #dcfce7;
  --correct-border: #86efac;
  --wrong: #b91c1c;
  --wrong-bg: #fee2e2;
  --wrong-border: #fca5a5;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---------- Home screen ---------- */

.home-header {
  text-align: center;
  margin: 32px 0 28px;
}

.app-title {
  font-size: 2.1rem;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.app-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.category-list {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .category-list {
    grid-template-columns: 1fr 1fr;
  }

  .category-card--wide {
    grid-column: 1 / -1;
  }
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.16);
}

.category-card:active {
  transform: translateY(0);
}

.category-card:focus-visible,
.option-button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.category-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.category-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.category-card--random {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  align-items: center;
  text-align: center;
}

.category-card--random .category-count {
  color: rgba(255, 255, 255, 0.85);
}

.category-card--random:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.35);
}

/* ---------- Quiz screen ---------- */

.quiz-header {
  margin: 20px 0 20px;
}

.quiz-category {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-progress-text {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

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

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
}

.question-text {
  margin: 0 0 18px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.options {
  display: grid;
  gap: 12px;
}

.option-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.option-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-button:active:not(:disabled) {
  transform: scale(0.99);
}

.option-button:disabled {
  cursor: default;
  opacity: 0.85;
}

.option-letter {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.9rem;
}

.option-button.is-correct {
  background: var(--correct-bg);
  border-color: var(--correct-border);
  color: var(--correct);
  opacity: 1;
}

.option-button.is-correct .option-letter {
  background: var(--correct);
  color: #fff;
}

.option-button.is-wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
  color: var(--wrong);
  opacity: 1;
}

.option-button.is-wrong .option-letter {
  background: var(--wrong);
  color: #fff;
}

.option-button.is-dimmed {
  opacity: 0.6;
}

.option-mark {
  margin-left: auto;
  font-weight: 800;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.explanation {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  font-size: 0.97rem;
}

.explanation-title {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.quiz-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 13px 26px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

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

.btn:disabled {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn--secondary {
  background: var(--card);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.btn--secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: none;
}

/* ---------- Results screen ---------- */

.results-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
  text-align: center;
  margin-top: 24px;
}

.results-score {
  font-size: 2.4rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.results-message {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.review-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
  text-align: left;
}

.review-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.review-item.is-correct {
  border-left-color: var(--correct);
}

.review-item.is-wrong {
  border-left-color: var(--wrong);
}

.review-question {
  margin: 0 0 8px;
  font-weight: 700;
}

.review-answer {
  margin: 0;
  font-size: 0.95rem;
}

.review-answer .label {
  font-weight: 700;
  color: var(--text-muted);
}

.review-answer .you {
  color: var(--wrong);
  font-weight: 600;
}

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

.review-answer .correct {
  color: var(--correct);
  font-weight: 600;
}

.review-verdict {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-verdict.is-correct {
  color: var(--correct);
}

.review-verdict.is-wrong {
  color: var(--wrong);
}

/* ---------- Utilities ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 400px) {
  .app {
    padding: 16px 12px 48px;
  }

  .app-title {
    font-size: 1.7rem;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .results-score {
    font-size: 2rem;
  }

  .btn {
    width: 100%;
  }

  .quiz-actions .btn {
    width: 100%;
  }
}
