@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  font-family: 'DM Sans', sans-serif;
  color: #172a27;
  background: #f4f5ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #172a27;
  --muted: #76817b;
  --line: #d9ded5;
  --green: #255d4e;
  --green-deep: #194537;
  --lime: #c5e581;
  --coral: #d86b51;
  --mono: 'DM Mono', monospace;
  --display: 'Manrope', sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button { font: inherit; }

.page-shell {
  width: min(100% - 64px, 1280px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 96px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.header-actions { display: flex; align-items: center; gap: 19px; }
.menu-button, .back-link, .previous-button { display: inline-flex; align-items: center; gap: 9px; border: 0; color: var(--green); background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; }
.menu-button:hover, .back-link:hover, .previous-button:hover:not(:disabled) { color: var(--coral); }
.menu-button span, .back-link span, .previous-button span { font-size: 18px; }
.menu-button:focus-visible, .back-link:focus-visible, .previous-button:focus-visible { outline: 3px solid #e49a75; outline-offset: 3px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 13px; font-weight: 800; line-height: 1.05; }
.wordmark-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: var(--lime); background: var(--green-deep); font-size: 22px; }
.topic-tag, .eyebrow, .footer-mark { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
.topic-tag { display: flex; align-items: center; gap: 9px; color: var(--green); }
.topic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }

.quiz { width: min(100%, 720px); margin: auto; padding: 74px 0 88px; animation: appear .55s ease-out both; }
.course-picker { width: min(100%, 720px); padding: 58px 0 70px; }
.course-picker h1 { max-width: 600px; }
.course-intro { max-width: 530px; margin: 17px 0 0; color: #65736c; font-size: 16px; line-height: 1.6; }
.course-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 36px; }
.course-option { width: 100%; min-height: 91px; display: grid; grid-template-columns: 31px minmax(0, 1fr) 18px; grid-template-rows: auto auto; align-items: center; gap: 7px 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: rgba(255,255,255,.48); text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.course-option:hover { transform: translateY(-1px); border-color: var(--green); background: #fff; }
.course-option:focus-visible, .match-select:focus-visible, .match-submit:focus-visible, .return-button:focus-visible { outline: 3px solid #e49a75; outline-offset: 3px; }
.course-number { color: var(--coral); font-family: var(--mono); font-size: 12px; }
.course-detail { display: grid; gap: 4px; }
.course-detail strong { font-family: var(--display); font-size: 16px; }
.course-detail span, .course-total { color: var(--muted); font-size: 12px; }
.course-number { grid-row: 1 / span 2; }
.course-detail { grid-column: 2; grid-row: 1; align-self: end; }
.course-total { grid-column: 2; grid-row: 2; font-size: 11px; }
.course-arrow { grid-column: 3; grid-row: 1 / span 2; color: var(--green); font-size: 19px; }
.quiz-session { display: contents; }
.quiz-session[hidden] { display: none; }
.lesson-screen { width: min(100%, 720px); padding: 6px 0 20px; }
.back-link { margin: 0 0 44px; padding: 0; }
.lesson-screen h1 { max-width: 620px; }
.lesson-summary { max-width: 620px; margin: 17px 0 0; color: #65736c; font-size: 16px; line-height: 1.65; }
.concept-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 33px 0 28px; border: 1px solid var(--line); background: var(--line); }
.concept-item { min-height: 125px; padding: 18px; background: rgba(255,255,255,.62); }
.concept-item h2 { margin: 0 0 9px; color: var(--green); font-family: var(--display); font-size: 15px; }
.concept-item p { margin: 0; color: #65736c; font-size: 13px; line-height: 1.55; }
.lesson-start { margin-top: 3px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.eyebrow { color: var(--muted); }
.score-label { color: var(--muted); font-size: 13px; }
.score-label strong { margin-left: 7px; color: var(--green); font-family: var(--mono); font-weight: 500; }
.progress-track { width: 100%; height: 4px; overflow: hidden; border-radius: 2px; background: #e2e6de; }
.progress-fill { display: block; width: 0; height: 100%; background: var(--green); transition: width .35s ease; }
.question-content { padding-top: 58px; }
.question-kicker { margin: 0 0 17px; color: var(--coral); font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
h1 { max-width: 660px; margin: 0; font-family: var(--display); font-size: clamp(32px, 5vw, 50px); font-weight: 700; line-height: 1.15; letter-spacing: 0; }
.answers { display: grid; gap: 10px; margin-top: 37px; }
.answer {
  width: 100%; min-height: 64px; display: flex; align-items: center; gap: 17px;
  padding: 13px 18px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink); background: rgba(255,255,255,.48); text-align: left; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.answer:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--green); background: #fff; }
.answer:focus-visible, .next-button:focus-visible, .restart-button:focus-visible { outline: 3px solid #e49a75; outline-offset: 3px; }
.answer:disabled { cursor: default; }
.answer-key { flex: 0 0 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.answer-text { flex: 1; font-size: 15px; line-height: 1.45; }
.answer.correct { border-color: var(--green); background: #e6f0e8; }
.answer.correct .answer-key { border-color: var(--green); color: #fff; background: var(--green); }
.answer.incorrect { border-color: #d98a74; background: #f8e9e4; }
.answer.incorrect .answer-key { border-color: var(--coral); color: #fff; background: var(--coral); }
.answer.dimmed { color: #a4aaa3; }
.match-submit { display: inline-flex; align-items: center; gap: 15px; min-height: 48px; margin-top: 20px; padding: 0 18px; border: 0; border-radius: 3px; color: #fff; background: var(--green-deep); font-size: 14px; font-weight: 600; cursor: pointer; }
.match-submit:disabled { opacity: .45; cursor: not-allowed; }
.match-submit span { color: var(--lime); font-size: 20px; }
.answers:has(.match-row) { gap: 10px; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .88fr); align-items: center; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.48); }
.match-prompt { font-size: 14px; line-height: 1.5; }
.match-select { width: 100%; min-height: 44px; padding: 8px 35px 8px 11px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: #fff; font: inherit; font-size: 13px; }
.match-row.correct { border-color: var(--green); background: #e6f0e8; }
.match-row.incorrect { border-color: #d98a74; background: #f8e9e4; }
.match-correction { grid-column: 1 / -1; margin-top: -9px; color: #8c3e2c; font-size: 12px; line-height: 1.45; }
.feedback { display: flex; gap: 13px; margin-top: 20px; padding: 16px 18px; border-left: 3px solid var(--green); background: #e8eee6; }
.feedback.is-wrong { border-color: var(--coral); background: #f4e9e4; }
.feedback-icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 14px; }
.is-wrong .feedback-icon { background: var(--coral); }
.feedback-title { margin: 1px 0 4px; font-size: 14px; font-weight: 700; }
.feedback-copy { margin: 0; color: #52625b; font-size: 13px; line-height: 1.55; }
.question-footer { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 25px; }
.previous-button { min-height: 44px; padding: 0; }
.previous-button:disabled { color: #aab0a9; cursor: not-allowed; }
.keyboard-hint { color: #919991; font-size: 11px; }
kbd { display: inline-grid; width: 19px; height: 20px; place-items: center; margin: 0 2px; border: 1px solid var(--line); border-radius: 3px; color: #66736c; background: #fafbf8; font-family: var(--mono); font-size: 10px; }
.next-button, .restart-button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 3px; color: #fff; background: var(--green-deep); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .16s ease; }
.next-button:hover, .restart-button:hover { background: #28634f; }
.next-button:disabled { opacity: .45; cursor: not-allowed; }
.next-button span:last-child { color: var(--lime); font-size: 20px; line-height: 1; }
.results { padding-top: 58px; }
.results h1 { max-width: 560px; }
.result-copy { max-width: 490px; margin: 17px 0 0; color: #65736c; font-size: 16px; line-height: 1.6; }
.result-score { display: flex; align-items: center; gap: 17px; margin: 34px 0; }
.result-score strong { color: var(--green); font-family: var(--display); font-size: 72px; line-height: 1; }
.result-score span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.restart-button { gap: 10px; }
.restart-button span { color: var(--lime); font-size: 19px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.return-button { min-height: 48px; padding: 0 18px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.return-button:hover { border-color: var(--green); background: #fff; }
.page-footer { min-height: 68px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: #818b84; font-size: 12px; }
.footer-mark { font-size: 9px; }
[hidden] { display: none !important; }

@keyframes appear { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .page-shell { width: calc(100% - 36px); }
  .topbar { min-height: 77px; }
  .topic-tag { max-width: 150px; font-size: 8px; line-height: 1.5; }
  .header-actions { gap: 7px; }
  .menu-button { gap: 4px; font-size: 11px; }
  .quiz { padding: 47px 0 58px; }
  .course-picker { padding: 47px 0 58px; }
  .course-options { grid-template-columns: 1fr; gap: 8px; margin-top: 25px; }
  .course-option { min-height: 76px; grid-template-columns: 31px minmax(0, 1fr) 16px; gap: 6px 11px; padding: 11px 12px; }
  .concept-list { grid-template-columns: 1fr; margin: 24px 0; }
  .concept-item { min-height: auto; }
  .back-link { margin-bottom: 34px; }
  .lesson-summary { font-size: 15px; }
  .course-intro { font-size: 15px; }
  .question-content, .results { padding-top: 44px; }
  h1 { font-size: 34px; }
  .answers { gap: 8px; margin-top: 27px; }
  .answer { min-height: 59px; gap: 12px; padding: 11px 12px; }
  .answer-text { font-size: 14px; }
  .match-row { grid-template-columns: 1fr; gap: 11px; padding: 13px; }
  .match-correction { margin-top: -4px; }
  .question-footer { flex-wrap: wrap; align-items: center; gap: 7px 10px; }
  .keyboard-hint { width: 100%; line-height: 1.8; }
  .previous-button, .next-button { min-height: 43px; padding: 0 11px; font-size: 12px; }
  .page-footer { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}