:root {
  color-scheme: light;
  --paper: #f5f6f4;
  --white: #fff;
  --ink: #102837;
  --muted: #455d68;
  --blue: #1d5169;
  --copper: #a45a3c;
  --rule: #cad5d8;
  --tint: #e8f0f2;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: var(--blue); text-underline-offset: .2em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #307da1;
  outline-offset: 3px;
}
h1, h2, h3, p, dl { margin: 0; }
.shell { width: min(1410px, calc(100% - 64px)); margin-inline: auto; }
.sr-only {
  position: absolute; overflow: hidden; width: 1px; height: 1px;
  padding: 0; margin: -1px; clip-path: inset(50%); white-space: nowrap;
}
.masthead { background: #fbfcfb; border-bottom: 1px solid var(--rule); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); font-size: 1.27rem; font-weight: 770; letter-spacing: -.055em; text-decoration: none; white-space: nowrap; }
.brand-em { color: #265871; }
.brand small { font-size: .66em; margin-left: 1px; }
.brand-icon {
  position: relative; display: block; flex: 0 0 auto; width: 31px; height: 31px;
  border-radius: 10px; background: var(--ink); transform: rotate(-10deg);
}
.brand-icon::before { content: ""; position: absolute; width: 15px; height: 14px; left: 8px; top: 8px; border: 1px solid #adccd6; transform: rotate(30deg); border-radius: 3px; }
.brand-icon i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #d9f0f6; }
.brand-icon i:nth-child(1) { left: 11px; top: 6px; }
.brand-icon i:nth-child(2) { right: 6px; top: 13px; }
.brand-icon i:nth-child(3) { left: 13px; bottom: 6px; }
.brand-icon i:nth-child(4) { left: 6px; bottom: 13px; }
.masthead-actions { display: flex; align-items: center; gap: 19px; font-size: .86rem; font-weight: 650; }
.share, .secondary, .primary {
  border: 1px solid #aabdc5; border-radius: 8px; padding: .6rem .9rem;
  min-height: 43px; background: var(--white); font-weight: 720;
}
.share:hover, .secondary:hover, .quiet-action:hover { background: var(--tint); }
.primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.primary:hover { background: #13394d; }
.intro { padding-block: clamp(25px, 4vw, 54px) 22px; }
.intro h1 { font: 500 clamp(2.35rem, 4.25vw, 5rem)/.98 var(--serif); letter-spacing: -.065em; }
.intro em { color: var(--copper); font-weight: 400; }
.intro p { margin-top: 13px; color: var(--muted); font-size: clamp(.94rem, 1.4vw, 1.15rem); line-height: 1.5; }
.experiments {
  display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; padding: 4px;
  border: 1px solid var(--rule); border-radius: 10px; background: #eaf0f1; margin-bottom: 15px;
}
.experiments button {
  border: 1px solid transparent; border-radius: 7px; padding: 8px 6px; min-height: 46px; background: transparent;
  font-weight: 680; font-size: clamp(.74rem,1.1vw,.9rem); line-height: 1.19;
}
.experiments .compact-name { display: none; }
.experiments button[aria-pressed="true"] { border-color: #819eaa; background: var(--white); color: #143e52; box-shadow: 0 1px 3px #10283714; }
.experiments button:hover { background: #f6fafb; }
.workbench { display: grid; grid-template-columns: minmax(0,1.88fr) minmax(290px,1fr); gap: 15px; align-items: start; }
.bench-column { min-width: 0; }
.view-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; border-bottom: 1px solid var(--rule); padding: 0 0 7px;
}
.view-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.view-buttons button, .tour-button {
  border-radius: 7px; border: 1px solid #9bb5c0; background: #fbfcfc;
  padding: .44rem .62rem; min-height: 42px; font-size: .86rem; font-weight: 720;
}
.view-buttons button[aria-pressed="true"] { background: #d9e9ef; border-color: #7193a1; }
.view-buttons #molecular-view[aria-pressed="false"] { color: var(--white); background: var(--blue); }
.view-buttons #molecular-view:disabled, .tour-button:disabled { opacity: .55; cursor: default; }
.tour-button { white-space: nowrap; }
.tour-button[aria-pressed="true"] { color: #fff; background: #975437; border-color: #975437; }
.stage-transport { display:none; }
.stage-transport button {
  flex: 0 0 72px; min-height:40px; border:1px solid #aabdc5;
  border-radius:7px; background:#fbfcfc; color:var(--ink); font-weight:720;
}
.playback-speed { display:inline-flex; align-items:center; gap:6px; font-size:.83rem; color:var(--muted); }
.playback-speed select, .stage-transport select {
  color:var(--ink); background:#fbfcfc; border:1px solid #aabdc5;
  border-radius:7px; min-height:40px; padding:0 .38rem; font-weight:680; font-size:.85rem;
}
.stage-phase {
  position:absolute; z-index:2; top:12px; left:12px; max-width:calc(100% - 24px);
  padding:.4rem .63rem; border:1px solid #afc2c8; border-radius:7px; pointer-events:none;
  background:#f6fafbf2; color:#173849; font-size:.8rem; line-height:1.25;
}
.stage-phase span { display:block; margin-top:3px; color:#385664; }
.stage-phase :empty { display:none; }
.stage[data-view="molecules"] .stage-phase { background:#0e2a3de8; color:#effafd; border-color:#647f8e; }
.stage[data-view="molecules"] .stage-phase span { color:#d6e7ee; }
.stage {
  position: relative; overflow: hidden; display: grid; width: 100%; aspect-ratio: 1.4;
  min-height: 360px; isolation: isolate; border-radius: 12px; border: 1px solid #b9c8ce;
  background: radial-gradient(ellipse at 48% 24%, #f4f6f6, #bdcdd1 90%);
}
.canvas-host, .fallback-photo, .markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas-host canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.dive-shade {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse at center, #29516d 0%, #10283c 58%, #081b2b 100%);
}
.stage[data-view="molecules"] { background: #10283c; }
.fallback-photo { object-fit: contain; }
.stage-note {
  z-index: 2; position: absolute; max-width: calc(100% - 32px); inset: 12px auto auto 12px;
  padding: .4rem .68rem; border-radius: 6px; background: #f8fbfc; border: 1px solid #bfd1d8;
  color: var(--muted); font-size: .83rem;
}
.markers { pointer-events: none; }
.markers svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.markers line { stroke: #537789; stroke-width: 1.15; }
.marker {
  position: absolute; padding: .24rem .37rem .24rem 1rem; width: max-content;
  max-width: 126px; background: #fafffff0; border: 1px solid #88a1ad; border-radius: 5px;
  font-size: .68rem; font-weight: 780; line-height: 1.18;
  box-shadow: 0 2px 9px #16334524;
}
.marker::before { position: absolute; content: ""; top: calc(50% - 3px); left: 5px; width: 6px; height: 6px; border-radius: 50%; background: #516770; }
.marker[data-tone="water"]::before { background: #09768f; }
.marker[data-tone="heat"]::before { background: #b2562b; }
.marker[data-tone="material"]::before { background: #745295; }
.camera-tools {
  position: absolute; z-index: 3; inset: auto 12px 12px auto; display: flex; padding: 3px; gap: 2px;
  border: 1px solid #aec0c7; background: #f9fcfcf2; border-radius: 9px; box-shadow: 0 3px 9px #10283718;
}
.camera-tools button, .quiet-action {
  min-width: 38px; min-height: 40px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; padding: .3rem .48rem; font-size: .82rem; font-weight: 740;
}
.camera-tools button[aria-pressed="true"], .camera-tools button:hover { border-color: #abc1c9; background: var(--tint); }
.stage-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); padding: 3px 1px; }
.stage-caption p { min-width: 0; font-size: .78rem; line-height: 1.4; }
.micro-card { margin-top: 7px; padding: 10px 12px; border-radius: 7px; background:#102c40; color:#f7faf9; }
.micro-card h3 { font-size: 1rem; font-weight: 720; }
.micro-card p { color:#dae6ea; line-height: 1.45; font-size: .88rem; margin-top: 5px; }
.micro-legend { display:flex; flex-wrap:wrap; gap: 5px 13px; margin:7px 0 0; padding:0; list-style:none; font-size:.77rem; color:#eaf2f4; }
.micro-legend li { display:inline-flex; align-items:center; gap:6px; }
.micro-swatch { display:inline-block; width:9px; height:9px; border-radius:50%; border:1px solid #edf6f9b5; background:var(--swatch); }
.stage-caption .quiet-action { flex: 0 0 auto; }
.quiet-action { text-decoration: underline; text-underline-offset: .18em; white-space: nowrap; }
.control-column, .chart-panel, .question {
  border: 1px solid var(--rule); background: #fbfcfb; border-radius: 12px; overflow: hidden;
}
.lab-heading { padding: 17px 18px 14px; }
.lab-heading h2 { font: 500 clamp(1.6rem,2.6vw,2.6rem)/1.02 var(--serif); letter-spacing: -.055em; }
.lab-heading p, .observation p { color: var(--muted); font-size: .94rem; margin-top: 8px; line-height: 1.49; }
.settings { display: grid; gap: 11px; padding: 0 18px 16px; }
.field { display: grid; gap: 5px; font-weight: 690; font-size: .84rem; color: var(--ink); }
.field select {
  max-width: 100%; width: 100%; min-height: 43px; border: 1px solid #9cb4bf; color: var(--ink);
  background: var(--white); border-radius: 7px; padding: .44rem .55rem;
}
.field:has(input[type="checkbox"]) { grid-template-columns: auto 1fr; align-items: center; gap: 9px; min-height: 40px; }
.field input[type="checkbox"] { appearance: auto; width: 21px; height: 21px; margin: 0; }
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }
input[type="range"] { width: 100%; margin: 0; min-height: 27px; cursor: pointer; }
.field-heading { display: flex; justify-content: space-between; gap: 10px; }
.timeline, .observation { padding: 14px 18px; border-top: 1px solid var(--rule); }
.timeline h3, .observation h3, .chart-heading h3 { font-size: 1rem; line-height: 1.27; }
.timeline-heading { display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: baseline; justify-content: space-between; }
.timeline-heading output { color: #385365; font-size: .82rem; font-weight: 700; }
.checkpoints, .transport { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.checkpoints { margin-bottom: 11px; }
.checkpoints button {
  background: transparent; min-height: 34px; border: 1px solid #bccdd1; border-radius: 6px; padding: .27rem .43rem;
  font-size: .76rem; font-weight: 680;
}
.checkpoints button[aria-current="step"], .checkpoints button:hover { border-color: #8eabb8; background: var(--tint); }
.transport { gap: 8px; }
.transport button { min-width: 82px; }
.observation { background: #f1f6f6; }
.observation h3 { border-left: 3px solid var(--copper); padding-left: 8px; }
.metrics { display: grid; gap: 5px; margin-top: 10px; }
.metrics div { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; border-top: 1px solid #d0dfe3; padding: .36rem 0 0; }
.metrics dt, .metrics dd { font-size: .8rem; }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; font-weight: 740; text-align: right; font-variant-numeric: tabular-nums; }
.chart-panel { margin-top: 8px; padding: 10px 13px 4px; }
.chart-heading { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; }
.chart-heading p { color: var(--muted); font-size: .8rem; }
.chart-panel svg { width: 100%; max-height: 230px; display: block; overflow: visible; }
.underbench { margin-top: 23px; display: grid; grid-template-columns: minmax(0,1.6fr) minmax(260px,1fr); gap: 17px; }
.underbench h2 { font: 500 clamp(1.35rem,2.1vw,2rem)/1.06 var(--serif); letter-spacing: -.05em; }
.facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 10px; gap: 12px 18px; }
.facts article { border-top: 1px solid var(--rule); padding-top: 9px; }
.facts h3 { font-size: .93rem; }
.facts p, .question p { color: var(--muted); font-size: .9rem; line-height: 1.48; margin-top: 6px; }
.question { padding: 14px 16px; align-self: start; }
.question fieldset { border: 0; padding: 0; margin: 8px 0 10px; }
.question legend { font-size: .9rem; line-height: 1.45; margin-bottom: 5px; }
.question label { display: flex; align-items: center; min-height: 44px; gap: 8px; font-size: .87rem; }
.question input { width: 17px; height: 17px; flex: none; }
.question p[data-correct="true"] { color: #195a3c; }
.question p:empty { display: none; }
footer { margin-top: 30px; border-top: 1px solid var(--rule); padding-block: 14px 18px; color: var(--muted); font-size: .8rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 12px; }
dialog { color: var(--ink); width: min(480px,calc(100% - 22px)); border-radius: 12px; border: 1px solid #9eb2bc; padding: 18px; }
dialog::backdrop { background: #132a3bb0; }
dialog label { display: block; margin-top: 12px; }
dialog input { width: 100%; min-height: 42px; margin: 4px 0 8px; padding-inline: 7px; }
dialog .secondary { margin-top: 8px; }
.workbench:fullscreen { background: var(--paper); padding: 18px; overflow: auto; }
.workbench:fullscreen .stage { min-height: min(64vh,900px); }
@media (max-width: 1020px) {
  .shell { width: calc(100% - 32px); }
  .workbench { grid-template-columns: minmax(0,1.5fr) minmax(268px,1fr); }
  .experiments .wide-name { display: none; }
  .experiments .compact-name { display: inline; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 22px); }
  .masthead-inner { min-height: 57px; }
  .masthead-actions > a { display: none; }
  .brand { font-size: 1.1rem; gap: 7px; }
  .experiments { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .workbench, .underbench { grid-template-columns: minmax(0,1fr); }
  .stage-transport { display:flex; align-items:center; gap:10px; margin:0 0 7px; }
  .stage-transport input { min-width:0; }
  .playback-speed { display:none; }
  .stage-phase { top:8px; left:8px; max-width:calc(100% - 16px); font-size:.75rem; }
  .stage { min-height: 0; aspect-ratio: 1.02; }
  .stage-caption { padding-block: 1px; }
  .camera-tools button { min-height: 43px; }
  .checkpoints button { min-height: 42px; }
}
@media (max-width: 365px) {
  .experiments { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .facts { grid-template-columns: minmax(0,1fr); }
  .lab-heading, .timeline, .observation, .settings { padding-inline: 12px; }
  .view-buttons button, .tour-button { font-size: .76rem; padding-inline: .43rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
