* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #173e36;
  background: #f1f5f1;
  --border: #d5e2db;
  --green: #087548;
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  border: 1px solid #b9cfc3;
  border-radius: 8px;
  background: white;
  color: #173e36;
  padding: 8px 11px;
  font-size: 12px;
}
button {
  cursor: pointer;
  font-weight: 650;
}
button:hover {
  background: #e5f3ea;
  border-color: #21875a;
}
button.primary {
  background: #087548;
  border-color: #087548;
  color: white;
}
button[aria-pressed="true"]:not(.primary) {
  background: #ddf1e5;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #b87920;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(21px, 2.1vw, 29px);
  letter-spacing: -0.6px;
}
h2 {
  font-size: 16px;
}
h3 {
  font-size: 15px;
}
p {
  line-height: 1.5;
}
label {
  font-size: 12px;
  font-weight: 600;
}
output {
  font-variant-numeric: tabular-nums;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 22px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar img {
  width: 119px;
  display: block;
}
.lab-name {
  font-size: 14px;
  font-weight: 700;
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
.topbar nav {
  display: flex;
  gap: 7px;
  margin-left: auto;
}
#count {
  background: #e9f1ec;
  padding: 2px 5px;
  border-radius: 4px;
}
main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.heading select {
  margin-left: 8px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: #54776b;
  margin-bottom: 5px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  grid-template-rows: minmax(min-content, 1fr) auto auto;
  gap: 12px;
  flex: 1;
  min-height: 640px;
}
.panel {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: white;
  overflow: hidden;
  min-width: 0;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 17px;
  gap: 12px;
  flex-shrink: 0;
}
.badge {
  background: #eef4fc;
  color: #235b89;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
}
.wave {
  display: flex;
  flex-direction: column;
}
.stage-wrap {
  position: relative;
  background: #112d32;
  flex: 1;
  min-height: 245px;
  overflow: hidden;
}
#scene {
  position: absolute;
  inset: 0;
}
#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.legend {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 11px;
  pointer-events: none;
}
.electric {
  color: #8cf1b5;
}
.magnetic {
  color: #75d5ff;
}
.probe-key {
  color: #ffd28b;
}
.wave-status {
  position: absolute;
  top: 38px;
  left: 14px;
  background: #1e4546e0;
  border: 1px solid #527779;
  color: #e1eeeb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  pointer-events: none;
}
.camera-tools {
  position: absolute;
  right: 10px;
  bottom: 35px;
  display: flex;
  gap: 5px;
}
.camera-tools button {
  padding: 6px 8px;
  background: #193e40;
  color: #e1eeeb;
  border-color: #527779;
  font-size: 10px;
}
.stage-caption {
  position: absolute;
  bottom: 10px;
  left: 14px;
  color: #cbe0db;
  font-size: 10px;
  pointer-events: none;
}
.transport {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.transport label {
  margin-left: auto;
  font-size: 10px;
}
.transport select {
  font-size: 11px;
  padding: 5px;
}
.transport #clock {
  font:
    10px ui-monospace,
    monospace;
  color: #527266;
}
.probe-controls {
  display: flex;
  gap: 22px;
  padding: 2px 14px 8px;
}
.probe-controls label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.probe-controls output {
  margin-left: auto;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  height: 6px;
  cursor: pointer;
}
.note {
  color: #58766b;
  font-size: 11px;
  margin: 5px 14px 10px;
}
.detector {
  display: flex;
  flex-direction: column;
}
.detector > * {
  flex-shrink: 0;
}
.readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #dee8e2;
  margin: 0 14px 8px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.readings > div {
  background: #f3f8f4;
  padding: 10px;
}
.readings span {
  display: block;
  font-size: 10px;
  color: #567367;
  margin-bottom: 4px;
}
.readings strong {
  font-size: clamp(17px, 1.55vw, 23px);
  font-variant-numeric: tabular-nums;
}
.trace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3px 14px;
  font-size: 10px;
  color: #557367;
}
.trace-heading button {
  font-size: 10px;
  padding: 5px 8px;
}
#trace,
#polarisation-viz {
  min-height: 120px;
  flex: 1;
  position: relative;
  margin: 0 9px;
  cursor: crosshair;
}
#trace svg,
#polarisation-viz svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.evidence-label select {
  padding: 5px;
  font-size: 10px;
  max-width: 100%;
}
.trace-heading {
  gap: 6px;
  flex-wrap: wrap;
}
#polarisation-note {
  line-height: 1.45;
}
#trace text {
  stroke: none;
}
.cursor-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px;
}
.cursor-controls label {
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cursor-controls input {
  width: 65px;
  min-width: 0;
  padding: 4px;
  border: 1px solid #b9cfc3;
  border-radius: 5px;
  font-size: 10px;
}
.cursor-controls span {
  font-size: 10px;
}
#cursor-result {
  min-height: 30px;
  font-size: 10px;
  margin-top: 7px;
}
.insight {
  margin: 0 14px 8px;
  font-size: 12px;
  line-height: 1.45;
}
#advanced {
  margin: 0 14px 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #557367;
}
.detector-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 14px 12px;
}
.detector-actions button {
  font-size: 11px;
}
.source-controls {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1fr 1.15fr 1fr;
  gap: 25px;
  padding: 13px 17px;
}
.source-controls label,
.filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.source-controls output,
.filter output {
  margin-left: auto;
}
.source-controls select {
  width: 100%;
  padding: 6px;
}
.filters {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.filter {
  padding: 12px 15px;
}
.filter > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.filter .eyebrow {
  font-size: 9px;
  margin: 0;
}
.filter button {
  padding: 6px 9px;
  font-size: 11px;
}
.filter input:disabled {
  opacity: 0.4;
}
.filter label {
  font-size: 11px;
}
.teaching .layout {
  grid-template-rows: minmax(min-content, 1fr) auto auto;
  min-height: 820px;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 15px;
  width: min(580px, calc(100% - 24px));
  max-height: 88dvh;
  padding: 0;
  color: #173e36;
  box-shadow: 0 25px 90px #001e2850;
}
dialog.wide {
  width: min(1000px, calc(100% - 24px));
}
dialog::backdrop {
  background: #092b2d65;
}
dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
dialog header button {
  font-size: 22px;
  border: 0;
  padding: 0 8px;
}
.dialog-body {
  padding: 18px 22px;
  overflow: auto;
}
.dialog-body p {
  font-size: 13px;
  margin-bottom: 14px;
}
.exact {
  display: grid;
  grid-template-columns: 1fr 120px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #e2ebe5;
}
.exact input {
  width: 100%;
  padding: 7px;
  border: 1px solid #b9cfc3;
  border-radius: 6px;
}
details {
  margin-top: 16px;
}
summary {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
}
.options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 18px;
}
#presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#presets button {
  padding: 13px;
  text-align: left;
  line-height: 1.4;
}
.task {
  background: #eff6f0;
  padding: 16px;
  border-radius: 10px;
  margin: 16px 0;
}
.task h3 {
  margin-bottom: 9px;
}
.file-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.table-wrap {
  overflow: auto;
  max-height: 40vh;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  white-space: nowrap;
}
th,
td {
  text-align: right;
  padding: 10px;
  border-bottom: 1px solid #dfe9e2;
}
th {
  background: #f0f6f1;
  position: sticky;
  top: 0;
}
#message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #143f34;
  color: white;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  z-index: 10;
  max-width: 90vw;
  pointer-events: none;
}
#message:empty {
  display: none;
}
.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip:focus {
  clip-path: none;
  width: auto;
  height: auto;
  top: 10px;
  left: 10px;
  background: white;
  padding: 15px;
  z-index: 20;
}
.fallback {
  padding: 80px 25px;
  color: white;
  font-size: 14px;
}
@media (min-width: 1101px) and (max-height: 850px) {
  .topbar {
    padding: 7px 18px;
  }
  .topbar img {
    width: 105px;
  }
  main {
    padding: 10px 18px 12px;
    gap: 10px;
  }
  h1 {
    font-size: 25px;
  }
  .layout {
    min-height: 590px;
    gap: 10px;
  }
  .panel-title {
    padding: 9px 14px;
  }
  .panel-title h2 {
    font-size: 14px;
  }
  .stage-wrap {
    min-height: 185px;
  }
  .readings > div {
    padding: 6px 10px;
  }
  .readings strong {
    font-size: 20px;
  }
  .readings span {
    margin-bottom: 2px;
  }
  .transport {
    padding: 7px 12px;
  }
  .probe-controls {
    padding-bottom: 5px;
  }
  .note {
    margin-bottom: 7px;
    font-size: 10px;
  }
  #cursor-result {
    min-height: 16px;
    margin-top: 5px;
  }
  .insight {
    font-size: 11px;
    margin-bottom: 5px;
  }
  .source-controls {
    padding: 8px 14px;
  }
  .filter {
    padding: 8px 14px;
  }
  .filter > div {
    margin-bottom: 6px;
  }
}
@media (min-width: 1600px) {
  main {
    padding: 20px 30px;
  }
  .stage-wrap {
    min-height: 340px;
  }
  h2 {
    font-size: 18px;
  }
  .legend {
    font-size: 13px;
  }
  .stage-caption {
    font-size: 12px;
  }
  .insight {
    font-size: 14px;
  }
  .readings strong {
    font-size: 25px;
  }
}
@media (max-width: 1100px) {
  .lab-name {
    display: none;
  }
  .layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
    min-height: 710px;
  }
  .transport #clock {
    display: none;
  }
  .source-controls {
    gap: 15px;
  }
  .legend {
    gap: 10px;
    font-size: 10px;
  }
  .filter .eyebrow {
    font-size: 8px;
  }
  .stage-caption {
    font-size: 9px;
  }
  .cursor-controls {
    flex-wrap: wrap;
  }
  .filter > div {
    flex-wrap: wrap;
  }
  .filter {
    padding: 10px;
  }
  .transport label {
    margin-left: 0;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar img {
    width: 90px;
  }
  .topbar nav {
    gap: 4px;
  }
  .topbar button {
    font-size: 10px;
    padding: 7px;
  }
  .topbar #fullscreen {
    display: none;
  }
  main {
    padding: 10px;
    gap: 10px;
  }
  .heading {
    align-items: flex-start;
  }
  .heading h1 {
    font-size: 21px;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .heading label {
    font-size: 10px;
  }
  .heading select {
    display: block;
    margin: 4px 0 0;
    padding: 6px;
    font-size: 11px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    min-height: auto;
    flex: none;
  }
  .wave {
    min-height: 440px;
  }
  .stage-wrap {
    min-height: 260px;
  }
  .panel-title {
    padding: 12px;
  }
  .panel-title h2 {
    font-size: 14px;
  }
  .probe-controls {
    gap: 12px;
  }
  .probe-controls label {
    font-size: 10px;
  }
  .transport {
    gap: 5px;
  }
  .transport button {
    font-size: 10px;
    padding: 7px;
  }
  .note {
    font-size: 10px;
  }
  .source-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 14px;
  }
  .source-controls label {
    font-size: 11px;
  }
  .detector {
    min-height: 470px;
  }
  #trace {
    min-height: 170px;
  }
  .filters {
    display: flex;
    flex-direction: column;
  }
  .filter {
    padding: 12px 15px;
  }
  .filter > div {
    flex-wrap: nowrap;
  }
  .filter .eyebrow {
    font-size: 9px;
  }
  .readings strong {
    font-size: 21px;
  }
  .camera-tools {
    gap: 4px;
  }
  .camera-tools button {
    font-size: 9px;
  }
  .stage-caption {
    font-size: 9px;
    max-width: 90%;
  }
  .wave-status {
    font-size: 9px;
    max-width: 90%;
  }
  #presets {
    grid-template-columns: 1fr;
  }
  .teaching .wave {
    min-height: 500px;
  }
}
