:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #536171;
  --paper: #fffdf8;
  --page: #f2f0ea;
  --surface: #ffffff;
  --surface-soft: #f5f7f7;
  --navy: #183a5a;
  --navy-soft: #e8eef4;
  --teal: #0b746f;
  --teal-soft: #e1f1ef;
  --amber: #a65d18;
  --amber-soft: #fff0da;
  --danger: #993b35;
  --danger-soft: #fbe9e6;
  --success: #22663f;
  --success-soft: #e6f3ea;
  --rule: #d2d8dc;
  --rule-strong: #9ca9b1;
  --shadow: 0 14px 34px rgba(28, 38, 46, .09);
  --radius: 14px;
  --content: 1180px;
  --reading: 72ch;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.58;
}
button, input, select, textarea { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img, svg, canvas { max-width: 100%; }
::selection { color: white; background: var(--teal); }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) var(--surface-soft); }
:focus-visible { outline: 3px solid rgba(11, 116, 111, .35); outline-offset: 3px; }

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 50;
  padding: 9px 13px;
  color: white;
  background: var(--navy);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.site-shell { width: min(1600px, 100%); min-height: 100vh; margin: 0 auto; background: var(--paper); }

.site-header {
  min-height: 72px;
  padding: 12px clamp(18px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-icon { width: 40px; height: 40px; color: var(--teal); flex: 0 0 auto; }
.brand-icon circle { fill: var(--paper); stroke: currentColor; stroke-width: 2.4; }
.brand strong { display: block; font-family: "Source Serif 4", Georgia, serif; font-size: 1.2rem; line-height: 1.05; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.level-toggle, .contents-toggle, .primary-button, .secondary-button, .tool-button, .choice-button, .text-button {
  min-height: 42px;
  border-radius: 9px;
  font-weight: 650;
}
.level-toggle { padding: 0 13px; border: 1px solid var(--rule-strong); background: var(--surface); }
.level-toggle span { display: inline-grid; width: 18px; height: 18px; margin-right: 4px; place-items: center; border: 1px solid currentColor; border-radius: 50%; line-height: 1; }
.level-toggle[aria-pressed="true"] { color: white; border-color: var(--navy); background: var(--navy); }
.overall-progress { width: 132px; color: var(--muted); font-size: .78rem; }
.progress-track { height: 5px; margin-top: 5px; display: block; overflow: hidden; border-radius: 3px; background: var(--navy-soft); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--teal); transition: width 260ms ease-out; }

.page-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.chapter-rail { padding: 30px 20px; border-right: 1px solid var(--rule); background: #f6f5f0; }
.rail-intro { margin: 0 4px 22px; color: var(--muted); font-size: .88rem; }
.chapter-nav { display: grid; gap: 5px; }
.chapter-button {
  position: relative;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px 10px 42px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
.chapter-button::before {
  content: attr(data-number);
  position: absolute;
  left: 12px;
  top: 18px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}
.chapter-button:hover { color: var(--ink); background: rgba(255,255,255,.72); }
.chapter-button[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 7px 20px rgba(28,38,46,.07); }
.chapter-button[aria-current="page"]::before { color: white; border-color: var(--teal); background: var(--teal); }
.chapter-button[data-complete="true"]::before { content: "✓"; color: var(--success); border-color: var(--success); }
.chapter-button strong, .chapter-button small { display: block; }
.chapter-button strong { line-height: 1.2; font-size: .91rem; }
.chapter-button small { margin-top: 3px; font-size: .73rem; }
.rail-tools { margin-top: 28px; padding: 17px 4px 0; display: grid; gap: 9px; border-top: 1px solid var(--rule); font-size: .8rem; }
.text-button { min-height: 0; padding: 0; border: 0; color: var(--navy); background: transparent; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

.lesson-area { min-width: 0; padding: 36px clamp(24px, 5vw, 74px) 24px; }
.chapter-heading { width: min(var(--content), 100%); margin: 0 auto 22px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.chapter-position { margin: 0 0 6px; color: var(--teal); font-size: 1.32rem; line-height: 1.15; font-weight: 700; }
.chapter-heading h1 { max-width: none; margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2rem, 3vw, 3.2rem); line-height: 1.04; letter-spacing: -.025em; text-wrap: pretty; }
.chapter-heading p:last-child { max-width: 68ch; margin: 10px 0 0; color: var(--muted); }
.contents-toggle { display: none; padding: 0 13px; border: 1px solid var(--rule-strong); background: var(--surface); }
.step-tabs {
  width: min(var(--content), 100%);
  margin: 0 auto 30px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
}
.step-tab {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 8px 14px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  white-space: nowrap;
}
.step-tab:hover { color: var(--ink); background: var(--surface-soft); }
.step-tab[aria-current="step"] { color: var(--navy); border-bottom-color: var(--teal); }
.step-tab[data-complete="true"]::after { content: " ✓"; color: var(--success); }

.lesson-view { width: min(var(--content), 100%); min-height: 560px; margin: 0 auto; }
.lesson-title { max-width: 32ch; margin: 0 0 9px; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
.lesson-lead { max-width: var(--reading); margin: 0 0 30px; color: var(--muted); font-size: 1.08rem; }
.lesson-grid { min-width: 0; display: grid; grid-template-columns: minmax(260px, .82fr) minmax(430px, 1.18fr); gap: clamp(28px, 5vw, 68px); align-items: start; }
.lesson-grid > * { min-width: 0; }
.copy-column { width: 100%; max-width: var(--reading); min-width: 0; }
.copy-column h3, .diagram-panel h3, .exercise-panel h3, .instrument-panel h3, .case-study h3 { margin: 0 0 8px; font-family: "Source Serif 4", Georgia, serif; font-size: 1.26rem; }
.copy-column h3:not(:first-child) { margin-top: 28px; }
.copy-column p { margin: 0 0 15px; color: var(--muted); }
.opening-next { margin: -4px 0 18px; }
.copy-column strong { color: var(--ink); }
.definition {
  margin: 22px 0;
  padding: 18px 20px;
  border-top: 2px solid var(--navy);
  border-bottom: 1px solid var(--rule);
  background: var(--navy-soft);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.13rem;
}
.takeaway { margin-top: 24px; padding: 16px 18px; background: var(--teal-soft); color: #164b48; }
.takeaway strong { color: #103f3c; }
.exam-sentence { margin-top: 24px; padding: 18px 20px; border: 1px solid var(--rule); background: var(--surface); }
.exam-sentence::before { content: "Exam sentence"; display: block; margin-bottom: 5px; color: var(--teal); font-size: .75rem; font-weight: 700; }
.exam-sentence.family-summary::before { content: "Stereoisomer definition"; }
.exam-sentence.mirror-summary::before { content: "Optical-isomer definition"; }
.exam-sentence.practice-rule::before { content: "Decision rule"; }
.level4-block { display: none; margin-top: 24px; padding: 18px 20px; border: 1px solid #a5c9c5; background: var(--teal-soft); }
body.show-level4 .level4-block { display: block; }
.level4-block h3 { margin: 0 0 7px; font-size: 1rem; }
.level4-block p { margin: 0; color: #234e4c; }

.diagram-panel, .exercise-panel, .instrument-panel, .case-study {
  min-width: 0;
  padding: clamp(18px, 3vw, 30px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.diagram-caption { margin: 10px 0 0; color: var(--muted); font-size: .85rem; }
.example-label { margin: 16px 0 7px; color: var(--teal); font-size: .75rem; font-weight: 700; letter-spacing: .025em; text-transform: uppercase; }
.family-tree { display: grid; justify-items: center; gap: 12px; padding: 24px 10px; }
.family-node { min-width: min(270px, 100%); padding: 12px 17px; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper); text-align: center; font-weight: 700; }
.family-node.active { color: white; border-color: var(--navy); background: var(--navy); }
.family-branches { width: min(560px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.family-arrow { width: 1px; height: 24px; background: var(--rule-strong); }

.family-panel { align-self: start; }
.full-family-tree { padding: 18px 2px 6px; }
.family-root, .family-group-title { padding: 13px 16px; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper); text-align: center; }
.family-root { width: min(270px, 84%); margin: 0 auto 48px; position: relative; }
.family-root::after { content: ""; width: 1px; height: 48px; position: absolute; left: 50%; top: 100%; background: var(--rule-strong); }
.family-root strong, .family-group-title strong { display: block; color: var(--navy); font-size: 1rem; text-transform: uppercase; }
.family-root span, .family-group-title span { display: block; margin-top: 3px; color: var(--muted); font-size: .83rem; line-height: 1.35; }
.family-main-branches { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; position: relative; }
.family-main-branches::before { content: ""; height: 1px; position: absolute; left: 25%; right: 25%; top: -24px; background: var(--rule-strong); }
.family-group { min-width: 0; position: relative; }
.family-group::before { content: ""; width: 1px; height: 24px; position: absolute; left: 50%; bottom: 100%; background: var(--rule-strong); }
.family-group.active .family-group-title { border-color: #8db9b5; background: var(--teal-soft); }
.family-leaves { margin-top: 34px; display: grid; gap: 8px; position: relative; }
.family-leaves::before { content: ""; height: 1px; position: absolute; left: 16.5%; right: 16.5%; top: -17px; background: var(--rule-strong); }
.family-leaves.two::before { left: 25%; right: 25%; }
.family-leaves.three { grid-template-columns: repeat(3, 1fr); }
.family-leaves.two { grid-template-columns: repeat(2, 1fr); }
.family-leaves > span { min-height: 54px; padding: 9px 6px; position: relative; display: grid; place-items: center; color: var(--muted); text-align: center; font-size: .8rem; line-height: 1.25; }
.family-leaves > span::before { content: ""; width: 1px; height: 17px; position: absolute; left: 50%; bottom: 100%; background: var(--rule-strong); }
.family-leaves .optical-leaf { border-radius: 8px; color: white; background: var(--navy); font-weight: 700; }

.reference-structure { margin: 14px 0 20px; display: grid; justify-items: center; }
.reference-structure img { width: min(235px, 75%); height: auto; }
.reference-structure figcaption, .hand-panel figcaption { margin-top: 9px; color: var(--muted); font-size: .84rem; line-height: 1.4; text-align: center; }
.bond-key { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.bond-key > div { padding: 11px 0; display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: center; border-bottom: 1px solid var(--rule); }
.bond-key p { margin: 0; color: var(--muted); font-size: .84rem; }
.bond-line { width: 46px; height: 18px; position: relative; display: block; }
.bond-line.flat::after { content: ""; height: 2px; position: absolute; inset: 8px 0 auto; background: var(--ink); transform: rotate(-14deg); }
.bond-line.wedge { clip-path: polygon(4% 48%,100% 0,100% 100%); background: var(--ink); }
.bond-line.dash { background: repeating-linear-gradient(105deg, transparent 0 4px, var(--ink) 4px 6px); clip-path: polygon(4% 48%,100% 0,100% 100%); }

.foundation-models { margin-top: 32px; }
.model-section-heading { margin-bottom: 20px; display: flex; justify-content: space-between; gap: 28px; align-items: end; }
.model-section-heading h3, .model-section-heading p { margin: 0; }
.model-section-heading > p { max-width: 52ch; color: var(--muted); font-size: .9rem; }
.foundation-representations { display: grid; grid-template-columns: minmax(310px,.85fr) minmax(480px,1.15fr); gap: 24px; align-items: start; }
.foundation-representations h4 { margin: 0 0 10px; color: var(--navy); }
.arrangement-pair { align-items: stretch; }
.arrangement-divider { align-self: center; color: var(--muted); text-align: center; font-size: .73rem; font-weight: 700; }
.foundation-viewer { height: 300px; }

.term-stack { margin: 14px 0 22px; display: grid; gap: 10px; }
.term-stack > div { padding: 15px 17px; border: 1px solid var(--rule); background: var(--surface); }
.term-stack strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; font-size: 1.08rem; }
.term-stack p { margin: 4px 0 0; }
.hand-panel figure { margin: 16px 0 22px; }
.hand-panel img { width: 100%; height: auto; display: block; border: 1px solid var(--rule); background: white; }
.compound-mirror-examples { margin-top: 32px; }
.compound-example-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 30px; }
.compound-example-grid section { min-width: 0; }
.compound-example-grid h4 { margin: 0 0 5px; font-family: "Source Serif 4", Georgia, serif; font-size: 1.1rem; }
.compound-example-grid h5 { margin: 18px 0 10px; color: var(--navy); font-size: .86rem; }
.compound-example-grid section > p { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.alevel-pair { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 10px; align-items: center; }
.alevel-structure-card { min-width: 0; margin: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: white; }
.alevel-structure-card figcaption { padding: 11px 13px; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--rule); }
.alevel-structure-card figcaption strong { color: var(--navy); }
.alevel-structure-card figcaption span { color: var(--muted); font-size: .77rem; }
.alevel-structure-svg { width: 100%; height: 190px; display: block; }
.alevel-structure-svg line { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.alevel-structure-svg .solid-wedge { fill: var(--ink); }
.alevel-structure-svg .hashed-wedge line { stroke-width: 2; }
.alevel-structure-svg .atom { fill: var(--ink); font-family: "Source Sans 3", Arial, sans-serif; font-size: 20px; font-weight: 600; }
.alevel-structure-svg .carbon { font-family: "Source Serif 4", Georgia, serif; font-size: 22px; }
.duplicate-groups { margin: 0; padding: 10px 12px; color: var(--muted); border-top: 1px solid var(--rule); text-align: center; font-size: .8rem; }
.example-3d-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.example-3d-block > div:first-child { margin-bottom: 12px; }
.example-3d-block h5 { margin: 0 0 4px; }
.example-3d-block p { margin: 0; color: var(--muted); font-size: .84rem; }
.compact-viewer { height: 265px; }
.achiral-compound-example .superimposable-result { margin-top: 12px; }
.achiral-example { display: grid; grid-template-columns: minmax(0,1fr) minmax(120px,.6fr); gap: 12px; align-items: center; }
.superimposable-result { padding: 16px; border: 1px solid #98c4ae; background: var(--success-soft); text-align: center; }
.superimposable-result strong, .superimposable-result span { display: block; }
.superimposable-result span { margin-top: 4px; color: var(--muted); font-size: .78rem; }

.molecule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.molecule-card { min-width: 0; padding: 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.molecule-card h4 { margin: 0 0 2px; font-size: 1rem; }
.molecule-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.molecule-svg { width: 100%; height: 220px; display: grid; place-items: center; margin-top: 8px; overflow: hidden; background: white; }
.molecule-svg.compact { height: 170px; }
.molecule-svg > svg { width: 100%; height: 100%; display: block; }
.molecule-loading { color: var(--muted); font-size: .82rem; }
.molecule-fallback { min-height: 150px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.mirror-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; }
.mirror-marker { color: var(--navy); text-align: center; font-size: .76rem; font-weight: 700; }
.mirror-marker svg { width: 40px; display: block; margin: 0 auto 5px; }
.mirror-plane { width: 2px; height: 66px; display: block; margin: 0 auto 6px; background: var(--teal); box-shadow: 6px 0 0 rgba(11,116,111,.12); }
.configuration-note { color: var(--muted); font-size: .8rem; text-align: center; }
.optical-opening { align-items: start; }
.alanine-pair-panel { min-width: 0; }
.static-stereo-figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: white; }
.static-stereo-figure img { width: 100%; height: auto; display: block; }
.static-stereo-figure figcaption { padding: 11px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid var(--rule); }
.static-stereo-figure.featured { border: 0; border-radius: 0; }
.static-stereo-figure.featured img { max-width: 760px; margin: 0 auto; }
.static-stereo-figure.featured figcaption { padding-inline: 0; border-top: 1px solid var(--rule); border-bottom: 0; }
.static-stereo-figure figcaption strong { color: var(--navy); }
.static-stereo-figure figcaption span { color: var(--muted); font-size: .82rem; }
.additional-stereo-examples { margin-top: 30px; }
.stereo-example-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.tartaric-static-figure { margin: 22px 0 0; overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: white; }
.tartaric-static-figure img { width: 100%; height: auto; display: block; }
.tartaric-static-figure figcaption { padding: 11px 14px; color: var(--muted); border-top: 1px solid var(--rule); font-size: .84rem; text-align: center; }
.compact-bond-key { margin-top: 16px; display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--rule); }
.compact-bond-key > div { padding: 10px; grid-template-columns: 44px 1fr; border-bottom: 0; border-right: 1px solid var(--rule); }
.compact-bond-key > div:last-child { border-right: 0; }
.compact-bond-key .bond-line { width: 38px; }
.same-different-strip { margin-top: 24px; display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.same-different-strip > div { padding: 14px 18px; display: grid; gap: 2px; text-align: center; border-right: 1px solid var(--rule); }
.same-different-strip > div:last-child { border-right: 0; }
.same-different-strip strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; }
.same-different-strip span { color: var(--muted); font-size: .8rem; }

.check-list, .plain-list { margin: 18px 0 0; padding: 0; list-style: none; }
.check-list li { padding: 10px 0 10px 30px; position: relative; border-bottom: 1px solid var(--rule); color: var(--muted); }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 12px; height: 12px; border: 2px solid var(--teal); border-radius: 50%; }
.plain-list li { margin: 8px 0; }
.formula-picker { margin: 20px 0; padding: 24px 12px; overflow-x: auto; background: var(--surface-soft); text-align: center; white-space: nowrap; font-size: clamp(1.15rem, 3vw, 1.55rem); }
.atom-choice { min-width: 46px; min-height: 42px; padding: 4px 7px; border: 1px solid var(--rule-strong); border-radius: 7px; background: white; font-weight: 700; }
.atom-choice:hover { border-color: var(--teal); }
.atom-choice.correct { color: white; border-color: var(--success); background: var(--success); }
.atom-choice.incorrect { color: white; border-color: var(--danger); background: var(--danger); }
.control-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 16px; }
.tool-button, .choice-button, .secondary-button, .primary-button { padding: 0 15px; }
.tool-button, .choice-button, .secondary-button { border: 1px solid var(--rule-strong); background: white; }
.tool-button:hover, .choice-button:hover, .secondary-button:hover { border-color: var(--navy); }
.tool-button[aria-pressed="true"], .choice-button[aria-pressed="true"] { color: white; border-color: var(--navy); background: var(--navy); }
.primary-button { color: white; border: 1px solid var(--navy); background: var(--navy); }
.primary-button:hover { background: #0f2c46; }
.feedback { min-height: 52px; margin-top: 16px; padding: 12px 14px; color: var(--muted); background: var(--surface-soft); }
.feedback.correct { color: var(--success); background: var(--success-soft); }
.feedback.incorrect { color: var(--danger); background: var(--danger-soft); }

.viewer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.viewer-card { min-width: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: #edf1f2; }
.viewer-card header { padding: 10px 13px; display: flex; justify-content: space-between; gap: 12px; background: white; border-bottom: 1px solid var(--rule); }
.viewer-card header strong { font-size: .9rem; }
.viewer-card header span { color: var(--muted); font-size: .75rem; }
.viewer3d { width: 100%; height: 360px; position: relative; }
.viewer3d canvas { outline: none; }
.viewer3d canvas:focus-visible, .overlay-viewer canvas:focus-visible, .protein-viewer canvas:focus-visible { outline: 4px solid #f1b24a; outline-offset: -4px; }
.viewer-control-row { min-height: 44px; padding: 7px 10px; display: flex; justify-content: center; gap: 7px; border-top: 1px solid var(--rule); background: white; }
.viewer-control-row button { min-width: 38px; min-height: 34px; border: 1px solid var(--rule-strong); border-radius: 7px; background: white; color: var(--navy); font-size: 1rem; font-weight: 700; }
.viewer-control-row button:hover { border-color: var(--navy); }
.viewer-error { min-height: 260px; display: grid; place-items: center; padding: 24px; color: var(--danger); text-align: center; }
.library-heading { display: grid; grid-template-columns: minmax(240px,.72fr) minmax(280px,1.28fr); gap: 24px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.library-heading .field { margin: 0; }
.library-identity { min-height: 44px; display: grid; align-content: center; gap: 2px; }
.library-identity strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; font-size: 1.08rem; }
.library-identity span { color: var(--muted); font-size: .84rem; }
.library-modes { margin: 16px 0; }
.overlay-stage { display: none; position: relative; }
.overlay-viewer { height: 430px; border: 1px solid var(--rule); border-radius: 12px 12px 0 0; background: #edf1f2; }
.overlay-key { position: absolute; z-index: 2; top: 12px; left: 12px; padding: 8px 10px; display: flex; gap: 14px; color: var(--muted); background: rgba(255,255,255,.92); border-radius: 8px; font-size: .76rem; }
.overlay-key .key-swatch { width: 16px; }
.overlay-controls { display: none; }
.viewer-stage[data-mode="overlay"] .viewer-grid { display: none; }
.viewer-stage[data-mode="overlay"] .overlay-stage { display: block; }
.viewer-stage[data-mode="overlay"] .overlay-controls { display: flex; }
.viewer-instructions { margin: 11px 0 0; color: var(--muted); font-size: .82rem; }

.stereo-practice { max-width: 960px; margin-inline: auto; }
.practice-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.practice-heading h3 { margin: 0; }
.practice-heading p { margin: 4px 0 0; color: var(--muted); }
.practice-heading > strong { min-width: 58px; color: var(--teal); text-align: right; font-variant-numeric: tabular-nums; }
.practice-figure { margin: 20px 0 18px; overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: white; }
.practice-figure img { width: 100%; height: min(34vw,350px); min-height: 230px; display: block; object-fit: contain; }
.practice-figure figcaption { padding: 9px 13px; color: var(--muted); border-top: 1px solid var(--rule); font-size: .82rem; text-align: center; }
.stereo-question-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.stereo-question-grid fieldset { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--rule); border-radius: 10px; }
.stereo-question-grid fieldset.correct { border-color: #78aa91; background: var(--success-soft); }
.stereo-question-grid fieldset.incorrect { border-color: #d39986; background: var(--danger-soft); }
.stereo-question-grid legend { padding: 0 4px; color: var(--navy); font-size: .85rem; font-weight: 700; }
.stereo-question-grid label { min-height: 42px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--rule); }
.stereo-question-grid label:last-child { border-bottom: 0; }
.stereo-question-grid input { accent-color: var(--teal); }

.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--teal) var(--surface-soft); }
.table-scroll:focus-visible { outline: 3px solid #f1b24a; outline-offset: 3px; }
.comparison-table { width: 100%; margin-top: 18px; border-collapse: collapse; }
.table-scroll .comparison-table { min-width: 620px; }
.comparison-table th, .comparison-table td { padding: 11px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.comparison-table th { color: var(--navy); background: var(--navy-soft); }
.counting-workbench { display: grid; grid-template-columns: minmax(190px,.58fr) minmax(330px,1.15fr) minmax(220px,.67fr); gap: 22px; align-items: start; }
.counting-copy { min-width: 0; }
.counting-copy > p { color: var(--muted); }
.counting-visual { min-width: 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: white; }
.counting-structure { height: 300px; margin: 0; }
.counting-structure > img { width: 100%; height: 100%; display: block; object-fit: contain; }
.counting-visual .diagram-caption { margin: 0; padding: 9px 12px; border-top: 1px solid var(--rule); text-align: center; }
.stereocentre-key { margin-top: 16px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; color: var(--muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: .82rem; }
.stereocentre-key strong { color: var(--teal); font-family: "Source Serif 4", Georgia, serif; font-size: 1.25rem; }
.count-result-panel h3 { margin-top: 0; }
.number-display { min-height: 160px; display: grid; place-items: center; background: var(--navy-soft); text-align: center; }
.number-display strong { display: block; font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2.8rem, 6vw, 5rem); line-height: 1; color: var(--navy); }
.number-display span { color: var(--muted); }
select, input[type="text"], textarea { min-height: 44px; padding: 9px 11px; border: 1px solid var(--rule-strong); border-radius: 8px; background: white; }
select { max-width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--teal); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field-label { color: var(--muted); font-size: .78rem; font-weight: 700; }

.light-board { width: 100%; height: 330px; border: 0 !important; background: white; }
.jxgbox { border: 0 !important; }
.light-key { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .82rem; }
.key-swatch { width: 18px; height: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; background: var(--teal); }
.key-swatch.secondary { background: var(--amber); }
.electromagnetic-intro { align-items: stretch; }
.electromagnetic-intro .instrument-panel { align-self: start; }
.polariser-lesson, .rotation-lesson { display: grid; grid-template-columns: minmax(280px,.68fr) minmax(560px,1.32fr); gap: clamp(28px,4vw,48px); align-items: start; }
.polariser-lesson > .lesson-grid, .rotation-lesson > .optical-rotation-copy { display: contents; }
.polariser-lesson > .lesson-grid > .copy-column, .rotation-lesson > .optical-rotation-copy > .copy-column { grid-column: 1; grid-row: 1 / 3; }
.property-strip { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-self: start; border-top: 2px solid var(--navy); border-bottom: 1px solid var(--rule); background: var(--surface); }
.polariser-lesson .property-strip { grid-column: 2; grid-row: 1; }
.property-strip > div { min-width: 0; padding: 16px; border-right: 1px solid var(--rule); }
.property-strip > div:last-child { border-right: 0; }
.property-strip strong, .property-strip span { display: block; }
.property-strip strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; font-size: 1.02rem; }
.property-strip span { margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.38; }
.polariser-lab { grid-column: 2; grid-row: 2; margin-top: 0; }
.polariser-stage { max-width: 100%; overflow-x: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: #fff; }
.polariser-stage svg { width: 100%; min-width: 720px; height: auto; display: block; }
.polariser-stage text, .polarimeter text, .rotation-comparison text, .detector-plot-grid text { fill: var(--ink); font-family: "Source Sans 3", "Segoe UI", sans-serif; font-size: 14px; }
.propagation-line { stroke: var(--navy); stroke-width: 2; }
.incoming-wave, .outgoing-electric, .outgoing-magnetic { fill: none; stroke-linecap: round; }
.incoming-wave { stroke-width: 3; }
.wave-a, .outgoing-electric { stroke: var(--teal); }
.wave-b, .outgoing-magnetic { stroke: var(--amber); stroke-dasharray: 9 6; }
.outgoing-electric { stroke-width: 4; }
.outgoing-magnetic { stroke-width: 3; }
.incoming-direction-view circle { fill: white; stroke: var(--rule-strong); stroke-width: 2; }
.incoming-direction-view line { stroke: var(--teal); stroke-width: 2; opacity: .72; }
.field-letter { font-weight: 700; }
.electric-label { fill: var(--teal) !important; }
.magnetic-label { fill: var(--amber) !important; }
.polariser-filter { fill: var(--navy-soft); stroke: var(--navy); stroke-width: 2; }
#polariser-axis { stroke: var(--navy); stroke-width: 4; fill: none; }
.plane-view { fill: var(--surface-soft); stroke: var(--rule-strong); stroke-width: 2; }
#plane-view-axis { stroke: var(--teal); stroke-width: 4; stroke-linecap: round; transform-box: fill-box; transform-origin: center; }
.front-view-label { fill: var(--muted) !important; font-size: 12px !important; }
.polariser-controls { margin-top: 18px; display: grid; grid-template-columns: minmax(260px,1fr) auto; gap: 24px; align-items: end; }
.polariser-controls .field, .polariser-controls .control-row { margin: 0; }
.polariser-controls .field { grid-template-columns: auto minmax(180px,1fr) 52px; align-items: center; }
.polariser-controls output { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.polariser-feedback { min-height: 0; margin-top: 14px; border-top: 1px solid var(--rule); background: white; }
.polariser-feedback strong { color: var(--navy); }
.comparison-note { padding: 18px 20px; border-top: 2px solid var(--teal); border-bottom: 1px solid var(--rule); background: var(--teal-soft); }
.rotation-lesson .comparison-note { grid-column: 2; grid-row: 1; }
.comparison-note strong, .comparison-note span { display: block; }
.comparison-note strong { color: #103f3c; font-family: "Source Serif 4", Georgia, serif; font-size: 1.05rem; }
.comparison-note span { margin-top: 5px; color: #234e4c; font-size: .88rem; }
.rotation-comparison { grid-column: 2; grid-row: 2; margin-top: 0; }
.rotation-dial-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 30px; }
.rotation-dial-grid figure, .detector-plot-grid figure, .limonene-pair figure { min-width: 0; margin: 0; }
.rotation-dial-grid figure + figure, .detector-plot-grid figure + figure { border-left: 1px solid var(--rule); padding-left: 30px; }
.rotation-dial-grid figcaption, .detector-plot-grid figcaption, .limonene-pair figcaption { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rotation-dial-grid figcaption span, .detector-plot-grid figcaption span, .limonene-pair figcaption span { color: var(--muted); font-size: .8rem; }
.rotation-dial-grid svg { width: 100%; height: auto; display: block; }
.rotation-dial-grid circle { fill: var(--surface-soft); stroke: var(--rule-strong); stroke-width: 2; }
.reference-plane { stroke: var(--rule-strong); stroke-width: 2; stroke-dasharray: 7 6; }
.measured-plane { stroke-width: 5; stroke-linecap: round; }
.measured-plane.positive, .rotation-arc.positive { stroke: var(--teal); }
.measured-plane.negative, .rotation-arc.negative { stroke: var(--amber); }
.rotation-arc { fill: none; stroke-width: 3; }
.rotation-control { margin-top: 12px; display: grid; grid-template-columns: auto minmax(200px,1fr) 54px; gap: 14px; align-items: center; }
.rotation-control label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.rotation-control output { color: var(--navy); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.parameter-explanation { margin-top: 18px; padding: 18px 0 0; border-top: 1px solid var(--rule); }
.parameter-explanation h4, .parameter-explanation p { margin: 0; }
.parameter-explanation h4 { font-family: "Source Serif 4", Georgia, serif; font-size: 1.05rem; }
.parameter-explanation > p { margin-top: 5px; color: var(--muted); font-size: .9rem; }
.parameter-explanation dl { margin: 14px 0 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.parameter-explanation dl > div { min-width: 0; padding: 12px; border-right: 1px solid var(--rule); }
.parameter-explanation dl > div:last-child { border-right: 0; }
.parameter-explanation dt { color: var(--muted); font-size: .75rem; font-weight: 700; }
.parameter-explanation dd { margin: 4px 0 0; color: var(--navy); font-weight: 700; line-height: 1.35; }
.polarimeter-explanation, .mixture-explanation { margin-top: 22px; }
.polarimeter-explanation dl { grid-template-columns: repeat(4,minmax(0,1fr)); }
.polarimeter-lesson { align-items: start; }
.polarimeter-sequence { counter-reset: instrument; }
.polarimeter-sequence li { margin: 0; padding: 10px 0 10px 38px; position: relative; border-bottom: 1px solid var(--rule); color: var(--muted); }
.polarimeter-sequence li::before { counter-increment: instrument; content: counter(instrument); width: 25px; height: 25px; position: absolute; left: 0; top: 11px; display: grid; place-items: center; border: 1px solid var(--teal); border-radius: 50%; color: var(--teal); font-size: .75rem; font-weight: 700; }
.polarimeter { padding: 20px; overflow-x: auto; background: #edf2f3; border-radius: 12px; }
.polarimeter svg { width: 100%; height: auto; display: block; }
.polarimeter-path { stroke: #d29322; stroke-width: 4; }
.polarimeter-plane { stroke: var(--teal); stroke-width: 5; }
.light-source { fill: var(--amber-soft); stroke: var(--amber); stroke-width: 2; }
.instrument-part { fill: var(--navy-soft); stroke: var(--navy); stroke-width: 2; }
.sample-tube { fill: rgba(11,116,111,.1); stroke: var(--teal); stroke-width: 2; }
.analyser-ring { fill: white; stroke: var(--navy); stroke-width: 2; }
#detector-window { fill: #d9e0e3; stroke: var(--navy); stroke-width: 2; }
.small-svg-label { fill: var(--muted) !important; font-size: 12px !important; }
.sample-meter { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.sample-meter > div:first-child { display: grid; grid-template-columns: auto minmax(170px,1fr); gap: 14px; align-items: center; }
.sample-meter label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.meter-readouts { display: flex; gap: 8px; align-items: stretch; }
.rotation-value { min-width: 112px; padding: 10px; color: white; background: var(--navy); text-align: center; font-variant-numeric: tabular-nums; }
.detector-value { min-width: 130px; padding: 10px; color: var(--navy); border: 1px solid var(--rule); background: white; text-align: center; font-variant-numeric: tabular-nums; }
.detector-plot-heading { margin-top: 28px; padding-top: 18px; display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--rule); }
.detector-plot-heading h4, .detector-plot-heading p { margin: 0; }
.detector-plot-heading h4 { font-family: "Source Serif 4", Georgia, serif; font-size: 1.08rem; }
.detector-plot-heading p { color: var(--muted); font-size: .84rem; }
.detector-plot-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 30px; }
.detector-plot-grid svg { width: 100%; height: auto; display: block; background: white; }
.plot-axis { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.intensity-curve { fill: none; stroke-width: 3; }
.intensity-curve.positive { stroke: var(--teal); }
.intensity-curve.negative { stroke: var(--amber); }
.target-line { stroke: var(--rule-strong); stroke-width: 1.5; stroke-dasharray: 6 5; }
.plot-marker { stroke: white; stroke-width: 2; }
.plot-marker.positive { fill: var(--teal); }
.plot-marker.negative { fill: var(--amber); }
.plot-ticks text { fill: var(--muted); font-size: 11px; }
.limonene-lesson { display: grid; grid-template-columns: minmax(270px,.7fr) minmax(520px,1.3fr); gap: 30px; align-items: start; }
.limonene-structures { min-width: 0; }
.limonene-pair { display: grid; grid-template-columns: minmax(0,1fr) 90px minmax(0,1fr); gap: 14px; align-items: center; }
.limonene-pair figure { padding-top: 12px; border-top: 2px solid var(--navy); }
.limonene-pair img { width: 100%; height: 230px; display: block; object-fit: contain; background: white; }
.limonene-pair figure p { margin: 6px 0 0; color: var(--muted); font-size: .82rem; text-align: center; }
.limonene-mixture { grid-column: 1 / -1; }
.limonene-mixture > label { display: block; margin-bottom: 8px; font-weight: 700; }
.limonene-mixture input[type="range"] { margin-bottom: 10px; }
.mixture-result { margin-top: 18px; display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.mixture-result > div { min-width: 190px; padding: 13px 16px; border-left: 4px solid var(--teal); background: var(--teal-soft); }
.mixture-result span, .mixture-result strong { display: block; }
.mixture-result span { color: var(--muted); font-size: .76rem; }
.mixture-result strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.mixture-result p { margin: 0; color: var(--muted); }
.ratio-bar { height: 20px; display: flex; overflow: hidden; border: 1px solid var(--rule-strong); border-radius: 6px; }
.ratio-a { background: var(--teal); }
.ratio-b { background: var(--amber); }

.mechanism-overview > .lesson-grid, .mechanism-copy { align-items: start; }
.reaction-outcome-panel, .mechanism-workbench { margin-top: 28px; }
.mechanism-stage { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: var(--teal) var(--surface-soft); }
.mechanism-stage:focus-visible { outline: 3px solid #f1b24a; outline-offset: 3px; }
.reaction-outcome-stage img { width: 100%; height: auto; display: block; }
.bond-meaning { margin-top: 12px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.bond-meaning span { min-width: 0; padding: 10px 12px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; border-right: 1px solid var(--rule); }
.bond-meaning span:last-child { border-right: 0; }
.bond-meaning .bond-line { width: 38px; flex: 0 0 38px; }
.mechanism-svg { width: 100%; max-width: 900px; height: auto; margin: 0 auto; display: block; background: white; }
.mechanism-svg .bond { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.mechanism-svg .reaction-arrow { stroke: var(--navy); stroke-width: 2.5; }
.mechanism-svg .electron-arrow { fill: none; stroke: var(--teal); stroke-width: 3.2; marker-end: url(#mechanism-arrowhead); opacity: .13; transition: opacity 180ms ease; }
.mechanism-svg[data-step="1"] .arrow-one,
.mechanism-svg[data-step="2"] .arrow-one, .mechanism-svg[data-step="2"] .arrow-two,
.mechanism-svg[data-step="3"] .arrow-one, .mechanism-svg[data-step="3"] .arrow-two, .mechanism-svg[data-step="3"] .arrow-three { opacity: 1; }
.mechanism-svg text { font-family: "Source Sans 3", sans-serif; fill: var(--ink); }
.mechanism-svg .atom-label { font-size: 27px; font-weight: 600; }
.mechanism-svg .stage-label { fill: var(--navy); font-size: 26px; font-weight: 700; }
.mechanism-svg .product-name { fill: var(--muted); font-size: 22px; }
.mechanism-svg .stage-divider { stroke: var(--rule); stroke-width: 1.5; }
.mechanism-svg .solid-wedge-svg { fill: var(--ink); }
.mechanism-svg .hashed-wedge-svg { stroke: var(--ink); stroke-width: 2; }
.mechanism-workbench > .exam-sentence { margin-top: 18px; }
.face-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.face-card { padding: 16px; border: 1px solid var(--rule); border-radius: 10px; background: white; }
.enantiomer-product-pair { margin-top: 18px; display: grid; grid-template-columns: minmax(0,1fr) 94px minmax(0,1fr); gap: 14px; align-items: center; }
.product-structure-card { margin: 0; padding: 14px; border: 1px solid var(--rule); border-radius: 12px; background: white; transition: border-color 160ms ease, background-color 160ms ease; }
.product-structure-card.selected { border-color: var(--teal); background: var(--teal-soft); }
.product-structure-card figcaption { display: grid; gap: 3px; }
.product-structure-card figcaption span { color: var(--muted); font-size: .78rem; }
.product-structure-card img { width: 100%; height: 240px; display: block; object-fit: contain; }
.product-structure-card p { margin: 8px 0 0; color: var(--muted); font-size: .84rem; text-align: center; }
.mechanism-comparison-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.mechanism-comparison-grid .positive-example { border-top: 2px solid var(--teal); }
.mechanism-comparison-grid .negative-example { border-top: 2px solid var(--navy); }
.reaction-example-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.reaction-example-grid figure { margin: 0; padding-top: 13px; border-top: 2px solid var(--navy); }
.reaction-example-grid figcaption { display: grid; gap: 3px; }
.reaction-example-grid figcaption span { color: var(--muted); font-size: .78rem; }
.reaction-example-grid img { width: 100%; height: auto; display: block; background: white; }
.reaction-example-grid p { margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
.condition-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.condition-result { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.condition-result strong { font-size: 1.35rem; color: var(--navy); }

.biology-target-figure { margin: 0; }
.biology-intro-grid { grid-template-columns: minmax(280px,.7fr) minmax(600px,1.3fr); gap: clamp(28px,4vw,52px); }
.biology-target-figure figcaption p, .model-section-heading > p { margin: 0; color: var(--muted); font-size: .86rem; }
.biology-target-figure img, .drug-journey-figure img { width: 100%; height: auto; display: block; margin-top: 14px; }
.binding-workbench .control-row { margin: 16px 0 10px; }
.binding-stage { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: white; }
.binding-model { width: 100%; height: auto; display: block; }
.binding-model .binding-heading { fill: var(--navy); font: 700 18px "Source Sans 3", sans-serif; }
.binding-model .binding-state[hidden] { display: none; }
.binding-model .binding-target > path { fill: #eef2f1; stroke: var(--navy); stroke-width: 2; }
.binding-model .binding-target rect { fill: white; stroke: var(--rule-strong); stroke-width: 1.5; }
.binding-model .binding-target text, .binding-model .drug-group text { fill: var(--ink); font: 600 14px "Source Sans 3", sans-serif; }
.binding-model .stereocentre { fill: var(--navy-soft); stroke: var(--navy); stroke-width: 2; }
.binding-model .centre-label { fill: var(--navy); font: 700 17px "Source Sans 3", sans-serif; }
.binding-model .binding-state > line:not(.contact-link), .binding-model .binding-hash line { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.binding-model .binding-state > path { fill: var(--ink); }
.binding-model .drug-group rect { fill: var(--teal-soft); stroke: var(--teal); stroke-width: 1.5; }
.binding-model .mismatch-group rect { fill: var(--surface-soft); stroke: var(--rule-strong); stroke-dasharray: 6 5; }
.binding-model .contact-link { stroke-width: 4; stroke-linecap: round; }
.binding-model .matched-link { stroke: var(--teal); }
.binding-model .missed-link { stroke: var(--rule-strong); stroke-dasharray: 8 8; }
.binding-readout { padding: 14px 0 2px; display: grid; grid-template-columns: minmax(170px,.35fr) 1fr; gap: 20px; align-items: start; }
.binding-readout strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; font-size: 1.08rem; }
.binding-readout p { margin: 0; color: var(--muted); }
.biology-molecule-pair { display: grid; grid-template-columns: minmax(0,1fr) 92px minmax(0,1fr); gap: 14px; align-items: center; }
.biology-molecule-card { margin: 0; padding: 14px; border-top: 2px solid var(--navy); background: white; }
.biology-molecule-card figcaption, .ibuprofen-pathway figcaption { display: grid; gap: 2px; }
.biology-molecule-card figcaption span, .ibuprofen-pathway figcaption span { color: var(--muted); font-size: .8rem; }
.biology-molecule-card img { width: 100%; height: 250px; display: block; object-fit: contain; }
.biology-molecule-card p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; text-align: center; }
.biology-mirror-marker { display: grid; gap: 6px; color: var(--teal); text-align: center; transform: none; }
.biology-mirror-marker::before { content: ""; width: 2px; height: 112px; margin: 0 auto; background: var(--teal); box-shadow: 7px 0 0 rgba(11,116,111,.13); }
.biology-mirror-marker strong { color: var(--muted); font-size: .72rem; line-height: 1.25; }
.biology-comparison-strip { margin-top: 18px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-top: 2px solid var(--navy); border-bottom: 1px solid var(--rule); }
.biology-comparison-strip > div { padding: 13px 16px; border-right: 1px solid var(--rule); }
.biology-comparison-strip > div:last-child { border-right: 0; }
.biology-comparison-strip strong, .biology-comparison-strip span { display: block; }
.biology-comparison-strip strong { color: var(--navy); font-family: "Source Serif 4", Georgia, serif; }
.biology-comparison-strip span { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.biology-case-study { display: grid; gap: 24px; }
.ibuprofen-pathway { margin-top: 16px; display: grid; grid-template-columns: minmax(0,1fr) 120px minmax(0,1fr); gap: 12px; align-items: center; }
.ibuprofen-pathway figure { min-width: 0; margin: 0; }
.ibuprofen-pathway img { width: 100%; height: 190px; display: block; object-fit: contain; }
.pathway-arrow { display: grid; gap: 5px; color: var(--muted); text-align: center; font-size: .76rem; }
.pathway-arrow strong { padding: 8px 0; border-top: 2px solid var(--teal); border-bottom: 2px solid var(--teal); color: var(--teal); font-size: 1.2rem; }
.biology-process-key { margin-top: 15px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); }
.biology-process-key > div { padding: 12px 14px 2px 0; }
.biology-process-key > div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.biology-process-key strong, .biology-process-key span { display: block; }
.biology-process-key span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.protein-evidence { margin-top: 2px; }
.protein-viewer { height: 410px; position: relative; border-radius: 12px; overflow: hidden; background: #e8edef; }
.protein-key { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.protein-key span { width: 12px; height: 12px; border-radius: 50%; background: #c4512d; box-shadow: 0 0 0 3px #f5ded6; }
.viewer-loading { min-height: 100%; display: grid; place-items: center; color: var(--muted); }
.protein-fallback { height: 100%; padding: 24px; display: grid; grid-template-columns: minmax(180px,.75fr) 1fr; gap: 24px; align-items: center; background: white; }
.protein-fallback img { width: 100%; height: 240px; object-fit: contain; }
.protein-fallback strong { font-family: "Source Serif 4", Georgia, serif; font-size: 1.1rem; }
.protein-fallback p { margin: 8px 0; color: var(--muted); }
.interconversion-marker { color: var(--teal); text-align: center; }
.interconversion-marker strong { display: block; font-size: 2rem; }
.interconversion-marker span { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.drug-journey-figure { margin: 0; }
.drug-journey-panel .table-scroll { margin-top: 22px; }
.case-study { margin-top: 24px; }
.case-study p { max-width: var(--reading); color: var(--muted); }
.source-note { font-size: .82rem; }

.exam-question { margin: 0; padding: 20px 0; border: 0; border-top: 1px solid var(--rule); }
.exam-question legend { max-width: var(--reading); padding: 0; font-family: "Source Serif 4", Georgia, serif; font-weight: 700; }
.marks { margin-left: 6px; color: var(--teal); font-family: "Source Sans 3", sans-serif; font-size: .78rem; }
.answers { margin-top: 12px; display: grid; gap: 8px; }
.answers label { padding: 11px 13px; display: flex; gap: 10px; align-items: start; border: 1px solid var(--rule); border-radius: 9px; background: white; }
.answers input { margin-top: 5px; accent-color: var(--teal); }
.mark-scheme { margin-top: 14px; padding: 15px 17px; background: var(--success-soft); }
.mark-scheme h4 { margin: 0 0 6px; }
.mark-scheme ul { margin: 0; padding-left: 20px; }
.mark-scheme[hidden] { display: none; }

.lesson-footer { width: min(var(--content), 100%); margin: 38px auto 0; padding-top: 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; border-top: 1px solid var(--rule); }
.lesson-footer p { margin: 0; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.lesson-footer .primary-button { justify-self: end; }
.lesson-footer button:disabled { cursor: not-allowed; opacity: .45; }
.source-footer { padding: 22px clamp(18px, 3vw, 42px); display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--rule); color: var(--muted); background: #f6f5f0; font-size: .78rem; }
.source-footer p { margin: 0; }
.source-footer div { display: flex; flex-wrap: wrap; gap: 14px; }

@media (min-width: 1000px) {
  .chapter-heading h1 { white-space: nowrap; }
}

@media (max-width: 1100px) {
  .page-layout { grid-template-columns: 215px minmax(0, 1fr); }
  .lesson-area { padding-inline: 30px; }
  .lesson-grid { grid-template-columns: minmax(0, 1fr); }
  .copy-column { max-width: 78ch; }
  .counting-workbench { grid-template-columns: 1fr; }
  .foundation-representations { grid-template-columns: 1fr; }
  .limonene-lesson { grid-template-columns: 1fr; }
  .limonene-mixture { grid-column: auto; }
  .polariser-lesson, .rotation-lesson { display: block; }
  .polariser-lesson > .lesson-grid, .rotation-lesson > .optical-rotation-copy { display: grid; }
  .polariser-lesson > .lesson-grid > .copy-column, .rotation-lesson > .optical-rotation-copy > .copy-column,
  .polariser-lesson .property-strip, .rotation-lesson .comparison-note, .polariser-lab, .rotation-comparison { grid-column: auto; grid-row: auto; }
  .polariser-lab, .rotation-comparison { margin-top: 30px; }
}

@media (max-width: 820px) {
  .site-header { min-height: 66px; padding: 10px 16px; }
  .brand small, .overall-progress { display: none; }
  .page-layout { display: block; }
  .chapter-rail {
    display: none;
    position: fixed;
    inset: 66px 0 auto 0;
    z-index: 20;
    max-height: calc(100vh - 66px);
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
  }
  .chapter-rail.open { display: block; }
  .rail-intro { display: none; }
  .lesson-area { padding: 26px 18px 20px; }
  .chapter-heading { margin-bottom: 16px; }
  .chapter-heading h1 { font-size: clamp(1.8rem, 8vw, 2.7rem); }
  .contents-toggle { display: inline-flex; align-items: center; }
  .step-tabs { margin-bottom: 24px; }
  .lesson-view { min-height: 440px; }
  .viewer3d { height: 320px; }
  .protein-viewer { height: 360px; }
  .compound-example-grid { grid-template-columns: 1fr; }
  .property-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .property-strip > div:nth-child(2) { border-right: 0; }
  .property-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .polariser-controls { grid-template-columns: 1fr; gap: 14px; }
  .polariser-controls .control-row { justify-content: flex-start; }
  .polarimeter-lesson { grid-template-columns: 1fr; }
  .source-footer { display: block; }
  .source-footer div { margin-top: 10px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .brand-icon { width: 34px; height: 34px; }
  .brand strong { font-size: 1.03rem; }
  .level-toggle { min-height: 40px; padding: 0 9px; font-size: .8rem; }
  .header-actions .level-toggle { width: 42px; padding: 0; font-size: 0; }
  .header-actions .level-toggle span { font-size: 1rem; }
  .chapter-heading { align-items: center; }
  .chapter-heading > div { min-width: 0; }
  .chapter-heading p:last-child { display: none; }
  .chapter-position { font-size: 1rem; }
  .chapter-heading h1 { font-size: 1.7rem; }
  .lesson-title { font-size: 1.75rem; }
  .lesson-lead { font-size: 1rem; }
  .diagram-panel, .exercise-panel, .instrument-panel, .case-study { padding: 16px; }
  .molecule-grid, .viewer-grid, .face-choice, .condition-switch { grid-template-columns: 1fr; }
  .mirror-pair { grid-template-columns: 1fr; }
  .alevel-pair { grid-template-columns: 1fr; }
  .mirror-marker { transform: rotate(90deg); }
  .alevel-pair .mirror-marker { transform: none; padding: 6px 0; }
  .stereo-example-grid { grid-template-columns: 1fr; }
  .static-stereo-figure figcaption { display: grid; gap: 2px; }
  .compact-bond-key { grid-template-columns: 1fr; }
  .compact-bond-key > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .compact-bond-key > div:last-child { border-bottom: 0; }
  .same-different-strip { grid-template-columns: 1fr; }
  .same-different-strip > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .same-different-strip > div:last-child { border-bottom: 0; }
  .model-section-heading { display: block; }
  .model-section-heading > p { margin-top: 8px; }
  .library-heading { grid-template-columns: 1fr; gap: 12px; }
  .overlay-key { position: static; border: 1px solid var(--rule); border-bottom: 0; border-radius: 10px 10px 0 0; }
  .practice-heading { display: grid; grid-template-columns: 1fr auto; }
  .practice-figure img { height: auto; min-height: 0; }
  .stereo-question-grid { grid-template-columns: 1fr; }
  .full-family-tree { padding-top: 10px; }
  .family-root { margin-bottom: 28px; }
  .family-root::after { height: 28px; }
  .family-main-branches { grid-template-columns: 1fr; gap: 30px; }
  .family-main-branches::before { display: none; }
  .family-group::before { height: 16px; }
  .family-group + .family-group { margin-top: 4px; }
  .family-leaves.three { grid-template-columns: repeat(3,1fr); }
  .family-leaves > span { padding-inline: 2px; font-size: .72rem; }
  .arrangement-divider { transform: none; }
  .achiral-example { grid-template-columns: 1fr; }
  .viewer3d { height: 300px; }
  .overlay-viewer { height: 340px; }
  .sample-meter, .condition-result { grid-template-columns: 1fr; }
  .property-strip { grid-template-columns: 1fr; }
  .property-strip > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .property-strip > div:last-child { border-bottom: 0; }
  .polariser-controls .field, .rotation-control { grid-template-columns: 1fr auto; }
  .polariser-controls .field input, .rotation-control input { grid-column: 1 / -1; grid-row: 2; }
  .polariser-controls .field output, .rotation-control output { grid-column: 2; grid-row: 1; }
  .rotation-dial-grid, .detector-plot-grid { grid-template-columns: 1fr; }
  .rotation-dial-grid figure + figure, .detector-plot-grid figure + figure { padding: 22px 0 0; border-top: 1px solid var(--rule); border-left: 0; }
  .sample-meter > div:first-child { grid-template-columns: 1fr; gap: 6px; }
  .meter-readouts { display: grid; grid-template-columns: 1fr 1fr; }
  .rotation-value, .detector-value { min-width: 0; }
  .detector-plot-heading { display: block; }
  .detector-plot-heading p { margin-top: 5px; }
  .parameter-explanation dl { grid-template-columns: 1fr; }
  .parameter-explanation dl > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .parameter-explanation dl > div:last-child { border-bottom: 0; }
  .limonene-pair { grid-template-columns: 1fr; }
  .limonene-pair .mirror-marker { transform: none; padding: 4px 0; }
  .limonene-pair .mirror-plane { width: 70px; height: 2px; box-shadow: 0 6px 0 rgba(11,116,111,.12); }
  .mixture-result { grid-template-columns: 1fr; gap: 12px; }
  .bond-meaning { grid-template-columns: 1fr; }
  .bond-meaning span { border-right: 0; border-bottom: 1px solid var(--rule); }
  .bond-meaning span:last-child { border-bottom: 0; }
  .enantiomer-product-pair, .mechanism-comparison-grid, .reaction-example-grid { grid-template-columns: 1fr; }
  .enantiomer-product-pair .mirror-marker { transform: none; padding: 4px 0; }
  .enantiomer-product-pair .mirror-plane { width: 70px; height: 2px; box-shadow: 0 6px 0 rgba(11,116,111,.12); }
  .product-structure-card img { height: 220px; }
  .binding-readout, .biology-comparison-strip, .biology-process-key, .protein-fallback { grid-template-columns: 1fr; }
  .biology-molecule-pair, .ibuprofen-pathway { grid-template-columns: 1fr; }
  .biology-mirror-marker::before { width: 72px; height: 2px; box-shadow: 0 6px 0 rgba(11,116,111,.13); }
  .biology-molecule-card img { height: 225px; }
  .biology-comparison-strip > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .biology-comparison-strip > div:last-child { border-bottom: 0; }
  .pathway-arrow { margin: 2px 0; }
  .pathway-arrow strong { width: min(220px,100%); margin: 0 auto; }
  .biology-process-key > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .protein-fallback { padding: 16px; }
  .protein-fallback img { height: 170px; }
  .thalidomide-pair .interconversion-marker { padding: 2px 0; }
  .binding-model { min-width: 660px; }
  .binding-stage { overflow-x: auto; }
  .lesson-footer { grid-template-columns: 1fr 1fr; }
  .lesson-footer p { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .lesson-footer .secondary-button { grid-column: 1; }
  .lesson-footer .primary-button { grid-column: 2; width: 100%; }
  .source-footer div { display: grid; gap: 8px; }
}

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