:root {
  color-scheme: light;
  --page: #f4f7f5;
  --ink: #152c31;
  --muted: #51666a;
  --teal: #13675e;
  --pale: #e9f3ee;
  --line: #d6dfdb;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button, select, input[type=range], input[type=checkbox], label[for=mixture] { cursor: pointer; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }
button, select, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 3px solid #3b8eb1;
  outline-offset: 3px;
}
button { padding: 0; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 1rem; top: -5rem; z-index: 2; padding: .75rem; background: white; }
.skip:focus { top: .5rem; }
.icon-defs { width: 0; height: 0; position: absolute; overflow: hidden; }
.icon { flex: none; width: 1.28rem; height: 1.28rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(1256px, calc(100% - clamp(2rem, 8vw, 9rem))); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); background: #fbfcfa; }
.mast-inner { min-height: 4.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .72rem; color: var(--ink); font: 1.3rem var(--serif); text-decoration: none; }
.monogram { width: 2.12rem; height: 2.12rem; display: grid; place-items: center; border: 1px solid var(--teal); color: var(--teal); font: 550 .84rem var(--sans); letter-spacing: -.07em; }
nav { display: flex; gap: clamp(.75rem, 2.2vw, 2rem); }
nav a { text-decoration: none; color: var(--muted); font-size: .88rem; line-height: 2.25rem; }
nav a:hover, footer a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: .24em; }
.intro { padding: clamp(1.55rem, 2.8vw, 2.6rem) 0 1.6rem; }
h1 { font: 400 clamp(2.75rem, 4.2vw, 4.15rem)/1.04 var(--serif); letter-spacing: -.055em; }
.intro p { color: var(--muted); margin-top: .65rem; font-size: 1.02rem; line-height: 1.5; max-width: 55rem; }
.dashboard { display: grid; gap: 1.15rem; grid-template-columns: minmax(0, 2.04fr) minmax(18rem, 1fr); }
.panel { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: .6rem; box-shadow: 0 2px 4px #20392d06; scroll-margin-top: 1rem; }
.panel-head { min-height: 3.6rem; padding: .8rem clamp(.95rem, 1.6vw, 1.5rem); display: flex; align-items: center; justify-content: space-between; gap: .65rem; border-bottom: 1px solid var(--line); }
h2 { display: inline-flex; align-items: center; gap: .6rem; font-size: 1.06rem; line-height: 1.3; font-weight: 630; letter-spacing: -.021em; }
h2 .icon { color: var(--teal); }
.status { display: inline-flex; align-items: center; gap: .42rem; font: 500 .78rem var(--mono); border: 1px solid #d1e6da; border-radius: 2rem; color: #246653; background: #eff8f1; padding: .26rem .55rem; }
.status::before { content: ""; width: .4rem; height: .4rem; background: #338659; border-radius: 50%; }
.status.paused, .status[data-paused=true], body:has(#pause[data-paused=true]) .status { color: #69615b; background: #f6f3ee; border-color: #e2ddd4; }
.status.paused::before, .status[data-paused=true]::before, body:has(#pause[data-paused=true]) .status::before { background: #8c8179; }
.chamber-body { margin: 0; padding: 1rem clamp(.82rem, 1.3vw, 1.35rem) 0; }
#chamber { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 480; border-radius: .28rem; background: #101e2a; touch-action: none; cursor: crosshair; }
.color-key { display: flex; justify-content: space-between; align-items: center; gap: .65rem; margin: .72rem 0 .85rem; color: var(--muted); font-size: .8rem; }
.scale-legend { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .75rem; }
.spectrum { display: inline-block; height: .36rem; width: clamp(4.8rem, 9vw, 8rem); border-radius: 1rem; background: linear-gradient(90deg, #43c5ec, #63d6b5, #f5d36d, #fc995f, #f16e89); }
.stats { margin-top: auto; padding: 1rem clamp(.9rem, 1.6vw, 1.5rem); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fafcfb; border-top: 1px solid var(--line); }
.stats div + div { padding-left: clamp(.4rem, 1.5vw, 1.5rem); border-left: 1px solid var(--line); }
dt { color: var(--muted); font-size: .81rem; line-height: 1.4; }
.stats dd { font: 500 clamp(.98rem, 1.45vw, 1.32rem)/1.25 var(--mono); margin-top: .32rem; letter-spacing: -.055em; white-space: nowrap; }
.control-body, .sample-body { padding: 1.05rem clamp(.95rem, 1.6vw, 1.5rem) 1.22rem; }
.control-body { display: flex; flex: 1; flex-direction: column; justify-content: space-between; gap: 1.08rem; }
.run-actions { display: flex; gap: .55rem; }
.run-actions button, .expansion { display: inline-flex; justify-content: center; align-items: center; gap: .55rem; min-height: 2.4rem; border: 1px solid #c6d3ce; background: #fff; border-radius: .33rem; font-weight: 580; font-size: .89rem; }
.run-actions button { flex: 1; }
.run-actions button.primary { background: var(--teal); color: white; border-color: var(--teal); }
.run-actions button.primary:hover { background: #104e48; }
.run-actions button:not(.primary):hover, .expansion:hover { border-color: var(--teal); background: #eff6f2; }
button .icon { width: 1.06rem; height: 1.06rem; }
.pause-mark { height: .76rem; width: .7rem; border-inline: .21rem solid currentColor; }
#pause[data-paused=true] .pause-mark, #pause[aria-label^="Resume"] .pause-mark { width: 0; height: 0; border: solid transparent; border-width: .43rem 0 .43rem .65rem; border-left-color: currentColor; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.field-row label, .field-row > span:first-child { font-size: .91rem; font-weight: 530; }
.field-row output { border-radius: .24rem; padding: .2rem .48rem; background: #eff5f1; color: #1b6356; font: 500 .85rem var(--mono); }
.range-control input { width: 100%; height: 1.35rem; padding: 0; margin: .27rem 0 0; accent-color: var(--teal); }
.range-limits { color: #566b68; display: flex; justify-content: space-between; font: .75rem var(--mono); }
.speed-row, .mixture-row { min-height: 1.75rem; }
.select-wrap { display: flex; position: relative; }
.select-wrap::after { content: ""; position: absolute; top: calc(50% - .22rem); right: .7rem; width: .37rem; height: .37rem; border: solid var(--teal); border-width: 0 1.7px 1.7px 0; transform: rotate(45deg); pointer-events: none; }
select { padding: .36rem 1.8rem .36rem .65rem; border: 1px solid #c5d2cc; border-radius: .3rem; background: #fff; appearance: none; font: .85rem var(--mono); }
.switch { display: inline-block; appearance: none; width: 2.2rem; height: 1.27rem; flex: none; margin: 0; border: 1px solid #aabbb4; background: #c0cdc6; border-radius: 1.2rem; position: relative; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.27rem - 6px); height: calc(1.27rem - 6px); background: white; border-radius: 50%; }
.switch:checked { background: var(--teal); border-color: var(--teal); }
.switch:checked::after { left: auto; right: 2px; }
.expansion { width: 100%; background: #f5f9f6; color: #235b51; }
.segment { display: inline-flex; background: #f0f4f1; border: 1px solid #d7e1db; border-radius: .36rem; padding: .13rem; gap: .16rem; }
.segment button { min-height: 1.72rem; padding: .2rem .55rem; border: 1px solid transparent; border-radius: .25rem; font-size: .81rem; color: var(--muted); background: none; }
.segment button[aria-pressed=true] { background: #fff; color: var(--teal); box-shadow: 0 1px 3px #21382e18; border-color: #d7e0da; font-weight: 600; }
.chart-body { padding: 1rem .85rem .7rem; }
#histogram { display: block; width: 100%; height: 305px; }
.sample-body p { color: var(--muted); line-height: 1.55; font-size: .88rem; }
.sample-totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1rem 0; }
.sample-totals div + div { border-left: 1px solid var(--line); padding-left: 1rem; }
.sample-totals dd { font: 500 1.68rem/1.3 var(--mono); color: var(--teal); letter-spacing: -.05em; }
.area-row { padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.area-row > span:first-child, .history-label { font-size: .82rem; color: var(--muted); }
#area { font: .85rem var(--mono); }
.history-label { margin-top: .8rem; }
#history { display: block; width: 100%; height: 4rem; margin: .4rem 0 .55rem; }
.sample-body .sample-note { font-size: .8rem; }
.notice { padding: 1rem; border: 1px solid var(--line); margin: 0 0 1rem; }
footer { margin-top: 1.5rem; border-top: 1px solid var(--line); padding: 1.2rem 0 2.35rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--muted); font-size: .8rem; }
footer a { text-underline-offset: .2em; }
@media (max-width: 850px) {
  .wrap { width: calc(100% - 2rem); }
  .dashboard { grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 1fr); gap: .8rem; }
  .control-body { gap: .8rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .stats div + div { padding: 0; border: 0; }
  .stats div:nth-child(even) { padding-left: .9rem; border-left: 1px solid var(--line); }
  h2 { font-size: 1rem; }
}
@media (max-width: 680px) {
  .dashboard { grid-template-columns: 1fr; }
  .intro { padding-block: 1.55rem 1.3rem; }
  .mast-inner { min-height: 3.6rem; }
  .brand { font-size: 1.12rem; gap: .48rem; }
  nav { gap: .65rem; }
  nav a { font-size: .8rem; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .stats div + div { padding-left: .55rem; border-left: 1px solid var(--line); }
  .stats dd { font-size: .93rem; }
  .control-body { gap: 1.05rem; }
  #histogram { height: 280px; }
}
@media (max-width: 420px) {
  .wrap { width: calc(100% - 1.25rem); }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); gap: .68rem; }
  .stats div + div { border: 0; padding: 0; }
  .stats div:nth-child(even) { border-left: 1px solid var(--line); padding-left: .75rem; }
  .panel-head { padding: .78rem; }
  .segment button { padding-inline: .4rem; }
  footer { flex-wrap: wrap; }
}
@media (forced-colors: active) {
  .switch { appearance: auto; }
  .switch::after { display: none; }
  .switch:checked { outline: 1px solid; }
}

.theory-key, .history-key, .history-key span { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .8rem; }
.theory-key { margin: .8rem .5rem .2rem; cursor: pointer; }
.theory-key input { accent-color: var(--teal); margin: 0 .1rem 0 0; width: 1rem; height: 1rem; }
.theory-key i, .history-key i { display: inline-block; width: 1.25rem; height: 0; border-top: 2px solid var(--teal); }
.theory-key .dashed-key, .history-key .dashed-key { border-top-style: dashed; border-color: #566b68; }
.history-key { gap: 1.1rem; margin-bottom: .75rem; }

.count-distribution { margin-top: 1.15rem; }
.count-distribution .panel-head { flex-wrap: wrap; }
.model-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.model-actions label, .count-legend, .count-summary p { font-size: .84rem; color: var(--muted); }
.model-actions select { font-family: var(--sans); }
#clearCounts { background: #fff; border: 1px solid #c5d2cc; padding: .37rem .65rem; border-radius: .3rem; font-size: .85rem; }
#clearCounts:hover { border-color: var(--teal); color: var(--teal); }
.count-grid { display: grid; grid-template-columns: minmax(0, 2.04fr) minmax(18rem, 1fr); }
.count-plot { padding: .85rem; min-width: 0; }
#countHistogram { display: block; width: 100%; height: clamp(270px, 24vw, 345px); }
.count-legend, .count-legend span { display: flex; align-items: center; flex-wrap: wrap; }
.count-legend { gap: .65rem 1.25rem; margin: .55rem 0 .25rem .65rem; }
.count-legend span { gap: .4rem; }
.count-legend i { display: inline-block; width: 1.2rem; height: 0; border-top: 2px solid #223746; }
.count-legend .bar-key { height: .6rem; width: .72rem; border: 0; background: #238478; }
.count-legend .poisson-key i { border-top: 2px dashed #b95f2b; }
.count-distribution:has(#countModel option[value=binomial]:checked) .poisson-key,
.count-distribution:has(#countModel option[value=poisson]:checked) .binomial-key { display: none; }
.count-summary { border-left: 1px solid var(--line); padding: 1.15rem clamp(.95rem,1.6vw,1.5rem); }
.sample-n, .moments div { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.sample-n { font-weight: 560; }
.sample-n output, .moments dd { font: 500 .94rem var(--mono); color: var(--teal); }
.sample-n output { font-size: 1.35rem; }
.moments { border-block: 1px solid var(--line); padding: .7rem 0; margin-top: .68rem; }
.moments div + div { margin-top: .48rem; }
.moments dd { color: var(--ink); }
.count-summary p { line-height: 1.5; margin-top: .65rem; }
.questions { padding: .95rem clamp(.95rem,1.6vw,1.5rem) .6rem; border-top: 1px solid var(--line); }
.questions h3 { font-weight: 610; font-size: 1rem; margin: 0 0 .35rem; }
.questions details + details { border-top: 1px solid #e5ebe8; }
.questions summary { cursor: pointer; padding: .65rem .15rem; font-size: .93rem; color: var(--teal); }
.questions p { max-width: 53rem; padding: .12rem 0 .9rem 1.15rem; line-height: 1.6; color: var(--muted); font-size: .92rem; }
@media (max-width: 760px) {
  .count-grid { grid-template-columns: 1fr; }
  .count-summary { border: 0; border-top: 1px solid var(--line); }
}

.count-status { color: var(--muted); font-size: .85rem; padding: .25rem .6rem; }
.count-status:empty { display: none; }
.event-readout { border-top: 1px solid var(--line); padding: .95rem clamp(.95rem, 1.6vw, 1.5rem); background: #fafcfb; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .8rem 1.25rem; }
.event-prompt, .event-values { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.event-prompt { font-size: .93rem; }
.event-prompt select { font-family: var(--sans); }
#eventCount { width: 4.7rem; border: 1px solid #c5d2cc; border-radius: .3rem; background: white; font: .85rem var(--mono); padding: .36rem .45rem; }
.event-values { gap: .7rem 1.5rem; }
.event-values dd { font: 500 1rem var(--mono); color: var(--teal); margin-top: .15rem; }

h1 em { font-family: inherit; font-weight: inherit; color: var(--teal); }
.volume-stage { background: #101e2a; border-radius: .32rem; overflow: hidden; }
#chamber { height: clamp(300px, 33vw, 455px); aspect-ratio: auto; cursor: grab; }
#chamber:active { cursor: grabbing; }
#chamber:focus-visible { outline-offset: -4px; }
.camera-bar { display: flex; align-items: center; gap: .65rem; justify-content: space-between; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.camera-bar p { color: var(--muted); font-size: .85rem; }
.camera-buttons { display: flex; gap: .4rem; }
.camera-buttons button { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; border: 1px solid var(--line); background: white; border-radius: .28rem; padding: .32rem .55rem; font-size: .83rem; }
.camera-buttons button:hover { background: var(--pale); border-color: var(--teal); }
.membership { display: flex; align-items: center; gap: .42rem; }
.membership i { display: inline-block; width: .72rem; height: .72rem; background: #20695d; border: 2px solid #a2e9dd; border-radius: 50%; box-shadow: 0 0 0 1px #2f7869; }
.preset-wrap { display: grid; gap: .5rem; }
.preset-wrap label { font-weight: 530; font-size: .91rem; }
.preset-wrap select { font: .91rem var(--sans); width: 100%; padding-block: .5rem; }
.cube-measures dl { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: .55rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.cube-measures dd { font: 500 1.35rem var(--mono); color: var(--teal); letter-spacing: -.05em; margin-top: .3rem; }
.cube-field input { width: 100%; margin: .35rem 0 0; height: 1.15rem; accent-color: var(--teal); }
.cube-coordinates { margin-block: .8rem; display: grid; gap: .6rem; }
.cube-field label { font-size: .86rem; }
.cube-coordinates .cube-field { display: grid; grid-template-columns: 7.5rem 1fr; align-items: center; gap: .85rem; }
.cube-coordinates input { margin: 0; }
.cube-example { padding: 1.1rem clamp(.95rem,1.6vw,1.5rem); border-top: 1px solid var(--line); }
.cube-example h3 { margin: 0 0 .4rem; font-weight: 610; font-size: 1rem; }
.cube-example p { max-width: 55rem; font-size: .93rem; line-height: 1.55; color: var(--muted); }
@media (max-width: 680px) {
  #chamber { height: clamp(290px, 85vw, 435px); }
  .camera-bar { gap: .45rem; }
}

#chamberHint { margin: .5rem 0 0; font-size: .83rem; color: var(--muted); line-height: 1.5; }
.membership i { border-color: #abf2d9; }

.stats { grid-template-columns: repeat(5,minmax(0,1fr)); }
.stats dd { font-size: clamp(.89rem,1.35vw,1.17rem); }
.stats div + div { padding-left: clamp(.4rem,.8vw,.75rem); }
.sampling .history-key { margin-bottom: 0; }
.sampling .history-label { margin-top: 1rem; }
@media (max-width: 990px) {
  .stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .7rem .3rem; }
  .stats div + div, .stats div:nth-child(even) { border: 0; padding-left: 0; }
}
