:root {
  color-scheme: light;
  --ink: #18211d;
  --muted: #64716a;
  --paper: #fffdf8;
  --canvas: #f2f0e8;
  --line: #d8ddd7;
  --green-950: #0f2e22;
  --green-800: #174735;
  --green-700: #236148;
  --green-100: #e2f1e8;
  --gold: #d6b85b;
  --gold-soft: #f4ebca;
  --success: #167447;
  --success-bg: #e3f4e9;
  --danger: #b43a32;
  --danger-bg: #fbe8e5;
  --neutral: #dfe4e0;
  --shadow: 0 18px 50px rgba(19, 48, 37, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(214, 184, 91, 0.15), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(35, 97, 72, 0.35);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 46, 34, 0.96);
  color: white;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: var(--gold);
  color: var(--green-950);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.96rem;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.74rem;
}

.source-pill {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.75rem;
  font-weight: 700;
}

.app-shell {
  width: min(1180px, calc(100% - 36px));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 0 60px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green-700);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 34px;
}

.hero h1 {
  max-width: 790px;
  margin: 0;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 6vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.hero-copy {
  max-width: 760px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.13rem);
  line-height: 1.65;
}

.source-note {
  padding: 20px;
  border: 1px solid #d9d4be;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.65);
}

.source-note strong,
.source-note span {
  display: block;
}

.source-note strong {
  color: var(--green-950);
  font-size: 0.9rem;
}

.source-note span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.subject-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  min-height: 190px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(13, 44, 32, 0.04);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.subject-card::after {
  position: absolute;
  right: -42px;
  bottom: -68px;
  width: 170px;
  height: 170px;
  border: 24px solid var(--gold-soft);
  border-radius: 50%;
  content: "";
  opacity: 0.72;
}

.subject-card:hover {
  border-color: #b7c7bd;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.subject-card__content {
  position: relative;
  z-index: 1;
}

.subject-card__module {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subject-card h2 {
  max-width: 440px;
  margin: 13px 0 22px;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.8vw, 2.15rem);
  font-weight: 500;
  line-height: 1.04;
}

.subject-card__meta {
  display: flex;
  gap: 15px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.subject-card__progress {
  color: var(--green-700);
}

.subject-card__arrow {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  align-self: start;
  border-radius: 50%;
  background: var(--green-950);
  color: white;
  font-size: 1.2rem;
}

.quiz-header {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.quiz-header h1 {
  margin: 0;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.back-link,
.ghost-button,
.nav-button {
  border: 0;
  cursor: pointer;
}

.back-link {
  padding: 0;
  background: transparent;
  color: var(--green-700);
  font-size: 0.84rem;
  font-weight: 800;
}

.score-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.score-chip {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.72);
}

.score-chip strong,
.score-chip small {
  display: block;
}

.score-chip strong {
  color: var(--green-950);
  font-size: 1.02rem;
}

.score-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-track {
  height: 7px;
  margin-bottom: 26px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe3df;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-700), var(--gold));
  transition: width 260ms ease;
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.question-card,
.question-nav {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 7px 28px rgba(19, 48, 37, 0.055);
}

.question-card {
  padding: clamp(22px, 4vw, 42px);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.question-meta__source {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6b591f;
}

.question-card h2 {
  margin: 0 0 28px;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.6vw, 1.72rem);
  font-weight: 730;
  line-height: 1.42;
}

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

.option-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 24px;
  gap: 13px;
  align-items: center;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.option-button:not([disabled]):hover {
  border-color: #9ab3a4;
  background: #f7fbf8;
  transform: translateX(3px);
}

.option-button[disabled] {
  cursor: default;
}

.option-letter {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #eef1ee;
  color: var(--green-950);
  font-size: 0.78rem;
  font-weight: 900;
}

.option-text {
  line-height: 1.5;
}

.option-result {
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}

.option-button.is-correct {
  border-color: #89c8a2;
  background: var(--success-bg);
  color: #105d39;
}

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

.option-button.is-wrong {
  border-color: #e3a29c;
  background: var(--danger-bg);
  color: #8d2c26;
}

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

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.5;
}

.feedback.correct {
  background: var(--success-bg);
  color: #105d39;
}

.feedback.wrong {
  background: var(--danger-bg);
  color: #8d2c26;
}

.question-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 26px;
}

.nav-button,
.ghost-button {
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 13px;
  font-size: 0.82rem;
  font-weight: 850;
}

.nav-button {
  background: var(--green-950);
  color: white;
}

.nav-button:disabled {
  background: #cdd4cf;
  cursor: default;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--green-800);
}

.question-nav {
  position: sticky;
  top: 98px;
  padding: 20px;
}

.question-nav__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 15px;
}

.question-nav h3 {
  margin: 0;
  color: var(--green-950);
  font-size: 0.9rem;
}

.question-nav__header span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 750;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.question-dot {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #cfd5d1;
  border-radius: 8px;
  background: var(--neutral);
  color: #4f5b55;
  font-size: 0.66rem;
  font-weight: 850;
  cursor: pointer;
}

.question-dot.is-correct {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.question-dot.is-wrong {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.question-dot.is-current {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--green-950);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
}

.legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral);
}

.legend .green {
  background: var(--success);
}

.legend .red {
  background: var(--danger);
}

.reset-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.loading-card,
.error-card {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d6dcd7;
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.site-footer {
  padding: 26px 20px 34px;
  color: #78817c;
  font-size: 0.72rem;
  text-align: center;
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .hero,
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .source-note {
    max-width: 520px;
  }

  .question-nav {
    position: static;
    grid-row: 2;
  }

  .question-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .quiz-header {
    align-items: start;
    flex-direction: column;
  }

  .score-strip {
    justify-content: flex-start;
  }
}

@media (max-width: 650px) {
  .site-header {
    min-height: 68px;
  }

  .source-pill {
    display: none;
  }

  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 30px;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .subject-grid {
    grid-template-columns: 1fr;
  }

  .subject-card {
    min-height: 170px;
    padding: 22px;
  }

  .score-chip {
    min-width: 80px;
  }

  .question-card {
    padding: 20px 16px;
  }

  .option-button {
    grid-template-columns: 34px minmax(0, 1fr) 20px;
    gap: 10px;
    padding: 13px 12px;
  }

  .question-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
