:root {
  color-scheme: light;
  --paper: #edf4f6;
  --panel: #f9fcfd;
  --text: #132838;
  --quiet: #465e6c;
  --line: #c9dade;
  --sea: #007b70;
  --scene: #0a1623;
  --liquid: #42e4c4;
  --angle: #ffc978;
  --field: #ad9def;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--text); }
h1, h2, h3, p, figure { margin: 0; }
h2 { font-size: clamp(1.13rem, 2.2vw, 1.65rem); line-height: 1.12; }
h3 { font-size: 1.03rem; line-height: 1.25; }
button, input { font: inherit; }
button {
  cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: inherit;
  border-radius: .45rem; min-height: 40px; padding: .5rem .76rem; font-size: .88rem; font-weight: 650;
  overflow-wrap: anywhere;
}
button:focus-visible, input:focus-visible { outline: 3px solid #168eaa; outline-offset: 3px; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .65; }
[hidden] { display: none !important; }
.taylor-lab { max-width: 1540px; margin: auto; padding: clamp(12px, 2vw, 34px) clamp(12px, 2.8vw, 52px); }
.masthead .overline { display: flex; align-items: center; gap: .75rem; }
.masthead { padding-bottom: 1.1rem; }
.masthead h1 {
  font-size: clamp(1.8rem, 4.2vw, 3.8rem); margin-block: .21em .15em; line-height: 1.05;
  letter-spacing: -.038em; font-weight: 780; overflow-wrap: anywhere;
}
.masthead p { color: var(--quiet); font-size: clamp(.92rem, 1.35vw, 1.15rem); max-width: 112ch; }
.overline {
  font-family: var(--mono); color: var(--sea); letter-spacing: .085em; text-transform: uppercase;
  font-weight: 700; font-size: .69rem; line-height: 1.25; overflow-wrap: anywhere;
}
.preset-row {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .52rem 0;
  border-block: 1px solid var(--line);
}
.preset-row button { flex: 0 1 auto; text-align: start; }
.preset-row button:hover { border-color: var(--sea); color: var(--sea); }
.preset-row button[aria-pressed="true"] { background: #d7eee9; border-color: #69a79c; color: #07574d; }
.scenario {
  min-height: 2em; color: var(--quiet); font-size: .88rem;
  margin: .55rem 0 .7rem; border-inline-start: 2px solid #74aea6; padding-inline-start: .7rem;
  display: flex; align-items: center;
}
#load-error { color: #983b2d; }
.bench {
  display: grid; grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr);
  grid-template-areas: "view analysis" "controls analysis"; align-items: start; align-content: start; gap: .9rem;
  grid-template-rows: auto 1fr;
}
.bench > * { min-width: 0; overflow-wrap: anywhere; border-radius: .75rem; }
.view-panel {
  grid-area: view; color: #f1f8f8; background: var(--scene);
  border: 1px solid #162e3e; padding: clamp(12px, 1.6vw, 24px);
}
.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; }
.view-head .overline { color: #8bc6ce; margin-bottom: .35rem; }
.mode {
  font: 650 .78rem/1.3 var(--mono); color: var(--liquid);
  padding: .34rem .65rem; border: 1px solid #37605f; background: #12282e; border-radius: .35rem;
}
.mode[data-kind="cone"] { color: var(--angle); border-color: #695337; background: #2a2520; }
.mode[data-kind="multi"] { color: #e2d7ff; border-color: #5b4b84; background: #28223b; }
.camera {
  margin-top: .8rem; border: 1px solid #2a4354; border-radius: .46rem; background: #0b1c2a;
}
canvas { display: block; width: 100%; }
#scene { height: clamp(250px, 27vw, 366px); border-radius: .46rem .46rem 0 0; }
.camera-legend, .plot-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .42rem 1rem; font-size: .77rem; }
.camera-legend { padding: .62rem .7rem; border-top: 1px solid #2a4354; color: #c5d6db; }
.ink { display: inline-flex; gap: .35rem; align-items: center; }
.ink::before { content: ""; flex: 0 0 .8rem; border-block-start: 2px solid currentColor; }
.ink.liquid::before { color: var(--liquid); }
.ink.field::before { color: var(--field); border-style: dashed; }
.ink.angle::before { color: var(--angle); border-style: dotted; }
.ink.unstable::before { color: var(--sea); }
.ink.cutoff::before { color: #8c5874; border-style: dashed; }
.view-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 0 .45rem; }
.angle-card { display: flex; flex-wrap: wrap; align-items: center; gap: .52rem; color: #b6cad2; font-size: .8rem; }
.angle-card output { color: var(--angle); font-size: 1.26rem; }
.playback { display: flex; flex-wrap: wrap; gap: .4rem; }
.playback button { border-color: #3a5666; background: #132635; color: #e9f4f4; }
.playback button:hover, .playback button[aria-pressed="true"] { border-color: #77dbcd; }
.playback #play { display: inline-flex; align-items: center; gap: .45rem; }
.play-icon { border: .32rem solid transparent; border-right: 0; border-left: .5rem solid var(--liquid); }
#play[aria-pressed="true"] .play-icon { height: .66rem; width: .43rem; border: 0; border-inline: .13rem solid var(--liquid); }
.camera-note { font-size: .78rem; color: #b6cad2; }
.control-panel, .analysis { background: var(--panel); border: 1px solid var(--line); padding: clamp(12px, 1.6vw, 24px); }
.control-panel { grid-area: controls; }
.control-panel h2 { margin-bottom: .65rem; }
.sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .57rem .9rem; }
.slider { background: #edf3f5; padding: .55rem .65rem .37rem; border: 1px solid #d5e4e6; border-radius: .4rem; min-width: 0; }
.slider > div { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .14rem .5rem; }
.slider label { font-size: .79rem; font-weight: 680; }
.slider output { color: #005e56; font-size: .78rem; }
.slider input { display: block; width: 100%; margin: .23rem 0 0; min-height: 24px; accent-color: var(--sea); }
.disturbance input { accent-color: #80527c; }
.slider-note { align-self: center; font-size: .79rem; color: var(--quiet); }
output { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.analysis { grid-area: analysis; }
.analysis h2 { margin: .27rem 0 .75rem; }
.balance-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(4.8rem, 26%); gap: .65rem; }
.bars { display: grid; align-content: space-around; gap: .35rem; }
.bar-item, .time-row > div {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .18rem .3rem;
  font-size: .77rem;
}
.bar-track { height: 6px; flex-basis: 100%; background: #e2edef; border-radius: 2px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: #6a54a6; }
#capillary-bar { background: #087c71; }
.ratio-tile {
  display: grid; align-content: center; gap: .2rem; background: #e1efef; text-align: center;
  border-radius: .4rem; padding: .42rem .25rem; min-width: 0; font: .7rem/1.1 var(--mono);
}
.ratio-tile output { color: #006057; font-size: clamp(1.25rem, 2.4vw, 2rem); }
.fine { color: var(--quiet); font-size: .76rem; line-height: 1.36; margin-top: .4rem; }
.time-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin-top: .54rem; }
.time-row > div, .numbers > div { background: #edf3f5; border-radius: .32rem; padding: .34rem .42rem; }
.chart-section { border-top: 1px solid var(--line); margin-top: .68rem; padding-top: .62rem; }
.model-seam { color: #75486d; margin-bottom: .31rem; }
#growth { height: 148px; }
#histogram { height: 116px; }
.plot-legend { color: var(--quiet); margin: .06rem 0 .36rem; }
.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .38rem; }
.numbers > div { display: grid; align-content: space-between; gap: .17rem; min-width: 0; }
.numbers span { font-size: .72rem; color: var(--quiet); }
.numbers output { font-size: .93rem; }
.histogram-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.taylor-lab footer { color: var(--quiet); border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .65rem; font-size: .8rem; }

@media (min-width: 1220px) {
  .sliders { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 810px) {
  .bench { grid-template-columns: minmax(0, 1fr); grid-template-areas: "view" "controls" "analysis"; grid-template-rows: auto; gap: .65rem; }
  #scene { height: clamp(230px, 53vw, 365px); }
}
@media (max-width: 480px) {
  .preset-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-row button { min-height: 44px; font-size: .8rem; }
  .sliders { grid-template-columns: minmax(0, 1fr); }
  .slider input { min-height: 34px; }
  .view-foot { align-items: flex-start; }
  .taylor-lab { padding-block-start: .95rem; }
}
