:root {
  color-scheme: dark;
  --ground: #08090b;
  --text: #f4f5f7;
  --muted: #b4b7c0;
  --blue: #8ca9df;
  --divider: #ffffff20;
  --top-height: 74px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: var(--top-height); scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--ground); font: 1rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button, summary, select, input[type="range"] { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #a7c3ff; outline-offset: 4px; }
h1:focus, h2:focus, .question:focus, .quiz-result:focus { outline: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
p { text-wrap: pretty; }
p + p { margin-top: .78rem; }
.shell { width: min(1136px, calc(100% - 104px)); margin-inline: auto; }

.topbar { position: fixed; z-index: 4; top: 0; inset-inline: 0; pointer-events: none; }
.topbar::before { content: ""; position: absolute; inset: 0 0 -23px; background: linear-gradient(#08090bf8, #08090bed 36%, #08090b00); }
.top-inner { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; min-height: var(--top-height); }
.top-inner a, .top-actions { pointer-events: auto; }
.brand { justify-self: start; font-size: 1.03rem; font-weight: 650; letter-spacing: -.025em; text-decoration: none; text-shadow: 0 1px 8px #08090b; }
#chapter-name { color: var(--muted); font-size: .88rem; text-shadow: 0 1px 8px #08090b, 0 1px 12px #08090b; }

.top-actions, details nav, .scroll-cue, .button, .source-select, .preset-row {
  border: 1px solid #ffffff30;
  background: radial-gradient(ellipse at 15% 0%, #ffffff29, #ffffff08 58%, transparent 85%), #13161bad;
  box-shadow: inset 0 1px 0 #ffffff32, inset 0 -1px 1px #b4bdcf24, 0 9px 24px #0004;
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}
.top-actions { display: flex; align-items: center; gap: 2px; justify-self: end; padding: 3px; border-radius: 999px; }
details { position: relative; }
summary, .icon-btn { display: flex; align-items: center; justify-content: center; gap: .57rem; min-height: 40px; border: 0; border-radius: 999px; background: transparent; }
summary { list-style: none; padding-inline: .85rem; font-size: .9rem; font-weight: 610; }
summary::-webkit-details-marker { display: none; }
summary:hover, details[open] summary, .icon-btn:hover { background: #ffffff19; }
.menu-icon { display: inline-block; position: relative; width: 13px; height: 8px; border-block: 1px solid currentColor; opacity: .9; }
.menu-icon::after { content: ""; position: absolute; top: 3px; left: 0; width: 9px; border-top: 1px solid currentColor; }
.icon-btn { width: 40px; padding: 0; }
.expand-icon { width: 14px; height: 14px; color: #e2e5ee; background: linear-gradient(currentColor,currentColor) 0 0/5px 1px, linear-gradient(currentColor,currentColor) 0 0/1px 5px, linear-gradient(currentColor,currentColor) 100% 0/5px 1px, linear-gradient(currentColor,currentColor) 100% 0/1px 5px, linear-gradient(currentColor,currentColor) 0 100%/5px 1px, linear-gradient(currentColor,currentColor) 0 100%/1px 5px, linear-gradient(currentColor,currentColor) 100% 100%/5px 1px, linear-gradient(currentColor,currentColor) 100% 100%/1px 5px; background-repeat: no-repeat; }
details nav { position: absolute; top: calc(100% + 10px); right: -40px; width: min(270px, calc(100vw - 40px)); max-height: calc(100svh - var(--top-height) - 16px); overflow: auto; padding: .46rem; border-radius: 22px; background-color: #15171de8; }
details nav a { display: block; padding: .57rem .77rem; border-radius: 14px; text-decoration: none; color: #d0d2d9; font-size: .95rem; }
details nav a:hover, details nav a[aria-current="location"] { color: white; background: #ffffff18; }
.fullscreen-status { position: absolute; top: calc(100% + 2px); right: max(20px, calc((100% - 1136px) / 2)); }
.fullscreen-status:not(:empty) { padding: .65rem .9rem; max-width: min(300px, 90vw); border-radius: 14px; background: #20232a; font-size: .9rem; }
#chapter-progress { position: fixed; z-index: 5; top: 0; inset-inline: 0; height: 2px; pointer-events: none; }
#chapter-progress > div { height: 100%; background: #6283c9; transform: scaleX(0); transform-origin: left; }

.slide { min-height: calc(100svh - var(--top-height)); padding-block: clamp(4rem, 10vh, 8rem); }
.slide:not(.hero) { display: flex; flex-direction: column; justify-content: center; }
.slide + .slide { border-top: 1px solid var(--divider); }
.scroll-reveal {
  opacity: calc(.08 + var(--reveal, 1) * .92);
  transform: translateY(calc((1 - var(--reveal, 1)) * 30px));
}
.scroll-reveal:focus-within { opacity: 1; transform: none; }
.hero { position: relative; isolation: isolate; display: grid; align-items: center; min-height: 100svh; padding-top: calc(var(--top-height) + 2.6rem); }
.hero-copy { position: relative; z-index: 1; width: fit-content; }
.eyebrow { color: #c0c9db; font-size: .95rem; font-weight: 600; letter-spacing: -.014em; }
h1 { margin: .53rem 0 .95rem; font: 650 clamp(4rem, 8.1vw, 7.3rem)/.97 var(--display); letter-spacing: -.079em; }
h1 span { display: block; margin-top: .34em; color: #bec3ce; font-size: .44em; font-weight: 570; letter-spacing: -.05em; }
.intro { max-width: 24rem; margin-bottom: 1.6rem; color: var(--muted); font-size: clamp(1.05rem, 1.55vw, 1.2rem); }
.hero-visual {
  --wave-mask: radial-gradient(ellipse at 61% 50%, #000 32%, #000d 55%, transparent 81%);
  position: absolute; z-index: -1; inset: 0 -48px 0 25%; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse at 66% 49%, #1724477d, transparent 57%);
  mask-image: var(--wave-mask), linear-gradient(90deg, #000 75%, transparent);
  mask-composite: intersect;
}
#hero-art { display: block; width: 100%; height: 100%; }
.scroll-cue, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .57rem; min-height: 44px;
  padding: .63rem 1.05rem; border-radius: 999px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 625;
  transition: background-color .22s ease, scale .26s ease;
}
.scroll-cue:hover, .button:hover:not(:disabled) { background-color: #343a47c4; }
.scroll-cue:active, .button:active:not(:disabled) { scale: .98; }
.scroll-cue span { position: relative; width: 13px; height: 19px; border: 1px solid #b1bed2; border-radius: 8px; }
.scroll-cue span::after { position: absolute; inset: 3px 4px auto; height: 4px; content: ""; border-radius: 2px; background: #b4c6e7; }
.button.primary { background-color: #23395d; border-color: #91add480; }
.button.primary:hover { background-color: #324e79; }
.button:disabled { opacity: .55; }

.section-head { max-width: 850px; margin-bottom: clamp(1.75rem, 5vh, 3.2rem); }
.section-head .eyebrow { margin-bottom: .57rem; }
h2 { font: 640 clamp(2.45rem, 5.45vw, 4.6rem)/1.01 var(--display); letter-spacing: -.062em; text-wrap: balance; }
.section-head > p:last-child:not(.eyebrow) { margin-top: .86rem; max-width: 660px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.15rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.48rem); font-weight: 640; letter-spacing: -.034em; line-height: 1.22; }
.split, .final-grid { display: grid; grid-template-columns: 1.24fr .88fr; gap: clamp(1.55rem, 4.7vw, 4.3rem); align-items: center; }
.panel { min-width: 0; padding: clamp(1rem, 2.7vw, 1.7rem); border-radius: 25px; background: #14161b; box-shadow: inset 0 1px 0 #ffffff0e; }
.text-panel { padding: 0; background: none; box-shadow: none; }
.panel p:not(.formula):not(.big-number), .application p, .insight { color: var(--muted); }
.panel p strong, .application strong, .insight strong { color: var(--text); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .85rem; }
.tag { flex: none; color: #b3c9ed; font: 600 .82rem/1.25 var(--sans); }
.plot, #globe { display: block; width: 100%; height: 155px; border-radius: 14px; background: #0c0e12; }
.axis { display: flex; justify-content: space-between; margin-top: .42rem; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.range-row { display: grid; grid-template-columns: 1fr auto; column-gap: .56rem; row-gap: .3rem; align-items: center; margin-top: .9rem; }
.range-row label { font-weight: 620; }
.range-row output { color: #d4dff3; font-weight: 640; font-variant-numeric: tabular-nums; }
input[type="range"] { grid-column: 1 / -1; width: 100%; min-height: 27px; margin: 0; accent-color: #7795d0; }
.preset-row, .source-select { display: flex; flex-wrap: wrap; width: fit-content; gap: 2px; padding: 3px; border-radius: 999px; }
.preset-row { margin-top: .48rem; backdrop-filter: none; -webkit-backdrop-filter: none; }
.source-select { margin-bottom: .9rem; }
.preset-row button, .source-select button { min-height: 38px; padding: .37rem .72rem; border: 0; border-radius: 999px; background: transparent; color: #cdd0d8; font-size: .89rem; }
.preset-row button:hover, .source-select button:hover { background: #ffffff12; }
.preset-row button[aria-pressed="true"], .source-select button[aria-pressed="true"] { color: #f3f5fa; background: #3a4b68; box-shadow: inset 0 1px 0 #ffffff26; }
.formula { margin-block: .7rem; color: #edf0f7; font-size: clamp(2rem, 5vw, 3.3rem); letter-spacing: -.065em; line-height: 1.1; }
.measurements { margin-block: .85rem; border-top: 1px solid var(--divider); padding-top: .42rem; }
.measurements div { display: flex; justify-content: space-between; align-items: center; gap: .45rem; padding-block: .25rem; }
.measurements dt { color: var(--muted); font-size: .94rem; }
.measurements dd { white-space: nowrap; font-weight: 650; font-variant-numeric: tabular-nums; }
.secondary { font-size: .9rem; }
.source-copy h3, .detector-controls h3, .case-metrics h3 { margin-bottom: .65rem; }
.signal-panel .plot { height: 175px; }
.signal-panel .secondary { margin-top: .65rem; }
.diagram-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem .8rem; margin: 1.2rem 0 .55rem; }
.diagram-top h3 { font-size: 1.02rem; }
.diagram-top .button { padding: .4rem .72rem; min-height: 38px; }
.diagram-caption { margin-top: .65rem; }
.particle-plot { height: 148px; }
.trace-plot { height: 108px; }
.spectrum-plot { height: 107px; }
.audio-player { margin-top: 1.05rem; padding-top: .88rem; border-top: 1px solid var(--divider); }
.audio-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.audio-heading strong { font-size: .92rem; font-weight: 650; }
.audio-player .audio-description, .audio-player .audio-status { margin: .35rem 0 0; font-size: .84rem; color: var(--muted); }
.audio-status:empty { display: none; }
.audio-actions { display: flex; flex-wrap: wrap; gap: .42rem; margin-top: .65rem; }
.audio-actions .button { min-height: 39px; padding: .42rem .78rem; font-size: .84rem; }
.audio-actions [aria-pressed="true"] { border-color: #adc8fa; background-color: #253e68; }
.audio-indicator { display: flex; align-items: center; gap: 3px; height: 20px; color: #a7c6ff; }
.audio-indicator i { width: 2px; height: 8px; border-radius: 2px; background: currentColor; opacity: .6; }
.audio-indicator i:nth-child(even) { height: 14px; }
.audio-player[data-playing="true"] .audio-indicator i { opacity: 1; animation: audio-level .75s ease-in-out infinite alternate; }
.audio-player[data-playing="true"] .audio-indicator i:nth-child(2) { animation-delay: -.35s; }
.audio-player[data-playing="true"] .audio-indicator i:nth-child(3) { animation-delay: -.16s; }
@keyframes audio-level { from { transform: scaleY(.45); } to { transform: scaleY(1.24); } }
.source-link, .bibliography a { color: #b3c9ee; text-underline-offset: .24em; }
.source-link { display: inline-block; margin-top: .87rem; font-size: .9rem; }
.source-link:hover, .bibliography a:hover { color: white; }
.detector-plot { height: 245px; }
.detector-key { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .6rem; color: var(--muted); font-size: .86rem; }
.detector-key span { display: inline-flex; align-items: center; gap: .45rem; }
.detector-key i { width: 8px; height: 8px; border: 1px solid #c7cad4; border-radius: 50%; }
.detector-key span + span i { width: 15px; height: 2px; border: 0; border-radius: 0; background: #6386c9; }
.detector-controls label { display: block; color: var(--muted); font-size: .91rem; }
select { appearance: none; width: 100%; min-height: 44px; margin: .38rem 0 .7rem; padding: .45rem 2rem .45rem .8rem; border: 1px solid var(--divider); border-radius: 12px; background: linear-gradient(45deg,transparent 50%,#bac1ce 50%) calc(100% - 15px) 50% / 5px 5px no-repeat, linear-gradient(135deg,#bac1ce 50%,transparent 50%) calc(100% - 10px) 50% / 5px 5px no-repeat, #171a20; }
.arrival { display: flex; gap: .45rem; margin: .85rem 0; padding: 0; list-style: none; }
.arrival li { flex: 1; padding: .4rem .2rem; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.arrival b { margin-right: .35rem; }
.arrival span { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
#globe { height: 260px; }
.big-number { margin: .42rem 0 .83rem; color: var(--text); font-size: clamp(2.55rem, 5.8vw, 4.45rem); letter-spacing: -.07em; line-height: 1.03; }
.application { display: grid; grid-template-columns: .8fr 1.25fr .56fr; align-items: baseline; gap: 1.45rem; padding-block: 1.3rem; border-top: 1px solid var(--divider); }
.application .source-link { margin-top: 0; }
.insight { margin-top: .85rem; font-size: .92rem; }
.insight p { margin-top: .25rem; max-width: 680px; }
.lab-links, .lab-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.lab-links { margin-bottom: 1.7rem; }
.lab-actions { margin-top: 1.15rem; }
.interactive-lab { padding: clamp(1.05rem, 3vw, 2rem); }
.medical-grid, .balloon-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: clamp(1.15rem, 4.2vw, 3.4rem); }
.lab-display, .lab-control { min-width: 0; }
.cardiac-route { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: .7rem; margin-bottom: 1.05rem; color: #d0d8e7; font-size: .85rem; }
.cardiac-path { position: relative; display: grid; justify-items: center; padding-bottom: .32rem; border-bottom: 1px solid #6c8ab566; color: var(--muted); text-align: center; font-size: .75rem; }
.cardiac-path i { position: absolute; bottom: 0; left: var(--travel, 0%); width: 8px; height: 8px; border-radius: 50%; background: #c1d5ff; box-shadow: 0 0 12px #7298df; opacity: var(--pulse-strength, 0); transform: translate(-50%, 50%); }
.lab-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .35rem .8rem; margin-bottom: .65rem; color: var(--muted); font-size: .9rem; }
.lab-legend span:first-child { color: var(--text); font-weight: 620; }
.cardiac-track { position: relative; overflow: hidden; border-radius: 14px; }
.cardiac-plot { height: clamp(110px, 13vw, 148px); }
#ecg-plot { cursor: crosshair; }
.cardiac-legend { margin-top: 1rem; }
.cardiac-cursor { position: absolute; inset: 0 auto 0 0; width: 2px; background: #e0ebff; box-shadow: 0 0 12px #759dea; pointer-events: none; }
.cardiac-markers { position: absolute; inset: 0; pointer-events: none; }
.cardiac-marker { position: absolute; inset-block: 0; width: 1px; border-left: 1px dashed #a3c7ff; }
.cardiac-marker::before { content: ""; position: absolute; top: 7px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: #dce9ff; }
.cardiac-measure { margin-top: 1rem; padding-top: .95rem; border-top: 1px solid var(--divider); }
.cardiac-measure h3 { font-size: 1.08rem; margin-bottom: .35rem; }
.beat-options { display: flex; flex-wrap: wrap; gap: .38rem; margin-block: .65rem; }
.beat-options button { min-height: 34px; padding: .25rem .53rem; border: 1px solid var(--divider); border-radius: .65rem; background: #1c212c; color: #e1e7f2; font-size: .8rem; font-variant-numeric: tabular-nums; }
.beat-options button:hover, .beat-options button[aria-pressed="true"] { background: #344c76; border-color: #91add4; }
#cardiac-measured { color: #c7d8f7; min-height: 2.8em; font-variant-numeric: tabular-nums; }
.balloon-plot { height: clamp(252px, 32vw, 330px); }
.balloon-phases { display: grid; grid-template-columns: 1fr 1.25fr .8fr; gap: 4px; margin: .6rem 0 0; padding: 0; list-style: none; }
.balloon-phases li { padding-block: .38rem; border-top: 2px solid #c3d5f33b; color: var(--muted); font-size: .76rem; }
.balloon-phases li[aria-current="step"] { border-color: #b0caff; color: var(--text); }
.balloon-phases li[data-complete="true"] { border-color: #5679b3; }
.balloon-trace-title { margin-top: .8rem; }
.balloon-case { margin-top: .92rem; }
.balloon-timing dd { color: #d3e1fa; }
#balloon-status { min-height: 2.8em; }
.lab-control .measurements { margin-top: 1.1rem; }
.lab-note { max-width: 850px; margin-top: 1.2rem; color: var(--muted); font-size: .92rem; }
.lab-note strong { color: var(--text); }
.lab-note a { color: #b3c9ee; text-underline-offset: .21em; }
.quiz-card { max-width: 750px; }
.quiz-meta { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .83rem; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.question { margin-bottom: .9rem; }
.quiz-options { display: grid; grid-template-columns: repeat(2,1fr); gap: .6rem; }
.quiz-options button { display: flex; align-items: center; gap: .64rem; min-height: 49px; padding: .55rem .7rem; border: 1px solid var(--divider); border-radius: 13px; background: #171b22; text-align: left; }
.quiz-options button:not(:disabled):hover { background: #2b303a; }
.quiz-options button[data-state="correct"] { border-color: #7a99d2; background: #2b4169; }
.quiz-options button[data-state="incorrect"] { border-style: dashed; border-color: #a1a4ae; }
.option-letter { flex: 0 0 1rem; color: var(--muted); font-size: .82rem; }
.quiz-card .feedback { margin: .85rem 0 .68rem; color: var(--text); }
.quiz-result p { margin: .65rem 0 1rem; }
.final-grid { grid-template-columns: 1fr 1fr; align-items: start; }
.takeaways ol, .bibliography ul { padding-left: 1.25rem; margin-block: .2rem 1rem; }
.takeaways li, .bibliography li { padding-block: .28rem; color: var(--muted); }
.takeaways strong { color: var(--text); }
.bibliography ul { margin-top: .65rem; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 64px); }
  .hero-visual { right: -28px; }
}
@media (max-width: 680px) {
  :root { --top-height: 65px; }
  .shell { width: calc(100% - 36px); }
  .top-inner { grid-template-columns: 1fr auto; gap: .45rem; }
  #chapter-name { display: none; }
  .hero { min-height: 100svh; align-items: start; padding-top: clamp(7.2rem, 19svh, 11rem); }
  .hero-visual { --wave-mask: radial-gradient(ellipse at 55% 52%, #000 27%, #000b 59%, transparent 83%); inset: 25% -17px 0; }
  h1 { font-size: clamp(3.35rem, 13vw, 5.4rem); }
  h1 span { font-size: .5em; }
  .intro { max-width: 19rem; }
  .slide:not(.hero) { min-height: auto; padding-block: 3.3rem 4.4rem; }
  .split, .final-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .medical-grid, .balloon-grid { grid-template-columns: 1fr; }
  .application { grid-template-columns: 1fr; gap: .36rem; }
  .application .source-link { margin-top: .15rem; }
  .quiz-options { grid-template-columns: 1fr; }
}
@media (max-width: 365px) {
  .icon-btn { width: 36px; }
  summary { padding-inline: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .scroll-reveal { opacity: 1; transform: none; }
}
