/* Layout: single column; the lesson sits beside its step text on wide screens and stacks on phones.
   Oxygen colors (blue/red) are content, so they are separate from the brand accent (deep navy). */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #59627a;
  --line: #dde1ec;
  --accent: #1f3b8f;
  --accent-ink: #ffffff;
  --accent-soft: #e6ebf8;
  --deox: #3b6fd6;
  --ox: #d93b4a;
  --right: #1d7a46;
  --right-soft: #e3f3ea;
  --wrong: #b4232f;
  --wrong-soft: #fbe7e9;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1222;
    --surface: #151c31;
    --ink: #e8ecf7;
    --muted: #9aa4bf;
    --line: #26304a;
    --accent: #8fa8ff;
    --accent-ink: #0d1222;
    --accent-soft: #1d2747;
    --deox: #6f9bff;
    --ox: #ff6b78;
    --right: #5fd08f;
    --right-soft: #13301f;
    --wrong: #ff7d86;
    --wrong-soft: #3a1820;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--body);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; line-height: 1.15; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: clamp(40px, 7vw, 68px); }
h2 { font-size: clamp(30px, 4.5vw, 42px); }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.site-header, main, .site-footer {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding-inline: 20px;
}
.site-header { display: flex; justify-content: space-between; align-items: center; padding-block: 18px; }
.brand { font-family: var(--display); font-size: 28px; }

main { display: flex; flex-direction: column; gap: 56px; padding-block: 24px 64px; }

.eyebrow {
  font: 500 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.hero { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.lede { font-size: 19px; color: var(--muted); max-width: 62ch; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  font: 600 16px/1 var(--body); text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: 0.45; cursor: default; filter: none; }
.button.ghost { background: transparent; color: var(--accent); }
.button.small { min-height: 38px; padding: 0 16px; font-size: 14px; }

/* Demo */
.demo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 4vw, 36px);
  display: flex; flex-direction: column; gap: 28px;
}
.demo-head { display: flex; flex-direction: column; gap: 8px; }
.lesson { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 760px) { .lesson { grid-template-columns: minmax(0, 1fr); } }

.heart-figure { margin: 0; display: flex; flex-direction: column; gap: 10px; }
#heart { width: 100%; height: auto; display: block; }
.heart-figure figcaption { font-size: 14px; color: var(--muted); }

.organ { fill: var(--accent-soft); stroke: var(--line); stroke-width: 1.5; transition: fill 0.3s; }
.organ-label { font: 600 12px var(--body); fill: var(--muted); }
.chamber { fill: var(--bg); stroke: var(--muted); stroke-width: 2; transition: fill 0.3s, stroke 0.3s; }
.chamber.thick { stroke-width: 5; }
.ch-label { font: 600 11.5px var(--body); fill: var(--ink); pointer-events: none; }
.vessel { fill: none; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: 0.35; transition: opacity 0.3s; }
.vessel.deox { stroke: var(--deox); }
.vessel.ox { stroke: var(--ox); }
.valve { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; opacity: 0.35; transition: opacity 0.3s; }
.is-on.vessel, .is-on.valve { opacity: 1; }
.is-on.chamber { fill: var(--accent-soft); stroke: var(--accent); }
.is-on.organ { fill: var(--accent-soft); stroke: var(--accent); }
.cell { stroke: var(--surface); stroke-width: 2.5; transition: fill 0.6s; }
.cell.deox { fill: var(--deox); }
.cell.ox { fill: var(--ox); }

.steps { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.step-count { font: 500 13px/1 var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.steps h3 { font-size: 22px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.mnemonic { font-size: 15px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }

/* Quiz */
.quiz { border-top: 1px solid var(--line); padding-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.quiz-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.quiz-head h3 { font-family: var(--display); font-weight: 400; font-size: 28px; }
.quiz-progress { font: 500 13px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.q { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.q fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.q-prompt { font-weight: 700; font-size: 18px; padding: 0; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
}
.option:hover { border-color: var(--accent); }
.option input { margin-top: 4px; accent-color: var(--accent); }
.option.right { border-color: var(--right); background: var(--right-soft); }
.option.wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.option.muted { opacity: 0.6; }
.cloze { line-height: 2.4; }
.cloze select {
  font: 600 16px var(--body); color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--accent); border-radius: 8px; padding: 4px 8px; margin: 0 4px;
}
.cloze select.right { border-color: var(--right); background: var(--right-soft); }
.cloze select.wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.feedback { display: flex; flex-direction: column; gap: 10px; }
.feedback:empty { display: none; }
.verdict { font-weight: 700; }
.verdict.right { color: var(--right); }
.verdict.wrong { color: var(--wrong); }
.hint { color: var(--wrong); }
.why { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15.5px; }
.why li.right { color: var(--right); }
.source { font-size: 13.5px; color: var(--muted); }
.result { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.result-score { font: 400 56px/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }

/* How */
.how { display: flex; flex-direction: column; gap: 22px; }
.how-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 760px) { .how-grid { grid-template-columns: minmax(0, 1fr); } }
.how-item { display: flex; flex-direction: column; gap: 8px; border-top: 2px solid var(--ink); padding-top: 14px; }
.how-item p { color: var(--muted); }

/* Join */
.join { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.join > p { color: var(--muted); }
.score-note { font-weight: 600; color: var(--accent) !important; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; padding: 0; }
.field input[type=email], .field select {
  font: 16px var(--body); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
.field input[type=email]:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; background: var(--surface);
}
.choices input { accent-color: var(--accent); }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.hp { position: absolute; left: -9999px; }
.status { min-height: 1.6em; }
.status.ok { color: var(--right); font-weight: 600; }
.status.error { color: var(--wrong); font-weight: 600; }
.fine { font-size: 14px; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 24px 40px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px; color: var(--muted);
}

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