:root {
  color-scheme: light dark;
  --palette-ink: #2b2d42;
  --palette-muted: #8d99ae;
  --palette-light: #edf2f4;
  --palette-red: #ef233c;
  --palette-red-deep: #d90429;
  --bg: var(--palette-light);
  --surface: color-mix(in srgb, var(--palette-light) 88%, var(--palette-muted));
  --surface-strong: color-mix(in srgb, var(--palette-light) 76%, var(--palette-muted));
  --text: var(--palette-ink);
  --muted: color-mix(in srgb, var(--palette-ink) 68%, var(--palette-muted));
  --line: color-mix(in srgb, var(--palette-muted) 54%, var(--palette-light));
  --accent: var(--palette-red-deep);
  --accent-strong: var(--palette-red-deep);
  --accent-hover: color-mix(in srgb, var(--palette-red-deep) 78%, var(--palette-ink));
  --accent-text: var(--palette-light);
  --accent-soft: color-mix(in srgb, var(--palette-red) 12%, var(--palette-light));
  --warning: var(--palette-red);
  --danger: var(--palette-red-deep);
  --blue: var(--palette-muted);
  --radius: 8px;
  --shadow: 0 22px 70px rgb(43 45 66 / 0.16);
  --shadow-tight: 0 12px 36px rgb(43 45 66 / 0.13);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--palette-ink);
    --surface: color-mix(in srgb, var(--palette-ink) 84%, var(--palette-muted));
    --surface-strong: color-mix(in srgb, var(--palette-ink) 70%, var(--palette-muted));
    --text: var(--palette-light);
    --muted: var(--palette-muted);
    --line: color-mix(in srgb, var(--palette-muted) 42%, var(--palette-ink));
    --accent: var(--palette-red-deep);
    --accent-strong: var(--palette-light);
    --accent-hover: color-mix(in srgb, var(--palette-red-deep) 74%, var(--palette-ink));
    --accent-text: var(--palette-light);
    --accent-soft: color-mix(in srgb, var(--palette-red) 22%, var(--palette-ink));
    --warning: var(--palette-red);
    --danger: var(--palette-red);
    --blue: var(--palette-muted);
    --shadow: 0 24px 80px rgb(43 45 66 / 0.52);
    --shadow-tight: 0 14px 44px rgb(43 45 66 / 0.42);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: var(--palette-light);
  --surface: color-mix(in srgb, var(--palette-light) 88%, var(--palette-muted));
  --surface-strong: color-mix(in srgb, var(--palette-light) 76%, var(--palette-muted));
  --text: var(--palette-ink);
  --muted: color-mix(in srgb, var(--palette-ink) 68%, var(--palette-muted));
  --line: color-mix(in srgb, var(--palette-muted) 54%, var(--palette-light));
  --accent: var(--palette-red-deep);
  --accent-strong: var(--palette-red-deep);
  --accent-hover: color-mix(in srgb, var(--palette-red-deep) 78%, var(--palette-ink));
  --accent-text: var(--palette-light);
  --accent-soft: color-mix(in srgb, var(--palette-red) 12%, var(--palette-light));
  --warning: var(--palette-red);
  --danger: var(--palette-red-deep);
  --blue: var(--palette-muted);
  --shadow: 0 22px 70px rgb(43 45 66 / 0.16);
  --shadow-tight: 0 12px 36px rgb(43 45 66 / 0.13);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--palette-ink);
  --surface: color-mix(in srgb, var(--palette-ink) 84%, var(--palette-muted));
  --surface-strong: color-mix(in srgb, var(--palette-ink) 70%, var(--palette-muted));
  --text: var(--palette-light);
  --muted: var(--palette-muted);
  --line: color-mix(in srgb, var(--palette-muted) 42%, var(--palette-ink));
  --accent: var(--palette-red-deep);
  --accent-strong: var(--palette-light);
  --accent-hover: color-mix(in srgb, var(--palette-red-deep) 74%, var(--palette-ink));
  --accent-text: var(--palette-light);
  --accent-soft: color-mix(in srgb, var(--palette-red) 22%, var(--palette-ink));
  --warning: var(--palette-red);
  --danger: var(--palette-red);
  --blue: var(--palette-muted);
  --shadow: 0 24px 80px rgb(43 45 66 / 0.52);
  --shadow-tight: 0 14px 44px rgb(43 45 66 / 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 42%, transparent), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(color-mix(in srgb, var(--palette-ink) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--palette-ink) 7%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, var(--palette-ink), transparent 65%);
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
textarea,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  transform: translateY(-140%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.nav-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 780;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  min-width: 48px;
  height: 38px;
  place-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 24px);
  min-width: 0;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 660;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.theme-toggle__track {
  position: relative;
  display: block;
  width: 36px;
  height: 18px;
}

.theme-toggle__knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -4px -2px 0 color-mix(in srgb, var(--bg) 70%, transparent);
  transition: transform 220ms ease;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__knob {
  transform: translateX(18px);
}

main {
  overflow: hidden;
}

.hero,
.study-strip,
.map-zone,
.journey,
.anatomy,
.headers,
.risks,
.quiz-zone,
.guide,
.references,
.glossary {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  align-items: center;
  gap: clamp(28px, 6vw, 74px);
  min-height: calc(100dvh - 68px);
  padding: clamp(46px, 7vw, 82px) 0 clamp(34px, 6vw, 68px);
}

.hero-copy {
  display: grid;
  gap: 22px;
  max-width: 650px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 14ch;
  font-size: clamp(3.15rem, 8vw, 6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  max-width: 12ch;
  font-size: clamp(2.15rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  font-size: clamp(1.28rem, 2.1vw, 1.95rem);
  line-height: 1.15;
}

.hero-lede {
  max-width: 50ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
}

.hero-actions,
.simulation-controls,
.quiz-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button-secondary,
.button-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: var(--accent);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.hero-visual {
  position: relative;
  min-height: 520px;
  isolation: isolate;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: min(540px, 58vw);
  min-height: 420px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  position: absolute;
  right: clamp(14px, 4vw, 42px);
  bottom: -24px;
  display: grid;
  gap: 8px;
  width: min(350px, 84%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(18px);
}

.hero-card span,
.journey-meta span,
.detail-kicker,
.reference-kicker,
.result-badge {
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 820;
}

.hero-card strong {
  font-size: 1.02rem;
  line-height: 1.35;
}

.study-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 32px 0 86px;
}

.study-strip article {
  min-height: 124px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.study-strip span {
  display: block;
  color: var(--accent-strong);
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  font-weight: 860;
  line-height: 0.95;
}

.study-strip p {
  max-width: 24ch;
  color: var(--muted);
  font-weight: 650;
}

.map-zone,
.journey,
.anatomy,
.headers,
.risks,
.quiz-zone,
.guide,
.references,
.glossary {
  padding: clamp(70px, 10vw, 116px) 0;
}

.section-heading {
  display: grid;
  gap: 18px;
  max-width: 740px;
  margin-bottom: clamp(28px, 5vw, 48px);
}

.section-heading p {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.06rem;
}

.map-workbench,
.journey-grid,
.anatomy-grid,
.headers-lab,
.risk-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(320px, 0.92fr);
  gap: 16px;
  align-items: stretch;
}

.concept-diagram,
.map-detail,
.journey-track,
.journey-detail,
.part-detail,
.headers-input,
.headers-output,
.risk-panel,
.quiz-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.concept-diagram {
  min-height: 560px;
  overflow: hidden;
}

.map-detail,
.journey-detail,
.part-detail,
.headers-output,
.risk-panel,
.quiz-card {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
}

.fallback-graph {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
}

.fallback-graph button,
.node-button,
.part-chip,
.quiz-option,
.mode-button,
.signal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--text);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.fallback-graph button,
.node-button,
.part-chip,
.mode-button {
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 720;
}

.fallback-graph button:hover,
.node-button:hover,
.part-chip:hover,
.quiz-option:hover,
.mode-button:hover,
.signal-card:hover {
  border-color: var(--accent);
}

.fallback-graph button.is-active,
.node-button.is-active,
.part-chip.is-active,
.mode-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.detail-lede {
  color: var(--muted);
  font-size: 1.04rem;
}

.detail-list,
.protocol-list,
.result-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.detail-list li,
.protocol-list li,
.result-list li {
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.map-links,
.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.map-links a,
.reference-links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent-strong);
  font-weight: 760;
  text-decoration: none;
}

.map-links a:hover,
.reference-links a:hover {
  border-color: var(--accent);
}

.journey-track {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.journey-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  cursor: pointer;
}

.journey-step.is-active {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface);
}

.journey-step span:first-child {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 840;
}

.journey-step strong {
  display: block;
  line-height: 1.25;
}

.journey-step small {
  color: var(--muted);
  font-weight: 650;
}

.journey-meta,
.quiz-meta,
.risk-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.flow-lab {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 66%, transparent);
}

.flow-piece {
  display: grid;
  grid-template-columns: minmax(88px, 0.34fr) 1fr;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 84%, var(--bg));
}

.flow-piece span {
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 820;
}

.anatomy-grid {
  grid-template-columns: minmax(360px, 0.95fr) minmax(340px, 1.05fr);
}

.message-surface {
  display: grid;
  gap: 10px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 45%),
    var(--surface);
  box-shadow: var(--shadow-tight);
}

.message-row,
.message-body {
  display: grid;
  grid-template-columns: minmax(96px, 0.25fr) 1fr;
  gap: 14px;
  align-items: start;
  min-height: 54px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  cursor: pointer;
}

.message-row.is-active,
.message-body.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.message-row span,
.message-body span,
.headers-input label,
.reference-search label {
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 820;
}

.message-row strong,
.message-body p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.part-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.headers-lab {
  grid-template-columns: minmax(380px, 1fr) minmax(340px, 0.9fr);
}

.headers-input {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
}

.headers-input input,
.headers-input select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 72%, var(--surface));
  color: var(--text);
  font: inherit;
}

.headers-input input:focus-visible,
.headers-input select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.headers-input textarea {
  width: 100%;
  min-height: 440px;
  resize: vertical;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 72%, var(--surface));
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.result-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
}

.result-card.good {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.result-card.warn {
  border-color: color-mix(in srgb, var(--warning) 56%, var(--line));
}

.result-card.bad {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--line));
}

.header-table {
  display: grid;
  gap: 8px;
}

.header-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.header-row span:first-child {
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 820;
}

.header-row span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.risk-workbench {
  grid-template-columns: minmax(360px, 1.05fr) minmax(320px, 0.95fr);
}

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

.signal-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  min-height: 122px;
  padding: 16px;
}

.signal-card input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.signal-card strong {
  display: block;
  line-height: 1.25;
}

.signal-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.risk-score {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 88%, var(--bg));
}

.risk-score strong {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.95;
}

.risk-score[data-level="medio"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--warning) 18%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 88%, var(--bg));
}

.risk-score[data-level="alto"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--danger) 18%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 88%, var(--bg));
}

.guide-grid,
.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-card,
.reference-card {
  display: grid;
  gap: 14px;
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.guide-card:nth-child(2n) {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    var(--surface);
}

.guide-card:nth-child(3n) {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--warning) 13%, transparent), transparent 62%),
    var(--surface);
}

.guide-card ul {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  margin: 0;
  color: var(--muted);
}

.reference-tools {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 1.2fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.reference-search {
  display: grid;
  gap: 8px;
}

.reference-search input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.reference-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reference-filter {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.reference-filter.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.reference-card {
  min-height: 250px;
}

.reference-card p {
  color: var(--muted);
}

.quiz-card {
  max-width: 820px;
}

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

.quiz-option {
  min-height: 58px;
  padding: 14px;
  text-align: left;
  font-weight: 720;
}

.quiz-option.is-correct {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.quiz-option.is-wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

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

details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

summary {
  cursor: pointer;
  padding: 18px 20px;
  color: var(--accent-strong);
  font-weight: 800;
}

details p {
  padding: 0 20px 20px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 760;
}

.section-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
}

.section-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .section-reveal {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1020px) {
  .nav-shell {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding: 0 0 12px;
  }

  .hero,
  .map-workbench,
  .journey-grid,
  .anatomy-grid,
  .headers-lab,
  .risk-workbench,
  .reference-tools {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: auto;
  }

  .hero-visual img {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .concept-diagram {
    min-height: 460px;
  }
}

@media (max-width: 760px) {
  .hero,
  .study-strip,
  .map-zone,
  .journey,
  .anatomy,
  .headers,
  .risks,
  .quiz-zone,
  .guide,
  .references,
  .glossary,
  .site-footer {
    width: calc(100% - 24px);
    max-width: 1180px;
  }

  .hero-copy,
  .hero-lede {
    min-width: 0;
    max-width: 100%;
  }

  .hero-lede {
    max-width: 31ch;
  }

  .hero-card {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .hero-card strong {
    max-width: 28ch;
    overflow-wrap: anywhere;
  }

  h1 {
    max-width: 8ch;
    font-size: clamp(3rem, 14vw, 4.4rem);
  }

  .study-strip,
  .guide-grid,
  .reference-grid,
  .signal-list,
  .glossary-list,
  .quiz-options,
  .fallback-graph {
    grid-template-columns: 1fr;
  }

  .message-row,
  .message-body,
  .flow-piece,
  .header-row {
    grid-template-columns: 1fr;
  }

  .headers-input textarea {
    min-height: 360px;
  }
}
