@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f7f5f2;
  --card: #fffdfa;
  --ink: #171715;
  --muted: #625f59;
  --line: #d9d4cc;
  --orange: #d85d0b;
  --orange-dark: #a94405;
  --orange-soft: #fff0e4;
  --green: #19673b;
  --green-soft: #e9f5ed;
  --red: #a2382e;
  --red-soft: #fbecea;
  --shadow: 0 20px 60px rgba(35, 31, 25, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 18px; line-height: 1.55; }
button, input { font: inherit; }
button { touch-action: manipulation; }
.hidden { display: none !important; }
.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; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; transform: translateY(-160%); padding: 10px 14px; color: white; background: var(--ink); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }

.shell { width: min(100% - 32px, 980px); margin: 0 auto; padding: 28px 0 40px; }
.masthead { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 28px; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.mark { width: 14px; height: 14px; background: var(--orange); border-radius: 2px; transform: rotate(45deg); }
.panel { padding: clamp(28px, 5vw, 64px); background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.state-panel { min-height: 360px; display: grid; align-content: center; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--orange-dark); font-size: 14px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { max-width: 820px; margin: 0; font-size: clamp(38px, 7vw, 74px); line-height: 0.98; letter-spacing: -0.045em; }
h1 span { color: var(--orange); }
h2 { margin: 0 0 20px; font-size: clamp(26px, 4vw, 38px); line-height: 1.1; letter-spacing: -0.03em; }
.lead { max-width: 720px; margin: 28px 0 0; color: var(--muted); font-size: clamp(19px, 2.5vw, 24px); line-height: 1.45; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.facts span { padding: 8px 13px; color: var(--muted); background: #f0ede8; border-radius: 999px; font-size: 15px; font-weight: 600; }
.actions, .quiz-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button { min-height: 50px; padding: 12px 20px; border: 2px solid transparent; border-radius: 12px; font-weight: 700; cursor: pointer; transition: transform 140ms ease, background 140ms ease, border-color 140ms ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .option:has(input:focus-visible) { outline: 4px solid rgba(216, 93, 11, 0.26); outline-offset: 3px; }
.button-primary { color: white; background: var(--orange-dark); }
.button-primary:hover { background: #8c3704; }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button-secondary:hover { background: #f2eee8; border-color: #b8b0a5; }
.button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.privacy-note { max-width: 720px; margin: 28px 0 0; color: var(--muted); font-size: 14px; }

.quiz-panel h1 { margin-top: 34px; font-size: clamp(32px, 5vw, 56px); line-height: 1.08; }
.progress-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 20px; }
.progress-row .eyebrow { margin: 0; white-space: nowrap; }
.progress-track { height: 7px; overflow: hidden; background: #e9e4dd; border-radius: 999px; }
.progress-track span { display: block; width: 10%; height: 100%; background: var(--orange); border-radius: inherit; transition: width 180ms ease; }
.options { display: grid; gap: 12px; margin: 34px 0 0; padding: 0; border: 0; }
.option { position: relative; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 14px; min-height: 64px; padding: 14px 18px; background: #fbf9f6; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.option:hover { border-color: #b8b0a5; }
.option:has(input:checked) { background: var(--orange-soft); border-color: var(--orange); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-letter { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #bdb5aa; border-radius: 9px; font-size: 15px; font-weight: 700; }
.option:has(input:checked) .option-letter { color: white; background: var(--orange-dark); border-color: var(--orange-dark); }
.inline-error { margin: 14px 0 0; color: var(--red); font-weight: 600; }
.quiz-actions { justify-content: space-between; }

.result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.result-heading h1, #stats-only h1 { font-size: clamp(38px, 6vw, 64px); }
.score { flex: 0 0 auto; display: flex; align-items: baseline; gap: 6px; color: var(--orange-dark); }
.score strong { font-size: clamp(64px, 11vw, 108px); line-height: 0.9; letter-spacing: -0.07em; }
.score span { font-size: 24px; font-weight: 700; }
.notice { margin-top: 28px; padding: 14px 18px; color: var(--muted); background: #f1eee9; border-radius: 12px; font-size: 15px; }
.stats-card { margin-top: 28px; padding: clamp(20px, 4vw, 32px); background: var(--ink); color: white; border-radius: 18px; }
.stats-card h2 { font-size: 26px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.metric span { display: block; color: #c9c5be; font-size: 14px; }
.metric strong { display: block; margin-top: 4px; color: #ff8a3c; font-size: 34px; line-height: 1.1; }
.hardest { grid-column: span 2; }
.hardest strong { font-size: 20px; line-height: 1.3; }
.stats-note { margin: 22px 0 0; color: #c9c5be; font-size: 13px; }
.waiting { margin: 0; font-size: 19px; }
.waiting strong { color: #ff8a3c; }
.review { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.review-item { padding: 24px 0; border-top: 1px solid var(--line); }
.review-item:first-child { border-top: 0; }
.review-item h3 { margin: 0 0 12px; font-size: 20px; line-height: 1.35; }
.review-item p { margin: 8px 0 0; color: var(--muted); }
.answer-line { padding: 10px 12px; border-radius: 10px; }
.answer-line.correct { color: var(--green); background: var(--green-soft); }
.answer-line.incorrect { color: var(--red); background: var(--red-soft); }
footer { padding: 24px 4px 0; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 680px) {
  body { font-size: 16px; }
  .shell { width: min(100% - 20px, 980px); padding-top: 16px; }
  .masthead { margin-bottom: 16px; font-size: 12px; }
  .panel { padding: 24px 18px; border-radius: 18px; }
  h1 { font-size: clamp(36px, 12vw, 54px); }
  .lead { margin-top: 22px; font-size: 18px; }
  .actions .button, #stats-back-button { width: 100%; }
  .progress-row { grid-template-columns: 1fr; gap: 10px; }
  .quiz-panel h1 { margin-top: 26px; font-size: 31px; }
  .options { margin-top: 26px; }
  .option { grid-template-columns: 32px 1fr; min-height: 58px; padding: 12px; }
  .option-letter { width: 30px; height: 30px; }
  .quiz-actions .button { flex: 1; }
  .result-heading { display: block; }
  .score { margin-top: 26px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hardest { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
