:root {
  color-scheme: dark;
  --page: #0c1715; --panel: #12221e; --panel-high: #192d26;
  --line: #2d443a; --text: #edf4e8; --muted: #afc3b8;
  --lime: #e1f3a5; --accent: #a9ddaf; --focus: #ffce82;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px; background: var(--page); color: var(--text);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(ellipse at 48% -8%, #243a2c 0, transparent 48rem); }
.wrap { width: min(1340px, calc(100% - 88px)); margin-inline: auto; }
.mast { min-height: 61px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 12px; }
.brand { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; gap: 9px; font-weight: 700; letter-spacing: -.025em; }
.brand svg,.domain { color: var(--accent); }
nav { display: flex; gap: 24px; }
nav a { color: var(--muted); text-decoration: none; font-size: .86rem; }
nav a:hover, a:hover { color: var(--lime); }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 30px 0 25px; }
.eyebrow { color: var(--lime); font-size: .73rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; margin: 0 0 9px; }
.eyebrow span { margin-inline: 3px; }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(3.5rem, 6vw, 5.5rem); letter-spacing: -.075em; margin: 0; line-height: .91; font-weight: 400; }
.subtitle { color: #c9ddc7; font-size: 1.21rem; margin: 12px 0 0; }
.introduction { color: var(--muted); line-height: 1.55; max-width: 348px; margin: 0 2px 3px 0; font-size: .96rem; }
.workbench { display: grid; grid-template-columns: minmax(0, 2.35fr) minmax(280px, 1fr); gap: 15px; }
.panel { background: linear-gradient(150deg, var(--panel-high), var(--panel) 72%); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
h2 { font-size: 1.15rem; margin: 0; letter-spacing: -.025em; line-height: 1.2; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
.instrument .panel-head { padding: 12px 15px 11px 17px; }
.rail { position: relative; margin: 0 14px; border: 1px solid #30483d; border-radius: 8px; background: #0b1714; overflow: hidden; }
#bench { width: 100%; height: auto; display: block; }
.rail-slots { position: absolute; inset: 0; pointer-events: none; }
button.slot { position: absolute; padding: 0; width: 12%; height: 52%; top: 23%; transform: translateX(-50%); pointer-events: auto; background: transparent; border: 1px solid transparent; touch-action: manipulation; }
button.slot:hover, button.slot.drop-target { border-color: var(--lime); background: #ebff9b16; }
.slot span { display: block; position: absolute; text-align: center; font: 700 .68rem ui-monospace, monospace; border-radius: 4px; background: #0f201c; border: 1px solid #537360; color: var(--lime); width: 21px; line-height: 17px; left: calc(50% - 10px); bottom: -2px; }
#slot-0 { left: 39.05%; }
#slot-1 { left: 60.95%; }
.instrument-controls { padding: 10px 16px 13px; display: grid; grid-template-columns: minmax(0, 1.9fr) 1fr 1fr; align-items: start; gap: 13px; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 2px; font-weight: 650; font-size: .83rem; }
.control-label output { color: var(--lime); font-size: 1.33rem; font-variant-numeric: tabular-nums; }
.control-label small { font-size: .78rem; }
input[type=range] { width: 100%; cursor: ew-resize; appearance: none; height: 13px; border-radius: 4px; background: linear-gradient(90deg,#9765ef,#557afc 23%,#54d8a4 43%,#bce964 55%,#f4ce65 64%,#ff835e 75%,#db4352 100%); margin: 6px 0 4px; }
input[type=range]::-webkit-slider-thumb { appearance: none; background: #f4f7dc; height: 21px; width: 11px; border: 2px solid #14201a; border-radius: 3px; }
input[type=range]::-moz-range-thumb { background: #f4f7dc; height: 19px; width: 9px; border: 2px solid #14201a; border-radius: 3px; }
.wavelength-ends { display: flex; justify-content: space-between; color: var(--muted); font: .69rem ui-monospace, monospace; }
.readout { display: grid; align-content: start; padding-left: 12px; border-left: 1px solid var(--line); gap: 2px; min-width: 0; }
.readout span, .readout small { color: var(--muted); font-size: .75rem; }
.readout strong { font: 500 clamp(1.05rem, 2.2vw, 1.77rem) ui-monospace, Consolas, monospace; color: var(--lime); letter-spacing: -.065em; }
button, select, input[type=number] { font: inherit; color: var(--text); border: 1px solid #405c4e; background: #20362d; border-radius: 7px; min-height: 36px; padding: 5px 10px; }
button { cursor: pointer; font-size: .8rem; font-weight: 650; }
button:not(:disabled):hover { border-color: var(--accent); filter: brightness(1.12); }
button:disabled { opacity: .53; cursor: default; }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
button[aria-pressed=true] { background: #365243; border-color: #8ebe9c; color: #f4ffd3; }
button.primary { color: #1c2d16; background: var(--lime); border-color: var(--lime); }
button.primary:hover { color: #0e180b; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.samples, .notebook, .study { padding: 12px 15px 14px; }
.instruction { color: var(--muted); font-size: .81rem; line-height: 1.4; margin: 5px 0 10px; }
.vials { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vial { display: flex; align-items: center; justify-content: flex-start; gap: 7px; text-align: left; padding: 5px 8px; touch-action: none; }
.vial:last-child { grid-column: 1 / -1; }
.swatch { display: inline-block; position: relative; width: 12px; height: 19px; border: 1px solid #b2c5b7; border-radius: 2px 2px 4px 4px; background: linear-gradient(#121e17 33%,var(--sample) 34%); flex: 0 0 auto; }
.swatch::before { content: ""; height: 4px; width: 12px; position: absolute; top: -1px; left: -1px; border-radius: 2px 2px 0 0; background: #b2c5b7; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 2; border: 1px solid var(--lime); border-radius: 6px; background: #263b2b; color: var(--text); padding: 6px 8px; font-size: .8rem; }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.setup label,.preset { font-size: .75rem; color: var(--muted); }
.setup select { display: block; width: 100%; margin-top: 4px; }
select { font-size: .82rem; min-width: 0; }
.preset { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.preset select { width: 56%; }
.spectrum { padding: 13px 15px 12px; }
.graph-head { align-items: start; }
.switch { display: flex; gap: 4px; }
.switch button { min-height: 32px; }
#graph { width: 100%; height: auto; display: block; cursor: crosshair; touch-action: pan-y; background: #0c1816; border: 1px solid #2c4439; border-radius: 8px; }
.graph-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.show-model { display: flex; align-items: center; gap: 5px; margin-inline-start: auto; color: var(--muted); font-size: .79rem; }
input[type=checkbox],input[type=radio] { accent-color: #c9e78a; cursor: pointer; }
.empty { padding: 12px; border: 1px dashed #476151; border-radius: 8px; color: var(--muted); font-size: .87rem; line-height: 1.4; }
.table-scroll { max-height: 230px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th,td { padding: 8px 4px; text-align: left; border-bottom: 1px solid var(--line); }
td small { color: var(--muted); display: block; margin-top: 2px; }
.learn { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 15px; margin-top: 15px; }
.study { padding: 16px; line-height: 1.5; }
.study p, .study ol { color: var(--muted); margin: 7px 0 12px; }
.study ol { padding-left: 25px; }
.study li { padding-bottom: 4px; }
.study a, summary { color: var(--lime); }
summary { cursor: pointer; }
#progress { font-size: .86rem; color: var(--lime); }
#exercise fieldset { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
#exercise legend { font-size: .8rem; padding: 0 4px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choices label { display: flex; align-items: center; gap: 4px; padding: 5px; }
#exercise input[type=number] { max-width: 125px; margin: 0 4px 10px 0; }
.exercise-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#feedback { min-height: 1.5em; }
#feedback[data-correct=true] { color: var(--lime); }
#feedback[data-correct=false] { color: #ffd39a; }
.footer { display: flex; justify-content: space-between; padding-block: 22px; color: var(--muted); gap: 12px; font-size: .78rem; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; top: 4px; left: 4px; z-index: 5; background: var(--lime); color: #162418; padding: 8px; }
[hidden] { display: none !important; }
@media (max-width: 940px) {
  .wrap { width: calc(100% - 38px); }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .intro { display: block; padding: 23px 0 19px; }
  .introduction { margin-top: 9px; }
  .workbench,.learn { grid-template-columns: minmax(0,1fr); }
  nav { gap: 12px; }
  .graph-head { flex-wrap: wrap; gap: 2px; }
  .graph-head .switch { margin-bottom: 8px; }
  .show-model { margin-inline-start: 0; }
  .rail { margin-inline: 8px; }
  .instrument-controls { padding-inline: 9px; gap: 6px; grid-template-columns: minmax(0, 1.55fr) 1fr .85fr; }
  .readout { padding-left: 7px; }
  .slot span { font-size: .62rem; width: 17px; line-height: 14px; left: calc(50% - 8px); bottom: -5px; }
  button,select { min-height: 40px; }
  .vial { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.drag-ghost { left: 0; top: 0; }
@media (max-width: 540px) {
  #bench text { font-size: 22px; }
  .instrument-controls { padding-block: 9px; }
  nav a { font-size: .79rem; }
  .mast { min-height: 51px; }
}
