.scope {
  --scope-ivory: var(--surface);
  --scope-ink: var(--ink);
  --scope-sage: var(--emerald);
  --scope-orange: var(--primary);
  --scope-screen: #151c23;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 280px;
  overflow: auto;
  padding: 0 14px 12px;
  color: var(--scope-ink);
  background: var(--scope-ivory);
  border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  isolation: isolate;
  container-type: inline-size;
  container-name: scope;
}

.scope *,
.scope *::before,
.scope *::after {
  box-sizing: border-box;
}
.scope button,
.scope input {
  font: inherit;
}
.scope button {
  cursor: pointer;
}
.scope button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.scope button:focus-visible,
.scope input:focus-visible,
.scope [tabindex]:focus-visible {
  outline: 2px solid var(--scope-orange);
  outline-offset: 3px;
}
.scope button svg {
  flex-shrink: 0;
  pointer-events: none;
}

.scope-header,
.scope-heading,
.scope-controls,
.scope-button-group {
  display: flex;
  align-items: center;
}
.scope-header {
  min-height: 47px;
  flex-shrink: 0;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}
.scope-heading {
  gap: 9px;
  min-width: 0;
}
.scope-mark {
  display: grid;
  place-items: center;
  color: var(--scope-sage);
}
.scope-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.35px;
}
.scope-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-inline-start: 5px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.scope-status > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--scope-sage);
}
.scope-status--stale {
  color: var(--warning);
}
.scope-status--stale > span {
  background: var(--scope-orange);
}
.scope-controls {
  gap: 9px;
}
.scope-button-group {
  gap: 2px;
}
.scope-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 29px;
  min-width: 29px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--scope-ink);
  background: transparent;
  font-size: 12.5px;
  font-weight: 550;
}
.scope-controls button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border-color: color-mix(in srgb, var(--ink) 12%, transparent);
}
.scope-control-divider {
  width: 1px;
  height: 14px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  margin: 0 4px;
}
.scope-controls .scope-export {
  padding: 0 11px;
  border-color: color-mix(in srgb, var(--ink) 17%, transparent);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.scope-controls .scope-export:hover:not(:disabled) {
  background: var(--raised);
  border-color: var(--scope-sage);
}

.scope-instrument {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 237px;
  overflow: hidden;
  color: #d9dee2;
  background: var(--scope-screen);
  border: 1px solid #0d1217;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 #ffffff0a,
    0 2px 4px #151c230a;
}
.scope-channel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 33px;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid #d4dce212;
}
.scope-channels {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #424e56 transparent;
  padding: 3px 1px;
}
.scope-channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 24px;
  max-width: 210px;
  padding: 2px 7px;
  color: #e0e5e8;
  background: #d3dde408;
  border: 1px solid #d3dde419;
  border-radius: 8px;
  font-size: 11.5px;
  transition:
    background 120ms,
    border-color 120ms;
}
.scope-channel:hover {
  background: #d3dde416;
  border-color: #d3dde444;
}
.scope-channel[aria-pressed="false"] {
  color: #939ca2;
  background: transparent;
  border-color: transparent;
}
.scope-channel[aria-pressed="false"] .scope-channel-name {
  text-decoration: line-through;
}
.scope-channel[aria-pressed="false"] .scope-channel-dot {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--channel-color, #84c3e0);
}
.scope-channel-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--channel-color, #84c3e0);
}
.scope-channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scope-channel-number,
.scope-channel-unit {
  color: #9ba4ab;
  font-size: 10.5px;
}
.scope-channel-unit {
  margin-inline-start: 4px;
}
.scope-capture-info,
.scope-no-probes {
  color: #9da6ac;
  font-size: 10.5px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.scope-no-probes {
  letter-spacing: 1px;
}
.scope-capture-info {
  flex-shrink: 0;
}
.scope-capture-info > span {
  margin: 0 4px;
  color: #6c7880;
}
.scope-capture-info .scope-gesture-hint {
  margin: 0 18px 0 0;
  color: #9da6ac;
}

.scope-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  min-height: 114px;
}
.scope-plot {
  position: relative;
  min-width: 0;
  min-height: 114px;
  overflow: hidden;
  background: radial-gradient(ellipse at 48% 45%, #222e3a24, transparent 75%);
}
.scope-svg {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
.scope-svg:focus-visible {
  outline-offset: -3px !important;
}
.scope-grid-minor {
  stroke: #bfc8cf;
  stroke-opacity: 0.045;
  stroke-width: 0.6;
}
.scope-grid-major {
  stroke: #bfc8cf;
  stroke-opacity: 0.12;
  stroke-width: 0.7;
}
.scope-grid-zero {
  stroke: #bfc8cf;
  stroke-opacity: 0.28;
  stroke-width: 0.8;
  stroke-dasharray: 3 4;
}
.scope-axis {
  fill: #9ca5ac;
  font-size: 10.5px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.scope-axis line:not(.scope-grid-major) {
  stroke: #9ca5ac;
  stroke-opacity: 0.35;
}
.scope-axis-title {
  fill: #a6b0b8;
  font-size: 9px;
  letter-spacing: 0.55px;
}
.scope-trace {
  fill: none;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.scope-cursor {
  cursor: ew-resize;
  --cursor-color: #7cc8ea;
}
.scope-cursor--b {
  --cursor-color: #4cbb7a;
}
.scope-cursor > line {
  stroke: var(--cursor-color);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.7;
}
.scope-cursor--active > line,
.scope-cursor:focus-visible > line {
  opacity: 1;
  stroke-dasharray: 2 2;
}
.scope-cursor-hit {
  fill: transparent;
}
.scope-cursor-label {
  fill: var(--cursor-color);
}
.scope-cursor text {
  fill: #151c23;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
}
.scope-cursor-point {
  stroke: #151c23;
  stroke-width: 1.2;
  pointer-events: none;
}
.scope-empty {
  position: absolute;
  inset: 20px 55px 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  pointer-events: none;
}
.scope-empty svg {
  color: #82929d;
  margin-bottom: 1px;
}
.scope-empty strong {
  color: #d0d9df;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.15px;
}
.scope-empty > span {
  max-width: 360px;
  color: #9da5aa;
  font-size: 11.5px;
  text-wrap: balance;
}
.scope-stale-overlay {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  background: #151c23e8;
  color: #ffdea1;
  font-size: 10px;
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
}

.scope-readouts {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 0;
  padding: 8px 12px;
  border-inline-start: 1px solid #d4dce217;
  background: #0b101515;
}
.scope-readout-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  color: #afb8be;
  font-size: 10px;
  letter-spacing: 1px;
}
.scope-readout-heading > span:last-child {
  color: #9da5aa;
  font-size: 10.5px;
  letter-spacing: 0;
  cursor: help;
}
.scope-cursor-inputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.scope-cursor-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.scope-cursor-row > button {
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  padding: 0;
  color: #7cc8ea;
  background: transparent;
  border: 1px solid #7cc8ea4a;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 650;
}
.scope-cursor-row--b > button {
  color: #4cbb7a;
  border-color: #4cbb7a4a;
}
.scope-cursor-row--a > button[aria-pressed="true"] {
  color: #151c23;
  background: #7cc8ea;
}
.scope-cursor-row--b > button[aria-pressed="true"] {
  color: #151c23;
  background: #4cbb7a;
}
.scope-time-input {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  border-bottom: 1px solid #d4dce21c;
}
.scope-time-input input {
  width: 100%;
  min-width: 0;
  height: 23px;
  padding: 2px 0;
  color: #dae1e6;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}
.scope-time-input input::-webkit-inner-spin-button,
.scope-time-input input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.scope-time-input input::placeholder {
  color: #899197;
}
.scope-time-input > span:last-child {
  padding-inline-end: 2px;
  color: #9da5aa;
  font-size: 11.5px;
}
.scope-outside {
  position: absolute;
  inset-inline-end: 12px;
  top: -6px;
  background: var(--scope-screen);
  color: #ffdea1;
  font-size: 9px;
  line-height: 1;
}
.scope-delta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: #a5adb3;
}
.scope-delta > span {
  flex: 1;
  min-width: 0;
}
.scope-delta > span + span {
  padding-inline-start: 12px;
  border-inline-start: 1px solid #d4dce217;
}
.scope-delta small {
  font-size: 10px;
  color: #9da5aa;
  margin-inline-start: 3px;
}
.scope-delta output {
  display: block;
  margin-top: 1px;
  color: #dae1e6;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.scope-measurements {
  flex: 0 0 auto;
  max-height: 88px;
  min-height: 47px;
  overflow: auto;
  border-top: 1px solid #d4dce21c;
  scrollbar-width: thin;
  scrollbar-color: #424e56 #151c23;
}
.scope-measurements:focus-visible {
  outline-offset: -2px !important;
}
.scope-measurements table {
  width: 100%;
  min-width: 650px;
  border-collapse: separate;
  border-spacing: 0;
  text-align: end;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.scope-measurements th,
.scope-measurements td {
  height: 22px;
  padding: 3px 12px;
  white-space: nowrap;
  border-bottom: 1px solid #d4dce209;
  font-weight: 400;
}
.scope-measurements thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 21px;
  background: #192028;
  color: #a9b2b9;
  font-size: 10.5px;
}
.scope-measurements th:first-child {
  text-align: start;
}
.scope-measurements tbody th {
  max-width: 220px;
  color: #d0d9df;
}
.scope-measurements tbody th > span:nth-child(2) {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.scope-measurements td {
  color: #d0d9df;
  font-family: var(--mono);
}
.scope-measurements tbody tr:hover {
  background: #d4dce205;
}
.scope-table-note {
  margin-inline-start: 5px;
  color: #969fa6;
  font-size: 10px;
  font-weight: 400;
}
.scope-table-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-inline-end: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.scope-measurements thead .scope-a-heading {
  color: #7cc8ea;
}
.scope-measurements thead .scope-b-heading {
  color: #4cbb7a;
}
.scope-measurement--hidden .scope-table-dot {
  opacity: 0.4;
}
.scope-measurements .scope-table-empty {
  color: #9da5aa;
  text-align: start;
  font-family: inherit;
  font-size: 11.5px;
}
.scope-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@container scope (max-width: 850px) {
  .scope-display {
    grid-template-columns: minmax(0, 1fr) 225px;
  }
  .scope-readouts {
    padding: 8px 10px;
    gap: 5px;
  }
  .scope-capture-info {
    font-size: 10px;
  }
  .scope-capture-info .scope-gesture-hint {
    display: none;
  }
  .scope-measurements th,
  .scope-measurements td {
    padding-inline-start: 9px;
    padding-inline-end: 9px;
  }
}

@container scope (max-width: 620px) {
  .scope-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 0;
  }
  .scope-heading {
    flex: 1 0 100%;
  }
  .scope-controls {
    width: 100%;
    justify-content: space-between;
  }
  .scope-controls button {
    height: 32px;
    min-width: 32px;
  }
  .scope-instrument {
    flex: 1 0 auto;
  }
  .scope-channel-bar {
    flex-wrap: wrap;
    gap: 3px;
    padding: 5px 8px;
  }
  .scope-channels {
    flex: 1 0 100%;
  }
  .scope-capture-info {
    padding-inline-start: 4px;
  }
  .scope-display {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .scope-plot {
    min-height: 175px;
  }
  .scope-readouts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 14px;
    padding: 9px 12px;
    border-inline-start: 0;
    border-top: 1px solid #d4dce217;
  }
  .scope-readout-heading {
    grid-column: 1 / -1;
  }
  .scope-cursor-row > button {
    width: 26px;
    height: 26px;
  }
  .scope-time-input input {
    height: 26px;
    font-size: 12.5px;
  }
  .scope-delta {
    align-items: center;
  }
  .scope-delta > span + span {
    padding-inline-start: 8px;
  }
  .scope-delta output {
    font-size: 11.5px;
  }
  .scope-measurements {
    max-height: 98px;
  }
  .scope-measurements th,
  .scope-measurements td {
    height: 27px;
  }
  .scope-empty {
    inset-inline-start: 40px;
    inset-inline-end: 40px;
  }
  .scope-empty strong {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scope * {
    transition: none !important;
  }
}
/* The Bode plot, drawn on the oscilloscope's screen. */
.bode-plot {
  flex: 1;
  touch-action: pan-y;
}
.bode .scope-instrument {
  min-height: 0;
}
.bode-corner {
  fill: var(--scope-screen);
  stroke-width: 1.6;
}
.bode-cursor {
  stroke: #e7ecef;
  stroke-opacity: 0.55;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.bode-empty {
  pointer-events: none;
}
/* Words on the instrument are set in the UI's face in Arabic: the
   instrument's monospace faces have no Arabic letters, and the fallback
   draws each one apart instead of joined. */
[lang="ar"] .scope-axis-title,
[lang="ar"] .scope-measurements td.word {
  font-family: "Alexandria", "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0;
}
[lang="ar"] .scope-axis-title {
  font-size: 10.5px;
}
/* The view switch: waveforms, spectrum, XY. */
.scope-view {
  min-width: 34px;
  font-weight: 650;
  font-size: 11.5px;
}
.scope-view.active {
  background: var(--strong);
  color: #fff;
}
.xy-trace {
  stroke: var(--scope-orange);
}
.spectrum-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #d4dce21c;
  font-size: 11.5px;
}
.spectrum-row > span:not(.scope-table-dot) {
  grid-column: 2;
  color: #a6b0b8;
}
.spectrum-row output {
  color: #e7ecef;
  font-variant-numeric: tabular-nums;
}
.scope-note {
  font-size: 11px;
  line-height: 1.6;
  color: #a6b0b8;
  margin: 8px 0 0;
}
/* The spectrum's readouts can outgrow the panel: it scrolls. */
.scope-readouts {
  overflow-y: auto;
}
/* The math channel's selector, after the channel buttons. */
.scope-math {
  border: 1px solid var(--scope-line, var(--border));
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 11.5px;
  padding: 3px 4px;
}
.scope-math-note {
  flex: none;
  white-space: nowrap;
  font-size: 11.5px;
  opacity: 0.75;
  cursor: help;
}

/* Dr. Machine's brand tokens (docs/DESIGN_SYSTEM.md), light, then dark under
   `html.dark` — the class the platform's theme controller sets. Everything
   below is written in these; only the oscilloscope's screen, dark in both
   themes, keeps colours of its own. */
:root {
  --bg: #f8fafb;
  --surface: #fff;
  --sunken: #f2f4f6;
  --raised: #eceef0;
  --paper: #f2f4f6; /* the bench */
  --grid: #c5ccd2;
  --line: #e1e6ea;
  --border: #bfc8cf;
  --ink: #191c1e;
  --muted: #40484e;
  --subtle: #636b72;
  --primary: #24a9e0;
  --strong: #0c6e9c;
  --strong-hover: #0a5c83;
  --link: #0c6e9c;
  --soft: rgba(36, 169, 224, 0.1);
  --tint: rgba(36, 169, 224, 0.35);
  --emerald: #1a8f50;
  --success: #198639;
  --success-soft: rgba(25, 134, 57, 0.1);
  --error: #ba1a1a;
  --error-soft: rgba(186, 26, 26, 0.08);
  --warning: #8f6400;
  --elev-1: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --elev-2: 0 2px 8px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --elev-3: 0 8px 24px rgba(16, 24, 40, 0.08), 0 24px 48px rgba(16, 24, 40, 0.1);
  --elev-primary: 0 6px 18px rgba(36, 169, 224, 0.28);
  --font: "Inter", "Alexandria", "Segoe UI", Tahoma, sans-serif;
  --display: "Space Grotesk", "Alexandria", "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Alexandria", monospace;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  font-weight: 400;
}
html.dark {
  color-scheme: dark;
  --bg: #121416;
  --surface: #1e2022;
  --sunken: #1a1c1e;
  --raised: #282a2c;
  --paper: #121416;
  --grid: #353c42;
  --line: #2f3538;
  --border: #3e484f;
  --ink: #e2e2e5;
  --muted: #bdc8d0;
  --subtle: #939da5;
  --strong-hover: #1580b3;
  --link: #5bc2ef;
  --soft: rgba(36, 169, 224, 0.14);
  --tint: rgba(36, 169, 224, 0.4);
  --emerald: #4cbb7a;
  --success: #6dd58c;
  --success-soft: rgba(109, 213, 140, 0.12);
  --error: #ffb4ab;
  --error-soft: rgba(255, 180, 171, 0.1);
  --warning: #ffdea1;
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --elev-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --elev-3: 0 24px 48px rgba(0, 0, 0, 0.55);
  --elev-primary: 0 8px 24px rgba(36, 169, 224, 0.3);
}
/* SVG presentation colours set in the Rust views (canvas.rs, app.rs). */
.bridge-mask,
.probe-reference circle {
  fill: var(--paper);
}
.bridge-arc {
  stroke: var(--subtle);
}
.grid-dot {
  fill: var(--grid);
}
.guide-mask {
  stroke: var(--surface);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
button {
  border: 0;
  background: none;
}
input,
select {
  min-width: 0;
  color: var(--ink);
}
svg {
  flex-shrink: 0;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
kbd,
code {
  font-family: var(--mono);
}
kbd {
  font-size: 11.5px;
  color: var(--subtle);
}
button:hover kbd {
  color: var(--link);
}
.app {
  height: 100dvh;
  min-height: 680px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-header {
  height: 60px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}
/* The company's lockup, the small (navbar) tier: gear 32px, DR in sky blue,
   MACHINE in navy — ice white in the dark. */
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  text-decoration: none;
}
.brand img {
  display: block;
  filter: drop-shadow(0 0 6px rgba(36, 169, 224, 0.25));
}
.brand span {
  display: flex;
  flex-direction: column;
  font: 800 14px/1.02 "Alexandria", sans-serif;
  color: #252161;
}
html.dark .brand span {
  color: #dae5ed;
}
.brand b {
  font-weight: inherit;
  color: var(--primary);
}
.lab-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.lab-title strong {
  font: 700 16px/1.25 var(--display);
  color: var(--ink);
}
.lab-title > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Dr.Machine embedding: return link to the platform's tools hub. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.back-link:hover {
  background: var(--raised);
}
@media (max-width: 600px) {
  .back-link span {
    display: none;
  }
}
.header-divider {
  height: 28px;
  width: 1px;
  background: var(--line);
}
.header-description {
  color: var(--subtle);
  font-size: 12px;
}
.header-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 12px;
  align-items: center;
}
.local-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--subtle);
  margin-inline-end: 9px;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  background: var(--emerald);
  border-radius: 50%;
}
.status-dot.error {
  background: var(--error);
}
.status-dot.stale {
  background: var(--warning);
}
.button {
  border: 1px solid var(--border);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  line-height: 1.2;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.12s;
}
.button:hover {
  background: var(--raised);
}
.button.subtle {
  border-color: transparent;
  background: none;
}
.project-bar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.project-name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.project-icon {
  color: var(--subtle);
}
.project-name input {
  background: transparent;
  border: 0;
  padding: 5px 0;
  font-size: 14px;
  font-weight: 600;
  width: 200px;
  max-width: 36vw;
  text-overflow: ellipsis;
}
.version-tag {
  font-size: 10px;
  letter-spacing: 0.7px;
  color: var(--subtle);
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.project-actions {
  display: flex;
  align-items: center;
  gap: 19px;
}
.text-button {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  padding: 7px 0;
  color: var(--subtle);
}
.text-button:hover {
  color: var(--link);
}
.vertical-rule {
  height: 18px;
  width: 1px;
  flex-shrink: 0;
  background: var(--line);
  margin: 0 4px;
}
.example-button {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.example-button > svg:first-child {
  color: var(--subtle);
}
.workbench {
  display: grid;
  --library: 220px;
  --inspector: 272px;
  grid-template-columns: var(--library) minmax(400px, 1fr) var(--inspector);
  flex: 1;
  min-height: 0;
}
/* Panels put away (the toolbar's toggles, F): their column closes, and they
   keep their place in the grid so nothing else moves into it. Phones have
   their own tabs instead. */
@media (min-width: 901px) {
  .workbench.hide-library {
    --library: 0px;
  }
  .workbench.hide-inspector {
    --inspector: 0px;
  }
  .hide-library > .library,
  .hide-inspector > .inspector {
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .hide-scope .scope-region {
    display: none;
  }
}
@media (max-width: 900px) {
  .tools > .panel-toggles {
    display: none;
  }
}
button.panel-toggles[aria-pressed="false"] {
  opacity: 0.55;
}
.library {
  padding: 23px 16px 0;
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 3px 19px;
}
.library-heading h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.library-heading > span {
  font-size: 11.5px;
  color: var(--subtle);
  font-family: var(--mono);
}
.search-field {
  height: 33px;
  border: 1px solid var(--border);
  background: var(--sunken);
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 0 9px;
  color: var(--subtle);
  margin-bottom: 24px;
}
.search-field input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 11.5px;
}
.search-field input::placeholder {
  color: var(--subtle);
}
.search-field kbd {
  border: 1px solid var(--border);
  width: 15px;
  text-align: center;
  border-radius: 6px;
}
.section-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--subtle);
  letter-spacing: 1.15px;
  font-weight: 600;
  margin-bottom: 13px;
}
.section-caption > span {
  letter-spacing: 0.45px;
  font-size: 10px;
  font-weight: 400;
}
.component-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.library-part {
  display: flex;
  align-items: center;
  width: 100%;
  height: 58px;
  padding: 8px 9px;
  text-align: start;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background 0.15s;
}
.library-part:hover {
  background: var(--raised);
}
.library-part.active {
  border-color: var(--primary);
  background: var(--soft);
}
.library-part > kbd {
  margin-inline-start: auto;
  color: var(--subtle);
}
.library-symbol {
  display: grid;
  place-items: center;
  width: 36px;
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}
.library-symbol svg {
  width: 32px;
  height: 26px;
}
.library-symbol .symbol-small {
  display: none;
}
.library-part-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 0;
}
.library-part-name,
.library-part-name small {
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-part-name small {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--subtle);
  margin-top: 5px;
}
.library-probes {
  margin: 24px 4px 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.library-probes > button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 34px;
  font-size: 11.5px;
  color: var(--subtle);
}
.library-probes kbd {
  margin-inline-start: auto;
}
.library-probes button:hover {
  color: var(--link);
}
.library-bottom {
  margin-top: auto;
  padding: 20px 3px 16px;
}
.connection-guide {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 9px 8px;
  color: var(--subtle);
}
.connection-guide > div {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  line-height: 27px;
}
.library-bottom > p {
  font-size: 11.5px;
  color: var(--subtle);
  line-height: 1.7;
  margin: 17px 0;
}
.library-bottom > button {
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--subtle);
}
.library-bottom > button > span {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 4px;
}
.center-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.editor-toolbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.tools {
  display: flex;
  align-items: center;
  gap: 3px;
}
.tools > button {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--subtle);
}
.tools > button > svg {
  width: 15px;
  height: 15px;
}
.tools > button:hover:not(:disabled) {
  background: var(--raised);
  color: var(--link);
}
.tools > button.active {
  background: var(--soft);
  color: var(--link);
  box-shadow: inset 0 0 0 1px var(--tint);
}
.analysis-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.analysis-controls > select {
  border: 0;
  background: transparent;
  color: var(--subtle);
  font-size: 11.5px;
  max-width: 137px;
  padding: 5px 0;
  cursor: pointer;
}
.run-button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  background: var(--strong);
  color: #fff;
  border: 1px solid var(--strong);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--elev-primary);
}
.run-button:hover {
  background: var(--strong-hover);
}
/* White text on it: the light theme's error red in both themes. */
.run-button.running {
  background: #ba1a1a;
  border-color: #ba1a1a;
}
.reset-button {
  display: grid;
  place-items: center;
  color: var(--subtle);
  width: 24px;
  height: 28px;
}
.schematic-region {
  flex: 1;
  min-height: 285px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}
.schematic {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}
.canvas-heading {
  position: absolute;
  inset-inline-start: 22px;
  inset-inline-end: 22px;
  top: 20px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--subtle);
  font-weight: 500;
}
.canvas-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--subtle);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.canvas-chip .status-dot {
  width: 4px;
  height: 4px;
}
.canvas-bottom {
  position: absolute;
  bottom: 12px;
  inset-inline-start: 17px;
  inset-inline-end: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  pointer-events: none;
}
.canvas-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--subtle);
  background: color-mix(in srgb, var(--bg) 91%, transparent);
  padding: 5px 4px;
  max-width: 70%;
}
.canvas-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--elev-2);
  pointer-events: auto;
  height: 30px;
  padding: 0 3px;
}
.canvas-zoom > button {
  display: grid;
  place-items: center;
  width: 23px;
  height: 25px;
  color: var(--subtle);
}
.canvas-zoom > button:hover {
  background: var(--soft);
}
.canvas-zoom > span {
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--subtle);
  min-width: 32px;
  text-align: center;
}
.canvas-zoom > button:last-child {
  border-inline-start: 1px solid var(--border);
  margin-inline-start: 3px;
  padding-inline-start: 6px;
  width: 29px;
}
.wire-line {
  fill: none;
  stroke: var(--subtle);
  stroke-width: 2;
  pointer-events: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 13;
  cursor: pointer;
}
.wire.highlighted .wire-line {
  stroke: var(--emerald);
  stroke-width: 3;
}
.wire.selected .wire-line {
  stroke: var(--primary);
  stroke-width: 3;
}
.bend-handle {
  stroke: var(--primary);
  stroke-width: 1.5;
  fill: var(--surface);
  cursor: move;
}
.component {
  color: var(--muted);
  cursor: grab;
}
.component:active {
  cursor: grabbing;
}
.component-hit {
  fill: var(--paper);
  stroke: transparent;
  stroke-dasharray: 4 3;
  stroke-width: 1.3;
}
.component:hover .component-hit {
  stroke: var(--border);
}
.component.selected .component-hit {
  stroke: var(--primary);
  fill: var(--soft);
}
.component.selected {
  color: var(--link);
}
.component-id {
  font-size: 13px;
  font-family: var(--mono);
  fill: var(--muted);
  font-weight: 600;
}
.component-value {
  font-size: 11.5px;
  fill: var(--subtle);
  font-family: var(--mono);
}
.reference-arrow {
  stroke: var(--subtle);
  stroke-width: 1;
  fill: none;
}
.reference-arrow > text {
  font: italic 9px Georgia;
  fill: var(--subtle);
  stroke: none;
}
.symbol-small {
  font-size: 10px;
  stroke: none;
  fill: currentColor;
}
.pin {
  cursor: crosshair;
}
.pin-dot {
  fill: var(--paper);
  stroke: #7b9fcc;
  stroke-width: 1.5;
}
.pin.connected .pin-dot {
  stroke: var(--subtle);
  fill: var(--subtle);
}
.pin:hover .pin-dot,
.pin.wiring .pin-dot {
  stroke: var(--primary);
  fill: var(--primary);
  r: 5;
}
.junction {
  cursor: move;
}
.junction-dot {
  fill: var(--subtle);
  stroke: var(--paper);
  stroke-width: 1;
}
.junction.selected .junction-dot {
  fill: var(--primary);
}
.net-label {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.8px;
  fill: var(--subtle);
}
.net-label > rect {
  fill: var(--raised);
  stroke: var(--line);
  stroke-width: 0.7;
}
.net-label:hover > rect {
  stroke: var(--tint);
}
.probe-overlay {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
}
.probe-overlay > circle {
  fill: currentColor;
  fill-opacity: 0.13;
  stroke: currentColor;
  stroke-width: 1;
}
.probe-overlay > text {
  fill: currentColor;
  font-weight: 600;
}
.probe-overlay .probe-reading {
  font-size: 11.5px;
  font-weight: 400;
}
.wire-preview {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  fill: none;
  pointer-events: none;
}
.tool-wire,
.tool-junction,
.tool-voltageProbe,
.tool-currentProbe,
.tool-label,
[class*="tool-place-"] {
  cursor: crosshair;
}
.tool-pan {
  cursor: grab;
}
.tool-pan:active {
  cursor: grabbing;
}
.tool-pan .component,
.tool-pan .wire-hit {
  cursor: grab;
}
.empty-canvas {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--subtle);
  pointer-events: none;
  white-space: nowrap;
}
.empty-canvas h2 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
  color: var(--muted);
  margin: 20px 0 12px;
}
.empty-canvas p {
  font-size: 12.5px;
  line-height: 1.8;
}
.scope-region {
  height: 305px;
  flex-shrink: 0;
  min-width: 0;
}
.inspector {
  border-inline-start: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.inspector-tabs {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding: 0 15px;
  gap: 17px;
}
.inspector-tabs > button {
  font-size: 11.5px;
  padding: 0 5px;
  color: var(--subtle);
  position: relative;
}
.inspector-tabs > button[aria-selected="true"] {
  color: var(--link);
}
.inspector-tabs > button[aria-selected="true"]:after {
  content: "";
  position: absolute;
  bottom: -1px;
  inset-inline-start: 2px;
  inset-inline-end: 2px;
  height: 2px;
  background: var(--primary);
}
.inspector-content {
  flex: 1;
  overflow-y: auto;
  padding: 23px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.part-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 27px;
}
.part-symbol {
  width: 42px;
  height: 44px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--link);
}
.part-symbol > svg {
  width: 39px;
  height: 34px;
}
.part-summary h2 {
  font-family: var(--mono);
  font-size: 18px;
  margin: 0 0 4px;
  font-weight: 500;
}
.part-summary > div > span {
  font-size: 11.5px;
  color: var(--subtle);
}
.small-badge {
  margin-inline-start: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 10px;
  padding: 3px 5px;
  color: var(--subtle);
}
.property-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11.5px;
  color: var(--subtle);
}
.field > span {
  line-height: 1.5;
}
.field > input,
.field > select,
.input-unit {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 35px;
  background: var(--surface);
  width: 100%;
}
.field > input,
.field > select {
  padding: 8px 10px;
  font-size: 12.5px;
}
.input-unit {
  display: flex;
  align-items: center;
  padding-inline-end: 11px;
}
.input-unit input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--mono);
  border-radius: 8px;
}
.input-unit > span {
  font-size: 11.5px;
  color: var(--subtle);
}
.field-note {
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--subtle);
  margin: 0 0 10px;
}
.field-note code {
  font-size: 11.5px;
  color: var(--subtle);
}
.property-form .field-note {
  margin: 0;
}
.apply-button {
  width: 100%;
  justify-content: space-between;
  background: var(--sunken);
  border-color: var(--border);
  color: var(--link);
}
.apply-button:hover {
  background: var(--soft);
}
.part-actions {
  display: flex;
  align-items: center;
  margin-top: 16px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
  gap: 9px;
}
.part-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--subtle);
  font-size: 11.5px;
  padding: 6px 3px;
}
.part-actions button:hover {
  color: var(--link);
}
.part-actions button:last-child {
  margin-inline-start: auto;
}
.separated {
  margin-top: 24px;
}
/* A pin's net, and the list that wires it without a pointer. */
.connection {
  display: flex;
  align-items: center;
  gap: 6px;
}
.connect-to {
  flex: none;
  max-width: 8.5rem;
  font-size: 12.5px;
  padding: 3px 4px;
}
/* A part reached by Tab shows it, as a selection does. */
.part:focus {
  outline: none;
}
.part:focus-visible .component-hit {
  stroke: var(--primary);
  stroke-dasharray: none;
  stroke-width: 2.5;
}
.connection-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: start;
  min-height: 34px;
  font-size: 10.5px;
}
.connection-row:hover {
  background: var(--soft);
}
.pin-number {
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  color: var(--subtle);
  font-size: 10px;
}
.connection-row > code {
  margin-inline-start: auto;
  color: var(--subtle);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.current-readout {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  padding: 14px;
}
.current-readout span {
  font-size: 10px;
  color: var(--subtle);
  display: block;
}
.current-readout strong {
  display: block;
  margin-top: 10px;
  font-size: 21px;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--link);
}
.inspector-empty {
  padding: 42px 4px;
  text-align: center;
  color: var(--subtle);
}
.inspector-empty > svg {
  color: var(--subtle);
  stroke-width: 1;
}
.inspector-empty h3 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  margin: 21px 0 12px;
  color: var(--subtle);
}
.inspector-empty p {
  line-height: 1.9;
  font-size: 12.5px;
}
.netlist-link {
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 43px;
  flex-shrink: 0;
  padding: 0 18px;
  color: var(--subtle);
  font-size: 11.5px;
  background: var(--sunken);
}
.netlist-link > span {
  display: flex;
  align-items: center;
  gap: 10px;
}
.netlist-link code {
  font-size: 13px;
}
.netlist-link:hover {
  background: var(--soft);
}
.entity-title {
  font-size: 16px;
  letter-spacing: -0.4px;
  font-weight: 500;
  margin: 20px 0;
}
.model-note {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--subtle);
  margin: 19px 0;
}
.model-note strong {
  font-size: 12.5px;
  color: var(--subtle);
  font-weight: 600;
}
.model-note p {
  margin: 9px 0;
}
.model-note p:last-child {
  margin-bottom: 0;
}
.model-note code {
  font-size: 11.5px;
  display: inline-block;
  margin: 5px 0;
}
.checkbox-field {
  font-size: 12.5px;
  color: var(--subtle);
  display: flex;
  align-items: center;
  gap: 7px;
}
.checkbox-field input {
  accent-color: var(--primary);
}
.danger {
  color: var(--error);
}
.text-button.danger {
  margin-top: 15px;
}
.resource-note {
  border-top: 1px solid var(--line);
  padding-top: 19px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--subtle);
  font-size: 10.5px;
  line-height: 1.8;
}
.resource-note strong {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--subtle);
  font-weight: 400;
}
.readings-table > button,
.readings-table > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 35px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  font-size: 11.5px;
  padding: 5px;
}
.readings-table > button:hover {
  background: var(--soft);
}
.readings-table code {
  color: var(--link);
  font-size: 12.5px;
}
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--error-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
  color: var(--error);
  font-size: 12.5px;
  line-height: 1.6;
  max-height: 150px;
  overflow: auto;
  z-index: 2;
}
.error-banner > span {
  flex: 1;
}
.error-banner strong {
  font-size: 11.5px;
  display: block;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.error-banner button {
  padding: 0;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.simulation-progress {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--sunken);
  color: var(--subtle);
  font-size: 10.5px;
  border-bottom: 1px solid var(--line);
}
.simulation-progress progress {
  flex: 1;
  height: 5px;
  accent-color: var(--primary);
}
.simulation-progress strong {
  font-family: var(--mono);
  font-weight: 400;
  min-width: 30px;
}
.statusbar {
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10.5px;
}
.statusbar > .status-dot {
  width: 4px;
  height: 4px;
}
.status-message {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.document-stats {
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.25px;
}
.document-stats > span {
  margin: 0 5px;
  color: var(--subtle);
}
.revision-label,
.grid-label {
  font-family: var(--mono);
  font-size: 10px;
  border-inline-start: 1px solid var(--line);
  padding-inline-start: 12px;
  margin-inline-start: 6px;
  white-space: nowrap;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 18, 0.55);
  backdrop-filter: blur(5px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 35px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--elev-3);
  width: 850px;
  max-width: 100%;
  max-height: 90dvh;
  padding: 27px 32px 30px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
}
.modal > header button {
  display: grid;
  place-items: center;
  color: var(--subtle);
}
.modal > h1 {
  font-family: var(--display);
  letter-spacing: -1px;
  font-weight: 400;
  font-size: 34px;
  margin: 0 0 13px;
  color: var(--link);
}
.modal-intro {
  font-size: 13px;
  line-height: 1.8;
  color: var(--subtle);
  margin-bottom: 26px;
  max-width: 650px;
}
.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.example-card {
  position: relative;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  background: var(--sunken);
  transition:
    background 0.15s,
    transform 0.15s;
  min-height: 254px;
}
.example-card:hover {
  background: var(--soft);
  transform: translateY(-2px);
}
.example-number {
  font-family: var(--mono);
  color: var(--link);
  font-size: 11.5px;
}
.example-mini {
  position: absolute;
  inset-inline-end: 15px;
  top: 16px;
  width: 46px;
  height: 32px;
  color: var(--link);
}
.example-mini svg {
  width: 100%;
  height: 100%;
}
.example-card h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  color: var(--link);
  letter-spacing: -0.5px;
  margin: 30px 0 12px;
}
.example-card p {
  color: var(--subtle);
  font-size: 11.5px;
  line-height: 1.8;
  flex: 1;
}
.example-open {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--link);
  font-size: 11.5px;
}
.blank-example {
  border-style: dashed;
  background: transparent;
}
.blank-example > svg {
  color: var(--subtle);
  margin-bottom: 0;
}
.blank-example h2 {
  margin-top: 21px;
}
.net-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.net-chips button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  color: var(--link);
  font-size: 12.5px;
}
.net-chips button > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.net-chips button > span.ground-dot {
  background: var(--muted);
}
.net-chips small {
  font-size: 10.5px;
  color: var(--subtle);
  margin-inline-start: 3px;
}
.netlist-code {
  max-height: 42vh;
  overflow: auto;
  border-radius: 12px;
  background: #1e262c;
  color: #88c3de;
  padding: 20px;
  font-size: 11.5px;
  line-height: 1.8;
  scrollbar-width: thin;
  scrollbar-color: #495964 #1e262c;
  margin-bottom: 22px;
}
.netlist-exports {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
/* ngspice (src/ngspice.rs): the netlist as the netlist dialog shows one,
   then the run drawn in the page's own ink. */
.spice-text {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 190px;
  resize: vertical;
  border: 0;
  border-radius: 12px;
  background: #1e262c;
  color: #88c3de;
  padding: 14px 16px;
  font: 12px/1.6 "JetBrains Mono", Consolas, monospace;
}
.spice-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  font-size: 14px;
}
.spice-plot {
  display: block;
  width: 100%;
  height: auto;
  color: inherit;
}
.spice-plot path {
  fill: none;
  stroke-width: 1.6;
}
.spice-plot .grid {
  stroke: currentColor;
  opacity: 0.14;
}
.spice-plot text {
  fill: currentColor;
  opacity: 0.72;
  font-size: 11.5px;
}
.spice-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 6px 0 14px;
  font-size: 13px;
}
.spice-legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-inline-end: 6px;
  vertical-align: middle;
  border-radius: 5px;
}
.spice-values {
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.spice-values caption {
  text-align: start;
  font-weight: 600;
  padding-bottom: 6px;
}
.spice-values td {
  padding: 3px 18px 3px 0;
  font-variant-numeric: tabular-nums;
}
.spice-errors {
  max-height: 160px;
  overflow: auto;
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--error-soft);
  color: var(--error);
  white-space: pre-wrap;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.help-grid h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 23px;
  color: var(--link);
  margin: 0 0 13px;
}
.help-grid p {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--subtle);
}
.help-grid kbd {
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--link);
}
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0;
}
.shortcut-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.shortcut-grid kbd {
  color: var(--link);
}
.shortcut-grid span {
  font-size: 11.5px;
  color: var(--subtle);
}
.mobile-navigation {
  display: none;
}
@media (min-width: 901px) and (max-height: 820px) {
  .schematic-region {
    min-height: 160px;
  }
}
@media (min-width: 1650px) {
  .workbench {
    --library: 235px;
    --inspector: 295px;
  }
  .scope-region {
    height: 330px;
  }
  .editor-toolbar {
    padding: 0 22px;
  }
  .tools {
    gap: 6px;
  }
  .inspector-content {
    padding: 26px;
  }
  .library-part {
    height: 61px;
  }
  .library {
    padding: 25px 20px 0;
  }
}
@media (max-width: 1300px) {
  .workbench {
    --library: 195px;
    --inspector: 250px;
    grid-template-columns: var(--library) minmax(350px, 1fr) var(--inspector);
  }
  .header-description {
    display: none;
  }
  .app-header {
    padding: 0 20px;
  }
  .optional-tool {
    display: none !important;
  }
  .tools {
    gap: 1px;
  }
  .tools > button {
    width: 27px;
  }
  .editor-toolbar {
    padding: 0 10px;
    gap: 5px;
  }
  .analysis-controls {
    gap: 5px;
  }
  .analysis-controls > select {
    font-size: 10.5px;
    max-width: 112px;
  }
  .library {
    padding: 21px 12px 0;
  }
  .library-part {
    gap: 8px;
    padding: 7px 5px;
  }
  .library-part-name {
    font-size: 11.5px;
  }
  .library-part-name small {
    font-size: 10px;
  }
  .inspector-content {
    padding: 21px 16px;
  }
  .inspector-tabs {
    gap: 14px;
  }
  .scope-region {
    height: 300px;
  }
  .project-bar {
    padding: 0 20px;
  }
  .library-probes {
    margin-top: 18px;
  }
  .library-bottom {
    padding-top: 12px;
  }
}
@media (max-width: 1100px) {
  .workbench {
    --library: 170px;
    --inspector: 228px;
    grid-template-columns: var(--library) minmax(320px, 1fr) var(--inspector);
  }
  .library-part > kbd {
    display: none;
  }
  .library-part {
    height: 53px;
  }
  .library-part-name {
    font-size: 10.5px;
  }
  .library-symbol {
    width: 30px;
    height: 31px;
  }
  .library-symbol svg {
    width: 28px;
  }
  .tools > button {
    width: 25px;
  }
  .tools .vertical-rule {
    display: none;
  }
  .analysis-controls > select {
    max-width: 83px;
  }
  .analysis-controls {
    gap: 3px;
  }
  .run-button {
    padding: 7px 9px;
  }
  .reset-button {
    display: none;
  }
  .editor-toolbar {
    padding: 0 7px;
  }
  .inspector-content {
    padding: 21px 13px;
  }
  .inspector-tabs {
    gap: 10px;
    padding: 0 10px;
  }
  .inspector-tabs > button {
    font-size: 10.5px;
  }
  .header-actions .local-badge {
    display: none;
  }
  .library-bottom .connection-guide {
    padding: 7px 5px;
  }
  .connection-guide > div {
    gap: 5px;
    font-size: 10px;
  }
  .project-name input {
    width: 180px;
  }
  .scope-region {
    height: 310px;
  }
  .canvas-heading {
    inset-inline-start: 15px;
    inset-inline-end: 15px;
  }
}
@media (max-width: 900px) {
  .app {
    min-height: 600px;
    height: 100dvh;
    overflow: auto;
  }
  .app-header {
    height: 56px;
    padding: 0 14px;
    gap: 10px;
  }
  .lab-title strong {
    font-size: 15px;
  }
  .header-divider {
    display: none;
  }
  .header-actions {
    gap: 7px;
  }
  .header-actions .subtle span {
    display: none;
  }
  .header-actions .button {
    padding: 8px 10px;
    font-size: 11.5px;
  }
  .project-bar {
    height: 53px;
    padding: 0 15px;
  }
  .version-tag {
    display: none;
  }
  .project-name {
    gap: 7px;
  }
  .project-name input {
    font-size: 13px;
    width: 185px;
  }
  .project-actions {
    gap: 12px;
  }
  .project-actions .text-button {
    font-size: 11.5px;
  }
  .example-button {
    font-size: 11.5px;
  }
  .mobile-navigation {
    display: flex;
    height: 39px;
    flex-shrink: 0;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    background: var(--sunken);
  }
  .mobile-navigation button {
    flex: 1;
    font-size: 11.5px;
    color: var(--subtle);
    border-bottom: 2px solid transparent;
  }
  .mobile-navigation button.active {
    border-color: var(--primary);
    color: var(--link);
    background: var(--soft);
  }
  .workbench {
    display: block;
    min-height: 0;
    flex: 1;
    position: relative;
  }
  .library,
  .inspector {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }
  .center-workspace {
    height: 100%;
    display: flex;
  }
  .mobile-library .library {
    display: flex;
    z-index: 3;
  }
  .mobile-library .center-workspace,
  .mobile-inspector .center-workspace {
    visibility: hidden;
  }
  .mobile-inspector .inspector {
    display: flex;
    z-index: 3;
  }
  .library {
    padding: 20px 25px;
  }
  .library-heading h2 {
    font-size: 16px;
  }
  .component-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .library-part {
    height: 60px;
    border-color: var(--line);
    background: var(--sunken);
    padding: 10px 15px;
    gap: 14px;
  }
  .library-part-name {
    font-size: 13px;
  }
  .library-part-name small {
    font-size: 10.5px;
  }
  .library-symbol {
    width: 40px;
    height: 38px;
  }
  .library-symbol svg {
    width: 35px;
  }
  .library-probes {
    margin: 20px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }
  .library-probes .section-caption {
    width: 100%;
    margin-bottom: 0;
  }
  .library-probes > button {
    width: auto;
    flex: 1;
    gap: 9px;
  }
  .library-probes kbd {
    display: none;
  }
  .library-bottom {
    padding-bottom: 12px;
  }
  .connection-guide {
    display: flex;
    gap: 30px;
    justify-content: center;
  }
  .connection-guide > div {
    font-size: 11.5px;
  }
  .library-bottom > p {
    display: none;
  }
  .library-bottom > button {
    margin-top: 13px;
  }
  .editor-toolbar {
    padding: 0 13px;
    height: 47px;
    gap: 10px;
  }
  .tools > button {
    width: 29px;
  }
  .tools {
    gap: 3px;
  }
  .analysis-controls > select {
    max-width: 135px;
    font-size: 11.5px;
  }
  .analysis-controls {
    gap: 7px;
  }
  .run-button {
    padding: 8px 13px;
  }
  .reset-button {
    display: grid;
  }
  .scope-region {
    height: 300px;
    flex-shrink: 0;
  }
  .inspector-tabs {
    padding: 0 25px;
    gap: 30px;
  }
  .inspector-tabs > button {
    font-size: 13px;
  }
  .inspector-content {
    padding: 24px 28px;
  }
  .property-form {
    max-width: 530px;
  }
  .field,
  .field-note {
    font-size: 12.5px;
  }
  .field > input,
  .field > select,
  .input-unit {
    min-height: 40px;
  }
  .part-summary {
    max-width: 530px;
  }
  .part-actions,
  .connection-row,
  .current-readout {
    max-width: 530px;
  }
  .inspector-empty {
    max-width: 400px;
    margin: auto;
  }
  .statusbar {
    font-size: 10px;
    padding: 0 12px;
    height: 26px;
  }
  .revision-label,
  .grid-label {
    display: none;
  }
  .modal {
    padding: 22px;
    max-height: 93dvh;
  }
  .modal-backdrop {
    padding: 20px;
  }
  .modal h1 {
    font-size: 29px;
  }
  .help-grid {
    gap: 22px;
  }
  .example-grid {
    gap: 10px;
  }
  .example-card {
    padding: 14px;
  }
  .example-card h2 {
    font-size: 20px;
  }
  .scope-region .scope {
    min-height: 0;
  }
  .schematic-region {
    min-height: 260px;
  }
}
@media (max-width: 600px) {
  .app {
    min-height: 870px;
    height: auto;
    overflow: visible;
  }
  .app-header {
    padding: 0 12px;
  }
  .brand span {
    display: none;
  }
  .header-actions .button {
    padding: 8px;
  }
  .header-actions .button > span {
    display: none;
  }
  .header-actions .subtle {
    padding: 8px;
  }
  .project-bar {
    padding: 0 12px;
    gap: 6px;
  }
  .project-name input {
    max-width: 37vw;
    font-size: 12.5px;
  }
  .project-icon {
    display: none;
  }
  .project-actions {
    gap: 12px;
  }
  .project-actions .text-button > span {
    display: none;
  }
  .project-actions .vertical-rule {
    display: none;
  }
  .example-button {
    font-size: 10.5px;
    gap: 5px;
  }
  .example-button svg {
    width: 13px;
  }
  .workbench {
    height: 830px;
    flex: none;
  }
  .center-workspace {
    height: 100%;
  }
  .editor-toolbar {
    height: auto;
    min-height: 78px;
    flex-wrap: wrap;
    gap: 5px;
    padding: 7px 10px;
  }
  .tools {
    flex: 1;
    gap: 6px;
    justify-content: space-between;
  }
  .tools > button {
    width: 28px;
    height: 28px;
  }
  .tools > button > svg {
    width: 15px;
    height: 15px;
  }
  .analysis-controls {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
  }
  .analysis-controls > select {
    margin-inline-end: auto;
    max-width: 180px;
  }
  .run-button {
    padding: 6px 18px;
  }
  .reset-button {
    display: grid;
  }
  .schematic-region {
    flex: 1;
    min-height: 290px;
  }
  .scope-region {
    height: 451px;
  }
  .canvas-heading {
    top: 14px;
    inset-inline-start: 13px;
    inset-inline-end: 13px;
  }
  .canvas-chip {
    font-size: 9px;
    padding: 4px 6px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .canvas-hint {
    font-size: 10px;
    max-width: 60%;
    gap: 5px;
  }
  .canvas-bottom {
    inset-inline-start: 10px;
    inset-inline-end: 10px;
    bottom: 10px;
    gap: 6px;
  }
  .canvas-zoom {
    height: 27px;
  }
  .canvas-zoom > button {
    width: 21px;
    height: 22px;
  }
  .canvas-zoom > span {
    font-size: 10px;
    min-width: 28px;
  }
  .empty-canvas h2 {
    font-size: 22px;
  }
  .empty-canvas p {
    font-size: 11.5px;
  }
  .document-stats {
    display: none;
  }
  .statusbar {
    position: relative;
    height: 28px;
  }
  .modal-backdrop {
    padding: 10px;
  }
  .modal {
    padding: 17px;
    border-radius: 12px;
    max-height: 95dvh;
  }
  .modal > header {
    margin-bottom: 19px;
  }
  .modal h1 {
    font-size: 27px;
  }
  .modal-intro {
    font-size: 12.5px;
    margin-bottom: 20px;
  }
  .example-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .example-card {
    padding: 13px;
    min-height: 244px;
  }
  .example-card h2 {
    font-size: 19px;
  }
  .example-card p {
    font-size: 10.5px;
  }
  .example-mini {
    width: 35px;
    inset-inline-end: 10px;
  }
  .example-open {
    font-size: 10.5px;
  }
  .help-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .shortcut-grid {
    grid-template-columns: 1fr 1fr;
  }
  .connection-guide {
    gap: 12px;
  }
  .connection-guide > div {
    font-size: 10px;
    gap: 7px;
  }
  .component-list {
    gap: 8px;
  }
  .library {
    padding: 22px 15px;
  }
  .library-part {
    gap: 9px;
    padding: 8px;
    height: 66px;
  }
  .library-part-name {
    font-size: 11.5px;
  }
  .library-part-name small {
    font-size: 10px;
  }
  .library-symbol {
    width: 34px;
    height: 34px;
  }
  .library-probes > button {
    font-size: 10.5px;
  }
  .library-probes {
    gap: 8px;
  }
  .inspector-tabs {
    gap: 25px;
  }
  .inspector-content {
    padding: 23px;
  }
  .empty-canvas {
    white-space: normal;
    width: 90%;
  }
}

/* ── Dr.Machine: Arabic / RTL ─────────────────────────────────────────────
   The UI mirrors (logical properties above), but circuit geometry does not:
   schematic coordinates and the oscilloscope's time axis run left→right in
   every language, so every SVG and the plot overlays stay LTR. */
svg,
.scope-plot {
  direction: ltr;
}
/* Values carry their own direction: "-5 V", "4.7k", "R1:0" and JSON paths must
   not be reordered inside an RTL row; Arabic names typed by the user still are. */
input,
code,
output,
kbd,
td,
.readings-table span,
.current-readout strong,
.resource-note strong,
.scope-channel-name {
  unicode-bidi: plaintext;
}
/* Arabic pages read in Alexandria throughout, headings included (the brand's rule). */
.app[dir="rtl"],
.app[dir="rtl"] .scope {
  --font: "Alexandria", "Inter", "Segoe UI", Tahoma, sans-serif;
  --display: "Alexandria", "Segoe UI", sans-serif;
  font-family: var(--font);
}
/* Letter-spacing breaks Arabic letter joining. */
.app[dir="rtl"] * {
  letter-spacing: normal !important;
}
/* Directional icons (back, undo/redo, "apply ›") point the other way in RTL. */
.app[dir="rtl"] .rtl-flip {
  transform: scaleX(-1);
}
/* Arabic glyphs need more size than Latin ones: no caption below 12px. */
.app[dir="rtl"]
  :is(
    .version-tag,
    .section-caption,
    .section-caption > span,
    .library-part-name,
    .library-part-name small,
    .connection-guide > div,
    .library-bottom > button,
    .library-probes > button,
    .eyebrow,
    .canvas-chip,
    .canvas-hint,
    .connection-row,
    .current-readout span,
    .resource-note,
    .simulation-progress,
    .statusbar,
    .document-stats,
    .net-chips small,
    .analysis-controls > select,
    .inspector-tabs > button,
    .example-button,
    .example-card p,
    .example-open,
    .scope-no-probes,
    .scope-stale-overlay,
    .scope-readout-heading,
    .scope-readout-heading > span:last-child,
    .scope-outside,
    .scope-delta,
    .scope-measurements thead th,
    .scope-table-note,
    .scope-capture-info
  ) {
  font-size: 12px;
}
.app[dir="rtl"] .lab-title strong {
  font-size: 17px;
}
.attribution a {
  color: var(--link);
}
/* Text overlays sit inside the LTR plot but are sentences in the UI language. */
.app[dir="rtl"] :is(.scope-empty, .scope-stale-overlay) {
  direction: rtl;
}
/* Monospace faces have no Arabic glyphs; fall back to the brand face, not a system one. */
.app[dir="rtl"] :is(kbd, code) {
  font-family: var(--mono);
}

/* ── Dr.Machine: language and theme controls (as in the site's navbar) ── */
.header-actions .lang-switch {
  gap: 5px;
  text-decoration: none;
}
.header-actions .lang-switch > .lang-code,
.header-actions .standard-switch > .lang-code {
  display: inline; /* stays visible where other button labels collapse */
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}
.header-actions .theme-toggle {
  padding-inline: 8px;
}
/* IEC / ANSI: a four-character label must not resize the button when it
   changes to a three-character one. */
.header-actions .standard-switch > .lang-code {
  display: inline-block;
  min-width: 4ch;
  text-align: center;
}
@media (max-width: 600px) {
  /* Two more header controls: tighter spacing keeps the title on one line. */
  .header-actions {
    gap: 4px;
  }
  .header-actions .button,
  .header-actions .subtle {
    padding: 7px;
  }
}

/* ── Dr.Machine: school bench ── */
/* A meter's letter: large, filled, upright (the group counter-rotates it). */
.symbol-letter {
  font-size: 17px;
  font-weight: 700;
}
/* A meter's reading reads like a display, not like a part's rating. */
.component-value.meter-reading {
  font-weight: 700;
  opacity: 1;
}
/* A lit lamp: the halo and a warm core under the symbol's strokes. */
.lamp-glow {
  transition: opacity 0.25s ease;
}
.lamp-core {
  fill: #fff3b0;
}
/* Touch screens: a fingertip is wider than a cursor, so a pin or a junction
   takes a larger target there. The dot drawn keeps its size. */
@media (pointer: coarse) {
  .pin-hit,
  .junction-hit {
    r: 16;
  }
}
/* The first visit's welcome. */
.welcome-steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
  padding: 0;
}
.welcome-steps li {
  counter-increment: step;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.welcome-steps h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
  color: var(--link);
  margin: 0 0 8px;
}
.welcome-steps h2::before {
  content: counter(step) " ";
  color: var(--primary);
}
.welcome-steps p {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--subtle);
  margin: 0;
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 16px;
}
.button.primary {
  background: var(--strong);
  border-color: var(--strong);
  color: #fff;
}
.button.primary:hover {
  background: var(--strong-hover);
}
@media (max-width: 600px) {
  .welcome-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .welcome-actions .button {
    flex: 1 1 100%;
  }
}
/* A phone's header must fit its width: on a 375 px screen the name, the six
   buttons and the back link once came to 419 px and the page scrolled
   sideways. The name shrinks to an ellipsis (.lab-title), the lockup keeps
   only its gear below 600 px, and below 440 px the spacing tightens. */
@media (max-width: 440px) {
  .app-header {
    padding: 0 8px;
    gap: 6px;
  }
  .back-link {
    padding-inline: 7px;
  }
}
/* A switch's OPEN / CLOSED is a word: in the UI's face, whose Arabic joins
   (the value line's monospace face has no Arabic letters). */
.component-value.switch-word {
  font-family: inherit;
  font-size: 12.5px;
}
/* A switch is flipped by clicking it. */
.tool-select .component.switch .component-hit {
  cursor: pointer;
}
.switch-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--subtle);
}
.switch-state.closed {
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
}
/* The scope region holds the oscilloscope and the Bode plot; the analysis
   mode shows one. The slot adds no box of its own. */
.instrument-slot {
  display: contents;
}
.instrument-slot[hidden] {
  display: none;
}
/* An LED past the current a real one survives. */
.component-value.led-over {
  fill: var(--error);
  font-weight: 700;
}
/* Current on the wires: a dot every 14 units, travelling one spacing per
   animation period; the direction is set per wire from the current's sign. */
.flow {
  fill: none;
  stroke: #f2b200;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0.1 14;
  animation: flow linear infinite;
}
@keyframes flow {
  to {
    stroke-dashoffset: -14.1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .flow {
    animation: none;
  }
}
/* A part's value on a slider. */
.slider-field > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.slider-field output {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  direction: ltr;
}
.slider-field input[type="range"] {
  width: 100%;
  accent-color: var(--strong);
}
/* A voltage probe's reference point: a small minus in the probe's colour. */
.probe-reference circle {
  fill: var(--paper); /* the canvas */
  stroke: currentColor;
  stroke-width: 1.4;
}
.probe-reference text {
  fill: currentColor;
  font-size: 12.5px;
  font-weight: 700;
}
/* An exercise: its task above the schematic, and the lab's mark. */
.exercise-banner {
  flex-shrink: 0;
  display: grid;
  gap: 6px;
  padding: 12px 18px 13px;
  background: var(--soft);
  border-bottom: 1px solid var(--tint);
  max-height: 40vh;
  overflow-y: auto;
}
.exercise-banner[hidden] {
  display: none;
}
.exercise-banner.solved {
  background: var(--success-soft);
  border-bottom-color: color-mix(in srgb, var(--success) 35%, transparent);
}
.exercise-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.exercise-eyebrow {
  color: var(--link);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.8px;
}
.exercise-solved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11.5px;
  font-weight: 650;
}
.exercise-close {
  margin-inline-start: auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--subtle);
}
.exercise-close:hover {
  background: var(--soft);
}
.exercise-task {
  margin: 0;
  max-width: 72ch;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}
.exercise-target {
  margin: 0;
  color: var(--subtle);
  font-size: 12.5px;
}
.exercise-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 2px;
}
.exercise-verdict {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
.exercise-verdict.right {
  color: var(--success);
}
.exercise-verdict.wrong {
  color: var(--error);
}
.exercise-hint {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
/* The examples dialog, a group at a time. */
.example-group {
  margin: 4px 0 10px;
  color: var(--subtle);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.4px;
}
@media (max-width: 600px) {
  .exercise-banner {
    padding: 10px 14px 11px;
  }
  .exercise-task {
    font-size: 13px;
  }
}
/* "My circuits": the account's shelf. */
.projects .busy {
  opacity: 0.6;
}
.project-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 18px;
}
.project-save [role="status"] {
  color: var(--success);
  font-size: 13px;
}
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.project-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.project-list li > span {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.project-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.project-list small {
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
  justify-self: start;
}
.project-list .text-button.danger {
  margin-top: 0;
}
.project-list li.here strong::after {
  content: " •";
  color: var(--strong);
}
/* The selection box (drag across empty space with the select tool). */
.marquee {
  fill: var(--soft);
  stroke: var(--primary);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
