/* ==========================================================================
   Three-phase half-wave controlled rectifier —?bench instrument UI
   ========================================================================== */

:root {
  --bg: #0a100d;
  --bg-deep: #070b09;
  --panel: #111915;
  --panel-raised: #151f1a;
  --paper: #ece6d8;
  --paper-strong: #f7f2e7;
  --muted: #9ca79d;
  --dim: #6f7b72;
  --faint: #4b574f;
  --rule: rgba(236, 230, 216, 0.115);
  --rule-strong: rgba(236, 230, 216, 0.24);
  --accent: #ff7a3d;
  --accent-soft: rgba(255, 122, 61, 0.14);
  --amber: #f2b84b;
  --teal: #62d0c3;
  --coral: #f07a59;
  --lime: #c8f56d;
  --sky: #6fd3ff;
  --pink: #ef9ad6;
  --lavender: #b8a1ff;
  --font-display: "STZhongsong", "Songti SC", "STSong", "SimSun", serif;
  --font-label: "Bahnschrift", "DIN Alternate", "Trebuchet MS", sans-serif;
  --font-body: "DengXian", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
  --shadow-panel: 0 24px 70px rgba(0, 0, 0, 0.32);
  --ease-out: cubic-bezier(0.22, 0.78, 0.22, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

a {
  color: inherit;
}

.mono,
code,
kbd,
.math {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
}

.math {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-style: italic;
  letter-spacing: 0.01em;
}

sub {
  font-size: 0.68em;
}

sup {
  font-size: 0.6em;
}

.eyebrow {
  margin: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--faint);
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 12px;
  padding: 9px 13px;
  transform: translateY(-180%);
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--paper);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Atmosphere
   -------------------------------------------------------------------------- */

.atmosphere {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 14% -10%, rgba(255, 122, 61, 0.1), transparent 43%),
    radial-gradient(ellipse at 100% 0%, rgba(98, 208, 195, 0.065), transparent 39%),
    linear-gradient(155deg, #0a110d 0%, #080d0a 54%, #0b120e 100%);
}

.atmosphere__grid {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(236, 230, 216, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 230, 216, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 55%, transparent 100%);
}

.atmosphere__glow {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
}

.atmosphere__glow--warm {
  top: -34vw;
  left: -12vw;
  background: #f07035;
}

.atmosphere__glow--cool {
  right: -26vw;
  bottom: -33vw;
  background: #438b7f;
  opacity: 0.12;
}

.atmosphere__noise {
  position: absolute;
  inset: 0;
  opacity: 0.075;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

/* --------------------------------------------------------------------------
   Page shell and masthead
   -------------------------------------------------------------------------- */

.shell {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 24px 30px 30px;
}

.masthead {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 5px 0 23px;
  border-bottom: 1px solid var(--rule);
}

.masthead::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 84px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.masthead__brand {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 19px;
}

.lab-mark {
  position: relative;
  display: flex;
  width: 58px;
  height: 66px;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px 8px 7px;
  border: 1px solid var(--rule-strong);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 52%),
    var(--panel);
}

.lab-mark::before,
.lab-mark::after {
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: var(--accent);
  border-style: solid;
  content: "";
}

.lab-mark::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.lab-mark::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.lab-mark__letters {
  color: var(--paper);
  font-family: var(--font-label);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.08em;
  line-height: 1;
}

.lab-mark__number {
  align-self: flex-end;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.lab-mark__rail {
  width: 14px;
  height: 1px;
  margin-top: 5px;
  background: var(--rule-strong);
}

.masthead__copy {
  min-width: 0;
}

.masthead__copy h1 {
  margin: 7px 0 9px;
  color: var(--paper-strong);
  font-family: var(--font-display);
  font-size: clamp(35px, 3.8vw, 52px);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 0.98;
  white-space: nowrap;
}

.title-accent {
  position: relative;
  display: inline-block;
  margin-left: 0.1em;
  color: var(--accent);
}

.title-accent::after {
  position: absolute;
  right: 0.02em;
  bottom: -0.09em;
  width: 76%;
  height: 1px;
  background: rgba(255, 122, 61, 0.5);
  content: "";
}

.masthead__subtitle {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.025em;
}

.masthead__subtitle .mono {
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.masthead__divider {
  width: 22px;
  height: 1px;
  background: var(--rule-strong);
}

.masthead__meta {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  padding-bottom: 1px;
}

.run-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  background: rgba(12, 20, 15, 0.56);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.run-state__code {
  margin-left: 4px;
  padding-left: 7px;
  border-left: 1px solid var(--rule);
  color: var(--lime);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.led {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(200, 245, 109, 0.08), 0 0 12px rgba(200, 245, 109, 0.4);
}

.led--live {
  animation: led-pulse 2.8s ease-in-out infinite;
}

@keyframes led-pulse {
  0%,
  100% {
    opacity: 0.82;
    box-shadow: 0 0 0 3px rgba(200, 245, 109, 0.06), 0 0 8px rgba(200, 245, 109, 0.26);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 0 4px rgba(200, 245, 109, 0.1), 0 0 15px rgba(200, 245, 109, 0.44);
  }
}

.reference-input {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.reference-input__label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.15em;
}

.reference-input__value {
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.text-button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.text-button svg {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.text-button:hover {
  border-color: var(--rule-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--paper);
}

.text-button:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   Workbench layout
   -------------------------------------------------------------------------- */

.circuit-switcher {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 15px;
  padding: 10px 0 11px;
  border-bottom: 1px solid var(--rule);
}

.circuit-switcher__label {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 3px;
  padding-right: 4px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}

.circuit-switcher__label .eyebrow {
  font-size: 7px;
  letter-spacing: 0.13em;
}

.circuit-tabs {
  display: flex;
  min-width: 0;
  flex: 1 1 520px;
  gap: 1px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.circuit-tab {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  background: #0e1612;
  color: var(--dim);
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.circuit-tab:hover {
  background: #141e18;
  color: var(--paper);
}

.circuit-tab[aria-pressed="true"] {
  background:
    linear-gradient(180deg, rgba(255, 122, 61, 0.1), transparent 85%),
    #141d17;
  color: var(--paper);
}

.circuit-tab[aria-pressed="true"]::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

.circuit-tab__index {
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.04em;
}

.circuit-tab[aria-pressed="true"] .circuit-tab__index {
  color: var(--accent);
}

.circuit-tab__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.circuit-tab__copy strong {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.circuit-tab[aria-pressed="true"] .circuit-tab__copy strong {
  color: var(--paper);
}

.circuit-tab__copy small {
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.025em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.circuit-tab[aria-pressed="true"] .circuit-tab__copy small {
  color: var(--dim);
}

.circuit-switcher__meta {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(286px, 334px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding-top: 22px;
}

/* --------------------------------------------------------------------------
   Control deck
   -------------------------------------------------------------------------- */

.control-deck {
  position: relative;
  min-width: 0;
  padding: 16px 17px 14px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(152deg, rgba(23, 34, 27, 0.92), rgba(12, 19, 15, 0.97) 68%),
    var(--panel);
  box-shadow: var(--shadow-panel);
}

@media (min-width: 881px) and (min-height: 900px) {
  .control-deck {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
  }
}

.control-deck::before {
  position: absolute;
  top: -1px;
  right: 18px;
  width: 34px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.control-deck::after {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 4px;
  height: 4px;
  border-top: 1px solid var(--rule-strong);
  border-right: 1px solid var(--rule-strong);
  content: "";
}

.deck-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--rule);
}

.deck-heading__id {
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.control-section {
  padding: 15px 0 14px;
  border-bottom: 1px dashed var(--rule);
}

.control-section:last-of-type {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 13px;
}

.section-heading__number {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.section-heading h2 {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.25;
}

.section-heading__en {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.13em;
}

.range-field {
  margin-top: 12px;
}

.range-field:first-of-type {
  margin-top: 0;
}

.range-field__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.range-field__label label {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.range-field__label label .math {
  margin-left: 3px;
  color: var(--paper);
  font-size: 12px;
}

.range-field__output {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--paper-strong);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.range-field__output small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.range-field__label--visually-hidden {
  height: 1px;
  margin: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
  clip-path: inset(50%);
}

.range {
  --range-accent: var(--accent);
  --fill: 50%;
  display: block;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.range-field--amber {
  --range-accent: var(--amber);
}

.range-field--orange,
.range-field--trigger {
  --range-accent: var(--accent);
}

.range-field--lime {
  --range-accent: var(--lime);
}

.range-field--sky {
  --range-accent: var(--sky);
}

.range::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  border: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(10% - 1px),
      rgba(236, 230, 216, 0.21) calc(10% - 1px),
      rgba(236, 230, 216, 0.21) 10%
    ) center / 100% 8px no-repeat,
    linear-gradient(
        90deg,
        var(--range-accent) 0,
        var(--range-accent) var(--fill),
        rgba(236, 230, 216, 0.16) var(--fill),
        rgba(236, 230, 216, 0.16) 100%
      ) center / 100% 2px no-repeat;
}

.range::-moz-range-track {
  width: 100%;
  height: 2px;
  border: 0;
  background: rgba(236, 230, 216, 0.16);
}

.range::-moz-range-progress {
  height: 2px;
  background: var(--range-accent);
}

.range::-webkit-slider-thumb {
  width: 9px;
  height: 20px;
  margin-top: -5px;
  appearance: none;
  border: 1px solid var(--range-accent);
  border-radius: 1px;
  background: var(--paper-strong);
  box-shadow: 0 0 0 3px var(--bg);
  cursor: ew-resize;
  transition: box-shadow 160ms ease, background 160ms ease;
}

.range::-moz-range-thumb {
  width: 8px;
  height: 18px;
  border: 1px solid var(--range-accent);
  border-radius: 1px;
  background: var(--paper-strong);
  box-shadow: 0 0 0 3px var(--bg);
  cursor: ew-resize;
}

.range:hover::-webkit-slider-thumb {
  background: var(--range-accent);
  box-shadow: 0 0 0 3px var(--bg), 0 0 14px color-mix(in srgb, var(--range-accent) 36%, transparent);
}

.range:focus-visible {
  outline: none;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--range-accent);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: -1px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.derived-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px dotted var(--rule);
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 9.5px;
}

.derived-strip > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.derived-strip strong {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 400;
}

/* Trigger angle */

.control-section--trigger {
  padding-top: 16px;
}

.alpha-hero {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 59px;
  margin: 0 0 6px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--rule);
}

.alpha-hero__glyph {
  align-self: flex-start;
  margin-top: 3px;
  color: var(--accent);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 26px;
  font-style: italic;
  line-height: 1;
}

.alpha-hero__number {
  color: var(--paper-strong);
  font-family: var(--font-mono);
  font-size: clamp(48px, 4.6vw, 61px);
  letter-spacing: -0.08em;
  line-height: 0.83;
}

.alpha-hero__number sup {
  position: relative;
  top: -0.42em;
  margin-left: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0;
}

.alpha-hero__caption {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  margin-left: auto;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.03em;
  line-height: 1.55;
  text-align: right;
}

.alpha-hero__caption span:first-child {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
}

.preset-row__label {
  margin-right: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.preset-button {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.preset-button:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  background: rgba(255, 122, 61, 0.07);
  color: var(--paper);
}

.preset-button:active {
  transform: translateY(1px);
}

.field-note {
  min-height: 15px;
  margin: 9px 0 0;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.field-note.is-warning {
  color: #ffc38a;
}

.load-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 13px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.load-stats > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 7px 7px 8px;
  background: rgba(10, 16, 13, 0.76);
}

.load-stats span {
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.load-stats strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.deck-foot {
  padding-top: 13px;
}

.deck-foot__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.deck-foot__keys span {
  padding: 3px 5px;
  border: 1px solid var(--rule);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.06em;
}

.deck-foot p {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Scope column
   -------------------------------------------------------------------------- */

.scope-column {
  min-width: 0;
}

.scope-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 1px 0 13px;
  border-bottom: 1px solid var(--rule);
}

.scope-heading h2 {
  margin: 4px 0 0;
  color: var(--paper-strong);
  font-family: var(--font-display);
  font-size: clamp(24px, 2.3vw, 33px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.metrics {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  border-left: 1px solid var(--rule);
}

.metric {
  display: grid;
  min-width: 86px;
  grid-template-columns: auto auto;
  grid-template-areas:
    "label label"
    "value unit";
  align-content: end;
  column-gap: 4px;
  padding: 0 12px;
  border-right: 1px solid var(--rule);
}

.metric:last-child {
  padding-right: 0;
  border-right: 0;
}

.metric__label {
  grid-area: label;
  align-self: end;
  margin-bottom: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.8px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.metric__value {
  grid-area: value;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
}

.metric__unit {
  grid-area: unit;
  align-self: end;
  margin-bottom: 3px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.metric--mode {
  min-width: 98px;
}

.metric--mode .metric__value--text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--lime);
  line-height: 1.35;
}

.metric--mode .metric__value--text.mode-continuous {
  color: var(--lime);
}

.metric--mode .metric__value--text.mode-discontinuous {
  color: var(--amber);
}

.metric--mode .metric__value--text.mode-none {
  color: var(--dim);
}

/* Channel rack */

.channel-rack {
  margin-top: 13px;
  border: 1px solid var(--rule);
  background: rgba(12, 19, 15, 0.56);
}

.channel-rack__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--rule);
}

.channel-rack__heading > span:last-child {
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.device-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--rule);
  background: rgba(236, 230, 216, 0.012);
}

.device-picker-row__label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.device-picker-row__label .eyebrow {
  color: var(--faint);
  font-size: 6.5px;
  letter-spacing: 0.1em;
}

.device-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.device-picker select {
  min-width: 78px;
  appearance: none;
  padding: 4px 25px 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 0;
  outline: none;
  background: #0c1410;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.device-picker select:hover {
  border-color: var(--dim);
}

.device-picker select:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.device-picker option {
  background: #0c1410;
  color: var(--paper);
}

.device-picker::after {
  position: absolute;
  top: 50%;
  right: 8px;
  color: var(--accent);
  content: "▾";
  font-size: 8px;
  pointer-events: none;
  transform: translateY(-50%);
}

.device-picker-row__hint {
  margin-left: auto;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.channel-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
}

.channel-list[data-visible="4"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.channel-button__indicator--triple.is-single > i:nth-child(n + 2) {
  display: none;
}

.channel-button[hidden] {
  display: none;
}

.channel-button__indicator > i[hidden] {
  display: none;
}

.channel-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 55px;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  overflow: hidden;
  border: 0;
  background: #0e1612;
  color: var(--dim);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.channel-button::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--channel-color);
  opacity: 0;
  content: "";
  transition: opacity 160ms ease;
}

.channel-button:hover {
  background: #131d17;
  color: var(--muted);
}

.channel-button[aria-pressed="true"] {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--channel-color) 10%, transparent), transparent 88%),
    #111b15;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--channel-color) 20%, transparent);
  color: var(--paper);
}

.channel-button[aria-pressed="true"]::after {
  opacity: 1;
}

.channel-button__indicator {
  display: flex;
  width: 14px;
  flex: 0 0 14px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.channel-button__indicator > i {
  display: block;
  width: 12px;
  height: 2px;
  background: var(--swatch, var(--channel-color));
  opacity: 0.38;
  transition: opacity 160ms ease, box-shadow 160ms ease;
}

.channel-button__indicator--triple > i {
  width: 12px;
}

.channel-button__indicator--gates {
  gap: 3px;
}

.channel-button__indicator--gates > i {
  width: 11px;
  background: var(--channel-color);
}

.channel-button__indicator--gates > i:nth-child(2) {
  width: 8px;
  opacity: 0.26;
}

.channel-button__indicator--gates > i:nth-child(3) {
  width: 5px;
  opacity: 0.17;
}

.channel-button[aria-pressed="true"] .channel-button__indicator > i {
  opacity: 1;
  box-shadow: 0 0 7px color-mix(in srgb, var(--swatch, var(--channel-color)) 32%, transparent);
}

.channel-button__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.channel-button__copy strong {
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-button__copy small {
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.2px;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-button[aria-pressed="true"] .channel-button__copy small {
  color: var(--dim);
}

.channel-button__unit {
  margin-left: auto;
  align-self: flex-start;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Scope frame */

.scope-frame {
  position: relative;
  margin-top: 13px;
  border: 1px solid var(--rule-strong);
  background: #070c09;
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.38),
    0 18px 45px rgba(0, 0, 0, 0.18);
}

.scope-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--rule);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.055em;
}

.scope-toolbar__group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

#scope-setpoints {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-toolbar__group--right {
  justify-content: flex-end;
  gap: 14px;
  white-space: nowrap;
}

.scope-crosshair {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

.scope-crosshair::before,
.scope-crosshair::after {
  position: absolute;
  background: var(--accent);
  content: "";
}

.scope-crosshair::before {
  top: 3px;
  left: -4px;
  width: 15px;
  height: 1px;
}

.scope-crosshair::after {
  top: -4px;
  left: 3px;
  width: 1px;
  height: 15px;
}

.scope-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.scope-live .led {
  width: 5px;
  height: 5px;
}

#scope-time-range {
  color: var(--muted);
}

.scope-zoomline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
  padding: 7px 13px;
  border-bottom: 1px solid var(--rule);
  background: rgba(236, 230, 216, 0.016);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.scope-zoomline__label {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.scope-zoomline__label::before {
  color: var(--accent);
  content: "↔";
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
}

.scope-zoomline__label span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.09em;
}

.zoom-options {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--rule);
}

.zoom-option {
  min-width: 29px;
  height: 22px;
  padding: 0 6px;
  border: 0;
  border-right: 1px solid var(--rule);
  background: transparent;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.zoom-option:last-child {
  border-right: 0;
}

.zoom-option:hover {
  background: rgba(255, 122, 61, 0.06);
  color: var(--paper);
}

.zoom-option.is-active,
.zoom-option[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
}

.zoom-option:active {
  transform: translateY(1px);
}

.scope-zoomline__readout {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  min-height: 342px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(111, 211, 255, 0.028), transparent 58%),
    #070c09;
}

#scope-canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 342px;
  cursor: crosshair;
  touch-action: pan-y;
}

.chart-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 30px;
  background: rgba(7, 12, 9, 0.88);
  color: var(--dim);
  text-align: center;
}

.chart-empty[hidden] {
  display: none;
}

.chart-empty__mark {
  display: grid;
  width: 36px;
  height: 36px;
  margin-bottom: 3px;
  place-items: center;
  border: 1px solid var(--rule-strong);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 17px;
}

.chart-empty strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.chart-empty span:not(.chart-empty__mark) {
  max-width: 260px;
  font-size: 9.5px;
  line-height: 1.6;
}

.chart-empty .text-button {
  margin-top: 8px;
  pointer-events: auto;
}

.frame-corner {
  position: absolute;
  z-index: 3;
  width: 12px;
  height: 12px;
  border-color: rgba(236, 230, 216, 0.34);
  border-style: solid;
  pointer-events: none;
}

.frame-corner--tl {
  top: 45px;
  left: 8px;
  border-width: 1px 0 0 1px;
}

.frame-corner--tr {
  top: 45px;
  right: 8px;
  border-width: 1px 1px 0 0;
}

.frame-corner--bl {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 1px 1px;
}

.frame-corner--br {
  right: 8px;
  bottom: 8px;
  border-width: 0 1px 1px 0;
}

/* Cursor readout */

.cursor-readout {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-height: 58px;
  padding: 9px 13px;
  border-top: 1px solid var(--rule);
  background: rgba(13, 22, 16, 0.8);
}

.cursor-readout__head {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.cursor-readout__head .eyebrow {
  font-size: 7px;
  letter-spacing: 0.15em;
}

#cursor-angle {
  color: var(--accent);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
}

#cursor-time {
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.01em;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cursor-values {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 15px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.01em;
}

.cursor-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--dim);
  white-space: nowrap;
}

.cursor-value__dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  align-self: center;
  border-radius: 50%;
  background: var(--dot-color, var(--paper));
}

.cursor-value strong {
  color: var(--paper);
  font-weight: 400;
}

.cursor-value em {
  color: var(--faint);
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 7px;
}

.cursor-placeholder {
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.015em;
  line-height: 1.5;
}

.cursor-values:has(.cursor-value) .cursor-placeholder {
  display: none;
}

/* Underbar */

.scope-underbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 9px;
  padding: 8px 11px;
  border: 1px solid var(--rule);
  background: rgba(12, 19, 15, 0.46);
}

.firing-legend {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
}

.firing-legend__title {
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.firing-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8px;
}

.firing-legend__item i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--firing-color);
  opacity: 0.9;
}

.firing-legend__hint {
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8.5px;
  letter-spacing: 0.01em;
}

.warning-strip {
  flex-basis: 100%;
  padding-top: 7px;
  border-top: 1px dashed rgba(255, 122, 61, 0.28);
  color: #ffc28c;
  font-size: 9px;
  letter-spacing: 0.015em;
  line-height: 1.55;
}

.warning-strip[hidden] {
  display: none;
}

.warning-strip p {
  margin: 0;
}

.warning-strip p + p {
  margin-top: 3px;
}

/* --------------------------------------------------------------------------
   Lab notes
   -------------------------------------------------------------------------- */

.lab-notes {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.note-card {
  min-width: 0;
  padding: 13px 14px 11px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 58%),
    rgba(12, 19, 15, 0.46);
}

.note-card__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.note-card__title {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.schematic-stage {
  position: relative;
}

.schematic-panel[hidden] {
  display: none;
}

.schematic-panel.is-active {
  display: block;
  animation: schematic-in 260ms var(--ease-out);
}

@keyframes schematic-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.schematic {
  display: block;
  width: 100%;
  max-height: none;
  margin-top: 7px;
  overflow: visible;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.schematic text {
  fill: var(--muted);
}

.schematic text[fill="#f2b84b"] {
  fill: #f2b84b;
}

.schematic text[fill="#62d0c3"] {
  fill: #62d0c3;
}

.schematic text[fill="#f07a59"] {
  fill: #f07a59;
}

.schematic .schematic__muted {
  fill: var(--faint);
  font-size: 10.5px;
}

.schematic .schematic__device {
  fill: var(--muted);
  font-size: 11px;
}

.schematic__frame {
  color: var(--rule-strong);
}

.schematic__caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  margin-top: 4px;
  padding-top: 7px;
  border-top: 1px dotted var(--rule);
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.protocol__intro {
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.protocol__formula {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 0 8px 10px;
  border-left: 2px solid var(--accent);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.protocol__formula-label {
  color: var(--accent);
  font-size: 7px;
  letter-spacing: 0.11em;
}

.protocol__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.protocol__chips span {
  padding: 3px 6px;
  border: 1px solid var(--rule);
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.protocol__notes {
  margin-top: 11px;
}

.protocol__notes > div {
  display: grid;
  grid-template-columns: 53px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-top: 1px dotted var(--rule);
}

.protocol__notes span {
  padding-top: 1px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
}

.protocol__notes p {
  margin: 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
}

.protocol__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dotted var(--rule);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
}

.protocol__foot b {
  color: var(--dim);
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.page-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 30px;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.035em;
}

.page-foot .mono {
  font-size: 7px;
  letter-spacing: 0.08em;
}

.noscript {
  position: fixed;
  z-index: 40;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 13px;
  border: 1px solid var(--accent);
  background: var(--bg-deep);
  color: var(--paper);
  font-size: 12px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Reveal
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(13px);
  animation: reveal-in 740ms var(--ease-out) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

@keyframes reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1260px) {
  .shell {
    padding-right: 22px;
    padding-left: 22px;
  }

  .workbench {
    grid-template-columns: minmax(278px, 312px) minmax(0, 1fr);
    gap: 19px;
  }

  .channel-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .channel-button {
    min-height: 51px;
  }

  .metric {
    min-width: 77px;
    padding: 0 10px;
  }

  .metric--mode {
    min-width: 88px;
  }
}

@media (max-width: 1040px) {
  .masthead {
    gap: 16px;
  }

  .masthead__copy h1 {
    font-size: clamp(32px, 4vw, 46px);
  }

  .masthead__subtitle .mono {
    display: none;
  }

  .workbench {
    grid-template-columns: minmax(270px, 292px) minmax(0, 1fr);
  }

  .scope-heading {
    flex-wrap: wrap;
    gap: 13px;
  }

  .metrics {
    width: 100%;
    border-top: 1px solid var(--rule);
    border-left: 0;
    padding-top: 9px;
  }

  .metric {
    flex: 1;
    padding-left: 0;
  }

  .metric:last-child {
    flex: 1.3;
  }

  .cursor-readout {
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px;
  }

  .lab-notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .note-card--topology .schematic {
    max-height: none;
  }
}

@media (max-width: 880px) {
  .shell {
    padding: 18px 18px 24px;
  }

  .circuit-switcher {
    gap: 8px;
    margin-top: 12px;
  }

  .circuit-switcher__label {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 0;
  }

  .circuit-tabs {
    display: grid;
    flex-basis: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .circuit-switcher__meta {
    display: none;
  }

  .masthead {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 17px;
  }

  .masthead__meta {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
    padding: 0;
  }

  .masthead__meta .text-button {
    margin-left: auto;
  }

  .reference-input {
    align-items: flex-start;
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding-top: 17px;
  }

  .control-deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 20px;
    padding: 15px 16px 13px;
  }

  .deck-heading,
  .deck-foot {
    grid-column: 1 / -1;
  }

  .control-section {
    border-bottom: 1px dashed var(--rule);
  }

  .control-section:nth-of-type(3) {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .control-section--trigger {
    border-bottom: 1px dashed var(--rule);
  }

  .control-section:last-of-type {
    border-bottom: 0;
  }

  .alpha-hero__number {
    font-size: 54px;
  }

  .deck-foot {
    padding-top: 9px;
    border-top: 1px solid var(--rule);
  }

  .channel-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scope-heading h2 {
    font-size: 30px;
  }

  .scope-frame {
    margin-top: 11px;
  }

  #scope-canvas {
    min-height: 360px;
  }

  .cursor-readout {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .lab-notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .note-card--topology .schematic {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 14px 13px 20px;
  }

  .masthead__brand {
    gap: 13px;
  }

  .lab-mark {
    width: 48px;
    height: 56px;
    padding: 7px 6px 6px;
  }

  .lab-mark__letters {
    font-size: 20px;
  }

  .lab-mark__number {
    font-size: 8px;
  }

  .masthead__copy h1 {
    margin-top: 6px;
    font-size: clamp(30px, 8.2vw, 39px);
    white-space: normal;
  }

  .title-accent {
    margin-left: 0;
  }

  .masthead__subtitle {
    max-width: 280px;
    font-size: 10px;
    line-height: 1.55;
  }

  .masthead__meta {
    gap: 7px;
    justify-content: flex-start;
  }

  .masthead__meta .text-button {
    min-height: 29px;
    margin-left: 0;
  }

  .run-state {
    padding: 5px 7px;
    font-size: 9px;
  }

  .reference-input__value {
    font-size: 10px;
  }

  .control-deck {
    display: block;
    padding: 14px;
  }

  .control-section {
    padding: 13px 0 12px;
  }

  .control-section:nth-of-type(3) {
    border-bottom: 0;
  }

  .section-heading h2 {
    font-size: 15px;
  }

  .scope-heading {
    padding-bottom: 11px;
  }

  .scope-heading h2 {
    font-size: 27px;
  }

  .scope-heading .eyebrow {
    font-size: 8px;
    line-height: 1.6;
  }

  .metrics {
    gap: 0;
    padding-top: 8px;
  }

  .metric {
    min-width: 0;
    padding: 0 8px;
  }

  .metric:first-child {
    padding-left: 0;
  }

  .metric__label {
    font-size: 6.3px;
    letter-spacing: 0.08em;
  }

  .metric__value {
    font-size: 19px;
  }

  .metric__unit {
    font-size: 7px;
  }

  .metric--mode {
    min-width: 0;
    padding-right: 0;
  }

  .metric--mode .metric__value--text {
    font-size: 13px;
  }

  .channel-rack {
    margin-top: 11px;
  }

  .channel-rack__heading {
    padding: 7px 9px;
  }

  .channel-rack__heading > span:last-child {
    display: none;
  }

  .device-picker-row {
    gap: 8px;
    padding: 7px 9px;
  }

  .device-picker-row__label .eyebrow,
  .device-picker-row__hint {
    display: none;
  }

  .device-picker select {
    min-width: 70px;
    font-size: 8.5px;
  }

  .channel-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .channel-list[data-visible="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .circuit-switcher {
    gap: 7px;
    margin-top: 10px;
    padding: 8px 0 9px;
  }

  .circuit-switcher__label {
    font-size: 10px;
  }

  .circuit-tab {
    padding: 7px 8px;
  }

  .circuit-tab__copy strong {
    font-size: 10px;
  }

  .circuit-tab__copy small {
    display: none;
  }

  .channel-button {
    min-height: 52px;
    padding: 7px;
  }

  .channel-button__copy strong {
    font-size: 9.5px;
  }

  .channel-button__unit {
    font-size: 6px;
  }

  .scope-toolbar {
    flex-wrap: wrap;
    gap: 5px 12px;
    padding: 8px 10px;
    font-size: 7.5px;
  }

  .scope-toolbar__group--right {
    gap: 10px;
  }

  .scope-zoomline {
    gap: 6px 10px;
    padding: 7px 10px;
  }

  .scope-zoomline__label span {
    display: none;
  }

  .zoom-option {
    min-width: 27px;
    height: 23px;
    font-size: 8.5px;
  }

  .scope-zoomline__readout {
    font-size: 7.5px;
  }

  #scope-canvas {
    min-height: 330px;
  }

  .frame-corner--tl,
  .frame-corner--tr {
    top: 37px;
  }

  .cursor-readout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: 8px 10px 9px;
  }

  .cursor-readout__head {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "eyebrow angle"
      "time time";
    align-items: baseline;
    gap: 1px 8px;
  }

  .cursor-readout__head .eyebrow {
    grid-area: eyebrow;
  }

  #cursor-angle {
    grid-area: angle;
    justify-self: end;
    font-size: 13px;
  }

  #cursor-time {
    grid-area: time;
    font-size: 7.5px;
  }

  .cursor-values {
    gap: 4px 12px;
    font-size: 8px;
  }

  .scope-underbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 8px 9px;
  }

  .firing-legend {
    gap: 8px;
  }

  .firing-legend__hint {
    flex-basis: 100%;
    padding-top: 1px;
  }

  .lab-notes {
    gap: 11px;
    margin-top: 11px;
  }

  .note-card {
    padding: 11px;
  }

  .note-card--topology .schematic {
    max-height: none;
  }

  .schematic {
    font-size: 12.5px;
  }

  .schematic .schematic__muted {
    font-size: 11px;
  }

  .schematic .schematic__device {
    font-size: 11.5px;
  }

  .protocol__intro {
    font-size: 9.5px;
  }

  .page-foot {
    margin-top: 20px;
    font-size: 7.5px;
  }

  .page-foot > span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 390px) {
  .masthead__copy h1 {
    font-size: 29px;
  }

  .metric {
    padding: 0 6px;
  }

  .metric__value {
    font-size: 17px;
  }

  .metric--mode .metric__value--text {
    font-size: 12px;
  }

  .alpha-hero__number {
    font-size: 47px;
  }

  .alpha-hero__caption span:first-child {
    display: none;
  }

  .load-stats > div {
    padding: 6px;
  }

  .load-stats span {
    font-size: 7px;
  }

  .load-stats strong {
    font-size: 8px;
  }
}

@media (max-width: 360px) {
  .scope-zoomline__label {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
