/* Styles are isolated by the existing static-lab iframe. */
:root {
  color-scheme: dark;
  --bg: #0e131b;
  --panel: #151c26;
  --line: #35404d;
  --ink: #f0eee5;
  --muted: #b0bbc9;
  --gold: #d9bc7d;
  --zero: #6ca6f8;
  --one: #efb45b;
  --real: #71d1d9;
  --imag: #ba9be9;
  --phase: #e68ec9;
  --control: #62b1ff;
  --readout: #e7c775;
  --noise: #d08b85;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button,
select,
input[type="number"] {
  border: 1px solid var(--line);
  background: #1c2531;
  color: var(--ink);
  border-radius: 3px;
  min-height: 42px;
  padding: 9px 13px;
}
button {
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}
button:hover {
  background: #2b3746;
  border-color: #8e9a86;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button[aria-pressed="true"],
button.active {
  border-color: var(--gold);
  color: var(--gold);
  background: #2b2a24;
}
a {
  color: var(--gold);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 4px;
}
button.primary {
  background: var(--gold);
  color: #151a22;
  border-color: var(--gold);
  font-weight: 650;
}
button.primary:hover {
  background: #f0d7a5;
}
.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 7px;
}
.quiet,
.caption {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}
p {
  line-height: 1.65;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
.masthead {
  margin: 0 34px;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.wordmark {
  text-decoration: none;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: -0.05em;
}
.wordmark span {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.13em;
  margin-left: 20px;
}
.edition {
  color: var(--muted);
  font-size: 10px;
}
.experience-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 35px;
  padding: 34px 34px 30px;
}
.eyebrow {
  font:
    10px/1.6 ui-monospace,
    SFMono-Regular,
    monospace;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin-bottom: 15px;
}
h1 {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 450;
  letter-spacing: -0.045em;
  line-height: 1.04;
  margin-bottom: 0;
}
.opening {
  max-width: 300px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 2px;
}
.chapter-nav {
  display: flex;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-left: 34px;
  gap: 32px;
}
.chapter-nav button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 15px 0;
  font-size: 12px;
}
.chapter-nav button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}
.chapter-nav span {
  color: var(--gold);
  font:
    11px ui-monospace,
    monospace;
  margin-right: 10px;
}
.machine-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 32%);
  border-bottom: 1px solid var(--line);
}
.viewport {
  position: relative;
  min-height: 570px;
  height: min(66vh, 760px);
  overflow: hidden;
  background: radial-gradient(
    ellipse at 45% 40%,
    #273343 0%,
    #17202d 45%,
    #101720 85%
  );
}
#webgl-host,
#poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#webgl-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
#poster {
  opacity: 0.9;
}
body.webgl #poster {
  display: none;
}
.viewport-caption {
  position: absolute;
  top: 20px;
  left: 25px;
  display: flex;
  gap: 9px;
  align-items: center;
  font:
    9px/1.5 ui-monospace,
    monospace;
  color: #c6cebd;
  letter-spacing: 0.08em;
  max-width: 80%;
}
.status-dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
}
.temperature-ruler {
  position: absolute;
  top: 100px;
  bottom: 110px;
  right: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid #586c82;
  padding-left: 12px;
  pointer-events: none;
}
.temperature-ruler span {
  font:
    12px ui-monospace,
    monospace;
  color: var(--gold);
}
.temperature-ruler small {
  font-size: 9px;
  color: var(--muted);
}
.scene-labels span {
  position: absolute;
  font:
    9px/1.6 ui-monospace,
    monospace;
  letter-spacing: 0.07em;
  border-top: 1px solid #586c82;
  padding-top: 7px;
  pointer-events: none;
  color: #d7dfcb;
}
.scene-labels b {
  display: block;
  color: var(--gold);
  font-weight: 400;
}
.label-warm {
  top: 28%;
  left: 9%;
}
.label-cold {
  bottom: 22%;
  left: 53%;
}
.scene-bottom {
  position: absolute;
  bottom: 66px;
  left: 25px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font:
    9px/1.5 ui-monospace,
    monospace;
  color: var(--muted);
}
#scene-note {
  max-width: 65%;
}
#render-mode {
  font-size: 8px;
  text-align: right;
}
.viewport-controls {
  position: absolute;
  bottom: 13px;
  left: 20px;
  right: 18px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.viewport-controls button {
  background: #141e2be8;
  min-height: 34px;
  font-size: 10px;
  padding: 7px 9px;
}
.lesson-panel {
  padding: 29px 28px 22px;
  border-left: 1px solid var(--line);
  background: linear-gradient(130deg, #1d2735, #151e29);
  overflow-y: auto;
  max-height: 760px;
  min-width: 0;
}
.step-meta {
  display: flex;
  justify-content: space-between;
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 21px;
}
.step-number {
  font:
    70px/0.85 Georgia,
    serif;
  color: #728397;
  display: block;
  margin: 0 0 20px;
}
.lesson-panel h2 {
  font-size: clamp(25px, 2.5vw, 40px);
  line-height: 1.12;
  font-weight: 450;
  letter-spacing: -0.035em;
  margin-bottom: 17px;
}
.lesson-panel p {
  font-size: 13px;
  color: #c0cad6;
}
.lesson-panel p.lede {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
.lesson-panel .primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin: 18px 0 10px;
}
.lesson-panel details {
  font-size: 12px;
}
.lesson-panel details p {
  font-size: 12px;
}
.fail-copy {
  padding: 12px;
  border-left: 2px solid var(--noise);
  background: #d08b850b;
  margin-top: 12px;
}
.source-link {
  font-size: 11px;
}
.progress-heading {
  display: flex;
  justify-content: space-between;
  padding: 18px 34px 0;
  font:
    9px ui-monospace,
    monospace;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.stage-rail {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 16px 34px;
  gap: 5px;
}
.stage-rail button {
  min-width: 0;
  padding: 11px 3px 8px;
  text-align: left;
  border: 0;
  border-top: 2px solid #3c4b60;
  background: none;
  border-radius: 0;
}
.stage-rail button b {
  display: block;
  font:
    12px ui-monospace,
    monospace;
}
.stage-rail button small {
  font-size: 9px;
  display: block;
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.4;
}
.stage-rail button.installed {
  border-top-color: var(--gold);
}
.stage-rail button.active {
  border-top-color: var(--ink);
  color: white;
}
.assembly-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 2px 34px 25px;
}
.assembly-actions .quiet {
  margin-left: auto;
  font-size: 10px;
}
.primary span {
  margin-left: 30px;
}
.lab-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 34px 20px;
}
.lab-heading h2 {
  font-size: 35px;
  font-weight: 400;
  letter-spacing: -0.035em;
  margin: 0;
}
.lab-heading p:last-child {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 34px 14px;
  align-items: start;
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 4px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}
.panel-heading h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.panel-heading h3 span {
  font:
    10px ui-monospace,
    monospace;
  color: var(--gold);
  margin-right: 12px;
}
.panel-heading > span {
  font:
    9px/1.6 ui-monospace,
    monospace;
  color: var(--muted);
  text-align: right;
}
.circuit-panel,
.readout-panel {
  grid-column: 1/-1;
}
.lab-toolbar,
.execution-controls,
.gate-builder {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.lab-toolbar label,
.gate-builder label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.lab-toolbar button,
.execution-controls button,
.gate-builder button {
  font-size: 12px;
}
.lab-toolbar select {
  font-size: 12px;
  padding: 6px;
}
.lab-toolbar input {
  width: 100px;
}
.circuit {
  overflow: auto;
  padding: 22px 0;
  min-height: 120px;
}
.wire-row {
  display: flex;
  align-items: center;
  min-width: max-content;
  height: 55px;
}
.wire-label {
  width: 68px;
  color: var(--zero);
  font:
    12px ui-monospace,
    monospace;
  flex: none;
}
.wire-gate {
  height: 46px;
  width: 62px;
  flex: none;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.wire-gate:before {
  content: "";
  position: absolute;
  height: 1px;
  left: 0;
  right: 0;
  top: 23px;
  background: #75806d;
}
.wire-gate button {
  z-index: 1;
  min-height: 35px;
  min-width: 35px;
  padding: 6px;
  font:
    12px ui-monospace,
    monospace;
  background: #252e25;
}
.wire-gate.executed button {
  border-color: #858d76;
}
.wire-gate.current {
  background: #ddbc7815;
  border-left: 2px solid var(--gold);
}
.wire-gate .connector {
  position: absolute;
  top: 23px;
  left: 30px;
  width: 1px;
  background: var(--gold);
  z-index: 0;
}
.wire-gate .control-dot {
  border: 0;
  background: var(--gold);
  color: #172018;
  width: 27px;
  min-width: 27px;
  border-radius: 50%;
}
.wire-gate .classical:after {
  content: "";
  position: absolute;
  left: 45px;
  right: -20px;
  top: 24px;
  border-top: 3px double white;
}
.gate-builder {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}
.gate-builder label:has(input) {
  flex: 1;
  min-width: 220px;
}
.gate-builder input {
  width: 110px;
}
.gate-builder output {
  font-size: 10px;
  white-space: nowrap;
}
#circuit-message {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 14px;
}
summary {
  cursor: pointer;
  font-size: 12px;
  line-height: 1.5;
  color: var(--gold);
}
details[open] > summary {
  margin-bottom: 14px;
}
.equation {
  overflow-x: auto;
  padding: 16px 0;
  margin: 0;
  line-height: 1.9;
}
.equation .katex-display {
  margin: 0.3em 0;
  text-align: left;
}
.equation .katex-display > .katex {
  text-align: left;
}
#coherent-input .katex-display > .katex,
#coherent-current .katex-display > .katex {
  white-space: normal;
}
.katex {
  font-size: 1.04em;
}
.compact-math .katex {
  font-size: 1.15em;
}
.amp-row {
  display: grid;
  grid-template-columns: 45px minmax(80px, 1fr) 126px;
  align-items: center;
  gap: 12px;
  font:
    11px/1.7 ui-monospace,
    monospace;
  padding: 10px 0;
  border-bottom: 1px solid #2d352e;
}
.amp-row .basis {
  color: var(--zero);
}
.amp-row .basis.one {
  color: var(--one);
}
.amp-track {
  height: 6px;
  background: #323a32;
  margin-bottom: 6px;
  border-radius: 1px;
}
.amp-track i {
  display: block;
  height: 100%;
  background: var(--zero);
  transition: width 0.25s;
}
.amp-track i.one {
  background: var(--one);
}
.amp-numbers {
  font-size: 10px;
  text-align: right;
  line-height: 1.9;
}
.real {
  color: var(--real);
}
.imaginary {
  color: var(--imag);
}
.phase {
  color: var(--phase);
}
.zero {
  color: var(--zero);
}
.one {
  color: var(--one);
}
.legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font:
    9px/1.6 ui-monospace,
    monospace;
  margin-top: 15px;
}
.legend span:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
  margin-right: 5px;
}
#bloch-spheres {
  display: flex;
  justify-content: space-around;
  gap: 0;
}
#bloch-spheres svg {
  min-width: 0;
  max-width: 290px;
  width: 100%;
  overflow: visible;
}
.sliders {
  display: grid;
  gap: 14px;
  margin: 12px 0;
}
.sliders label {
  display: grid;
  grid-template-columns: 110px 1fr 60px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.sliders output {
  text-align: right;
  font:
    10px ui-monospace,
    monospace;
}
.sliders input {
  min-width: 0;
  width: 100%;
}
input[type="range"] {
  accent-color: var(--gold);
  height: 30px;
}
#waveform svg {
  width: 100%;
  height: auto;
  display: block;
}
.control-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font:
    10px/1.7 ui-monospace,
    monospace;
  color: var(--muted);
}
.control-values span {
  border: 1px solid var(--line);
  padding: 5px 8px;
}
.calibration label {
  grid-template-columns: 150px 1fr 45px;
}
#calibration-prediction {
  font-size: 12px;
  color: var(--control);
}
.noise-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  margin: 10px 0;
}
.noise-slider input {
  flex: 1;
  max-width: 240px;
}
.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 30px;
  align-items: center;
  margin-top: 20px;
}
#iq-plot svg {
  width: 100%;
  max-height: 220px;
}
#histogram .hist-row {
  display: grid;
  grid-template-columns: 35px 1fr 110px;
  align-items: center;
  gap: 12px;
  font:
    11px ui-monospace,
    monospace;
  margin: 13px 0;
}
.hist-bars {
  position: relative;
  height: 16px;
  background: #252d26;
}
.hist-bars b {
  position: absolute;
  top: 1px;
  height: 5px;
  display: block;
  background: var(--readout);
}
.hist-bars i {
  position: absolute;
  top: 9px;
  height: 5px;
  background: #f0eee5;
  display: block;
}
#histogram .hist-row span:last-child {
  font-size: 10px;
  color: var(--muted);
}
#correlations {
  font-size: 13px;
}
.callout {
  font-size: 12px;
  line-height: 1.65;
  border-left: 2px solid var(--gold);
  background: #ddbc7808;
  padding: 12px 15px;
  margin: 15px 0;
}
.concepts {
  margin: 0 34px 25px;
}
.concept-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.concept-tabs button {
  font-size: 11px;
}
.concepts h4 {
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 10px;
}
.concepts p {
  font-size: 13px;
  max-width: 950px;
}
.symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.symbols button {
  font-family: KaTeX_Main, Georgia, serif;
  min-width: 40px;
  color: var(--gold);
}
#symbol-meaning {
  font-size: 13px;
  min-height: 45px;
  padding: 12px;
  background: #222a22;
  margin-top: 12px;
}
.op-layers {
  font-size: 12px;
  margin: 0;
}
.op-layers dt {
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-top: 16px;
  text-transform: uppercase;
}
.op-layers dd {
  margin: 6px 0;
  color: #d5d9ce;
  line-height: 1.65;
}
.op-select {
  width: 100%;
  margin: 8px 0 15px;
}
.compile-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font:
    10px/1.6 ui-monospace,
    monospace;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.compile-row strong {
  min-width: 80px;
  color: var(--control);
}
.compile-row.current {
  background: #ddbc7810;
}
.scope-note {
  border-top: 1px solid var(--line);
  padding: 28px 34px;
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 30px;
}
.scope-note p:not(.eyebrow) {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 15px 34px;
  font:
    9px ui-monospace,
    monospace;
  color: var(--muted);
  gap: 15px;
}
footer div {
  display: flex;
  gap: 7px;
}
footer button {
  font-size: 10px;
  min-height: 34px;
}
dialog {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 640px;
  width: 90vw;
  background: #1c241e;
  color: var(--ink);
  border: 0;
  border-left: 1px solid var(--line);
  padding: 28px;
  overflow-y: auto;
}
dialog::backdrop {
  background: #000a;
}
.drawer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}
dialog h2 {
  font-size: 27px;
  letter-spacing: -0.03em;
}
dialog p,
dialog dd {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
dialog h3 {
  font-size: 17px;
  font-weight: 450;
  margin-top: 30px;
}
.source-entry {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.source-entry a {
  font-size: 13px;
  line-height: 1.6;
}
.source-entry p {
  margin: 7px 0 0;
  font-size: 12px;
}
dialog dt {
  text-transform: capitalize;
  font-size: 13px;
  margin-top: 16px;
}
dialog dd {
  margin: 4px 0;
}
.skip {
  position: fixed;
  top: -100px;
  z-index: 30;
  background: var(--ink);
  color: var(--bg);
  padding: 12px;
}
.skip:focus {
  top: 10px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.energy-levels,
.tensor-basis {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 18px 0;
}
.energy-levels span,
.tensor-basis span {
  border-bottom: 2px solid var(--gold);
  padding: 14px;
  font:
    13px ui-monospace,
    monospace;
}
.energy-levels span:last-child {
  border-bottom-style: dashed;
  color: var(--noise);
}
[hidden] {
  display: none !important;
}
.reduced-motion * {
  scroll-behavior: auto !important;
  transition: none !important;
  animation: none !important;
}
body.html-mode #webgl-host {
  visibility: hidden;
}
body.html-mode #poster {
  display: block;
}
body.compute-mode .viewport {
  height: 480px;
  min-height: 480px;
}
body.compute-mode .lesson-panel {
  max-height: 700px;
}
body.compute-mode .temperature-ruler {
  top: 75px;
  bottom: 100px;
}
#mixture-comparison {
  font-size: 12px;
  line-height: 1.7;
  margin-top: 12px;
}
@media (min-width: 1600px) {
  .viewport {
    min-height: 650px;
  }
  .lesson-panel {
    padding: 35px;
  }
  .lesson-panel p {
    font-size: 15px;
  }
  .viewport-controls button {
    font-size: 12px;
  }
  .stage-rail button small {
    font-size: 11px;
  }
  .stage-rail button {
    padding: 15px 5px;
  }
}
@media (max-width: 1000px) {
  .edition {
    display: none;
  }
  .experience-heading {
    padding: 25px;
  }
  .opening {
    max-width: 250px;
    font-size: 12px;
  }
  .machine-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .lesson-panel {
    padding: 23px 20px;
  }
  .viewport {
    height: 580px;
  }
  .viewport-controls {
    left: 14px;
    right: 10px;
    gap: 4px;
  }
  .viewport-controls button {
    padding: 5px 7px;
    font-size: 9px;
  }
  .scene-bottom {
    bottom: 100px;
  }
  .viewport-caption {
    left: 15px;
    font-size: 8px;
  }
  .label-warm {
    left: 5%;
  }
  .temperature-ruler {
    right: 12px;
  }
  .stage-rail {
    padding: 15px 25px;
  }
  .stage-rail button small {
    display: none;
  }
  .scope-note {
    grid-template-columns: 1fr 1fr;
  }
  .scope-note .eyebrow {
    grid-column: 1/-1;
    margin-bottom: 0;
  }
  .assembly-actions {
    flex-wrap: wrap;
  }
  .assembly-actions .quiet {
    display: none;
  }
  .sliders label {
    grid-template-columns: 85px 1fr 55px;
  }
  .calibration label {
    grid-template-columns: 110px 1fr 45px;
  }
  .workspace,
  .concepts {
    margin-left: 20px;
    margin-right: 20px;
  }
  .lab-heading {
    margin-left: 20px;
    margin-right: 20px;
  }
  .readout-grid {
    gap: 15px;
  }
  .wordmark span {
    margin-left: 8px;
  }
}
@media (max-width: 720px) {
  .masthead {
    margin: 0 18px;
    padding: 14px 0;
  }
  .wordmark span {
    font-size: 8px;
  }
  .masthead > .text-button {
    font-size: 10px;
  }
  .experience-heading {
    display: block;
    padding: 24px 18px;
  }
  .opening {
    max-width: 95%;
    margin-top: 20px;
    font-size: 13px;
  }
  h1 {
    font-size: clamp(32px, 7.4vw, 50px);
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 12px;
  }
  .chapter-nav {
    padding: 0 18px;
    gap: 24px;
  }
  .chapter-nav button {
    font-size: 10px;
  }
  .chapter-nav span {
    font-size: 9px;
    margin-right: 6px;
  }
  .machine-layout {
    grid-template-columns: 1fr;
  }
  .viewport,
  body.compute-mode .viewport {
    height: 60dvh;
    min-height: 420px;
    max-height: 650px;
  }
  .lesson-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none !important;
    padding: 24px 20px;
  }
  .lesson-panel h2 {
    font-size: 32px;
  }
  .lesson-panel p {
    font-size: 14px;
  }
  .step-number {
    font-size: 45px;
    margin-bottom: 15px;
    float: right;
  }
  .step-meta {
    margin-bottom: 16px;
  }
  .stage-rail {
    padding: 12px 18px;
    gap: 5px;
  }
  .stage-rail button b {
    font-size: 10px;
  }
  .progress-heading {
    padding: 18px 18px 0;
  }
  .assembly-actions {
    padding: 6px 18px 22px;
    gap: 9px;
  }
  .assembly-actions button {
    font-size: 11px;
  }
  .viewport-controls button {
    min-height: 37px;
    font-size: 10px;
    padding: 6px 8px;
  }
  .viewport-controls {
    bottom: 12px;
    left: 15px;
    right: 15px;
  }
  .scene-bottom {
    bottom: 100px;
    left: 15px;
    font-size: 8px;
  }
  .scene-labels span {
    font-size: 8px;
  }
  .temperature-ruler {
    right: 12px;
    top: 80px;
    bottom: 125px;
  }
  .viewport-caption {
    top: 17px;
    font-size: 8px;
  }
  .label-cold {
    left: 48%;
    bottom: 28%;
  }
  .label-warm {
    left: 7%;
    top: 25%;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0 14px 14px;
  }
  .panel {
    padding: 17px;
  }
  .lab-heading {
    display: block;
    margin: 25px 18px 20px;
  }
  .lab-heading h2 {
    font-size: 30px;
  }
  .lab-heading p:last-child {
    margin-top: 10px;
  }
  .panel-heading > span {
    font-size: 8px;
  }
  .lab-toolbar {
    gap: 8px;
  }
  .lab-toolbar label {
    font-size: 11px;
  }
  .lab-toolbar input {
    width: 80px;
  }
  .gate-builder label:has(input) {
    min-width: 100%;
    justify-content: space-between;
  }
  .gate-builder label:has(input) input {
    flex: 1;
  }
  .gate-builder label {
    font-size: 11px;
  }
  .gate-builder select {
    max-width: 82px;
  }
  .readout-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #iq-plot svg {
    max-height: 220px;
  }
  .noise-slider {
    font-size: 10px;
    gap: 8px;
  }
  .noise-slider input {
    min-width: 55px;
  }
  .concepts {
    margin: 0 14px 20px;
  }
  .concept-tabs button {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 10px;
  }
  .scope-note {
    display: block;
    padding: 25px 20px;
  }
  .scope-note p:not(.eyebrow) {
    margin-top: 15px;
    font-size: 12px;
  }
  footer {
    display: block;
    padding: 20px;
    font-size: 9px;
  }
  footer div {
    margin-top: 15px;
    flex-wrap: wrap;
  }
  #operation-panel .equation {
    font-size: 17px;
  }
  .energy-levels span {
    font-size: 10px;
    padding: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.hardware-path {
  padding: 15px 34px;
  border-bottom: 1px solid var(--line);
}
.hardware-path > p {
  font:
    9px/1.7 ui-monospace,
    monospace;
  color: var(--muted);
  margin: 0 0 10px;
}
.signal-nodes {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: auto;
  padding: 3px 0 9px;
}
.signal-nodes span {
  flex: none;
  padding: 7px 9px;
  border: 1px solid var(--line);
  font:
    10px ui-monospace,
    monospace;
  color: var(--muted);
}
.signal-nodes span.active {
  color: var(--control);
  border-color: var(--control);
}
.signal-nodes span.return {
  color: var(--readout);
}
.signal-nodes i {
  font-style: normal;
  color: var(--gold);
}
.scrub-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-left: auto;
}
.scrub-label input {
  width: 100px;
}
.temperature-ruler {
  display: block;
}
.temperature-ruler span {
  position: absolute;
  left: 12px;
  white-space: nowrap;
  transform: translateY(-50%);
}
.temperature-ruler span:nth-child(1) {
  top: 0;
}
.temperature-ruler span:nth-child(2) {
  top: 18.09%;
}
.temperature-ruler span:nth-child(3) {
  top: 43.59%;
}
.temperature-ruler span:nth-child(4) {
  top: 59.85%;
}
.temperature-ruler span:nth-child(5) {
  top: 80.84%;
}
.temperature-ruler span:nth-child(6) {
  top: 100%;
}
.katex-html [data-meaning] {
  cursor: help;
}
.katex-html [data-meaning]:hover {
  background: #ddbc7820;
  border-bottom: 1px dotted var(--gold);
}
#carrier svg {
  width: 100%;
}
@media (max-width: 720px) {
  .hardware-path {
    padding: 15px 18px;
  }
  .hardware-path > p {
    font-size: 8px;
  }
  .scrub-label {
    margin-left: 0;
  }
}

.energy-diagram {
  width: 100%;
  max-width: 650px;
}
.signal-nodes:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 4px;
}

.temperature-ruler {
  width: 65px;
  right: 12px;
}
.temperature-ruler span {
  left: 10px;
}
@media (max-width: 720px) {
  .temperature-ruler {
    width: 48px;
    right: 8px;
  }
  .temperature-ruler span {
    font-size: 10px;
    left: 8px;
  }
  .temperature-ruler small {
    font-size: 8px;
  }
}

.signal-nodes span.return.active {
  border-color: var(--readout);
}

.equation:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 4px;
}

/* Keep the five views in one visual field; explanations remain inspectable below. */
.experiment-story {
  margin: 24px 34px 14px;
  padding: 24px 26px 16px;
  border: 1px solid #635b42;
  background: linear-gradient(120deg, #29291f80, #151c26);
  border-radius: 4px;
}
.story-heading,
.story-body {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}
.story-heading .eyebrow {
  margin-bottom: 8px;
}
.story-heading h2 {
  font:
    400 clamp(23px, 2.2vw, 34px) / 1.15 Georgia,
    serif;
  letter-spacing: -0.025em;
  margin: 0;
}
#story-steps {
  display: flex;
  gap: 4px;
}
#story-steps button {
  border: 0;
  border-bottom: 2px solid var(--line);
  background: none;
  border-radius: 0;
  font-size: 11px;
  padding: 8px 12px;
  color: var(--muted);
}
#story-steps button span {
  font:
    9px ui-monospace,
    monospace;
  margin-right: 8px;
  color: var(--gold);
}
#story-steps button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--ink);
  background: #d9bc7d0c;
}
#story-reading {
  max-width: 850px;
  font-size: 13px;
  color: var(--muted);
  margin: 15px 0 0;
  min-height: 44px;
}
.story-phases {
  display: flex;
  gap: 14px;
  flex: none;
  font:
    9px ui-monospace,
    monospace;
  color: var(--muted);
}
.story-phases span {
  padding-bottom: 7px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.story-phases .active {
  color: var(--control);
  border-color: var(--control);
}
#story-equation {
  padding: 8px 0 0;
  font-size: 19px;
}
#story-equation .math-reading {
  margin: 4px 0 0;
  font-size: 11px;
}
#story-equation .math-definitions summary {
  font-size: 9px;
}
.trace-equivalence {
  display: flex;
  gap: 20px;
  align-items: start;
  min-width: max-content;
}
.trace-equivalence > .equation {
  padding: 6px 0;
  overflow: visible;
}
.trace-equivalence .math-reading {
  display: none;
}
.trace-equivalence .math-definitions {
  font-size: 11px;
  max-width: 330px;
}
#trace-operator {
  color: var(--gold);
}
.trace-reading {
  font-size: 11px;
  margin: 8px 0 0;
}
#story-equation {
  overflow: auto;
}
.math-definitions {
  margin-top: 6px;
  padding-top: 5px;
  border: 0;
}
.math-definitions summary {
  font-size: 10px;
  color: var(--muted);
}
.math-definitions p {
  font-size: 11px;
  margin: 7px 0;
}
.operation-detail {
  margin: 0 34px 14px;
}
.operation-detail #operation-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 30px;
}
.operation-detail #operation-panel h2 {
  font-size: 28px;
  grid-column: 1/-1;
  margin: 12px 0;
}
.operation-detail .step-meta,
.operation-detail .lede {
  grid-column: 1/-1;
}
.operation-detail .step-meta {
  margin-top: 20px;
}
.operation-detail .op-layers {
  grid-column: 2;
  grid-row: 4 / span 2;
}
.operation-detail .op-layers dt {
  margin-top: 10px;
}
.subsystem-diagnostic {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin-top: 22px;
}
.diagnostic-heading {
  display: flex;
  justify-content: space-between;
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 0.07em;
  color: var(--gold);
}
#diagnostic-condition {
  color: var(--muted);
  font-size: 8px;
}
#diagnostic-cause {
  font-size: 12px;
  margin: 14px 0 0;
}
#diagnostic-chart svg {
  width: 100%;
  display: block;
  max-height: 160px;
}
#diagnostic-label {
  display: block;
  font-size: 11px;
  margin: 6px 0;
}
#diagnostic-input {
  width: calc(100% - 100px);
  vertical-align: middle;
  accent-color: var(--control);
}
#diagnostic-input-value {
  font:
    10px ui-monospace,
    monospace;
  float: right;
  margin-top: 9px;
}
.diagnostic-result {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: baseline;
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.diagnostic-result strong {
  font:
    19px Georgia,
    serif;
  color: var(--real);
  white-space: nowrap;
}
body.compute-mode .machine-layout {
  display: none;
}
body.compute-mode .experience-heading {
  padding: 22px 34px;
  align-items: center;
}
body.compute-mode h1 {
  font-size: clamp(28px, 3vw, 43px);
}
body.compute-mode h1 br {
  display: none;
}
body.compute-mode h1 em {
  display: block;
}
body.compute-mode .opening {
  font-size: 12px;
  max-width: 380px;
}
body.compute-mode .lab-heading {
  display: none;
}
body.compute-mode .workspace {
  grid-template-columns:
    minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 1fr)
    minmax(0, 0.95fr);
  gap: 10px;
}
body.compute-mode .workspace .panel {
  padding: 17px 15px;
  position: relative;
  transition: border-color 0.3s;
}
body.compute-mode .panel-heading {
  margin-bottom: 12px;
  align-items: start;
}
body.compute-mode .panel-heading h3 {
  font-size: 13px;
}
body.compute-mode .panel-heading h3 span {
  margin-right: 7px;
}
body.compute-mode .panel-heading > span {
  font-size: 8px;
}
body.compute-mode .circuit-panel {
  grid-column: 1/-1;
}
body.compute-mode .state-panel {
  grid-column: 1;
}
body.compute-mode .geometry-panel {
  grid-column: 2;
}
body.compute-mode .control-panel {
  grid-column: 3;
}
body.compute-mode .hardware-panel {
  grid-column: 4;
}
body.compute-mode .readout-panel {
  grid-column: 1/-1;
}
body.compute-mode .circuit {
  padding: 6px 0;
  min-height: 0;
}
body.compute-mode .wire-row {
  height: 43px;
}
body.compute-mode .wire-gate {
  height: 43px;
}
body.compute-mode .wire-gate.current button {
  transform: scale(1.09);
  border-color: var(--gold);
  box-shadow: 0 0 18px #d9bc7d18;
}
body.compute-mode .lab-toolbar {
  float: right;
}
body.compute-mode .lab-toolbar label {
  font-size: 10px;
}
body.compute-mode .lab-toolbar select {
  min-height: 32px;
  padding: 4px;
}
body.compute-mode .lab-toolbar button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 10px;
}
body.compute-mode .execution-controls {
  clear: both;
}
body.compute-mode .execution-controls button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 10px;
}
body.compute-mode .builder-disclosure {
  display: inline-block;
  margin-right: 24px;
  border: 0;
  margin-top: 10px;
  padding: 0;
}
body.compute-mode .builder-disclosure[open] {
  display: block;
}
body.compute-mode .builder-disclosure[open] .gate-builder {
  margin: 8px 0;
}
body.compute-mode .circuit-panel > details:last-child {
  display: inline-block;
  border: 0;
  padding: 0;
  margin: 10px 0 0;
}
body.compute-mode #circuit-message {
  font-size: 10px;
  display: inline;
  margin: 0 20px 0 0;
}
body.compute-mode .equation {
  padding: 9px 0;
}
body.compute-mode #state-ket {
  font-size: 14px;
}
body.compute-mode #state-ket .math-reading {
  font-size: 11px;
  margin: 6px 0 0;
}
body.compute-mode .state-panel > .caption {
  font-size: 10px;
  margin: 8px 0;
}
body.compute-mode .amp-row {
  grid-template-columns: 25px minmax(25px, 1fr) 86px;
  gap: 8px;
  padding: 8px 0;
  font-size: 10px;
}
body.compute-mode .amp-numbers {
  font-size: 9px;
}
body.compute-mode .legend {
  font-size: 8px;
  gap: 8px;
}
body.compute-mode #bloch-spheres {
  flex-wrap: wrap;
}
body.compute-mode #bloch-spheres svg {
  width: 50%;
  max-height: 170px;
}
body.compute-mode #bloch-spheres svg:only-child {
  width: 100%;
  max-height: 220px;
}
body.compute-mode #geometry-explanation {
  font-size: 11px;
}
body.compute-mode .control-panel > .caption {
  font-size: 10px;
  margin: 10px 0;
}
body.compute-mode .control-values {
  gap: 4px;
  font-size: 9px;
}
body.compute-mode .control-values span {
  padding: 3px 5px;
}
body.compute-mode .calibration label {
  grid-template-columns: 1fr 55px;
  gap: 4px;
  font-size: 10px;
}
body.compute-mode .calibration label input {
  grid-column: 1/-1;
  grid-row: 2;
}
body.compute-mode .calibration {
  gap: 7px;
  margin: 10px 0;
}
body.compute-mode #calibration-prediction {
  font-size: 10px;
  line-height: 1.6;
}
body.compute-mode .viewport {
  height: 260px;
  min-height: 260px;
  max-height: 260px;
  border-radius: 2px;
}
body.compute-mode .viewport-caption {
  left: 9px;
  top: 9px;
  font-size: 6px;
  max-width: 85%;
}
body.compute-mode .scene-labels,
body.compute-mode .temperature-ruler,
body.compute-mode .scene-bottom {
  display: none;
}
body.compute-mode .viewport-controls {
  left: 8px;
  right: 8px;
  bottom: 8px;
  gap: 4px;
}
body.compute-mode .viewport-controls button {
  font-size: 8px;
  min-height: 28px;
  padding: 4px 5px;
}
body.compute-mode
  .viewport-controls
  button:not(#processor-view):not(#reset-view):not(#rotate) {
  display: none;
}
body.compute-mode .hardware-panel > .caption {
  font-size: 10px;
  margin: 10px 0;
}
body.compute-mode .hardware-path {
  padding: 12px 0 0;
  border-bottom: 0;
}
body.compute-mode .hardware-path > p {
  font-size: 7px;
}
body.compute-mode .signal-nodes {
  gap: 4px;
}
body.compute-mode .signal-nodes span {
  font-size: 9px;
  padding: 5px 6px;
}
body.compute-mode .readout-panel .panel-heading {
  margin-bottom: 15px;
}
body.compute-mode .readout-panel .lab-toolbar {
  float: none;
}
body.compute-mode .readout-grid {
  grid-template-columns: 1fr 2fr;
  margin-top: 10px;
}
body.compute-mode .readout-grid > div:first-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 20px;
}
body.compute-mode #iq-plot svg {
  max-height: 180px;
}
body.compute-mode .readout-grid .caption {
  font-size: 11px;
}
.workspace[data-beat="evolve"] .state-panel,
.workspace[data-beat="evolve"] .geometry-panel,
.workspace[data-beat="evolve"] .control-panel,
.workspace[data-beat="evolve"] .hardware-panel {
  border-top-color: var(--control);
}
.workspace[data-beat="operator"] .circuit-panel {
  border-color: var(--gold);
}
@media (max-width: 1199px) and (min-width: 721px) {
  body.compute-mode .workspace {
    grid-template-columns: 1fr 1fr;
  }
  body.compute-mode .state-panel {
    grid-column: 1;
  }
  body.compute-mode .geometry-panel {
    grid-column: 2;
  }
  body.compute-mode .control-panel {
    grid-column: 1;
  }
  body.compute-mode .hardware-panel {
    grid-column: 2;
  }
  body.compute-mode .viewport {
    height: 310px;
    min-height: 310px;
    max-height: 310px;
  }
  body.compute-mode .lab-toolbar {
    float: none;
  }
  .story-heading,
  .story-body {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }
  .story-phases {
    margin-top: 2px;
  }
}
@media (max-width: 720px) {
  body.compute-mode .experience-heading {
    padding: 22px 18px;
  }
  body.compute-mode h1 {
    font-size: 32px;
  }
  body.compute-mode .opening {
    margin-top: 15px;
    font-size: 12px;
  }
  .experiment-story {
    margin: 18px 14px 12px;
    padding: 20px 17px 14px;
  }
  .story-heading,
  .story-body {
    display: block;
  }
  #story-steps {
    margin-top: 17px;
  }
  #story-steps button {
    padding: 8px 6px;
    font-size: 10px;
    flex: 1;
  }
  #story-steps button span {
    display: block;
    margin: 0 0 5px;
  }
  #story-reading {
    font-size: 12px;
    min-height: 0;
  }
  .story-phases {
    margin-top: 15px;
    gap: 17px;
  }
  #story-equation {
    font-size: 15px;
  }
  body.compute-mode .workspace {
    display: flex;
    flex-direction: column;
  }
  body.compute-mode .workspace > .panel {
    width: 100%;
  }
  body.compute-mode .lab-toolbar {
    float: none;
    margin-bottom: 8px;
  }
  body.compute-mode .builder-disclosure {
    display: block;
  }
  body.compute-mode #circuit-message {
    display: block;
    margin-top: 8px;
  }
  body.compute-mode .amp-row {
    grid-template-columns: 28px 1fr 96px;
    font-size: 11px;
  }
  body.compute-mode .amp-numbers {
    font-size: 10px;
  }
  body.compute-mode #state-ket {
    font-size: 16px;
  }
  body.compute-mode #bloch-spheres svg {
    max-height: 210px;
  }
  body.compute-mode .calibration label {
    grid-template-columns: 150px 1fr 45px;
  }
  body.compute-mode .calibration label input {
    grid-column: auto;
    grid-row: auto;
  }
  body.compute-mode .viewport {
    height: 320px;
    min-height: 320px;
    max-height: 320px;
  }
  body.compute-mode .readout-grid {
    grid-template-columns: 1fr;
  }
  body.compute-mode .readout-grid > div:first-child {
    grid-template-columns: 1fr;
    gap: 0;
  }
  body.compute-mode .readout-grid .caption {
    font-size: 11px;
  }
  .operation-detail {
    margin: 0 14px 12px;
  }
  .operation-detail #operation-panel {
    display: block;
  }
  .operation-detail .lede,
  .operation-detail .op-layers {
    font-size: 12px;
  }
  .diagnostic-result strong {
    font-size: 19px;
  }
}

.component-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
body.webgl .scene-labels {
  display: none;
}
.symbol-inspector {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(600px, calc(100vw - 28px));
  border: 1px solid #7d7456;
  border-radius: 5px;
  background: #202b3b;
  box-shadow: 0 15px 70px #0009;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
}
#inspected-symbol {
  font:
    32px KaTeX_Main,
    Georgia,
    serif;
  color: var(--gold);
  min-width: 24px;
}
#inspected-meaning {
  font-size: 12px;
  line-height: 1.7;
  margin: 0;
  color: var(--ink);
}
#symbol-inspector-close {
  flex: none;
  background: none;
  border: 0;
  font-size: 20px;
  min-width: 35px;
  padding: 0;
}
body.compute-mode .calibration-disclosure {
  margin-top: 14px;
}
body.compute-mode .control-panel > .caption {
  margin-top: 14px;
}
@media (min-width: 1200px) {
  body.compute-mode .experiment-story {
    padding: 17px 22px 12px;
    margin-top: 16px;
  }
  body.compute-mode #story-reading {
    min-height: 0;
    margin-top: 10px;
    font-size: 12px;
  }
  body.compute-mode .story-heading h2 {
    font-size: 29px;
  }
  body.compute-mode #story-equation {
    font-size: 17px;
  }
  body.compute-mode #calculation-detail {
    margin-top: 8px;
    padding-top: 8px;
  }
}

body.compute-mode .amp-numbers {
  font-size: 10px;
}
body.compute-mode .control-values {
  font-size: 10px;
}
body.compute-mode .control-panel > .caption,
body.compute-mode .hardware-panel > .caption {
  font-size: 11px;
}
body.compute-mode .geometry-panel summary,
body.compute-mode .state-panel summary,
body.compute-mode .control-panel summary {
  font-size: 11px;
}
body.compute-mode .calibration label {
  font-size: 11px;
}
body.compute-mode .signal-nodes span {
  font-size: 10px;
}
body.compute-mode .readout-grid .caption {
  font-size: 12px;
}
@media (min-width: 1200px) {
  body.compute-mode .chapter-nav {
    position: sticky;
    top: 0;
    z-index: 8;
    background: #0e131b;

  }
  body.compute-mode .experiment-story {
    scroll-margin-top: 65px;
  }
}

@media (min-width: 1200px) {
  body.compute-mode .experiment-story {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 8px 28px;
  }
  body.compute-mode .story-heading {
    grid-column: 1/-1;
  }
  body.compute-mode .story-body {
    display: block;
    grid-column: 1;
    grid-row: 2 / span 2;
  }
  body.compute-mode #story-reading {
    margin-top: 6px;
  }
  body.compute-mode .story-phases {
    margin-top: 14px;
  }
  body.compute-mode #story-equation {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0;
  }
  body.compute-mode .trace-equivalence {
    gap: 12px;
  }
  body.compute-mode #story-equation .katex {
    font-size: 1em;
  }
  body.compute-mode #calculation-detail {
    grid-column: 2;
    grid-row: 3;
    margin: 0;
    padding-top: 5px;
  }
  body.compute-mode .circuit-panel .panel-heading {
    margin-bottom: 5px;
  }
  body.compute-mode .panel.circuit-panel {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  body.compute-mode.measuring .readout-panel {
    grid-column: 1/4;
    grid-row: 2;
  }
  body.compute-mode.measuring .hardware-panel {
    grid-column: 4;
    grid-row: 2;
  }
  body.compute-mode.measuring .state-panel {
    grid-column: 1;
    grid-row: 3;
  }
  body.compute-mode.measuring .geometry-panel {
    grid-column: 2;
    grid-row: 3;
  }
  body.compute-mode.measuring .control-panel {
    grid-column: 3;
    grid-row: 3;
  }
  body.compute-mode.measuring .readout-grid {
    grid-template-columns: 1fr 1.7fr;
  }
  body.compute-mode.measuring .readout-grid > div:first-child {
    grid-template-columns: 1fr;
    gap: 0;
  }
  body.compute-mode.measuring .readout-grid .caption {
    font-size: 11px;
  }
}

.skip:not(:focus) {
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  padding: 0;
}
.amplitude-plane {
  width: 40px;
  height: 40px;
  display: block;
}
.amp-row {
  grid-template-columns: 35px 44px minmax(50px, 1fr) 126px;
}
.amplitude-key {
  font-size: 11px;
  margin: 12px 0 0;
}
body.compute-mode .amp-row {
  grid-template-columns: 22px 38px minmax(20px, 1fr) 86px;
  gap: 7px;
}
body.compute-mode .amplitude-plane {
  width: 36px;
  height: 36px;
}
body.compute-mode .state-panel > .amplitude-key {
  font-size: 11px;
  margin: 12px 0 0;
}
@media (max-width: 720px) {
  body.compute-mode .amp-row {
    grid-template-columns: 24px 38px minmax(20px, 1fr) 86px;
  }
}

body.html-mode .component-labels {
  display: none !important;
}

.comparison-table {
  overflow: auto;
  margin: 14px 0;
}
.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}
.comparison-table th {
  font-weight: 500;
  color: var(--muted);
}
.comparison-table th,
.comparison-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
  min-width: 110px;
}
.comparison-table th:first-child {
  min-width: 60px;
}
.comparison-table td {
  font:
    11px ui-monospace,
    monospace;
}
.comparison-bar {
  display: inline-block;
  width: calc(var(--probability) * 0.55);
  height: 5px;
  background: var(--phase);
  margin-right: 10px;
  vertical-align: middle;
}
.comparison-bar.mixture {
  background: var(--muted);
}
.comparison-table:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 3px;
}

.workspace-nav {
  display: none;
}
@media (max-width: 720px) {
  .workspace-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 9;
    padding: 8px 14px;
    background: #0e131b;

    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
  }
  .workspace-nav > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
  }
  #mobile-operation {
    font:
      11px ui-monospace,
      monospace;
    color: var(--gold);
  }
  #mobile-play {
    min-height: 32px;
    font-size: 11px;
    padding: 5px 15px;
    background: var(--gold);
    color: var(--bg);
  }
  .workspace-jumps {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }
  .workspace-jumps button {
    min-width: 0;
    min-height: 36px;
    padding: 5px 1px;
    font-size: 10px;
    background: none;
  }
  body.compute-mode .workspace > .panel {
    scroll-margin-top: 100px;
  }
}

/* A quiet optical bench: contrast and material carry the visual hierarchy. */
.masthead {
  padding-top: 17px;
  padding-bottom: 17px;
}
.experience-heading {
  padding-top: 26px;
  padding-bottom: 26px;
}
h1 {
  font-size: clamp(34px, 3.8vw, 62px);
}
.viewport {
  background: radial-gradient(
    ellipse at 55% 35%,
    #293442 0%,
    #18222e 44%,
    #0c121c 85%
  );
}
.viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px #080d173d;
}
.viewport-caption,
.scene-bottom,
.viewport-controls {
  z-index: 3;
}
.viewport-controls {
  width: fit-content;
  max-width: calc(100% - 38px);
  border: 1px solid #56667844;
  background: #111a25;
  border-radius: 7px;
  padding: 4px;

}
.viewport-controls button {
  background: transparent;
  border: 0;
  border-radius: 4px;
}
.viewport-controls button[aria-pressed="true"] {
  background: #d9bc7d20;
}
.lesson-panel {
  background: linear-gradient(140deg, #202b3a, #141c27 70%);
}
.assembly-intro .subsystem-diagnostic,
.assembly-intro > details,
.assembly-intro .step-number,
.assembly-intro .execution-controls {
  display: none;
}
.assembly-intro .step-meta {
  margin-bottom: 34px;
}
.assembly-intro h2 {
  font-size: clamp(30px, 3vw, 46px);
  max-width: 360px;
}
.assembly-intro .lede {
  font-size: 16px;
  line-height: 1.7;
}
.machine-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 22px 0;
  margin: 16px 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.machine-facts strong {
  display: block;
  color: var(--gold);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 10px;
}
.machine-facts strong small {
  font-size: 13px;
}
.machine-facts span {
  display: block;
  color: var(--muted);
  font:
    8px/1.6 ui-monospace,
    monospace;
  letter-spacing: 0.08em;
}
.assembly-guidance {
  position: absolute;
  z-index: 4;
  bottom: 108px;
  left: 24px;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 13px;
  background: #111b29ee;
  border: 1px solid #566678;
  padding: 12px 15px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 10px 40px #0004;
  font-size: 11px;
  line-height: 1.65;
  color: #dce6f0;
}
.assembly-guidance.aligned {
  border-color: var(--gold);
  color: var(--gold);
}
.guidance-icon {
  width: 27px;
  height: 35px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 20px;
  color: var(--gold);
  font-size: 20px;
}
.amplitude-theatre {
  margin: 20px 34px;
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  border: 1px solid #445266;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 30%, #21304588, transparent 70%), #121a26;
}
.flow-introduction {
  padding: 30px 28px;
  border-right: 1px solid #364559;
}
.flow-introduction .eyebrow {
  color: var(--real);
}
#flow-title {
  font-size: clamp(27px, 2.9vw, 44px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 22px;
}
#flow-reading {
  color: #d0dbe7;
  font-size: 13px;
}
.flow-introduction .caption {
  margin-bottom: 0;
  font-size: 11px;
}
#flow-rule {
  font-size: 14px;
  margin-top: 18px;
}
.flow-stage {
  padding: 25px 20px 16px;
  min-width: 0;
}
.flow-column-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 0.1em;
  margin: 0 15px 16px;
}
.flow-column-labels span:nth-child(2) {
  color: var(--gold);
}
#amplitude-flow {
  position: relative;
  margin: 0;
}
#amplitude-flow svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.flow-guides path {
  stroke: #34455a;
  stroke-width: 0.6;
  stroke-dasharray: 2 7;
}
.flow-links > g {
  transition: opacity 0.14s;
}
.flow-links path {
  fill: none;
  transition:
    stroke-width 0.14s,
    stroke 0.14s;
}
.contribution-phase circle {
  fill: #121c2b;
  stroke: #65728b;
  stroke-width: 0.7;
}
.contribution-phase line {
  stroke: var(--phase);
  stroke-width: 1.6;
}
.flow-node-ring {
  fill: #142134;
  stroke: #5d7590;
  stroke-width: 1;
}
.flow-node-core {
  fill: var(--real);
}
.flow-node line {
  stroke: #f5f6f8;
  stroke-width: 2;
  transition:
    x2 0.12s,
    y2 0.12s;
}
.flow-node {
  transition: opacity 0.14s;
}
.flow-probability-track {
  fill: #35445a;
}
.flow-probability {
  fill: #e5edf8;
  transition:
    height 0.12s,
    y 0.12s;
}
.flow-basis-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.flow-basis-labels > div {
  position: absolute;
  width: 9%;
  transform: translateY(-50%);
  font-size: 12px;
  text-align: center;
}
.input-labels > div {
  left: 0;
}
.output-labels > div {
  right: 0;
}
.flow-basis-labels .math-visual {
  overflow: visible;
}
.flow-basis-labels .katex-display {
  margin: 0;
}
.flow-basis-labels .math-reading,
.flow-basis-labels .math-definitions {
  display: none;
}
#flow-select {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 15px;
  flex-wrap: wrap;
}
#flow-select::before {
  content: "INSPECT OUTPUT";
  align-self: center;
  font:
    8px ui-monospace,
    monospace;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-right: 8px;
}
#flow-select button {
  min-height: 34px;
  padding: 6px 12px;
  font:
    11px ui-monospace,
    monospace;
}
#flow-calculation {
  border-top: 1px solid #364559;
  padding-top: 15px;
  font-size: 15px;
  margin-bottom: 0;
}
body.compute-mode .experiment-story {
  border-radius: 9px;
  background: #151f2d;
  border-color: #445266;
}
body.compute-mode .workspace {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #3b4b60;
  gap: 1px;
  background: #3b4b60;
}
body.compute-mode .panel {
  background: #141d2a;
}
body.compute-mode .panel-heading h3 {
  font-size: 15px;
}
body.compute-mode .panel-heading h3 > span {
  color: #94acc8;
}
body.compute-mode .panel-heading > span {
  font-size: 9px;
}
body.compute-mode .frame-note {
  border-left: 2px solid var(--control);
  padding-left: 10px;
}
body.compute-mode .hardware-panel .viewport {
  border-radius: 6px;
}
@media (min-width: 1200px) {
  .machine-layout {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 30%);
  }
  .lesson-panel {
    padding: 32px;
  }
  .assembly-intro {
    padding-top: 9px;
  }
  body.compute-mode .experiment-story {
    margin-bottom: 0;
  }
}
@media (max-width: 1000px) {
  .amplitude-theatre {
    grid-template-columns: 0.8fr 1.2fr;
  }
  .flow-introduction {
    padding: 23px 19px;
  }
  .flow-stage {
    padding: 23px 12px 16px;
  }
  #flow-rule {
    font-size: 12px;
  }
}
@media (max-width: 720px) {
  .experience-heading {
    padding: 23px 18px;
  }
  .amplitude-theatre {
    margin: 14px;
    grid-template-columns: 1fr;
  }
  .flow-introduction {
    border-right: 0;
    border-bottom: 1px solid #364559;
    padding: 22px;
  }
  #flow-title br {
    display: none;
  }
  #flow-title {
    font-size: 31px;
  }
  #flow-reading {
    margin-bottom: 10px;
  }
  #flow-rule {
    font-size: 14px;
  }
  .flow-introduction > .caption {
    display: none;
  }
  .flow-stage {
    padding-top: 20px;
  }
  .flow-basis-labels > div {
    font-size: 10px;
  }
  #flow-calculation {
    font-size: 13px;
  }
  .flow-column-labels {
    font-size: 8px;
    margin-left: 4px;
    margin-right: 4px;
  }
  .assembly-guidance {
    bottom: 125px;
    max-width: 235px;
    font-size: 10px;
    left: 14px;
    padding: 9px 11px;
  }
  .viewport-controls {
    max-width: calc(100% - 28px);
    left: 14px;
  }
  .machine-facts {
    margin-bottom: 20px;
  }
}
.reduced-motion .flow-links > g,
.reduced-motion .flow-node,
.reduced-motion .flow-node line,
.reduced-motion .flow-probability {
  transition: none;
}
#try-interference {
  font-size: 11px;
  text-align: left;
  margin: 15px 0;
  color: var(--real);
  border-color: #49657c;
  background: #193040;
}
#flow-phase-controls {
  padding: 15px 0 10px;
  border-top: 1px solid #364559;
}
#flow-phase-controls label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 7px;
}
#flow-phase-controls output {
  color: var(--phase);
  font:
    11px ui-monospace,
    monospace;
}
#flow-phase-controls input {
  width: 100%;
  margin: 3px 0 17px;
  accent-color: var(--phase);
}
/* KaTeX's overlapping layout spans must not intercept clicks on a defined symbol. */
.katex-html span:not([data-meaning]) {
  pointer-events: none;
}
.katex-html [data-meaning] {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  scroll-margin-top: 90px;
}
/* Wide equations scroll within their own containers, never the page. */
body {
  overflow-x: clip;
}
.native-moment {
  border-left: 2px solid var(--phase);
  padding-left: 13px;
  color: #c6d1df;
  font-size: 12px;
  line-height: 1.75;
  margin: 16px 0;
}
.native-moment strong {
  display: block;
  color: var(--phase);
  font-size: 11px;
  margin-bottom: 5px;
  font-weight: 500;
}
#story-equation {
  position: relative;
  contain: paint;
}
.flow-node line {
  transform-origin: 0 0;
  transition: transform 0.13s linear;
}
.bloch-vector,
.bloch-tip {
  transform-origin: 0 0;
  transition: transform 0.13s linear;
}
.reduced-motion .flow-node line,
.reduced-motion .bloch-vector,
.reduced-motion .bloch-tip {
  transition: none;
}
.temperature-ruler {
  display: block;
  width: 46px;
}
.temperature-ruler > span {
  position: absolute;
  left: 12px;
  transform: translateY(-50%);
  white-space: nowrap;
}
.temperature-ruler > span:nth-child(1) {
  top: 0%;
}
.temperature-ruler > span:nth-child(2) {
  top: 18.092207%;
}
.temperature-ruler > span:nth-child(3) {
  top: 43.595633%;
}
.temperature-ruler > span:nth-child(4) {
  top: 59.846857%;
}
.temperature-ruler > span:nth-child(5) {
  top: 80.84392%;
}
.temperature-ruler > span:nth-child(6) {
  top: 100%;
}

/* Gate calculation: the algebra is the main stage. */
.calculation-theatre {
  position: relative;
  margin: 18px 34px 24px;
  padding: 28px;
  border: 1px solid #536579;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 70% 15%, #24435b55, transparent 65%), #121c29;
  overflow: clip;
}
.calculation-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.calculation-heading h2 {
  font-size: clamp(28px, 3vw, 43px);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.035em;
  margin: 0;
}
.calculation-heading .eyebrow {
  color: var(--real);
  margin-bottom: 8px;
}
.calculation-heading > div:last-child {
  display: flex;
  gap: 15px;
  align-items: center;
}
.calculation-kind {
  color: var(--real);
  font:
    10px ui-monospace,
    monospace;
  letter-spacing: 0.1em;
}
[data-calc="replay"] {
  background: var(--gold);
  color: #101a26;
  font-size: 12px;
  font-weight: 600;
}
.calculation-phases {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}
.calculation-phases button {
  flex: 1;
  border: 0;
  border-bottom: 2px solid #435369;
  border-radius: 0;
  padding: 11px;
  background: none;
  color: #bac8d8;
  font-size: 12px;
}
.calculation-phases button[aria-pressed="true"] {
  color: var(--real);
  border-bottom-color: var(--real);
  background: #71d1d90a;
}
.calculation-identity {
  font-size: clamp(24px, 3vw, 39px);
  text-align: center;
}
.calculation-identity .katex-display {
  text-align: center;
}
.calculation-label {
  font:
    9px/1.5 ui-monospace,
    monospace;
  color: #9fb3ca;
  letter-spacing: 0.12em;
  margin: 0 0 12px;
}
.basis-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 28px;
  padding: 20px 0;
  border-bottom: 1px solid #3e5169;
  margin-bottom: 22px;
}
.basis-input > .equation {
  font-size: 23px;
}
.source-ket {
  display: inline-block;
  padding: 5px 12px 5px 0;
  opacity: 0.7;
  font-size: 20px;
}
.basis-images {
  min-width: 0;
}
.basis-image {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 10px 0;
  font-size: 22px;
  overflow-x: auto;
  padding: 5px 0;
}
.basis-image-terms {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.basis-arrow {
  color: var(--gold);
  font-size: 24px;
}
.basis-plus {
  color: #a4b4c8;
}
.calculation-matrices {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 23px;
  overflow-x: auto;
  padding: 15px 12px 28px;
  font-size: 24px;
}
.matrix-object {
  flex: none;
}
.matrix-object > .calculation-label {
  text-align: center;
}
.matrix-brackets {
  position: relative;
  padding: 4px 12px;
  border-left: 2px solid #95abc3;
  border-right: 2px solid #95abc3;
}
.matrix-brackets::before,
.matrix-brackets::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 10px;
  height: calc(100% + 2px);
  border-top: 2px solid #95abc3;
  border-bottom: 2px solid #95abc3;
  pointer-events: none;
}
.matrix-brackets::before {
  left: -2px;
}
.matrix-brackets::after {
  right: -2px;
}
.matrix-row {
  display: grid;
  align-items: center;
  min-height: 48px;
  border-radius: 4px;
  transition: background 0.2s;
}
.matrix-entry {
  min-width: 52px;
  padding: 5px 8px;
  text-align: center;
}
.matrix-entry .katex-display {
  margin: 0;
  text-align: center;
}
.matrix-entry .katex {
  font-size: 1em;
}
.selected-row {
  background: #71d1d91a;
}
[data-calc="output"] .selected-row {
  background: #d9bc7d25;
  color: var(--gold);
}
.matrix-sign {
  margin-top: 24px;
  color: #a4b8cf;
  font-size: 28px;
}
.calculation-row-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin: 0 0 22px;
}
.calculation-row-choices::before {
  content: "CALCULATE AN OUTPUT";
  font:
    9px ui-monospace,
    monospace;
  color: #9fb3ca;
  letter-spacing: 0.1em;
  margin-right: 12px;
}
.calculation-row-choices button {
  padding: 7px 14px;
  min-height: 42px;
}
.calculation-row-choices .katex-display {
  margin: 0;
}
.row-working {
  padding: 23px;
  border: 1px solid #415974;
  border-radius: 7px;
  background: #0c1521;
}
.row-working h3 {
  font-size: 14px;
  font-weight: 500;
  color: #c4d7eb;
  margin: 0 0 20px;
}
.row-products {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 15px;
  font-size: 22px;
}
.row-product {
  flex: 1 0 110px;
  max-width: 210px;
  background: #1c2c40;
  border: 1px solid #466380;
  border-radius: 5px;
  padding: 15px 12px;
  text-align: center;
}
.zero-product {
  opacity: 0.4;
}
.product-factors {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
[data-factor="matrix"] {
  color: var(--real);
}
[data-factor="input"] {
  color: var(--gold);
}
[data-factor="value"] {
  color: #f2f4f9;
}
.product-equals {
  font-size: 17px;
  color: #8da7c4;
  margin: 10px 0;
}
.row-product .katex-display {
  margin: 0;
}
.row-sum {
  font-size: 24px;
}
.row-sum .math-reading {
  font-size: 12px;
}
.row-ket {
  font-size: 22px;
  color: var(--real);
}
.calculation-result {
  margin-top: 22px;
  padding: 22px 12px;
  border-radius: 7px;
  text-align: center;
  border-top: 1px solid #415974;
}
.collected-ket {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: clamp(25px, 3vw, 40px);
}
.collected-ket .katex-display {
  margin: 0;
}
.result-term {
  transition: opacity 0.25s;
  max-width: 100%;
  overflow-x: auto;
  padding: 8px;
}
.calculation-explanation {
  text-align: center;
  max-width: 800px;
  margin: 12px auto 0;
  font-size: 14px;
  color: #b5c8dd;
}
.calculation-parameter {
  text-align: center;
  font-size: 16px;
}
.calculation-ghost {
  position: absolute;
  z-index: 12;
  pointer-events: none;
  color: var(--real);
  filter: drop-shadow(0 0 6px #71d1d94a);
}
.calculation-ghost .katex-display {
  margin: 0;
}
.calculation-theatre[data-phase="basis"] .basis-actions {
  background: #71d1d908;
}
.calculation-theatre[data-phase="multiply"] .calculation-matrices {
  background: #71d1d905;
}
.calculation-theatre[data-phase="result"] .calculation-result {
  border-color: var(--real);
}
.amplitude-disclosure {
  margin: 0 34px 24px;
  border-top: 1px solid #34465e;
  padding-top: 15px;
}
.amplitude-disclosure > summary {
  color: #b5c8dd;
  font-size: 13px;
}
.amplitude-disclosure .amplitude-theatre {
  margin: 18px 0 0;
}
body.compute-mode .story-phases {
  display: none;
}
body.compute-mode #story-reading {
  font-size: 14px;
}
body.compute-mode .experiment-story {
  display: block;
  padding: 20px 26px;
}
body.compute-mode .story-heading {
  margin-bottom: 10px;
}
body.compute-mode #calculation-detail {
  margin-top: 8px;
}
@media (max-width: 720px) {
  .calculation-theatre {
    margin: 14px;
    padding: 20px 16px;
  }
  .calculation-heading {
    display: block;
  }
  .calculation-heading > div:last-child {
    margin-top: 16px;
    justify-content: space-between;
  }
  .calculation-kind {
    font-size: 8px;
  }
  [data-calc="replay"] {
    font-size: 11px;
    padding: 8px;
  }
  .calculation-phases {
    gap: 3px;
  }
  .calculation-phases button {
    font-size: 10px;
    padding: 8px 3px;
  }
  .calculation-identity {
    font-size: 22px;
  }
  .basis-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .basis-image {
    font-size: 18px;
    gap: 10px;
  }
  .basis-input > .equation {
    font-size: 20px;
  }
  .calculation-matrices {
    justify-content: start;
    gap: 12px;
    font-size: 19px;
  }
  .matrix-entry {
    min-width: 36px;
    padding: 5px;
  }
  .matrix-row {
    min-height: 43px;
  }
  .row-working {
    padding: 17px 12px;
  }
  .row-products {
    justify-content: start;
    font-size: 19px;
  }
  .row-product {
    flex-basis: 112px;
  }
  .row-sum {
    font-size: 19px;
  }
  .row-ket {
    font-size: 19px;
  }
  .calculation-row-choices::before {
    width: 100%;
    margin-bottom: 8px;
    text-align: center;
  }
  .collected-ket {
    font-size: 25px;
    gap: 5px;
  }
  .calculation-explanation {
    font-size: 13px;
    text-align: left;
  }
  .amplitude-disclosure {
    margin: 0 14px 20px;
  }
  body.compute-mode .experiment-story {
    padding: 18px;
  }
}
.calculation-result {
  transition: opacity 0.45s;
}
.calculation-theatre[data-phase="basis"] .calculation-result,
.calculation-theatre[data-phase="multiply"] .calculation-result {
  opacity: 0.28;
}
.calculation-theatre[data-phase="basis"] .result-term,
.calculation-theatre[data-phase="multiply"] .result-term {
  transform: translateY(8px);
}
.result-term {
  transition:
    opacity 0.3s,
    transform 0.45s;
}
.reduced-motion .calculation-result,
.reduced-motion .result-term {
  transition: none;
}
@media (min-width: 1100px) {
  .calculation-theatre {
    padding: 23px 26px;
  }
  .calculation-phases {
    margin: 16px 0 7px;
  }
  .calculation-identity {
    padding: 8px 0;
    font-size: 30px;
  }
  .basis-actions {
    padding: 8px 0 14px;
    margin-bottom: 12px;
  }
  .basis-input > .equation {
    font-size: 21px;
  }
  .source-ket {
    font-size: 17px;
    padding-top: 0;
  }
  .basis-image {
    font-size: 20px;
    margin: 4px 0;
  }
  .matrix-calculation-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 12px 22px;
    align-items: start;
  }
  .calculation-matrices {
    grid-column: 1;
    grid-row: 1;
    justify-content: start;
    padding: 12px 9px;
    gap: 15px;
    font-size: 22px;
    min-width: 0;
  }
  .calculation-row-choices {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
  }
  .row-working {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 0;
    padding: 18px;
  }
  .row-products {
    font-size: 20px;
    gap: 7px;
  }
  .row-product {
    flex-basis: 80px;
    padding: 12px 8px;
  }
  .product-factors {
    gap: 7px;
  }
  .row-sum {
    font-size: 21px;
    padding: 8px 0;
  }
  .row-ket {
    font-size: 20px;
    padding: 4px 0;
  }
  .calculation-result {
    margin-top: 18px;
    padding: 16px 12px 8px;
  }
  .collected-ket {
    font-size: 34px;
  }
  .calculation-explanation {
    font-size: 13px;
  }
}
.zero-product {
  opacity: 1;
  background: #101b2a;
  border-color: #33475f;
}
.zero-product [data-factor] {
  color: #9caec4;
}
[data-calc="input"] .selected-row {
  background: #d9bc7d0c;
}
.calculation-theatre {
  scroll-margin-top: 65px;
}
.calculation-theatre[data-phase="multiply"] .calculation-result {
  opacity: 1;
}
.calculation-theatre[data-phase="multiply"] .result-term {
  opacity: 0.35;
}
.calculation-theatre[data-phase="multiply"] .result-term.selected-output {
  opacity: 1;
}
.calculation-matrices:focus-visible,
.row-products:focus-visible,
.result-term:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 3px;
}
.basis-image:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 3px;
}

/* One operation, one time coordinate, one continuous stage. */
body.compute-mode #computation {
  padding-top: 0;
}
body.compute-mode .experiment-story {
  margin-bottom: 16px;
}
body.compute-mode #computation > .circuit-panel {
  margin: 0 0 16px;
  padding: 14px 24px;
  background: #0e1824;
  border: 1px solid #314254;
  border-radius: 12px;
}
body.compute-mode #computation > .circuit-panel .panel-heading {
  margin-bottom: 0;
}
body.compute-mode #computation > .circuit-panel .execution-controls {
  display: inline-flex;
}
body.compute-mode #computation > .circuit-panel .lab-toolbar {
  margin-left: 20px;
}
.coherent-stage {
  --stage-accent: #71d1d9;
  --progress: 1;
  --pulse-power: 0;
  position: relative;
  isolation: isolate;
  padding: 25px 28px 0;
  border: 1px solid #40566c;
  border-radius: 16px;
  overflow: clip;
  background:
    radial-gradient(ellipse at 78% 28%, #213a4c55, transparent 56%),
    linear-gradient(145deg, #152535, #0d1723 70%);
  box-shadow: 0 24px 80px #0003;
}
.coherent-stage[data-kind="flux"] {
  --stage-accent: var(--phase);
}
.coherent-stage[data-kind="frame"] {
  --stage-accent: var(--phase);
}
.coherent-stage[data-kind="readout"] {
  --stage-accent: var(--readout);
}
.coherent-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
}
.coherent-heading .eyebrow {
  margin: 0 0 8px;
  color: var(--stage-accent);
  font-size: 10px;
  letter-spacing: 0.16em;
}
.coherent-heading h2 {
  margin: 0;
  font-size: clamp(23px, 2.6vw, 38px);
  font-weight: 500;
  letter-spacing: -0.04em;
}
.coherent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.coherent-actions button {
  font-size: 12px;
  border-radius: 5px;
  min-height: 40px;
}
.coherent-actions button.primary {
  background: #d9bc7d;
  color: #121b24;
}
.ket-trajectory {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) 120px minmax(0, 1.8fr);
  align-items: center;
  gap: 20px;
  min-height: 176px;
  padding: 23px 6px 12px;
}
.stage-label {
  display: block;
  color: #aabaca;
  font-size: 10px;
  letter-spacing: 0.13em;
}
.ket-origin,
.ket-destination {
  min-width: 0;
}
body.compute-mode #coherent-input {
  font-size: clamp(16px, 1.7vw, 23px);
}
body.compute-mode #coherent-current {
  font-size: clamp(20px, 2.2vw, 31px);
  color: #f1f1e9;
}
#coherent-stage .equation {
  overflow-x: auto;
  padding: 8px 0;
}
#coherent-stage .equation .katex-display {
  margin: 7px 0;
  text-align: left;
}
#coherent-stage .equation .math-reading,
#coherent-stage .equation .math-definitions {
  display: none;
}
.ket-operator {
  display: grid;
  place-items: center;
  color: #91aec4;
}
.gate-orb {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  font-size: 19px;
  font-weight: 500;
  border: 1px solid var(--stage-accent);
  border-radius: 50%;
  color: #e2f5ff;
  background: #192e42;
  box-shadow: 0 0 calc(8px + 24px * var(--pulse-power)) #71d1d930;
}
.ket-operator svg {
  width: 120px;
  height: 28px;
}
.ket-operator path {
  fill: none;
  stroke: #67869d;
  stroke-width: 1;
}
.ket-operator circle {
  fill: var(--stage-accent);
  filter: drop-shadow(0 0 3px var(--stage-accent));
}
#coherent-percent {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.coherent-populations {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px 16px;
  padding-top: 6px;
}
.coherent-population {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.coherent-population[data-occupied="true"] {
  opacity: 1;
}
.coherent-population > span {
  font-size: 11px;
}
.coherent-population .katex-display {
  margin: 0;
}
.coherent-population i {
  height: 3px;
  background: #345069;
  border-radius: 3px;
  overflow: hidden;
}
.coherent-population b {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--real);
  transform-origin: left;
  transition: transform 0.08s linear;
}
.coherent-population output {
  font-size: 10px;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #c3d6e3;
}
.coherent-caption {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 58px;
  padding: 12px 0 16px;
  border-bottom: 1px solid #3e5267;
}
#coherent-reading {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  max-width: 850px;
  color: #c3d0dc;
}
#coherent-correlation {
  font-size: 9px;
  line-height: 1.6;
  color: var(--stage-accent);
  letter-spacing: 0.08em;
  max-width: 160px;
}
.coherent-views {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.25fr);
}
body.compute-mode .coherent-views > .panel {
  grid-column: auto;
  padding: 20px 22px 16px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-width: 0;
}
body.compute-mode .coherent-views > .panel + .panel {
  border-left: 1px solid #34495c;
}
body.compute-mode .coherent-views > .panel:first-child {
  padding-left: 0;
}
body.compute-mode .coherent-views > .panel:last-child {
  padding-right: 0;
}
body.compute-mode .coherent-views .panel-heading h3 {
  font-size: 13px;
  font-weight: 500;
}
body.compute-mode .coherent-views .panel-heading > span {
  color: #9fb5c6;
  font-size: 9px;
}
body.compute-mode .coherent-views #bloch-spheres {
  flex-wrap: nowrap;
  align-items: center;
  min-height: 194px;
}
body.compute-mode .coherent-views #bloch-spheres svg {
  width: 50%;
  max-height: 204px;
  flex: 1;
  min-width: 0;
  overflow: visible;
}
body.compute-mode .coherent-views #bloch-spheres svg:only-child {
  max-height: 230px;
}
body.compute-mode .coherent-views #geometry-explanation {
  font-size: 11px;
  line-height: 1.6;
  min-height: 36px;
  margin: 5px 0 10px;
}
body.compute-mode .coherent-views .stage-inspection {
  margin-top: 12px;
  font-size: 11px;
  border-top: 0;
  padding-top: 0;
}
body.compute-mode .coherent-views .stage-inspection > summary {
  font-size: 11px;
  color: #aec4d5;
}
.coherent-views .stage-inspection[open] > div {
  padding-top: 12px;
}
body.compute-mode .coherent-views #waveform {
  min-height: 194px;
  display: grid;
  align-items: center;
}
body.compute-mode .coherent-views #waveform svg {
  width: 100%;
  overflow: visible;
}
body.compute-mode .coherent-views .control-values {
  font-size: 10px;
  gap: 4px;
  min-height: 36px;
  margin: 5px 0 10px;
}
body.compute-mode .coherent-views .control-values span {
  padding: 2px 4px;
  border: 0;
  background: transparent;
}
body.compute-mode .coherent-views .frame-note,
body.compute-mode .coherent-views .hardware-panel > .caption {
  display: none;
}
body.compute-mode .coherent-views .viewport {
  height: 224px;
  min-height: 224px;
  max-height: 224px;
  border-radius: 9px;
  border: 1px solid #40556a;
  background: radial-gradient(ellipse at 50% 55%, #253c50, #111d2a);
}
body.compute-mode .coherent-views .viewport-caption {
  font-size: 8px;
  top: 10px;
  left: 10px;
}
body.compute-mode .coherent-views .viewport-controls {
  bottom: 8px;
}
body.compute-mode .coherent-views .viewport-controls button {
  font-size: 9px;
  background: #111e2be0;
}
#processor-signal {
  display: block;
  width: 100%;
  height: 48px;
  overflow: visible;
}
#processor-signal path {
  fill: none;
  stroke: #57758c;
  stroke-width: 1;
}
#processor-signal circle {
  fill: var(--stage-accent);
  filter: drop-shadow(0 0 4px var(--stage-accent));
}
#processor-signal text {
  fill: #b7cedf;
  font-size: 11px;
  font-family: inherit;
}
.coherent-transport {
  display: grid;
  grid-template-columns: 230px minmax(80px, 1fr) 130px;
  gap: 24px;
  align-items: center;
  min-height: 60px;
  border-top: 1px solid #40566b;
}
#coherent-moment {
  color: var(--stage-accent);
  font-size: 10px;
  letter-spacing: 0.05em;
}
#coherent-time {
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #c7d6e2;
}
body.compute-mode .coherent-transport .scrub-label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  font-size: 11px;
  color: #adc1d3;
}
.coherent-transport input {
  width: 100%;
  accent-color: #71d1d9;
}
body.compute-mode .workspace {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  margin-top: 24px;
}
body.compute-mode .workspace .state-panel {
  grid-column: 1;
}
body.compute-mode .workspace .readout-panel {
  grid-column: 2;
}
body.compute-mode .workspace .readout-grid {
  grid-template-columns: 1fr 1.2fr;
}
body.compute-mode .workspace .readout-grid > div:first-child {
  display: block;
}
.exact-working {
  margin: 20px 0;
  padding: 0;
  border: 1px solid #3f5265;
  border-radius: 10px;
  background: #111e2a;
}
.exact-working > summary {
  padding: 20px 24px;
  color: #eef1ec;
  font-size: 16px;
  cursor: pointer;
}
.exact-working > summary span {
  color: #a5bdcf;
  font-size: 12px;
  margin-left: 24px;
}
.exact-working .calculation-theatre {
  border: 0;
  box-shadow: none;
  margin: 0;
  border-radius: 0 0 10px 10px;
}
body.compute-mode .experiment-story .story-heading h2,
body.compute-mode .experiment-story #story-reading {
  display: none;
}
body.compute-mode .experiment-story {
  padding: 12px 0;
  border: 0;
  background: transparent;
}
body.compute-mode .experiment-story .story-body {
  display: none;
}
body.compute-mode .experiment-story .story-heading {
  align-items: center;
}
body.compute-mode .experiment-story .eyebrow {
  margin: 0;
  font-size: 10px;
}
.bloch-vector,
.bloch-tip {
  transition: none;
}
@media (min-width: 1500px) {
  body.compute-mode .coherent-views .viewport {
    height: 270px;
    min-height: 270px;
    max-height: 270px;
  }
  body.compute-mode .coherent-views #bloch-spheres,
  body.compute-mode .coherent-views #waveform {
    min-height: 240px;
  }
}
@media (max-width: 1050px) {
  .coherent-stage {
    padding: 20px 20px 0;
  }
  .coherent-heading {
    align-items: start;
  }
  .coherent-actions {
    flex-direction: column;
  }
  .coherent-actions button {
    font-size: 11px;
  }
  .ket-trajectory {
    grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1.5fr);
    gap: 12px;
  }
  .ket-operator svg {
    width: 72px;
  }
  .coherent-views {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  body.compute-mode .coherent-views > .hardware-panel {
    grid-column: 1/-1;
    border-left: 0;
    border-top: 1px solid #34495c;
    padding-left: 0;
  }
  body.compute-mode .coherent-views .viewport {
    height: 300px;
    min-height: 300px;
    max-height: 300px;
  }
  .coherent-transport {
    grid-template-columns: 160px 1fr 100px;
    gap: 12px;
  }
}
@media (max-width: 720px) {
  body.compute-mode #computation > .circuit-panel {
    padding: 14px;
  }
  body.compute-mode #computation > .circuit-panel .lab-toolbar {
    float: none;
    margin: 8px 0;
  }
  body.compute-mode #computation > .circuit-panel .execution-controls {
    display: flex;
  }
  .coherent-stage {
    padding: 20px 15px 0;
    border-radius: 12px;
  }
  .coherent-heading {
    display: block;
  }
  .coherent-heading h2 {
    font-size: 27px;
    line-height: 1.15;
  }
  .coherent-actions {
    flex-direction: row;
    margin-top: 16px;
    flex-wrap: wrap;
  }
  .coherent-actions button {
    flex: 1;
    padding: 9px 7px;
    min-height: 42px;
  }
  .ket-trajectory {
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 7px;
    padding: 20px 0 14px;
  }
  .ket-origin {
    grid-column: 1;
  }
  .ket-operator {
    grid-column: 2;
    grid-row: 1;
  }
  .gate-orb {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  .ket-operator svg {
    width: 50px;
  }
  .ket-destination {
    grid-column: 1/-1;
  }
  body.compute-mode #coherent-current {
    font-size: 21px;
  }
  body.compute-mode #coherent-input {
    font-size: 17px;
  }
  .stage-label {
    font-size: 9px;
  }
  .coherent-populations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .coherent-caption {
    display: block;
  }
  #coherent-reading {
    font-size: 12px;
  }
  #coherent-correlation {
    display: block;
    max-width: none;
    margin-top: 10px;
  }
  .coherent-views {
    grid-template-columns: 1fr;
  }
  body.compute-mode .coherent-views > .panel {
    padding: 18px 0;
  }
  body.compute-mode .coherent-views > .panel + .panel {
    border-left: 0;
    border-top: 1px solid #34495c;
  }
  body.compute-mode .coherent-views > .hardware-panel {
    grid-column: auto;
  }
  body.compute-mode .coherent-views #bloch-spheres {
    min-height: 200px;
  }
  body.compute-mode .coherent-views #waveform {
    min-height: 145px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 260px;
    min-height: 260px;
    max-height: 260px;
  }
  .coherent-transport {
    position: sticky;
    bottom: 0;
    background: #142535f5;
    z-index: 3;
    grid-template-columns: 1fr 110px;
    gap: 7px;
    padding: 12px 0;
  }
  .coherent-transport .scrub-label {
    grid-row: 2;
    grid-column: 1/-1;
  }
  .coherent-transport input {
    min-height: 32px;
  }
  #coherent-time {
    grid-column: 2;
    grid-row: 1;
  }
  #coherent-moment {
    font-size: 9px;
  }
  .exact-working > summary {
    padding: 16px;
    font-size: 14px;
  }
  .exact-working > summary span {
    display: block;
    margin: 7px 0 0 18px;
    font-size: 10px;
  }
  body.compute-mode .workspace {
    grid-template-columns: 1fr;
  }
  body.compute-mode .workspace .state-panel,
  body.compute-mode .workspace .readout-panel {
    grid-column: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .coherent-population b,
  .coherent-population {
    transition: none;
  }
}
.coherent-stage {
  scroll-margin-top: 70px;
}
.coherent-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 7px 0;
  border-bottom: 1px solid #3e5267;
}
.coherent-row > .stage-label {
  flex: 0 0 158px;
  font-size: 9px;
  line-height: 1.6;
}
body.compute-mode #coherent-rule {
  margin: 0;
  font-size: 16px;
  flex: 1;
  min-width: 0;
}
.coherent-row > a {
  font-size: 11px;
  color: var(--real);
  white-space: nowrap;
}
#coherent-mobile-live {
  display: none;
}
#exact-working {
  scroll-margin-top: 70px;
}
@media (max-width: 720px) {
  .coherent-row {
    flex-wrap: wrap;
    gap: 5px 12px;
    padding: 12px 0;
  }
  .coherent-row > .stage-label {
    flex: 1;
  }
  .coherent-row > a {
    order: 1;
  }
  body.compute-mode #coherent-rule {
    flex: 0 0 100%;
    order: 2;
    font-size: 15px;
  }
  #coherent-mobile-live {
    position: sticky;
    top: 52px;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin: 14px -15px 0;
    padding: 0 15px;
    background: #122232;
    border-block: 1px solid #4a6378;

  }
  body.compute-mode #coherent-mobile-ket {
    font-size: 14px;
    padding: 3px 0;
  }
  #coherent-mobile-time {
    color: var(--real);
    font-size: 10px;
  }
  .coherent-population output {
    min-width: 26px;
  }
}
#circuit-heading {
  font-size: 13px;
  margin: 0;
  font-weight: 500;
}
#circuit-heading span {
  color: var(--gold);
  font-size: 10px;
  margin-right: 7px;
}
#coherent-circuit {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  padding: 16px 0 2px;
}
#coherent-circuit > span {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #a7bdcf;
  margin-right: 5px;
}
#coherent-circuit button {
  min-height: 31px;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
  background: #182a3c;
  border-radius: 4px;
}
#coherent-circuit button small {
  color: #a5bdcf;
  font-size: 10px;
  margin-left: 8px;
}
#coherent-circuit button[aria-current="step"] {
  color: #f5dfae;
  border-color: #d9bc7d;
  box-shadow: 0 0 18px #d9bc7d16;
}
#coherent-circuit > i {
  color: #7892a9;
  font-style: normal;
}
@media (max-width: 720px) {
  #coherent-circuit {
    gap: 6px;
  }
  #coherent-circuit button {
    min-height: 40px;
  }
}
.ket-trajectory {
  min-height: 150px;
  padding-top: 18px;
  padding-bottom: 9px;
}

/* Joint coherence keeps the information local Bloch spheres cannot carry. */
#coherence-peek {
  margin-top: 8px;
}
#coherence-peek .stage-label {
  font-size: 8px;
  letter-spacing: 0.11em;
}
#coherence-metrics {
  display: flex;
  gap: 16px;
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}
#coherence-metrics > span {
  font-size: 9px;
  color: #a9bdcd;
  display: grid;
  gap: 3px;
}
#coherence-metrics output {
  color: #d7e8ef;
  font-size: 13px;
}
#coherence-peek button {
  border: 0;
  padding: 0;
  min-height: 22px;
  font-size: 10px;
  color: var(--real);
  background: transparent;
  text-align: left;
}
.coherence-inspector {
  margin: 20px 0;
  border: 1px solid #465d72;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 40% 15%, #20374b77, transparent 65%), #101e2c;
  scroll-margin-top: 70px;
}
.coherence-inspector > summary {
  padding: 20px 24px;
  font-size: 16px;
  color: #edf2f0;
}
.coherence-inspector > summary > span {
  color: #a5bdcf;
  font-size: 12px;
  margin-left: 24px;
}
.coherence-intro {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: start;
  padding: 10px 28px 20px;
}
.coherence-intro .eyebrow {
  font-size: 9px;
  color: var(--real);
}
.coherence-intro h2 {
  font-size: clamp(23px, 2.6vw, 35px);
  letter-spacing: -0.035em;
  font-weight: 500;
  margin: 0 0 10px;
}
.coherence-intro p:last-child {
  font-size: 13px;
  color: #bfcedb;
  line-height: 1.6;
  max-width: 790px;
}
.coherence-intro button {
  flex-shrink: 0;
  margin-top: 12px;
}
.coherence-matrices {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.85fr) minmax(0, 1.35fr);
  gap: 32px;
  padding: 14px 28px 24px;
}
.coherence-matrices h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.coherence-matrices .caption {
  color: #afc1d1;
  line-height: 1.6;
  font-size: 11px;
}
.joint-density {
  display: grid;
  grid-template-columns: 35px repeat(4, minmax(0, 1fr));
  gap: 5px;
  max-width: 315px;
  align-items: center;
}
.joint-density > span {
  text-align: center;
  font-size: 11px;
  min-width: 0;
}
.joint-density .katex-display {
  margin: 7px 0;
}
.coherence-cell {
  --magnitude: 0;
  --entry-color: var(--real);
  position: relative;
  aspect-ratio: 1;
  min-height: 0;
  padding: 4px;
  border: 1px solid #35516b;
  border-radius: 5px;
  background: #0b1723;
  color: var(--entry-color);
}
.coherence-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--entry-color);
  opacity: calc(var(--magnitude) * 0.3);
  border-radius: inherit;
}
.coherence-cell svg {
  width: 100%;
  height: 100%;
  position: relative;
}
.coherence-cell circle {
  fill: none;
  stroke: #8fa8bc;
  stroke-width: 0.5;
  opacity: calc(0.1 + var(--magnitude) * 0.45);
}
.coherence-cell path {
  fill: none;
  stroke: var(--entry-color);
  stroke-width: 1.4;
  transform-origin: 15px 15px;
}
.coherence-cell[aria-pressed="true"] {
  border-color: #e4c98a;
  box-shadow: 0 0 0 1px #e4c98a inset;
}
.coherence-working {
  min-width: 0;
  padding-top: 4px;
}
.coherence-working .equation {
  overflow-x: auto;
  font-size: 15px;
}
.coherence-working .math-reading {
  font-size: 11px;
  color: #b8c9d7;
}
.coherence-working .stage-label {
  font-size: 9px;
}
#bell-witness-equation {
  font-size: 13px;
}
#bell-witness-reading {
  font-size: 12px;
  line-height: 1.6;
  color: #c4d3df;
}
.witness-scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 24px 4px 10px;
  padding-top: 15px;
  font-size: 9px;
  color: #a7bdd0;
}
.witness-scale::before {
  content: "";
  position: absolute;
  top: 0;
  height: 3px;
  inset-inline: 0;
  background: linear-gradient(90deg, #4a5e72 50%, #71d1d9 50%);
}
.witness-scale i {
  position: absolute;
  left: 50%;
  top: -5px;
  height: 13px;
  border-left: 1px solid #d9bc7d;
}
.witness-scale b {
  position: absolute;
  top: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #eef2ed;
  transform: translateX(-50%);
  box-shadow: 0 0 12px #a4e5eaaa;
}
#bell-phase-controls {
  margin: 0 28px 22px;
  padding: 18px 20px;
  background: #152b3f;
  border: 1px solid #405c73;
  border-radius: 8px;
}
#bell-phase-controls label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #d4e2eb;
}
#bell-phase-controls output {
  color: var(--phase);
  font-variant-numeric: tabular-nums;
}
#bell-phase-controls input {
  width: 100%;
  accent-color: var(--phase);
  margin: 14px 0;
}
#bell-phase-controls button {
  min-height: 34px;
  font-size: 11px;
  margin-right: 6px;
}
#bell-phase-equation {
  overflow-x: auto;
  font-size: 16px;
}
.coherence-measurements {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 20px 28px;
  border-top: 1px solid #3c5266;
  align-items: center;
}
#coherence-correlations {
  font-size: 12px;
  color: #becfdb;
  max-width: 650px;
  line-height: 1.7;
}
.coherence-basis {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.coherence-basis > span {
  width: 100%;
  font-size: 10px;
  color: #a9c1d5;
}
.coherence-basis button {
  min-height: 36px;
  font-size: 11px;
}
.coherence-source {
  margin: 0;
  padding: 0 28px 22px;
  font-size: 10px;
  color: #a1b8cb;
  line-height: 1.6;
}
.coherence-source a {
  color: var(--real);
}
@media (max-width: 1050px) {
  .coherence-matrices {
    grid-template-columns: 1fr 1fr;
  }
  .coherence-working {
    grid-column: 1/-1;
  }
}
@media (max-width: 720px) {
  #coherence-peek {
    margin-top: 10px;
  }
  #coherence-metrics {
    gap: 18px;
  }
  .coherence-inspector > summary {
    padding: 16px;
    font-size: 14px;
  }
  .coherence-inspector > summary > span {
    display: block;
    margin: 7px 0 0 18px;
    font-size: 10px;
  }
  .coherence-intro {
    display: block;
    padding: 12px 16px;
  }
  .coherence-intro button {
    width: 100%;
    margin: 4px 0 14px;
  }
  .coherence-matrices {
    padding: 10px 16px;
    gap: 18px 10px;
  }
  .coherence-matrices h3 {
    font-size: 12px;
  }
  .coherence-matrices .caption {
    font-size: 10px;
  }
  .joint-density {
    grid-template-columns: 21px repeat(4, minmax(0, 1fr));
    gap: 3px;
  }
  .joint-density > span {
    font-size: 9px;
  }
  .coherence-cell {
    padding: 1px;
  }
  .coherence-measurements {
    display: block;
    padding: 16px;
  }
  .coherence-basis {
    margin-top: 16px;
  }
  #bell-phase-controls {
    margin: 0 16px 18px;
    padding: 14px;
  }
  #bell-phase-equation {
    font-size: 13px;
  }
  .coherence-source {
    padding: 0 16px 16px;
  }
}
.joint-phase-peek svg {
  width: 28px;
  height: 22px;
  color: var(--phase);
}
.joint-phase-peek circle {
  stroke: #7792a8;
  stroke-width: 0.7;
  fill: none;
}
.joint-phase-peek path {
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  transform-origin: 14px 11px;
}
#stage-phase-controls {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 14px 0 4px;
  padding: 10px 14px;
  border: 1px solid #526279;
  border-radius: 6px;
  background: #21304777;
}
#stage-phase-controls label {
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#stage-phase-controls output {
  color: var(--phase);
  font-variant-numeric: tabular-nums;
}
#stage-phase-controls input {
  width: 100%;
  accent-color: var(--phase);
}
#stage-phase-controls > span {
  font-size: 10px;
  color: #b6c8d6;
}
@media (max-width: 720px) {
  #stage-phase-controls {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 12px;
  }
  #stage-phase-controls > span {
    display: none;
  }
  #stage-phase-controls input {
    min-height: 30px;
  }
  #coherence-metrics {
    gap: 12px;
  }
}
#coherence-peek .stage-label {
  font-size: 9px;
  letter-spacing: 0.08em;
}
#coherence-metrics > span {
  font-size: 10px;
}
#coherence-metrics output {
  font-size: 15px;
}
@media (max-width: 720px) {
  #coherence-metrics {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
}
@media (min-width: 1200px) and (max-height: 950px) {
  .coherent-stage {
    padding-top: 18px;
  }
  .coherent-heading h2 {
    font-size: 31px;
  }
  #coherent-circuit {
    padding-top: 11px;
  }
  .ket-trajectory {
    padding-top: 12px;
    padding-bottom: 5px;
  }
  body.compute-mode #coherent-current {
    font-size: 27px;
  }
  .coherent-caption {
    padding-block: 8px;
    min-height: 44px;
  }
  body.compute-mode #coherent-rule {
    padding-block: 3px;
  }
  #coherent-rule .katex-display {
    margin-block: 3px;
  }
  body.compute-mode .coherent-views > .panel {
    padding-top: 14px;
    padding-bottom: 12px;
  }
  body.compute-mode .coherent-views #bloch-spheres,
  body.compute-mode .coherent-views #waveform {
    min-height: 170px;
  }
  body.compute-mode .coherent-views #bloch-spheres svg {
    max-height: 180px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 200px;
    min-height: 200px;
    max-height: 200px;
  }
  .coherent-transport {
    min-height: 50px;
  }
}

/* A single scientific stage: equations above, geometry and processor in one field. */
.circuit-tools {
  margin: 0 34px 14px;
  border: 0;
  border-bottom: 1px solid #354456;
  padding: 0;
}
.circuit-tools > summary {
  padding: 13px 0;
  color: #bccbd7;
  font-size: 12px;
}
.circuit-tools > summary > span {
  color: #8299ad;
  font-size: 10px;
  margin-left: 20px;
}
.circuit-tools .circuit-panel {
  margin: 10px 0;
  padding: 18px;
  border: 1px solid #354b60;
  border-radius: 6px;
  background: #101b28;
}
.circuit-tools .experiment-story {
  margin: 0;
}
body.compute-mode .coherent-stage {
  padding: 28px 34px 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 77% 62%, #1c314430, transparent 48%),
    linear-gradient(165deg, #111d2b, #090f18 72%);
  box-shadow: none;
}
.coherent-heading h2 {
  font-size: clamp(28px, 3.1vw, 45px);
  font-weight: 450;
  letter-spacing: -0.055em;
}
.coherent-heading .eyebrow {
  color: #91afc5;
  font-size: 9px;
  letter-spacing: 0.19em;
}
.coherent-actions button {
  border-radius: 3px;
  font-size: 11px;
  padding-inline: 16px;
}
.coherent-actions button.primary {
  background: #ddc28a;
}
#coherent-circuit {
  padding-top: 18px;
  gap: 10px;
}
#coherent-circuit button {
  background: transparent;
  border-color: #32465a;
  border-radius: 2px;
}
#coherent-circuit button[aria-current="step"] {
  border-color: #c8b27f;
  background: #c8b27f0b;
  box-shadow: none;
}
.ket-trajectory {
  grid-template-columns: minmax(0, 0.85fr) 220px minmax(0, 1.8fr);
  gap: 24px;
  padding: 24px 0 16px;
  min-height: 190px;
}
body.compute-mode #coherent-input {
  font-size: clamp(19px, 1.9vw, 27px);
}
body.compute-mode #coherent-current {
  font-size: clamp(26px, 2.6vw, 38px);
}
#coherent-stage .stage-label {
  color: #9bb1c4;
  font-size: 9px;
  letter-spacing: 0.14em;
}
#coherence-peek {
  margin-top: 5px;
}
#coherence-peek > .stage-label,
#coherence-peek #coherence-metrics {
  display: none;
}
#coherence-peek button {
  font-size: 11px;
  min-height: 30px;
  color: #9bbbd0;
}
.ket-operator {
  position: relative;
  height: 170px;
}
.ket-operator > svg {
  display: none;
}
.ket-operator .gate-orb {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 41px;
  height: 41px;
  font-size: 15px;
  border-radius: 8px;
  background: #122233;
  border-color: #7596ad;
  box-shadow: none;
}
#coherent-percent {
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  text-align: center;
  color: #8fa8bd;
  font-size: 9px;
}
#ket-ribbons {
  width: 220px;
  padding-top: 24px;
}
#ket-ribbons svg {
  display: block;
  width: 100%;
  overflow: visible;
}
#ket-ribbons foreignObject > div {
  font-size: 11px;
}
#ket-ribbons .katex-display {
  margin: 0;
  text-align: center;
}
#ket-ribbons [data-ribbon] > path {
  fill: none;
}
.ribbon-phase circle {
  fill: #0c1724;
  stroke: #65839b;
  stroke-width: 0.6;
}
.ribbon-phase path {
  stroke: var(--phase);
  stroke-width: 1.4;
  fill: none;
  transform-origin: 0 0;
}
.coherent-populations {
  padding-top: 12px;
  gap: 10px 18px;
}
.coherent-population i {
  height: 2px;
  background: #273e53;
}
.coherent-population b {
  background: #8ac7d2;
  transition: none;
}
.coherent-population output {
  color: #afc2d2;
}
.coherent-caption {
  padding: 13px 0;
  border-bottom: 0;
  min-height: 55px;
}
#coherent-reading {
  color: #bacbd9;
  font-size: 14px;
  max-width: 950px;
}
#coherent-correlation {
  color: #b4a2bc;
  font-size: 9px;
  font-weight: 400;
}
.coherent-row {
  padding: 4px 0 16px;
  border-bottom: 1px solid #2b3e51;
}
.coherent-row > .stage-label {
  color: #809ab0;
}
body.compute-mode #coherent-rule {
  font-size: 20px;
}
.coherent-row > a {
  color: #9fb9cc;
}
.coherent-views {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  grid-template-areas: "geometry hardware" "geometry control";
  grid-template-rows: auto auto;
  gap: 0 38px;
}
body.compute-mode .coherent-views > .panel {
  padding: 20px 0 10px;
  border: 0;
  background: transparent;
}
body.compute-mode .coherent-views > .panel + .panel {
  border: 0;
}
body.compute-mode .coherent-views > .geometry-panel {
  grid-area: geometry;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
body.compute-mode .coherent-views > .hardware-panel {
  grid-area: hardware;
  padding-bottom: 0;
}
body.compute-mode .coherent-views > .control-panel {
  grid-area: control;
  border-top: 1px solid #283c50;
  padding-top: 12px;
}
body.compute-mode .coherent-views .panel-heading {
  margin-bottom: 8px;
  align-items: baseline;
}
body.compute-mode .coherent-views .panel-heading h3 {
  font-size: 12px;
  font-weight: 450;
  color: #d6e1e9;
}
body.compute-mode .coherent-views .panel-heading h3 > span {
  display: none;
}
body.compute-mode .coherent-views .panel-heading > span {
  font-size: 8px;
  color: #738fa6;
}
body.compute-mode .coherent-views #bloch-spheres {
  min-height: 288px;
  flex-wrap: nowrap;
}
body.compute-mode .coherent-views #bloch-spheres svg {
  width: 50%;
  height: 300px;
  max-height: 315px;
}
body.compute-mode .coherent-views #bloch-spheres svg:only-child {
  max-height: 325px;
}
.bloch-grid {
  fill: none;
  stroke: #9bb3c7;
  stroke-width: 0.65;
}
.bloch-grid.front {
  opacity: 0.38;
}
.bloch-grid.rear {
  opacity: 0.15;
  stroke-dasharray: 2 4;
}
.bloch-pole-label {
  font-size: 17px;
  text-align: center;
}
.bloch-pole-label .katex-display,
.bloch-mixed-label .katex-display {
  margin: 0;
  text-align: center;
}
.bloch-mixed-label > div {
  font-size: 14px;
  color: #c4a7c1;
}
.bloch-arrowhead,
.bloch-mixed-label,
.bloch-mixed-core {
  transition: opacity 0.2s;
}
body.compute-mode .coherent-views #geometry-explanation {
  color: #90a8bd;
  font-size: 12px;
  line-height: 1.65;
  max-width: 440px;
  margin: 12px 0 4px;
  min-height: 0;
}
body.compute-mode .coherent-views .viewport {
  height: 290px;
  min-height: 290px;
  max-height: 290px;
  background: transparent;
  border: 0;
  border-radius: 0;
}
body.compute-mode .coherent-views .viewport-caption {
  top: 2px;
  left: 0;
  font-size: 7px;
  color: #7793a9;
}
body.compute-mode .coherent-views .viewport-controls {
  left: auto;
  right: 0;
  bottom: 0;
  gap: 2px;
}
body.compute-mode .coherent-views .viewport-controls button {
  border: 0;
  background: #14243588;
  font-size: 9px;
  padding: 5px 8px;
}
body.compute-mode .coherent-views #processor-signal {
  display: none;
}
body.compute-mode .coherent-views #waveform {
  min-height: 0;
}
body.compute-mode .coherent-views #waveform svg {
  width: 100%;
  height: auto;
  max-height: 135px;
}
body.compute-mode .coherent-views .control-values {
  font-size: 9px;
  min-height: 0;
  margin: 2px 0 7px;
  color: #93abc1;
}
body.compute-mode .coherent-views .stage-inspection {
  margin-top: 6px;
}
body.compute-mode .coherent-views .stage-inspection > summary {
  color: #7894ac;
  font-size: 10px;
}
body.compute-mode .coherent-views .hardware-panel > .stage-inspection {
  position: relative;
  z-index: 2;
  margin: 3px 0 8px;
}
.coherent-transport {
  min-height: 56px;
  border-top-color: #2b4055;
}
#stage-phase-controls {
  border: 0;
  border-bottom: 1px solid #2b4055;
  background: transparent;
  border-radius: 0;
  padding: 11px 0 13px;
  margin-top: 15px;
}
#stage-phase-controls input {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  height: 28px;
}
#stage-phase-controls input::-webkit-slider-runnable-track {
  height: 2px;
  background: #55617a;
}
#stage-phase-controls input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border: 2px solid #e6b7da;
  border-radius: 50%;
  background: #172536;
  margin-top: -5px;
}
#stage-phase-controls input::-moz-range-track {
  height: 2px;
  background: #55617a;
}
#stage-phase-controls input::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 2px solid #e6b7da;
  border-radius: 50%;
  background: #172536;
}
#stage-phase-controls > span {
  font-size: 10px;
  color: #829eb5;
}
@media (min-width: 1200px) and (max-height: 950px) {
  body.compute-mode .coherent-stage {
    padding-top: 19px;
  }
  .coherent-heading h2 {
    font-size: 34px;
  }
  .ket-trajectory {
    min-height: 172px;
    padding-block: 16px 7px;
  }
  body.compute-mode #coherent-current {
    font-size: 31px;
  }
  .coherent-views {
    gap: 0 28px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 240px;
    min-height: 240px;
    max-height: 240px;
  }
  body.compute-mode .coherent-views #bloch-spheres {
    min-height: 265px;
  }
  body.compute-mode .coherent-views #bloch-spheres svg {
    height: 276px;
    max-height: 276px;
  }
  body.compute-mode .coherent-views #waveform svg {
    max-height: 105px;
  }
  body.compute-mode .coherent-views > .panel {
    padding-top: 12px;
  }
  .coherent-row {
    padding-bottom: 9px;
  }
  .coherent-caption {
    padding-block: 8px;
  }
}
@media (max-width: 1199px) and (min-width: 721px) {
  .ket-trajectory {
    grid-template-columns: minmax(0, 0.8fr) 170px minmax(0, 1.4fr);
    gap: 15px;
  }
  #ket-ribbons {
    width: 170px;
    padding-top: 27px;
  }
  .coherent-views {
    gap: 0 22px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  body.compute-mode .coherent-views #bloch-spheres svg {
    max-height: 240px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 255px;
    min-height: 255px;
    max-height: 255px;
  }
  .coherent-heading h2 {
    font-size: 31px;
  }
  .coherent-actions {
    flex-direction: column;
  }
}
@media (max-width: 720px) {
  .circuit-tools {
    margin-inline: 16px;
  }
  .circuit-tools > summary > span {
    display: none;
  }
  body.compute-mode .coherent-stage {
    padding: 20px 16px 0;
  }
  .coherent-heading h2 {
    font-size: 30px;
  }
  .coherent-actions {
    flex-direction: row;
  }
  .ket-trajectory {
    grid-template-columns: minmax(0, 1fr) 140px;
    gap: 12px;
    padding-top: 20px;
  }
  .ket-origin {
    grid-column: 1;
  }
  .ket-operator {
    grid-column: 2;
    grid-row: 1;
    height: 150px;
  }
  #ket-ribbons {
    width: 140px;
    padding-top: 34px;
  }
  #ket-ribbons foreignObject > div {
    font-size: 14px;
  }
  .ket-operator .gate-orb {
    width: 33px;
    height: 33px;
    top: 0;
    font-size: 13px;
  }
  #coherent-percent {
    bottom: 0;
  }
  .ket-destination {
    grid-column: 1/-1;
  }
  body.compute-mode #coherent-current {
    font-size: 25px;
  }
  body.compute-mode #coherent-input {
    font-size: 18px;
  }
  .coherent-caption {
    display: block;
    padding: 12px 0;
  }
  #coherent-reading {
    font-size: 13px;
  }
  .coherent-row {
    padding-bottom: 12px;
  }
  body.compute-mode #coherent-rule {
    font-size: 17px;
  }
  .coherent-views {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  body.compute-mode .coherent-views > .geometry-panel {
    order: 0;
    padding: 20px 0;
  }
  body.compute-mode .coherent-views > .hardware-panel {
    order: 1;
    padding: 20px 0 10px;
    border-top: 1px solid #2b4055;
  }
  body.compute-mode .coherent-views > .control-panel {
    order: 2;
    padding: 15px 0;
  }
  body.compute-mode .coherent-views #bloch-spheres {
    min-height: 230px;
  }
  body.compute-mode .coherent-views #bloch-spheres svg {
    height: 245px;
    max-height: 245px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 265px;
    min-height: 265px;
    max-height: 265px;
  }
  body.compute-mode .coherent-views #geometry-explanation {
    font-size: 12px;
  }
  body.compute-mode .coherent-views #waveform svg {
    max-height: 125px;
  }
  body.compute-mode #computation > .workspace-nav {
    margin-top: 16px;
  }
}
/* Keep the visual explanation in one desktop composition. */
#ket-ribbons svg {
  height: auto;
  max-height: none;
}
body.compute-mode .coherent-stage {
  padding-top: 20px;
}
.coherent-heading h2 {
  font-size: clamp(28px, 2.8vw, 39px);
  line-height: 1.12;
}
#coherent-circuit {
  padding-top: 14px;
}
#stage-phase-controls {
  margin-top: 8px;
  padding-block: 6px 8px;
}
.ket-trajectory {
  min-height: 170px;
  padding-block: 16px 8px;
}
.coherent-caption {
  min-height: 44px;
  padding-block: 8px;
}
#coherent-reading {
  font-size: 13px;
}
body.compute-mode #coherent-rule {
  font-size: 18px;
  padding-block: 3px;
}
#coherent-rule .katex-display {
  margin-block: 3px;
}
.coherent-row {
  padding-block: 3px 10px;
}
body.compute-mode .coherent-views > .geometry-panel {
  justify-content: flex-start;
}
body.compute-mode .coherent-views .viewport {
  height: 250px;
  min-height: 250px;
  max-height: 250px;
}
body.compute-mode .coherent-views #waveform svg {
  max-height: 112px;
}
@media (min-width: 1200px) and (max-height: 950px) {
  .coherent-heading h2 {
    font-size: 33px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 215px;
    min-height: 215px;
    max-height: 215px;
  }
  body.compute-mode .coherent-views #bloch-spheres {
    min-height: 250px;
  }
  body.compute-mode .coherent-views #bloch-spheres svg {
    height: 265px;
    max-height: 265px;
  }
  .coherent-transport {
    min-height: 46px;
  }
}
@media (max-width: 720px) {
  .ket-trajectory {
    padding-block: 18px 10px;
  }
  .ket-operator {
    height: 150px;
  }
  .coherent-heading h2 {
    font-size: 30px;
  }
  body.compute-mode .coherent-views .viewport {
    height: 265px;
    min-height: 265px;
    max-height: 265px;
  }
}
.math-explanation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 34px;
  align-items: center;
  padding: 7px 0 13px;
  border-bottom: 1px solid #2b3e51;
}
.math-explanation .coherent-caption {
  display: block;
  padding: 0;
  min-height: 0;
}
.math-explanation #coherent-correlation {
  display: block;
  max-width: none;
  margin-top: 7px;
  font-size: 8px;
}
.math-explanation .coherent-row {
  padding: 0;
  border: 0;
  gap: 14px;
}
.math-explanation .coherent-row > .stage-label {
  flex-basis: 94px;
}
.math-explanation #coherent-rule {
  font-size: 17px;
}
.math-explanation .coherent-row > a {
  font-size: 10px;
}
@media (max-width: 1199px) {
  .math-explanation {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
@media (max-width: 720px) {
  .math-explanation {
    gap: 14px;
    padding-block: 10px 14px;
  }
}
body.compute-mode .chapter-nav {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #0b1420;

}
.math-explanation .coherent-row > .stage-label {
  flex-basis: 112px;
  letter-spacing: 0.08em;
}
@media (max-width: 720px) {
  body.compute-mode .chapter-nav {
    gap: 20px;
  }
  body.compute-mode .chapter-nav button {
    min-height: 50px;
    padding-block: 13px;
  }
}
[data-ribbon-result] circle {
  fill: #0b1724;
  stroke: #91adbf;
  stroke-width: 0.7;
}
[data-ribbon-result] path {
  stroke: #edf4ee;
  stroke-width: 1.25;
  fill: none;
}
[data-ribbon-result][data-cancelled="true"] circle {
  stroke: #d6e3eb;
  stroke-dasharray: 1 2;
}
@media (max-width: 720px) {
  .workspace-nav {
    top: 52px;
  }
  body.compute-mode .workspace > .panel {
    scroll-margin-top: 140px;
  }
  body.compute-mode .coherent-views > .panel {
    scroll-margin-top: 125px;
  }
}

#experience-title {
  font-size: clamp(26px, 2.6vw, 36px);
  letter-spacing: -0.025em;
  line-height: 1.2;
}
#coherent-title,
#flow-title,
#coherence-inspector h2,
#exact-working h2,
#assembly-panel h2,
body.compute-mode .story-heading h2 {
  font-size: clamp(22px, 2vw, 28px);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: -0.025em;
}
.math-explanation .coherent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 7px 14px;
}
#coherent-rule-caption,
#coherent-rule,
#show-exact {
  grid-column: 1;
}
#coherent-rule .katex-display > .katex {
  white-space: normal;
}
#coherent-addition {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
}
#coherent-addition svg {
  width: 100%;
  display: block;
  overflow: visible;
}
#coherent-addition .addition-vector,
#coherent-addition .addition-head {
  fill: none;
  stroke: inherit;
  stroke-width: 1.1px;
  vector-effect: non-scaling-stroke;
}
#coherent-addition .addition-total {
  stroke: var(--phase);
}
#coherent-addition .addition-total .addition-vector {
  stroke-width: 2.4px;
}
button.coherent-population {
  border: 0;
  border-radius: 0;
  padding: 5px 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid transparent;
}
button.coherent-population[aria-pressed="true"] {
  opacity: 1;
  border-bottom-color: var(--phase);
}
#ket-ribbons circle {
  filter: none;
}
#ket-ribbons [data-ribbon-result][data-focused="true"] circle {
  stroke: var(--phase);
  stroke-width: 1.2px;
}
.bloch-grid.front {
  opacity: 0.26;
}
.bloch-grid.rear {
  opacity: 0.12;
}
@media (max-width: 720px) {
  .math-explanation .coherent-row {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 5px 10px;
  }
  .math-explanation #coherent-rule {
    font-size: 15px;
  }
}
