@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #11151b;
  --panel: #1b2129;
  --raised: #242c36;
  --inset: #111820;
  --screen: #0c141c;
  --line: #323e4b;
  --grid: #1f303e;
  --text: #e4eaf0;
  --muted: #a1aebd;
  --accent: #6ce7ba;
  --blue: #7abaff;
  --amber: #f5ce7a;
  --red: #ff9f9b;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    13px/1.5 "DM Sans",
    system-ui,
    sans-serif;
}
body.light {
  color-scheme: light;
  --bg: #e7ebee;
  --panel: #f8fafb;
  --raised: #eaf0f3;
  --inset: #eef2f5;
  --screen: #f3f8fa;
  --line: #c4d0d9;
  --grid: #d7e1e7;
  --text: #1a2d3e;
  --muted: #526578;
  --accent: #087550;
  --blue: #1b61ad;
  --amber: #875900;
  --red: #b52f30;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: var(--raised);
  padding: 9px 13px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  background: var(--inset);
  border-color: var(--muted);
}
button:disabled {
  opacity: 0.38;
  cursor: default;
}
button.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}
button.primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}
a {
  color: var(--muted);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 21px;
  letter-spacing: -0.5px;
  font-weight: 600;
}
h2 {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}
h3 {
  font-size: 10px;
  font-weight: 500;
}
.topbar {
  height: 64px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  gap: 36px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}
.brand-mark {
  font-size: 35px;
  color: var(--accent);
}
.brand small {
  display: block;
  font: 8px var(--mono);
  letter-spacing: 0.13em;
  color: var(--muted);
  margin-top: 2px;
}
.bench-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 9px var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.divider {
  color: var(--line);
  margin: 0 4px;
}
.status-dot,
.channel-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--accent);
  border-radius: 50%;
}
.rx-dot {
  background: var(--blue);
}
.topbar nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 11px;
}
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 17px;
}
main {
  max-width: 1760px;
  margin: auto;
  padding: 0 24px 20px;
}
.bench-toolbar {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 19px 0;
}
.bench-toolbar p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.scenario {
  margin-left: auto;
  min-width: 240px;
}
.scenario > span {
  font: 8px var(--mono);
  letter-spacing: 0.1em;
}
.scenario select {
  margin-top: 4px;
}
.acquisition-actions {
  display: flex;
  gap: 7px;
}
.acquisition-actions .primary {
  padding: 11px 17px;
}
.acquisition-actions .primary span {
  margin-right: 6px;
  font-size: 9px;
}
.bench-layout {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.sidebar {
  display: grid;
  gap: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  min-width: 0;
}
.panel-head {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--raised), var(--panel));
  min-height: 43px;
}
.module-number {
  color: var(--muted);
  font: 9px var(--mono);
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.port-tag {
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.panel-body {
  padding: 15px;
}
label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.controls label {
  margin-bottom: 18px;
}
select,
input[type="number"],
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  background: var(--inset);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 9px;
  margin-top: 6px;
  font-size: 12px;
}
input[type="number"],
output {
  font-family: var(--mono);
}
input:disabled {
  opacity: 0.6;
}
input[type="range"] {
  display: block;
  width: 100%;
  accent-color: var(--accent);
  height: 16px;
  margin: 10px 0 0;
  cursor: pointer;
}
output,
.unit {
  float: right;
  color: var(--accent);
}
.unit {
  color: var(--muted);
  font: 9px var(--mono);
}
.range-scale {
  display: flex;
  justify-content: space-between;
  font: 8px var(--mono);
  color: var(--muted);
  margin-top: 4px;
}
.control-divider {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font: 8px var(--mono);
  letter-spacing: 0.04em;
  padding: 16px 0 14px;
  margin-top: 3px;
  border-top: 1px solid var(--line);
}
.control-divider span:last-child {
  color: var(--accent);
}
fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 10px;
  margin: 0 0 16px;
}
legend {
  font: 8px var(--mono);
  color: var(--accent);
  padding: 0 4px;
}
fieldset .hint {
  margin-top: 9px;
}
.derived-value {
  font: 10px/1.6 var(--mono);
  color: var(--accent);
}
.hint {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
}
.editor-file {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  font: 9px var(--mono);
  color: var(--muted);
}
.editor-file > span:last-child {
  margin-left: auto;
  font-size: 7px;
}
textarea {
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
  padding: 12px;
  font: 11px/1.8 var(--mono);
  resize: vertical;
  min-height: 100px;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 8px var(--mono);
  padding: 8px 12px;
  color: var(--muted);
}
.firmware > .hint {
  padding: 0 12px 12px;
}
kbd {
  font: 8px var(--mono);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 4px;
}
.reset-button {
  text-align: center;
  background: transparent;
  padding: 11px;
}
.sidebar-note {
  font: 8px/1.8 var(--mono);
  color: var(--muted);
  text-align: center;
}
.workspace {
  min-width: 0;
  display: grid;
  gap: 14px;
}
.measurement-rack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.measurement-rack article {
  padding: 12px 17px;
  min-width: 0;
}
.measurement-rack article + article {
  border-left: 1px solid var(--line);
}
.meter-label {
  display: block;
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: 0.04em;
}
.measurement-rack strong {
  display: block;
  font: 25px/1.5 var(--mono);
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.meter-detail {
  display: block;
  color: var(--muted);
  font-size: 9px;
}
.link-bench {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  background-image: radial-gradient(var(--line) 0.6px, transparent 0.6px);
  background-size: 9px 9px;
}
.board {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #173d35;
  border: 1px solid #3d6e5d;
  border-radius: 5px;
  box-shadow: inset 0 0 0 4px #ffffff04;
  color: #dff9ef;
  position: relative;
}
.rx-board {
  background: #203447;
  border-color: #456480;
}
.board-chip {
  display: grid;
  place-items: center;
  background: #182024;
  border: 2px solid #89958e;
  border-radius: 2px;
  width: 34px;
  height: 34px;
  font: 14px var(--mono);
}
.board strong {
  font: 10px var(--mono);
  display: block;
}
.board strong span {
  font-size: 8px;
  color: #96cbb5;
  margin-left: 7px;
}
.rx-board strong span {
  color: #9fcbf5;
}
.board small {
  display: block;
  font-size: 8px;
  color: #b2c6c3;
  margin-top: 4px;
  white-space: nowrap;
}
.board-led {
  width: 4px;
  height: 4px;
  background: #8ae8b8;
  border-radius: 50%;
  position: absolute;
  right: 6px;
  top: 6px;
}
.air {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
}
.signal-path {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  font: 7px var(--mono);
  letter-spacing: 0.08em;
}
.signal-path i {
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
  flex: 1;
}
.signal-path b {
  color: var(--accent);
}
.air strong {
  font-size: 9px;
  font-weight: 500;
}
#error {
  padding: 12px 15px;
  color: var(--red);
  background: var(--panel);
  border: 1px solid var(--red);
  border-radius: 5px;
}
.acq-state {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 9px var(--mono);
  color: var(--muted);
}
.status-pill {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 8px;
  padding: 3px 7px;
}
.status-pill[data-state="ok"] {
  color: var(--accent);
  border-color: var(--accent);
}
.status-pill[data-state="pending"] {
  color: var(--amber);
  border-color: var(--amber);
}
.status-pill[data-state="error"] {
  color: var(--red);
  border-color: var(--red);
}
.acquisition-caption {
  padding: 9px 15px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font: 9px var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.wave-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--inset);
  border-bottom: 1px solid var(--line);
}
.wave-tools > label {
  min-width: 110px;
  flex: 1;
  font: 8px var(--mono);
  letter-spacing: 0.04em;
}
.wave-tools select {
  font: 10px var(--mono);
  padding: 6px 7px;
  margin-top: 5px;
  height: 30px;
}
.wave-tools .check {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  font:
    9px "DM Sans",
    system-ui,
    sans-serif;
  letter-spacing: 0;
}
.wave-tools input[type="checkbox"] {
  width: auto;
  accent-color: var(--blue);
  margin: 0;
}
.symbol-control {
  min-width: 145px;
  flex: 1;
}
.symbol-control > label {
  font: 8px var(--mono);
}
.symbol-control > div {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
}
.symbol-control button {
  padding: 0;
  width: 24px;
  height: 26px;
  font-size: 17px;
}
.symbol-control input {
  margin: 0;
  flex: 1;
  width: 50px;
}
.plots {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
  padding: 14px 14px 0;
}
figure {
  margin: 0;
  min-width: 0;
}
.instrument-screen {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--screen);
  overflow: hidden;
}
figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  padding: 9px 10px;
  background: var(--inset);
  border-bottom: 1px solid var(--line);
  min-height: 34px;
}
.channel-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font: 8px var(--mono);
  color: var(--accent);
  white-space: nowrap;
}
.channel-label i {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}
.channel-rx {
  color: var(--blue);
}
.screen-kind {
  margin-left: auto;
  font: 7px var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
canvas {
  display: block;
  width: 100%;
  height: 250px;
  background: var(--screen);
}
.legend {
  margin: 0;
  padding: 7px 10px;
  font: 8px/1.6 var(--mono);
  color: var(--muted);
  border-top: 1px solid var(--grid);
  min-height: 28px;
}
.display-help {
  font-size: 10px;
  color: var(--muted);
  padding: 10px 15px;
}
summary {
  cursor: pointer;
}
.display-help p {
  margin-top: 7px;
  max-width: 100ch;
}
.lora-summary {
  padding: 10px 15px 0;
  font: 9px/1.7 var(--mono);
  color: var(--muted);
  border-top: 1px solid var(--line);
}
#lora-inspection .plots {
  padding-bottom: 14px;
}
.checks {
  display: flex;
  gap: 12px;
  font: 8px var(--mono);
  color: var(--muted);
}
.checks b {
  font-size: 9px;
  margin-left: 4px;
}
[data-state="ok"] {
  color: var(--accent);
}
[data-state="error"] {
  color: var(--red);
}
.signal-chain {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 8px var(--mono);
  overflow-x: auto;
  white-space: nowrap;
}
.signal-chain span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.signal-chain i {
  color: var(--accent);
  font-style: normal;
}
.packet-body {
  padding: 12px 15px;
}
.packet-body > p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}
#bytes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
}
#bytes button {
  font: 9px var(--mono);
  padding: 6px 7px;
  background: var(--inset);
  border-radius: 3px;
}
#bytes button.bad {
  color: var(--red);
  border-color: var(--red);
}
#bytes button.selected {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.logs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.terminals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}
.terminals > div {
  background: var(--panel);
  min-width: 0;
}
.terminals h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  color: var(--muted);
  font: 8px var(--mono);
}
pre {
  margin: 0;
  padding: 0 12px 12px;
  height: 125px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 9px/1.9 var(--mono);
  color: var(--text);
}
.history-scroll {
  overflow: auto;
  max-height: 177px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font: 9px var(--mono);
}
th {
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
  background: var(--inset);
  position: sticky;
  top: 0;
}
th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.empty-history {
  color: var(--muted);
  text-align: center;
  padding: 35px 12px;
}
.reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.reference summary {
  padding: 13px 15px;
  font-size: 11px;
}
.reference summary span {
  float: right;
  font-size: 9px;
  color: var(--muted);
}
.reference > p,
.reference > ol {
  margin: 12px 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}
.reference ol {
  padding-left: 15px;
}
.reference li {
  margin-bottom: 9px;
}
.reference a {
  text-decoration: underline;
}
footer {
  display: flex;
  align-items: center;
  gap: 7px;
  font: 8px var(--mono);
  color: var(--muted);
  padding: 8px 0;
}
footer > span:last-child {
  margin-left: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  z-index: 10;
  left: 15px;
  top: -70px;
  padding: 12px;
  background: var(--accent);
  color: var(--bg);
}
.skip-link:focus {
  top: 10px;
}
@media (min-width: 1250px) {
  .sidebar {
    position: sticky;
    top: 16px;
  }
}
@media (max-width: 1150px) {
  .bench-identity {
    display: none;
  }
  .bench-toolbar {
    gap: 18px;
  }
  .bench-layout {
    grid-template-columns: 235px minmax(0, 1fr);
  }
  .board {
    padding: 10px;
    gap: 8px;
  }
  .link-bench {
    gap: 10px;
    padding: 12px;
  }
  .board-chip {
    display: none;
  }
  .measurement-rack article {
    padding: 11px;
  }
  .meter-label {
    font-size: 7px;
  }
  .measurement-rack strong {
    font-size: 21px;
  }
  .screen-kind {
    display: none;
  }
  .logs-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  main {
    padding: 0 14px 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .bench-toolbar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .scenario {
    min-width: 210px;
  }
  .acquisition-actions {
    width: 100%;
  }
  .acquisition-actions .primary {
    flex: 1;
  }
  .plots {
    grid-template-columns: 1fr;
  }
  .measurement-rack {
    grid-template-columns: 1fr 1fr;
  }
  .measurement-rack article:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .measurement-rack article:nth-child(4) {
    border-top: 1px solid var(--line);
  }
  .reference-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .topbar {
    gap: 10px;
    height: 58px;
  }
  .topbar nav {
    gap: 12px;
    font-size: 10px;
  }
  .brand {
    font-size: 13px;
    gap: 6px;
  }
  .brand-mark {
    font-size: 27px;
  }
  .bench-toolbar h1 {
    font-size: 18px;
  }
  .scenario {
    width: 100%;
    margin-left: 0;
  }
  .scenario select {
    width: 100%;
  }
  .bench-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .controls .panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
  }
  #lora-controls,
  .control-divider,
  .controls .hint {
    grid-column: 1/-1;
  }
  .sidebar-note {
    display: none;
  }
  .firmware textarea {
    min-height: 75px;
  }
  .panel-head {
    padding: 11px 12px;
  }
  .board small {
    font-size: 7px;
  }
  .board strong {
    font-size: 8px;
  }
  .board strong span {
    margin-left: 3px;
  }
  .signal-path {
    font-size: 6px;
    gap: 4px;
  }
  .air {
    font-size: 8px;
  }
  .air strong {
    font-size: 8px;
  }
  .link-bench {
    gap: 8px;
    padding: 10px;
  }
  .board {
    padding: 10px 8px;
  }
  .acquisition-caption {
    display: block;
    line-height: 1.7;
  }
  .acquisition-caption .port-tag {
    display: none;
  }
  .wave-tools {
    gap: 12px;
  }
  .wave-tools > label {
    min-width: 110px;
  }
  .symbol-control {
    flex-basis: 100%;
  }
  .wave-tools .check {
    flex-basis: 100%;
  }
  .plots {
    padding: 10px 10px 0;
  }
  canvas {
    height: 245px;
  }
  figcaption {
    font-size: 9px;
  }
  .checks {
    gap: 7px;
    font-size: 7px;
  }
  .reference summary span {
    display: none;
  }
  footer {
    flex-wrap: wrap;
    font-size: 7px;
  }
  footer > span:last-child {
    margin-left: 0;
    width: 100%;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.12s,
      border-color 0.12s;
  }
}
.rx-board[data-state="error"] {
  border-color: var(--red);
}
@media (min-width: 901px) {
  .bench-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg);
  }
  #instruments {
    scroll-margin-top: 106px;
  }
}
@media (min-width: 1250px) {
  .sidebar {
    top: 110px;
    max-height: calc(100vh - 126px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
}
/* Editable, independent setup()/loop() firmware for each virtual board. */
.acquisition-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.firmware-rack > summary {
  padding: 12px 15px;
  font-weight: 600;
  font-size: 12px;
}
.firmware-rack > summary > .port-tag {
  float: right;
}
.firmware-toolbar {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.firmware-toolbar > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.firmware-toolbar input {
  width: 90px;
  margin: 0;
  padding: 6px;
}
#firmware-status {
  color: var(--muted);
  font: 9px var(--mono);
  margin-left: auto;
}
.firmware-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.firmware-board {
  min-width: 0;
}
.firmware-board + .firmware-board {
  border-left: 1px solid var(--line);
}
.firmware-board .editor-file {
  padding: 10px 12px;
}
.firmware-board .editor-file h3 {
  font: 9px var(--mono);
}
.firmware-board .editor-file button {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 9px;
}
.firmware-board textarea {
  height: 355px;
  min-height: 200px;
  font: 11px/1.75 var(--mono);
  white-space: pre;
  tab-size: 2;
  padding: 12px;
}
.firmware-rack > .hint {
  padding: 8px 14px;
}
.firmware-exercise {
  background: var(--inset);
  border-top: 1px solid var(--line);
}
code {
  font-family: var(--mono);
}
.crc-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.crc-values article {
  padding: 12px 15px;
}
.crc-values article + article {
  border-left: 1px solid var(--line);
}
.crc-values span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.crc-values strong {
  display: block;
  margin-top: 5px;
  font: 17px var(--mono);
}
.crc-inspector > .hint {
  padding: 10px 15px;
}
.crc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
}
.crc-toolbar label {
  min-width: 140px;
}
.crc-toolbar .hint {
  flex: 1;
  min-width: 180px;
}
.crc-scroll {
  overflow-x: auto;
}
#run-loops[data-state="running"] {
  color: var(--accent);
  border-color: var(--accent);
}
@media (max-width: 1100px) {
  .bench-toolbar {
    flex-wrap: wrap;
  }
  .acquisition-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
@media (max-width: 720px) {
  .firmware-editors {
    grid-template-columns: 1fr;
  }
  .firmware-board + .firmware-board {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .firmware-toolbar {
    gap: 10px;
  }
  #firmware-status {
    margin-left: 0;
  }
  .firmware-rack > summary > .port-tag {
    display: none;
  }
  .crc-values {
    grid-template-columns: 1fr 1fr;
  }
  .crc-values article:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .crc-values article:nth-child(4) {
    border-top: 1px solid var(--line);
  }
  .acquisition-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .acquisition-actions button {
    min-width: 0;
    white-space: normal;
  }
  .acquisition-actions .primary {
    grid-column: 1/-1;
  }
}
.firmware-board .editor-file button + button {
  margin-left: 0;
}

/* Textarea retains editing/accessibility; the inert layer paints its text. */
.code-editor {
  position: relative;
  margin-top: 6px;
  background: var(--inset);
  border-radius: 4px;
  --syntax-keyword: #bfa5ff;
  --syntax-string: #6ce7ba;
  --syntax-number: #f5ce7a;
  --syntax-comment: #a1aebd;
}
body.light .code-editor {
  --syntax-keyword: #6833a6;
  --syntax-string: #087550;
  --syntax-number: #875900;
  --syntax-comment: #526578;
}
.firmware-board .code-editor textarea,
.code-editor-highlight {
  margin: 0;
  padding: 12px;
  border: 1px solid transparent;
  font: 11px/1.75 var(--mono);
  letter-spacing: normal;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}
.code-editor-highlight {
  position: absolute;
  inset: 0;
  height: auto;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
  background: transparent;
}
.firmware-board .code-editor textarea {
  position: relative;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  border-color: var(--line);
  resize: vertical;
}
.code-editor textarea::selection { background: #547bb577; color: transparent; }
.syntax-keyword { color: var(--syntax-keyword); }
.syntax-string { color: var(--syntax-string); }
.syntax-number { color: var(--syntax-number); }
.syntax-comment { color: var(--syntax-comment); }
@media (forced-colors: active) {
  .code-editor-highlight { display: none; }
  .firmware-board .code-editor textarea { color: CanvasText; caret-color: CanvasText; }
}

.oled-module { margin: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--screen); }
.oled-module figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font: 10px var(--mono); margin-bottom: 12px; }
.oled-module .oled-screen { width: calc(23ch + 12px); max-width: 100%; height: auto; min-height: 10em; margin: 0 auto; padding: 1em 1ch; border: 6px solid #080d12; border-radius: 5px; background: #02121a; color: #8deaff; font: clamp(10px, 1.3vw, 16px)/1.25 ui-monospace, monospace; white-space: pre; overflow: hidden; box-shadow: inset 0 0 18px #123546; }
.oled-module p { margin: 12px 0 0; font-size: 11px; color: var(--muted); }
.oled-module a { color: var(--blue); }

/* ---------- Firmware IDE: gutter, linha ativa, status, testes ---------- */
.firmware-editors[data-view="A"],
.firmware-editors[data-view="B"] { grid-template-columns: 1fr; }
.firmware-editors[data-view="A"] > .firmware-board:nth-child(2),
.firmware-editors[data-view="B"] > .firmware-board:nth-child(1) { display: none; }
.firmware-editors[data-view="B"] > .firmware-board + .firmware-board { border-left: 0; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.view-switch button { border: 0; border-radius: 0; padding: 6px 11px; font: 600 10px var(--mono); background: transparent; color: var(--muted); }
.view-switch button + button { border-left: 1px solid var(--line); }
.view-switch button[aria-pressed="true"] { background: var(--raised); color: var(--accent); }
.test-button { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }

.code-editor { display: flex; margin: 0; border: 1px solid var(--line); border-radius: 0; overflow: hidden; }
.code-editor.has-error { border-color: color-mix(in srgb, var(--red) 70%, var(--line)); }
.code-gutter { position: relative; flex: none; width: 42px; overflow: hidden; background: color-mix(in srgb, var(--inset) 70%, var(--bg)); border-right: 1px solid var(--line); user-select: none; }
.code-gutter-numbers { position: absolute; top: 0; left: 0; right: 0; padding: 12px 8px 12px 0; text-align: right; font: 12px/1.75 var(--mono); color: color-mix(in srgb, var(--muted) 60%, transparent); will-change: transform; }
.code-gutter-numbers .active { color: var(--text); }
.code-gutter-numbers .error { color: var(--red); font-weight: 700; }
.code-area { position: relative; flex: 1; min-width: 0; }
.code-line-band { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; background: color-mix(in srgb, var(--text) 5%, transparent); }
.code-error-band { background: color-mix(in srgb, var(--red) 16%, transparent); box-shadow: inset 3px 0 0 var(--red); }
.firmware-board .code-editor textarea,
.code-editor-highlight { font: 12px/1.75 var(--mono); padding: 12px 14px; border: 0; }
.firmware-board .code-editor textarea { border: 0; height: 440px; min-height: 220px; }
.code-editor textarea:focus-visible { outline: none; }
.code-editor:focus-within { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 60%, transparent); }
.syntax-call { color: var(--blue); }
.syntax-todo { color: var(--amber); font-weight: 600; }
.code-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 5px 12px; font: 10px var(--mono); color: var(--muted); background: var(--inset); border-bottom: 1px solid var(--line); }
.code-todos { padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.code-todos[data-done="true"] { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.code-message { color: var(--red); flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-message:empty { flex: 1 1 0; }
.code-hint { opacity: .75; }
@media (max-width: 720px) { .code-hint { display: none; } .firmware-board .code-editor textarea { height: 360px; } }

.selftest { margin: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--inset); font-size: 11px; }
.selftest[data-state="pass"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.selftest[data-state="fail"] { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.selftest-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.selftest-head strong { font: 600 11px var(--mono); white-space: nowrap; }
.selftest-meter { flex: 1; height: 6px; border-radius: 99px; background: var(--raised); overflow: hidden; }
.selftest-meter span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.selftest[data-state="fail"] .selftest-meter span { background: var(--amber); }
.selftest-close { padding: 0 6px; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; }
.selftest ul { list-style: none; margin: 0; padding: 6px 0; max-height: 260px; overflow: auto; }
.selftest li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 3px 12px; }
.selftest li.selftest-group { display: block; margin-top: 6px; font: 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.selftest-icon { font-weight: 700; text-align: center; }
.selftest li.pass .selftest-icon { color: var(--accent); }
.selftest li.fail .selftest-icon { color: var(--red); }
.selftest li.pending { color: var(--muted); }
.selftest-detail { font: 10px var(--mono); color: var(--muted); text-align: right; overflow-wrap: anywhere; max-width: 28ch; }
button.selftest-detail { padding: 0; border: 0; background: none; color: var(--red); text-decoration: underline dotted; cursor: pointer; font-weight: 400; white-space: normal; }
.selftest-error { margin: 0; padding: 10px 12px; color: var(--red); font: 10px var(--mono); }
.firmware-board .oled-module { margin: 12px; }
.selftest-message { display: block; margin-top: 2px; font: 10px var(--mono); color: var(--red); opacity: .85; }
