:root {
  font-family: Inter, "Segoe UI", sans-serif;
  color: #173e35;
  background: #eff4ef;
  font-size: 14px;
  --green: #185544;
  --line: #ceded4;
  --muted: #5e746b;
  --gold: #ffd179;
  --a: #80e1c0;
  --b: #f6bb75;
}
#build-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  color: #fff0cf;
  background: #38432b;
  border-block: 1px solid #75815a;
  font-size: 12px;
  flex: none;
}
#repair-string {
  font-size: 12px;
  flex-shrink: 0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input[type="number"],
input[type="text"],
input:not([type]) {
  min-height: 34px;
  border: 1px solid #b8cec1;
  border-radius: 7px;
  background: #fff;
  color: #173e35;
  padding: 6px 10px;
}
button {
  cursor: pointer;
  font-weight: 550;
}
button:hover {
  background: #e3eee5;
}
button.primary,
button[aria-pressed="true"] {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #dd9b32;
  outline-offset: 2px;
}
input[type="range"] {
  accent-color: var(--green);
  min-width: 0;
}
input[type="checkbox"] {
  accent-color: var(--green);
}
label {
  font-size: 12px;
  display: flex;
  gap: 5px;
  flex-direction: column;
}
label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
}
input[type="number"] {
  width: 86px;
}
select {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 18px;
  background: white;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand img {
  width: 138px;
  height: auto;
  display: block;
}
.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar button {
  font-size: 12px;
}
#count {
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 8px;
  gap: 9px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: none;
}
.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.6px;
  margin: 0 0 4px;
  color: #637c6c;
}
h1 {
  font-size: clamp(19px, 2vw, 27px);
  font-weight: 600;
  margin: 0;
}
#question {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.workspace-label {
  min-width: 175px;
}
.transport,
.live-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  flex: none;
}
.transport button {
  font-size: 12px;
}
.transport #clock {
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.live-controls {
  background: #e4ede3;
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 9px;
  gap: 14px;
}
.live-controls label {
  flex-direction: row;
  align-items: center;
  white-space: nowrap;
}
.live-controls label span {
  display: flex;
  align-items: center;
  gap: 4px;
}
#frequency-slider {
  width: 180px;
  flex: 1;
  max-width: 300px;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.stage-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid #a7bfaf;
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
  background: #102d26;
}
.bench-explanation {
  flex: none;
  padding: 8px 12px 10px;
  background: #193b31;
  border-block: 1px solid #315344;
  color: #e0ecdf;
  font-size: 12px;
  line-height: 1.4;
}
.bench-explanation p {
  margin: 0;
}
.run-explanation {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 6px !important;
  color: #b6d2c0;
  font-size: 11px;
  min-height: 2.8em;
}
#run-state {
  color: #ffda92;
  flex-shrink: 0;
}
#scope-explanation {
  margin: 0;
  color: #405d4e;
  font-size: 11px;
  line-height: 1.4;
}
.guide-callout {
  border-left: 3px solid #9b742c;
  background: #f0ecd9;
  padding: 12px;
  margin-top: 0;
}
.investigation-plan {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.investigation-plan > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}
.investigation-plan dt,
.button-guide dt {
  font-weight: 650;
}
.investigation-plan dd,
.button-guide dd {
  margin: 0;
  line-height: 1.5;
}
.button-guide dt {
  margin: 14px 0 4px;
}
#guide .panel-body > h3:first-of-type {
  margin-top: 16px;
}
.stage-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: #c4dcd0;
  padding: 9px 12px;
  font-size: 12px;
}
.stage-top span {
  margin-right: auto;
}
.stage-top label {
  font-size: 11px;
}
.stage-top input {
  accent-color: #a8dfbd;
}
#stage {
  position: relative;
  flex: 1;
  min-height: 170px;
  isolation: isolate;
  overflow: hidden;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
}
#scene.pluckable {
  touch-action: none;
}
#scene:focus-visible {
  outline: 2px solid #f8dc8b;
  outline-offset: -3px;
}
#handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.handle {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  min-width: 34px;
  min-height: 32px;
  padding: 4px 7px;
  font-size: 11px;
  color: #e2efdf;
  background: #234d40;
  border: 1px solid #759e89;
  white-space: nowrap;
}
.handle:hover {
  background: #356e56;
}
.handle[data-handle="probe"] {
  border-color: var(--a);
}
.handle[data-handle="probeB"] {
  border-color: var(--b);
}
.handle.dragging {
  background: #417d60;
}
.stage-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  color: #a8c7b5;
  font-size: 10px;
}
.stage-foot label {
  flex-direction: row;
  align-items: center;
  margin-left: auto;
  font-size: 10px;
}
.stage-foot select {
  font-size: 11px;
  min-height: 28px;
  padding: 3px 6px;
}
.readings {
  background: #f6faf4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}
.readings span {
  font-size: 10px;
  color: var(--muted);
  display: block;
}
.readings strong {
  font-size: clamp(16px, 2vw, 25px);
  font-weight: 600;
  display: block;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.instrument {
  background: #f9fcf7;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.scope-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.scope-top h2 {
  font-size: 17px;
  margin: 0;
}
.scope-top select {
  font-size: 12px;
}
.scope-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}
.scope-controls select,
.scope-controls button {
  padding: 5px;
  font-size: 11px;
  min-height: 30px;
}
.scope-controls label {
  font-size: 10px;
}
.scope-canvas {
  flex: 1;
  min-height: 135px;
  background: #102621;
  border-radius: 6px;
  overflow: hidden;
}
#scope {
  display: block;
  width: 100%;
  height: 100%;
}
#scope-status {
  font-size: 11px;
  color: #526c5b;
  margin: 0;
  min-height: 14px;
}
.cursor-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 55px;
  gap: 10px;
}
.cursor-controls input[type="number"] {
  width: 100%;
  min-height: 28px;
}
.cursor-controls input[type="range"] {
  width: 100%;
  margin: 2px 0;
}
.cursor-controls label {
  font-size: 10px;
}
#cursor-result {
  font-size: 12px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.scope-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}
.scope-footer button {
  margin-left: auto;
  font-size: 11px;
  min-height: 28px;
}
.channel-a {
  color: #087559;
}
.channel-b {
  color: #a95c1b;
}
.footer {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11px;
  min-height: 28px;
}
.footer button {
  font-size: 11px;
  min-height: 28px;
  margin-left: auto;
}
.footer #message {
  font-weight: 600;
  color: #22583d;
}
#empty-hint {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  color: #daecd9;
  font-size: 18px;
  white-space: nowrap;
}
.teacher .heading .eyebrow,
.teacher #question {
  display: none;
}
.teacher .readings strong {
  font-size: 27px;
}
dialog {
  padding: 0;
  border: 1px solid #a6bead;
  border-radius: 14px;
  background: #f8fbf6;
  color: #173e35;
  width: min(680px, 94vw);
  max-height: 90dvh;
  box-shadow: 0 22px 80px #092d3f30;
}
dialog#notebook {
  width: min(920px, 96vw);
}
dialog::backdrop {
  background: #0b231d88;
}
dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #f8fbf6;
  z-index: 2;
}
dialog h2 {
  font-size: 20px;
  margin: 0;
}
.panel-body {
  padding: 16px 18px;
}
.panel-body p {
  line-height: 1.5;
}
.panel-body h3 {
  font-size: 16px;
  margin: 20px 0 9px;
}
.panel-body label select {
  width: 100%;
}
.panel-body li {
  margin: 9px 0;
  line-height: 1.4;
}
#experiment-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
}
#experiment-list button {
  padding: 11px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#experiment-list button span {
  font-size: 10px;
  color: #5f7564;
  font-weight: 400;
}
#experiment-list button[aria-pressed="true"] span {
  color: #c5dfcd;
}
details {
  margin: 16px 0;
  font-size: 13px;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.form-grid input {
  width: 100%;
}
#parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#parts button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
}
.connections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.toggles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.table-wrap {
  overflow: auto;
  max-height: 300px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  border-bottom: 1px solid #d8e4d9;
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}
td:last-child {
  white-space: normal;
  min-width: 130px;
}
#notebook-graph {
  width: 100%;
  height: 250px;
  display: block;
}
#fit-result {
  font-size: 13px;
}
#note {
  width: 100%;
}
#kept-traces > div {
  padding: 10px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
#kept-traces button {
  margin-left: auto;
  font-size: 11px;
}
@media (min-width: 1600px) {
  :root {
    font-size: 16px;
  }
  .topbar button,
  .transport button {
    font-size: 14px;
  }
  .handle {
    font-size: 14px;
    min-height: 38px;
  }
  .stage-top {
    font-size: 14px;
  }
  .scope-controls label,
  .scope-controls select {
    font-size: 13px;
  }
  .readings span {
    font-size: 13px;
  }
}
@media (max-width: 1050px) {
  .topbar {
    padding: 7px 10px;
    gap: 10px;
  }
  .brand img {
    width: 112px;
  }
  .topbar button {
    font-size: 11px;
    padding: 5px 7px;
  }
  main {
    padding: 9px 10px;
  }
  .workbench {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr);
  }
  .live-controls {
    gap: 8px;
  }
  .live-controls label {
    font-size: 11px;
  }
  #frequency-slider {
    max-width: 130px;
  }
  .transport {
    gap: 5px;
  }
  .transport button {
    padding: 5px 8px;
  }
  .stage-top {
    gap: 6px;
  }
}
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar nav {
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
  }
  .topbar button {
    min-height: 30px;
  }
  .brand img {
    width: 96px;
  }
  .heading {
    align-items: start;
  }
  .workspace-label {
    min-width: 130px;
    max-width: 145px;
    font-size: 10px;
  }
  .workspace-label select {
    font-size: 11px;
  }
  h1 {
    font-size: 19px;
  }
  #question {
    font-size: 11px;
  }
  .eyebrow {
    font-size: 8px;
  }
  .workbench {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(500px, 1fr) minmax(430px, 1fr);
    gap: 8px;
    overflow: auto;
  }
  .stage-top {
    padding: 5px 8px;
    font-size: 10px;
  }
  .stage-top label {
    font-size: 10px;
  }
  #stage {
    min-height: 240px;
  }
  .stage-foot {
    padding: 4px 8px;
    font-size: 9px;
  }
  .readings {
    padding: 7px 9px;
    gap: 6px;
  }
  .readings strong {
    font-size: 18px;
  }
  .readings span {
    font-size: 9px;
  }
  .instrument {
    padding: 8px;
    gap: 5px;
  }
  .scope-top h2 {
    font-size: 14px;
  }
  .scope-top select {
    min-height: 27px;
  }
  .scope-canvas {
    min-height: 90px;
  }
  .scope-controls {
    gap: 5px;
  }
  .scope-controls label {
    font-size: 9px;
  }
  .scope-controls select,
  .scope-controls button {
    min-height: 25px;
    font-size: 10px;
  }
  .cursor-controls {
    gap: 6px;
    grid-template-columns: 1fr 1fr 45px;
  }
  #scope-status,
  .scope-footer {
    font-size: 10px;
  }
  #cursor-result {
    font-size: 11px;
  }
  .transport button {
    min-height: 29px;
    font-size: 11px;
  }
  .transport #clock {
    font-size: 10px;
  }
  .live-controls {
    padding: 5px;
    gap: 6px;
  }
  .live-controls input[type="number"] {
    width: 65px;
    min-height: 28px;
    padding: 3px 5px;
  }
  #frequency-slider {
    max-width: none;
    width: 75px;
    flex: 1;
  }
  #fit {
    font-size: 10px;
    min-height: 28px;
  }
  .live-controls label {
    font-size: 10px;
  }
  .footer {
    font-size: 10px;
    gap: 5px;
  }
  .footer #prediction {
    max-width: 68%;
  }
  .footer button {
    font-size: 10px;
  }
  main {
    gap: 6px;
  }
  .handle {
    font-size: 10px;
    min-height: 28px;
    min-width: 29px;
    padding: 3px 4px;
  }
  #experiment-list {
    grid-template-columns: 1fr 1fr;
  }
  #parts,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 761px) and (max-height: 740px) {
  .topbar {
    padding-block: 5px;
  }
  .brand img {
    width: 112px;
  }
  main {
    padding-top: 8px;
    gap: 6px;
  }
  .heading .eyebrow {
    display: none;
  }
  h1 {
    font-size: 22px;
  }
  #question {
    margin-top: 2px;
    font-size: 12px;
  }
  .heading {
    min-height: 45px;
  }
  .readings {
    padding-block: 9px;
  }
}
@media (max-height: 600px) {
  main {
    overflow: auto;
  }
  .workbench {
    flex: none;
    min-height: 380px;
  }
  .heading {
    gap: 5px;
  }
  .topbar {
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .heading .eyebrow {
    display: none;
  }
}
@media (pointer: coarse) {
  button {
    min-height: 40px;
  }
  .handle {
    min-height: 40px;
    min-width: 40px;
  }
  input,
  select {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
.scope-canvas {
  min-height: 90px;
}
.cursor-controls {
  grid-template-columns: 1fr 1fr 72px;
}
.cursor-controls label:last-child {
  flex-direction: row;
  align-items: center;
}
.cursor-controls label:last-child input {
  width: 40px;
}
.instrument {
  overflow: auto;
}

@media (max-width: 760px) {
  .scope-canvas {
    min-height: 130px;
  }
  .instrument {
    overflow: visible;
  }
  .workbench {
    overscroll-behavior: contain;
  }
  .stage-panel {
    min-height: 500px;
  }
  .bench-explanation {
    font-size: 11px;
    padding: 8px;
  }
  .run-explanation {
    display: block;
    min-height: 7em;
  }
  #run-state {
    margin-right: 6px;
  }
  .investigation-plan > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  #empty-hint {
    font-size: 14px;
    white-space: normal;
    width: 85%;
    text-align: center;
  }
}
