:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #173e32;
  background: #f3f7f3;
  font-synthesis: none;
  --green: #167553;
  --border: #dce7df;
  --muted: #657d70;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: #234d3c;
  min-height: 34px;
  padding: 6px 10px;
}
button {
  cursor: pointer;
  font-weight: 550;
  white-space: nowrap;
}
button:hover {
  background: #eaf4ed;
  border-color: #7fac92;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
button[aria-pressed="true"] {
  background: #def0e3;
  border-color: #6ca384;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 5px 0 0;
}
input[type="range"] {
  accent-color: var(--green);
  min-width: 50px;
}
input:focus-visible,
button:focus-visible,
select:focus-visible,
canvas:focus-visible,
a:focus-visible {
  outline: 3px solid #d6a945;
  outline-offset: 2px;
}
input[type="number"] {
  width: 100%;
  min-width: 0;
}
select {
  max-width: 100%;
  min-width: 0;
}
a {
  color: var(--green);
}
[hidden] {
  display: none !important;
}
#lab {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 18px 9px;
  gap: 8px;
}
.header {
  height: 61px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}
.brand img {
  width: 113px;
  max-height: 39px;
  object-fit: contain;
}
.brand span {
  font-size: 13px;
  font-weight: 650;
  border-left: 1px solid var(--border);
  padding-left: 14px;
  white-space: nowrap;
}
nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
nav button {
  font-size: 12px;
  background: transparent;
}
#capture-count {
  font-size: 10px;
  display: inline-flex;
  border-radius: 20px;
  background: #def0e3;
  min-width: 17px;
  justify-content: center;
}
main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  min-height: 61px;
  flex-shrink: 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--green);
  margin: 0 0 5px;
}
h1 {
  margin: 0;
  font-size: clamp(19px, 2vw, 27px);
  font-weight: 650;
  letter-spacing: -0.7px;
}
.heading > p {
  font-size: 13px;
  line-height: 1.5;
  max-width: 340px;
  color: var(--muted);
  margin: 0;
}
.transport {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-shrink: 0;
}
.transport button,
.transport select {
  font-size: 12px;
}
.speed {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.speed select {
  padding: 4px;
  min-height: 32px;
}
#clock {
  font:
    600 12px ui-monospace,
    monospace;
  min-width: 75px;
  text-align: right;
}
.pill {
  font-size: 10px;
  letter-spacing: 0.4px;
  padding: 5px 8px;
  border-radius: 30px;
  background: #e4eee7;
  color: var(--green);
}
#mobile-view {
  display: none;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 275px;
  gap: 12px;
  min-height: 0;
  flex: 1;
}
.bench {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 3px 13px #173e3205;
}
.quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 14px;
  border-bottom: 1px solid #eaf0eb;
  flex-shrink: 0;
  background: #fcfefc;
  font-size: 12px;
}
.quick-row > label {
  font-weight: 600;
  white-space: nowrap;
}
.quick-row input[type="range"] {
  flex: 1;
}
.quick-row input[type="number"] {
  width: 78px;
  font-size: 12px;
}
.quick-row button,
.quick-row select {
  font-size: 11px;
  min-height: 30px;
}
.quick-row span {
  color: var(--muted);
  margin-left: auto;
  font-size: 11px;
}
.canvas-wrap {
  min-height: 60px;
  position: relative;
  flex: 1;
  overflow: hidden;
}
#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#stage:active {
  cursor: grabbing;
}
.overlays {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 12px;
  border-top: 1px solid #edf2ed;
  min-height: 43px;
  flex-shrink: 0;
  font-size: 11px;
  flex-wrap: wrap;
}
.overlays label {
  white-space: nowrap;
}
.overlays input {
  width: 14px;
  height: 14px;
}
.overlays button,
.overlays select {
  font-size: 10px;
  padding: 3px 7px;
  min-height: 28px;
}
.view-label {
  margin-left: auto;
}
.selection-row {
  padding: 7px 12px;
  display: flex;
  gap: 7px;
  align-items: center;
  background: #f8fbf8;
  border-top: 1px solid #e9f0e9;
  font-size: 11px;
  flex-shrink: 0;
}
.selection-row select {
  flex: 1;
  max-width: 220px;
  font-size: 11px;
  min-height: 30px;
}
.selection-row button {
  font-size: 10px;
  padding: 4px 8px;
  min-height: 30px;
}
.evidence {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px;
  gap: 10px;
}
.evidence-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.evidence-heading .eyebrow {
  margin: 0;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 10px;
  background: #59aa78;
}
.readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
}
.reading {
  min-width: 0;
  border-bottom: 1px solid #ecf2ed;
  padding-bottom: 9px;
}
.reading span {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.reading output {
  font-size: clamp(14px, 1.4vw, 20px);
  font-weight: 600;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}
.graph-select {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.graph-select select {
  font-size: 11px;
  flex: 1;
  min-height: 30px;
}
#graph {
  width: 100%;
  height: 100%;
  min-height: 90px;
  flex: 1;
}
#graph-note {
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}
.equation {
  font-size: 12px;
  color: var(--green);
  background: #f0f7f1;
  border: 1px solid #e0ece2;
  padding: 10px;
  border-radius: 7px;
  line-height: 1.6;
  margin: 0;
}
.bench-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  min-height: 16px;
}
.bench-footer > span:first-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bench-footer > span:last-child {
  white-space: nowrap;
}
#toast {
  position: absolute;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  width: max-content;
  max-width: 92%;
  background: #173e32;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 3px 12px #123c3422;
  pointer-events: none;
  opacity: 0;
}
#toast.visible {
  opacity: 1;
}
.panel {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  color: #173e32;
  width: 450px;
  max-width: calc(100vw - 24px);
  height: calc(100dvh - 36px);
  max-height: 850px;
  margin: 18px 18px 18px auto;
  box-shadow: 0 20px 90px #163f3430;
}
.panel[open] {
  display: flex;
  flex-direction: column;
}
.panel::backdrop {
  background: #173e3226;
}
.wide-panel {
  width: 770px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #f9fcf9;
}
.panel-heading h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
}
.panel-heading button {
  font-size: 22px;
  line-height: 1;
  padding: 6px 9px;
  min-height: 34px;
}
.panel-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  min-height: 0;
  line-height: 1.6;
  font-size: 13px;
}
.panel-message {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 20px;
  background: #fff4d9;
  color: #624b1b;
  font-size: 12px;
  line-height: 1.5;
}
.panel-content section {
  border-bottom: 1px solid var(--border);
  padding: 0 0 18px;
  margin: 0 0 18px;
}
.panel-content h3 {
  font-size: 14px;
  margin: 0 0 10px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.section-title button {
  font-size: 10px;
  min-height: 28px;
  padding: 4px 8px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.fields label:has(input[type="checkbox"]) {
  display: block;
  align-self: center;
}
.fields input,
.fields select {
  font-size: 13px;
  width: 100%;
}
.fields input[type="checkbox"] {
  width: 16px;
}
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.button-row button {
  font-size: 12px;
}
.muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
details {
  border-top: 1px solid var(--border);
  padding: 13px 0;
}
summary {
  font-weight: 600;
  cursor: pointer;
}
details p {
  font-size: 12px;
  color: var(--muted);
}
.experiment-group {
  margin-bottom: 22px;
}
.experiment-group > p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 9px;
}
.experiment-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  white-space: normal;
  margin: 7px 0;
  padding: 12px 14px;
  gap: 4px;
  background: #fbfdfb;
}
.experiment-card span {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
.experiment-card.active {
  border-color: #398d60;
  background: #eff8f1;
}
.tray {
  position: fixed;
  z-index: 5;
  right: 18px;
  top: 70px;
  bottom: 18px;
  width: 290px;
  max-width: calc(100vw - 24px);
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 15px 50px #173e3226;
  border-radius: 13px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 15px;
}
.tray > p,
.tray > button {
  margin: 13px 16px;
  font-size: 12px;
  line-height: 1.5;
}
.parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px;
}
.parts button {
  font-size: 11px;
  min-height: 60px;
  white-space: normal;
  touch-action: none;
  text-align: left;
}
.parts b {
  display: block;
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 4px;
}
.table-wrap {
  overflow-x: auto;
  margin-top: 15px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
  white-space: nowrap;
}
th,
td {
  padding: 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #eff6f0;
  font-weight: 600;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.teacher .heading {
  display: none;
}
.transformer .selection-row,
.transformer .overlays label:not(:has(#magnetic-lines)),
.transformer .overlays button {
  display: none;
}
.teacher .equation {
  font-size: 15px;
}
.teacher .reading output {
  font-size: 24px;
}
.teacher .workbench {
  grid-template-columns: minmax(0, 1fr) 300px;
}
@media (min-width: 1700px) {
  #lab {
    padding: 0 28px 14px;
    gap: 14px;
  }
  .header {
    height: 72px;
  }
  .workbench {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .evidence {
    padding: 20px;
  }
  .readings {
    gap: 15px;
  }
  .reading span {
    font-size: 12px;
  }
  .reading output {
    font-size: 25px;
  }
  .overlays {
    font-size: 13px;
  }
  .transport button {
    min-height: 39px;
    font-size: 14px;
  }
}
@media (max-width: 1000px) {
  #lab {
    padding: 0 10px 7px;
  }
  .brand span {
    display: none;
  }
  .workbench {
    grid-template-columns: minmax(0, 1fr) 235px;
    gap: 8px;
  }
  .heading > p {
    max-width: 260px;
    font-size: 11px;
  }
  .overlays {
    gap: 7px;
  }
  .overlays #pan {
    display: none;
  }
  .selection-row #keep-trace {
    display: none;
  }
  .selection-row > label {
    display: none;
  }
  .evidence {
    padding: 10px;
  }
  .teacher .workbench {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}
@media (max-width: 740px) {
  .header {
    height: auto;
    min-height: 78px;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 0;
  }
  .brand img {
    width: 90px;
    height: 27px;
  }
  .brand span {
    display: inline;
    font-size: 11px;
  }
  .header nav {
    width: 100%;
    gap: 4px;
    justify-content: space-between;
  }
  nav button {
    padding: 5px 7px;
    font-size: 10px;
    min-height: 29px;
  }
  #fullscreen {
    position: absolute;
    top: 5px;
    right: 10px;
    min-height: 27px;
  }
  main {
    gap: 6px;
  }
  .heading {
    min-height: 43px;
  }
  .heading > p {
    display: none;
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 3px;
  }
  h1 {
    font-size: 18px;
    letter-spacing: -0.4px;
  }
  .transport {
    gap: 4px;
    flex-wrap: wrap;
  }
  .transport button {
    padding: 5px 7px;
    min-height: 31px;
    font-size: 10px;
  }
  .speed {
    font-size: 0;
    gap: 0;
  }
  .speed select {
    font-size: 10px;
    min-height: 31px;
  }
  .pill {
    display: none;
  }
  #clock {
    font-size: 10px;
    min-width: 53px;
  }
  #mobile-view {
    display: inline-block;
  }
  .workbench,
  .teacher .workbench {
    display: flex;
  }
  .bench {
    width: 100%;
  }
  .evidence {
    display: none;
    width: 100%;
  }
  .graph-view .bench {
    display: none;
  }
  .graph-view .evidence {
    display: flex;
  }
  .graph-view .readings {
    grid-template-columns: repeat(3, 1fr);
  }
  .quick-row {
    padding: 5px 9px;
    gap: 6px;
    min-height: 42px;
    font-size: 10px;
  }
  .quick-row input[type="number"] {
    width: 60px;
    font-size: 11px;
    padding: 4px;
  }
  .quick-row button {
    font-size: 10px;
    padding: 4px 6px;
  }
  .quick-row > label {
    max-width: 120px;
    white-space: normal;
  }
  .quick-row span {
    display: none;
  }
  .overlays {
    gap: 7px;
    padding: 6px 8px;
    font-size: 10px;
    min-height: 40px;
  }
  .overlays input {
    width: 12px;
    height: 12px;
    margin-right: 2px;
  }
  .overlays #pan {
    display: none;
  }
  .overlays button {
    padding: 3px 6px;
  }
  .overlays .view-label {
    margin-left: 0;
  }
  .selection-row {
    padding: 5px 8px;
    gap: 5px;
  }
  .selection-row #keep-trace {
    display: inline;
  }
  .selection-row select {
    width: 50px;
    min-width: 50px;
  }
  .selection-row button {
    font-size: 9px;
    padding: 3px 5px;
  }
  .bench-footer {
    font-size: 9px;
    gap: 5px;
  }
  .bench-footer > span:first-child {
    display: none;
  }
  .panel {
    max-width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    margin: 6px;
  }
  .panel-heading {
    padding: 12px 15px;
  }
  .panel-content {
    padding: 15px;
  }
  .tray {
    top: 86px;
    right: 6px;
    bottom: 6px;
  }
  .reading output {
    font-size: 18px;
  }
}
@media (max-height: 540px) {
  #lab {
    gap: 4px;
    padding-bottom: 4px;
  }
  .header {
    height: 43px;
    min-height: 43px;
    flex-wrap: nowrap;
  }
  .header nav {
    width: auto;
  }
  .brand img {
    width: 75px;
  }
  .brand span {
    display: none;
  }
  #fullscreen {
    position: static;
  }
  .heading {
    min-height: 32px;
  }
  .heading .eyebrow {
    display: none;
  }
  h1 {
    font-size: 17px;
  }
  main {
    gap: 4px;
  }
  .transport button,
  .transport select {
    min-height: 27px;
  }
  .quick-row {
    min-height: 35px;
    padding: 3px 8px;
  }
  .overlays,
  .selection-row {
    padding: 3px 8px;
    min-height: 30px;
  }
  .overlays button,
  .overlays select,
  .selection-row button,
  .selection-row select {
    min-height: 24px;
  }
  .bench-footer {
    display: none;
  }
  .readings {
    gap: 5px;
  }
  .reading {
    padding-bottom: 4px;
  }
  .reading output {
    font-size: 13px;
  }
  .evidence {
    gap: 5px;
  }
  .equation {
    display: none;
  }
  .tray {
    top: 48px;
  }
  .teacher .reading output {
    font-size: 16px;
  }
}
@media (max-width: 360px) {
  nav button {
    font-size: 9px;
    padding: 4px 5px;
  }
  #capture-count {
    display: none;
  }
  .transport {
    gap: 3px;
  }
  .transport button {
    padding: 4px 5px;
  }
  #clock {
    min-width: 45px;
  }
  .speed select {
    padding: 3px;
  }
  .overlays {
    gap: 5px;
  }
  .overlays #zoom-out,
  .overlays #zoom-in {
    display: none;
  }
  .selection-row #keep-trace {
    display: none;
  }
  .quick-row input[type="number"] {
    width: 52px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
