:root {
  color-scheme: light;
  --bg: #edf0f2;
  --surface: #f8f9f9;
  --surface-2: #e5e9eb;
  --surface-3: #d7dde0;
  --ink: #182024;
  --muted: #637078;
  --line: #c6cdd1;
  --line-strong: #9ba7ad;
  --accent: #e66f32;
  --accent-soft: #f7d7c6;
  --accent-ink: #6d2a0d;
  --valid: #3f7660;
  --invalid: #b54e3f;
  --shadow: 0 18px 55px rgb(52 64 70 / 0.1);
  --radius: 14px;
  --font-sans: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111719;
  --surface: #192124;
  --surface-2: #212b2f;
  --surface-3: #2a363b;
  --ink: #e8ecec;
  --muted: #9eaaae;
  --line: #344147;
  --line-strong: #526269;
  --accent: #ee7c42;
  --accent-soft: #48281b;
  --accent-ink: #ffd8c3;
  --valid: #6eaa8f;
  --invalid: #df7567;
  --shadow: 0 20px 60px rgb(0 0 0 / 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgb(105 118 124 / 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgb(105 118 124 / 0.055) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
summary,
.stage-card,
canvas {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 10px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 35px;
  height: 35px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 3px;
  background: var(--ink);
  transform: rotate(-11deg);
}

.brand-mark span {
  position: absolute;
  left: 14px;
  top: 6px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: 0.015em;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

nav {
  display: flex;
  gap: 28px;
  font-size: 13px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a:focus-visible {
  color: var(--ink);
}

.theme-button,
.text-button {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.theme-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.stage-card:focus-visible,
canvas:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 3px;
}

main {
  width: min(1680px, calc(100% - 36px));
  margin: 0 auto;
  padding: 56px 0 100px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  align-items: end;
  gap: clamp(36px, 8vw, 140px);
  max-width: 1420px;
  margin: 0 auto 34px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 18px;
  font-size: clamp(39px, 5vw, 72px);
  font-weight: 690;
  letter-spacing: -0.055em;
  line-height: 1.03;
}

.intro-copy {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 20px);
}

.model-statement {
  padding: 22px 0 5px;
  border-top: 2px solid var(--ink);
}

.model-statement span,
.model-statement strong {
  display: block;
}

.model-statement span {
  color: var(--muted);
  font-size: 12px;
}

.model-statement strong {
  margin: 5px 0 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: clamp(20px, 2vw, 30px);
}

.command-bar {
  position: sticky;
  top: 68px;
  z-index: 18;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  max-width: 1540px;
  margin: 0 auto 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.transport {
  display: flex;
  gap: 8px;
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover {
  border-color: var(--ink);
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #22130c;
}

:root[data-theme="dark"] .button.primary {
  color: #1b0e08;
}

.button.full {
  width: 100%;
}

.preset-control {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

select,
input[type="number"] {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

select {
  padding: 6px 34px 6px 10px;
}

.run-state,
.detection-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.state-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.run-state[data-state="running"] .state-indicator,
.detection-chip[data-valid="true"] .state-indicator {
  background: var(--valid);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--valid) 14%, transparent);
}

.detection-chip[data-valid="false"] .state-indicator {
  background: var(--invalid);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--invalid) 14%, transparent);
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(276px, 330px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  max-width: 1540px;
  margin: 0 auto;
}

.control-panel {
  position: sticky;
  top: 144px;
  max-height: calc(100dvh - 162px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p {
  margin-bottom: 2px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.text-button {
  padding: 3px 0;
  color: var(--accent);
}

details {
  border-bottom: 1px solid var(--line);
}

details:last-child {
  border-bottom: 0;
}

summary {
  position: relative;
  padding: 14px 42px 14px 18px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  color: var(--muted);
  font-family: var(--font-mono);
  transform: translateY(-50%);
}

details[open] > summary::after {
  content: "−";
}

.control-group {
  display: grid;
  gap: 17px;
  padding: 2px 18px 20px;
}

.control-group.compact {
  gap: 14px;
}

.range-control {
  display: grid;
  gap: 8px;
}

.range-control > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.range-control b {
  color: var(--ink);
  font-weight: 610;
}

output,
.threshold-readout strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 4px 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, var(--accent) var(--range-progress, 50%), var(--surface-3) var(--range-progress, 50%));
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--line-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.threshold-readout,
.number-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.number-control input {
  width: 88px;
  padding: 5px 8px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-row label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.control-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.calibration-box {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--valid) 4%, transparent);
}

.calibration-box[data-valid="false"] {
  border-color: color-mix(in srgb, var(--invalid) 55%, var(--line));
  background: color-mix(in srgb, var(--invalid) 5%, transparent);
}

.calibration-box legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
}

.calibration-readouts,
.triple-input {
  display: grid;
  gap: 8px;
}

.calibration-readouts {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
}

.calibration-readouts > div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.calibration-readouts span,
.calibration-readouts strong {
  display: block;
}

.calibration-readouts span {
  color: var(--muted);
  font-size: 9px;
}

.calibration-readouts strong {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calibration-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calibration-actions .button {
  min-width: 0;
  padding-inline: 8px;
  white-space: normal;
}

.triple-input {
  grid-template-columns: repeat(3, 1fr);
}

.triple-input label {
  color: var(--muted);
  font-size: 10px;
}

.triple-input input {
  width: 100%;
  margin-top: 4px;
  padding: 5px 6px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.calibration-box p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
}

.section-block,
.metrics,
.learning-grid {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-block {
  padding: clamp(18px, 2.4vw, 30px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h2,
.learning-intro h2 {
  margin-bottom: 6px;
  font-size: clamp(23px, 2.3vw, 34px);
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.section-heading p,
.learning-intro p {
  max-width: 710px;
  margin-bottom: 0;
  color: var(--muted);
}

.detection-chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stage-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease;
}

.stage-card:hover {
  transform: translateY(-2px);
}

.stage-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.stage-card header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
}

.stage-card header span {
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.stage-card header strong {
  font-size: 13px;
}

.stage-card header b {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.stage-card canvas,
.beam-wrap canvas,
.chart-section canvas {
  display: block;
  width: 100%;
  height: auto;
}

.stage-card canvas {
  aspect-ratio: 4 / 3;
  background: #101719;
  cursor: crosshair;
}

.stage-card > p {
  min-height: 55px;
  margin: 0;
  padding: 11px 13px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.explain-panel {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.3fr);
  gap: 24px;
  margin-top: 14px;
  padding: 20px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
}

.formula-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  padding-right: 24px;
  border-right: 1px solid color-mix(in srgb, var(--surface) 24%, transparent);
}

.formula-block span {
  color: color-mix(in srgb, var(--surface) 64%, transparent);
  font-size: 11px;
}

.formula-block strong,
.formula-inline {
  color: var(--accent);
  font-family: var(--font-mono);
}

.formula-block strong {
  font-size: clamp(15px, 1.6vw, 21px);
}

.explain-panel h3 {
  margin-bottom: 7px;
  font-size: 17px;
}

.explain-panel p {
  margin-bottom: 12px;
  color: color-mix(in srgb, var(--surface) 75%, transparent);
  font-size: 12px;
}

.explain-panel code,
footer code {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
}

.metrics > div {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.metrics > div:last-child {
  border-right: 0;
}

.metrics span,
.metrics small,
.control-equation span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.metrics strong {
  display: block;
  overflow: hidden;
  margin: 2px 0;
  font-family: var(--font-mono);
  font-size: clamp(17px, 1.8vw, 24px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-inline {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12px;
}

.formula-inline span {
  color: var(--ink);
}

.beam-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(rgb(105 118 124 / 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgb(105 118 124 / 0.07) 1px, transparent 1px),
    var(--surface-2);
  background-size: 24px 24px;
}

.beam-wrap canvas {
  min-height: 250px;
  cursor: ew-resize;
}

.beam-legend,
.chart-legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 10px;
}

.beam-legend {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
}

.beam-legend span,
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.beam-legend i,
.chart-legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  background: var(--line-strong);
}

.beam-legend .legend-ball {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.beam-legend .legend-target,
.chart-legend [data-series="target"] {
  background: var(--accent);
}

.beam-legend .legend-trail,
.chart-legend [data-series="measured"] {
  background: var(--valid);
}

.chart-legend [data-series="true"] {
  background: var(--ink);
}

.control-equation {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.control-equation > div {
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-equation > div:nth-child(4n) {
  border-right: 0;
}

.control-equation > div:nth-child(n + 5) {
  border-bottom: 0;
}

.control-equation strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.compact-heading {
  align-items: center;
}

.chart-section canvas {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.chart-legend {
  justify-content: flex-end;
  margin-top: 9px;
}

.learning-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) repeat(2, minmax(220px, 1fr));
  overflow: hidden;
}

.learning-intro,
.learning-grid details {
  padding: clamp(20px, 2.5vw, 30px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.learning-intro {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--ink);
  color: var(--surface);
}

.learning-intro p {
  color: color-mix(in srgb, var(--surface) 70%, transparent);
}

.learning-grid details:nth-of-type(2),
.learning-grid details:nth-of-type(4) {
  border-right: 0;
}

.learning-grid details:nth-of-type(3),
.learning-grid details:nth-of-type(4) {
  border-bottom: 0;
}

.learning-grid summary {
  padding: 0 32px 0 0;
  font-size: 15px;
}

.learning-grid summary::after {
  right: 0;
}

.learning-grid details p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(18px, 4vw, 64px) 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

footer p {
  margin: 0;
}

@media (max-width: 1180px) {
  .lab-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metrics > div:nth-child(3) {
    border-right: 0;
  }

  .metrics > div:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .learning-grid {
    grid-template-columns: 1fr 1fr;
  }

  .learning-intro {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 230px;
  }

  .learning-grid details:nth-of-type(2) {
    border-right: 0;
  }

  .learning-grid details:nth-of-type(3) {
    border-bottom: 0;
  }
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  nav {
    display: none;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .model-statement {
    max-width: 420px;
  }

  .command-bar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .preset-control {
    justify-self: end;
  }

  .run-state {
    grid-column: 1 / -1;
  }

  .lab-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    max-height: none;
  }

  .pipeline {
    grid-template-columns: 1fr;
  }

  .stage-card canvas {
    aspect-ratio: 16 / 8.8;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics > div,
  .metrics > div:nth-child(3) {
    border-right: 1px solid var(--line);
    border-top: 1px solid var(--line);
  }

  .metrics > div:nth-child(-n + 2) {
    border-top: 0;
  }

  .metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .control-equation {
    grid-template-columns: repeat(2, 1fr);
  }

  .control-equation > div,
  .control-equation > div:nth-child(4n),
  .control-equation > div:nth-child(n + 5) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .control-equation > div:nth-child(2n) {
    border-right: 0;
  }

  .control-equation > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  .site-header {
    min-height: 62px;
    padding: 8px 16px;
  }

  .brand small {
    display: none;
  }

  .theme-button {
    padding: 7px 9px;
    font-size: 11px;
  }

  main {
    width: min(100% - 24px, 1680px);
    padding-top: 38px;
  }

  h1 {
    font-size: clamp(35px, 11vw, 48px);
  }

  .command-bar {
    grid-template-columns: 1fr;
  }

  .transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .transport .primary {
    grid-column: 1 / -1;
  }

  .preset-control {
    justify-self: stretch;
    justify-content: space-between;
  }

  .section-block {
    padding: 14px;
  }

  .section-heading {
    display: block;
  }

  .detection-chip,
  .formula-inline {
    width: max-content;
    margin-top: 13px;
  }

  .explain-panel {
    grid-template-columns: 1fr;
  }

  .formula-block {
    min-height: 80px;
    padding: 0 0 16px;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--surface) 24%, transparent);
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics > div,
  .metrics > div:nth-child(2n),
  .metrics > div:nth-child(3),
  .metrics > div:nth-child(-n + 2) {
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .metrics > div:first-child {
    border-top: 0;
  }

  .calibration-readouts,
  .calibration-actions {
    grid-template-columns: 1fr;
  }

  .beam-wrap canvas {
    min-height: 220px;
  }

  .beam-legend {
    position: static;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }

  .control-equation {
    grid-template-columns: 1fr;
  }

  .control-equation > div,
  .control-equation > div:nth-child(2n),
  .control-equation > div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-equation > div:last-child {
    border-bottom: 0;
  }

  .learning-grid {
    grid-template-columns: 1fr;
  }

  .learning-intro {
    grid-column: auto;
  }

  .learning-grid details,
  .learning-grid details:nth-of-type(2),
  .learning-grid details:nth-of-type(3),
  .learning-grid details:nth-of-type(4) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .learning-grid details:last-child {
    border-bottom: 0;
  }

  footer {
    display: block;
  }

  footer p + p {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
