/* Respiratory Physiology & Spirometry Lab (layout shared with the Wave H labs). Everything is scoped under .sp so site.css (loaded after this file) can't collide. */
.sp {
  --sp-ink: #14263a; --sp-muted: #4b6075; --sp-paper: #eef4f7; --sp-card: #ffffff; --sp-line: #cfdce4;
  --sp-accent: #0d6670; --sp-accent-ink: #ffffff; --sp-sun: #e89a2c; --sp-soft: #f3f7f9; --sp-ok: #1f7a3d; --sp-no: #b3261e;
  --sp-shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 8px 24px rgba(16, 40, 60, .07);
  color: var(--sp-ink); font: 16px/1.5 "Atkinson Hyperlegible", system-ui, sans-serif;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #dcebf3, var(--sp-paper) 70%);
  padding: 0 clamp(12px, 2vw, 28px) 56px; min-height: 70vh;
}
html[data-theme="dark"] .sp {
  --sp-ink: #e6eef3; --sp-muted: #aabdca; --sp-paper: #0f1b26; --sp-card: #172633; --sp-line: #33495a;
  --sp-accent: #3fb5a3; --sp-accent-ink: #062521; --sp-soft: #1d3040; --sp-ok: #7fdc9a; --sp-no: #ff9b93;
  --sp-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #19324a, var(--sp-paper) 70%);
}
.sp *, .sp *::before, .sp *::after { box-sizing: border-box; }
.sp [hidden] { display: none !important; }
.sp h1, .sp h2, .sp h3 { color: var(--sp-ink); font-family: inherit; }
.sp-eyebrow { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .08em; color: var(--sp-accent); }
.sp-muted { color: var(--sp-muted); }

/* title bar */
.sp-bar { max-width: 1500px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0 8px; }
.sp-titles { flex: 1 1 260px; }
.sp-bar h1 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.1; }
.sp-level { padding: 4px 12px; border-radius: 999px; background: var(--sp-soft); border: 1px solid var(--sp-line); font-weight: 700; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* buttons */
.sp .sp-btn { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.sp .sp-btn:hover { border-color: var(--sp-accent); }
.sp .sp-btn:disabled { opacity: .5; cursor: not-allowed; }
.sp .sp-btn--pri { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-accent-ink); }
.sp .sp-btn--ghost { background: transparent; }
.sp .sp-btn--small { min-height: 36px; padding: 6px 12px; margin-top: 6px; }
.sp button:focus-visible, .sp a:focus-visible, .sp input:focus-visible, .sp select:focus-visible, .sp textarea:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }

/* level gate */
.sp-gate { max-width: 1500px; margin: 8px auto 0; padding: clamp(18px, 4vw, 48px); border-radius: 22px; background: linear-gradient(140deg, #0d2338, #1d5b6e 55%, #4fa3a0); }
.sp-gate-card { max-width: 860px; margin: 0 auto; padding: clamp(22px, 4vw, 44px); border-radius: 18px; background: var(--sp-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.sp-gate-card h2 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0; }
.sp-gate-lede { font-size: 18px; color: var(--sp-muted); }
.sp-gate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.sp-gate-grid button { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 2px solid var(--sp-line); border-radius: 14px; cursor: pointer; background: var(--sp-soft); color: var(--sp-ink); }
.sp-gate-grid button:hover, .sp-gate-grid button:focus-visible { border-color: var(--sp-accent); box-shadow: 0 0 0 3px rgba(13, 102, 112, .25); }
.sp-gate-grid button:disabled { opacity: .45; cursor: not-allowed; }
.sp-gate-grid b { font-size: 21px; }
.sp-gate-grid span { color: var(--sp-muted); }
.sp-gate-grid em { font-style: normal; font-weight: 700; color: var(--sp-accent); }

/* tabs */
#workspace { max-width: 1500px; margin: 0 auto; }
.sp-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; }
.sp-tabs button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; white-space: nowrap; min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); cursor: pointer; }
.sp-tabs button.is-on { background: var(--sp-ink); color: var(--sp-card); border-color: var(--sp-ink); }

/* stage */
.sp-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.sp-scene { background: #0a1a30; border-radius: 16px; overflow: hidden; box-shadow: var(--sp-shadow); color: #eaf3f8; }
.sp-viewbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px; background: #0d223b; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sp-views { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-views button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; padding: 8px 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #d7e7f2; cursor: pointer; }
.sp-views button.is-on { background: #f3b54a; color: #1a1408; border-color: #f3b54a; }
.sp-transport { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sp-scene .sp-btn { background: #16304d; border-color: rgba(255, 255, 255, .2); color: #eef6fb; min-height: 40px; padding: 8px 12px; }
.sp-scene .sp-btn:hover { border-color: #f3b54a; }
.sp-speed { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sp-speed select, .sp-controls select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25); background: #16304d; color: #eef6fb; padding: 6px 8px; }
.sp-canvas-wrap { position: relative; }
#scene { display: block; width: 100%; touch-action: none; }
.sp-caption { margin: 0; padding: 10px 14px; background: #0d223b; color: #d6e6f1; border-top: 1px solid rgba(255, 255, 255, .08); min-height: 3.2em; }
.sp-controls { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px 12px; background: #10263f; }
.sp-ctl input[type=range] { margin: 0; }
.sp-ctl { display: flex; flex-direction: column; gap: 2px; font-weight: 700; min-width: 210px; flex: 1 1 210px; }
.sp-ctl input[type=range] { width: 100%; accent-color: #f3b54a; min-height: 28px; }
.sp-out { font-weight: 800; color: #ffd27a; margin-left: 6px; }
.sp-check { display: flex; align-items: center; gap: 8px; font-weight: 700; align-self: center; }
.sp-check input { width: 20px; height: 20px; accent-color: #f3b54a; }

/* readouts */
.sp-readouts { display: flex; flex-direction: column; gap: 12px; }
.sp-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-metric { background: var(--sp-card); border: 1px solid var(--sp-line); border-left: 4px solid var(--sp-sun); border-radius: 12px; padding: 7px 10px; box-shadow: var(--sp-shadow); line-height: 1.3; }
.sp-metric--v { border-left-color: var(--sp-accent); }
.sp-metric span, .sp-metric small { display: block; font-size: 16px; color: var(--sp-muted); }
.sp-metric span { font-weight: 700; color: var(--sp-ink); }
.sp-metric b { display: block; font-size: 22px; line-height: 1.25; color: var(--sp-ink); white-space: nowrap; }
.sp-year { background: var(--sp-card); border: 1px solid var(--sp-line); border-radius: 12px; padding: 10px; box-shadow: var(--sp-shadow); }
.sp-year h3 { margin: 0 0 6px; font-size: 18px; }
.sp-year canvas, #labGraph { display: block; width: 100%; }

/* lab work */
.sp-work { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(0, 1.4fr); gap: 14px; margin-top: 14px; }
.sp-panel { background: var(--sp-card); border: 1px solid var(--sp-line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--sp-shadow); }
.sp-panel h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; }
.sp-panel h3 { margin: 14px 0 6px; font-size: 18px; }
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sp-pred { border: 1px solid var(--sp-line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: var(--sp-soft); }
.sp-pred legend { font-weight: 700; padding: 0 4px; }
.sp-pred label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.sp-pred input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--sp-accent); }
.sp-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sp-cards li { border: 1px dashed var(--sp-line); border-radius: 10px; padding: 8px 10px; }
.sp-cards li span { display: block; color: var(--sp-muted); }
.sp-cards li.done { border-style: solid; border-color: var(--sp-ok); background: rgba(31, 122, 61, .08); }
.sp-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sp-steps li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sp-line); font-weight: 700; }
.sp-steps li.done { border-color: var(--sp-ok); color: var(--sp-ok); }
.sp-months { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sp .sp-chip { appearance: none; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; min-width: 56px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--sp-line); background: var(--sp-soft); color: var(--sp-ink); cursor: pointer; }
.sp .sp-chip.done { border-color: var(--sp-ok); color: var(--sp-ok); }
.sp .sp-chip.is-on { outline: 2px solid var(--sp-sun); }
.sp-inline { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.sp-inline select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); padding: 6px 8px; max-width: 100%; }
.sp-feedback { min-height: 1.5em; font-weight: 700; color: var(--sp-accent); margin: 8px 0 0; }
.sp-data-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sp-data-head h3 { margin: 2px 0 8px; font-size: 20px; }
.sp-table { overflow: auto; max-height: 290px; border: 1px solid var(--sp-line); border-radius: 10px; margin-bottom: 12px; }
.sp table { width: 100%; border-collapse: collapse; font-size: 16px; }
.sp th, .sp td { padding: 7px 10px; border-bottom: 1px solid var(--sp-line); text-align: right; white-space: nowrap; color: var(--sp-ink); }
.sp th:first-child, .sp td:first-child, .sp th:nth-child(2), .sp td:nth-child(2) { text-align: left; }
.sp th { position: sticky; top: 0; background: var(--sp-soft); font-weight: 800; }
.sp-empty { text-align: center !important; color: var(--sp-muted) !important; }

/* CER */
.sp-cer { margin-top: 14px; }
.sp-cer-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sp-checklist { list-style: none; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--sp-soft); min-width: 280px; }
.sp-checklist li { padding: 2px 0; color: var(--sp-muted); }
.sp-checklist li.done { color: var(--sp-ok); font-weight: 700; }
.sp-cer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.sp-cer-grid label { display: flex; flex-direction: column; font-weight: 800; }
.sp-cer-grid small { font-weight: 500; color: var(--sp-muted); }
.sp-cer-grid textarea { font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 130px; padding: 10px; margin-top: 4px; border: 1px solid var(--sp-line); border-radius: 10px; background: var(--sp-card); color: var(--sp-ink); resize: vertical; }
.sp-turnin { margin-top: 12px; }

/* test */
.sp-test { margin-top: 14px; max-width: 980px; }
.sp-test-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sp-test-head h2 small { font-size: 18px; color: var(--sp-muted); }
.sp-progress { flex: 0 1 260px; height: 10px; background: var(--sp-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--sp-line); }
.sp-progress i { display: block; height: 100%; background: var(--sp-accent); }
.sp-tag { display: inline-block; margin: 8px 0 0; padding: 3px 10px; border-radius: 999px; background: #fff1d6; color: #6b4300; font-weight: 700; }
html[data-theme="dark"] .sp-tag { background: #4a3510; color: #ffe2a8; }
.sp-q { font-size: 19px; font-weight: 700; margin: 12px 0; }
.sp-run { margin-bottom: 10px; }
.sp-readout { margin: 8px 0 0; padding: 10px 12px; border-left: 4px solid var(--sp-sun); background: var(--sp-soft); border-radius: 8px; }
.sp-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.sp-choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--sp-line); border-radius: 12px; cursor: pointer; background: var(--sp-card); }
.sp-choice input { position: absolute; opacity: 0; pointer-events: none; }
.sp-choice:focus-within { outline: 3px solid #eaa33d; outline-offset: 2px; }
.sp-choice.is-picked { border-color: var(--sp-accent); background: var(--sp-soft); }
.sp-choice.ok { border-color: var(--sp-ok); }
.sp-choice.no { border-color: var(--sp-no); }
.sp-choice em { margin-left: auto; font-style: normal; font-weight: 900; font-size: 20px; }
.sp-choice.ok em { color: var(--sp-ok); } .sp-choice.no em { color: var(--sp-no); }
.sp-letter { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--sp-soft); border: 1px solid var(--sp-line); }
.sp-choices:disabled .sp-choice { cursor: default; }
.sp-explain { padding: 10px 12px; border-radius: 10px; background: var(--sp-soft); }
.sp-explain.ok { border-left: 4px solid var(--sp-ok); } .sp-explain.no { border-left: 4px solid var(--sp-no); }
.sp-test-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.sp-test-nav .sp-btn--pri { margin-left: auto; }
.sp-review { padding-left: 22px; }
.sp-review li { margin: 8px 0; }
.sp-review li.ok > b { color: var(--sp-ok); } .sp-review li.no > b { color: var(--sp-no); }

/* dialogs */
.sp-dialog { max-width: 720px; border: 0; border-radius: 16px; padding: 22px 26px; color: #14263a; background: #fff; box-shadow: 0 20px 70px rgba(0, 0, 0, .4); font: 16px/1.55 "Atkinson Hyperlegible", system-ui, sans-serif; }
html[data-theme="dark"] .sp-dialog { background: #172633; color: #e6eef3; }
html[data-theme="dark"] .sp-dialog a { color: #8fd6f0; }
.sp-dialog::backdrop { background: rgba(6, 21, 37, .7); }
.sp-dialog h2 { margin-top: 0; }
.sp-x { float: right; font-size: 28px; line-height: 1; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; }

/* responsive */
@media (max-width: 1100px) {
  .sp-stage { grid-template-columns: minmax(0, 1fr); }
  .sp-metrics { grid-template-columns: repeat(3, 1fr); }
  .sp-work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sp-gate-grid, .sp-cer-grid { grid-template-columns: minmax(0, 1fr); }
  .sp-metrics { grid-template-columns: 1fr 1fr; }
  .sp-viewbar { flex-direction: column; align-items: stretch; }
  .sp-views button { flex: 1; }
  .sp-ctl { min-width: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sp * { transition: none !important; animation: none !important; } }
@media print { .sp-scene, .sp-tabs, .sp-actions, .sp-turnin { display: none !important; } }

.sp small { font-size: 16px; }
.sp .sp-th-title { text-align: left !important; background: var(--sp-card); color: var(--sp-accent); font-weight: 800; position: static; }
.sp .sp-th-sub { position: static; }
.sp-caption { font-size: 16px; }

/* ── v3 structure: modes, tabs, coach, pre-lab, advanced, toast ── */
.sp-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 8px; }
.sp-modes-label { font-weight: 800; margin-right: 4px; }
.sp-modes button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 2px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); cursor: pointer; }
.sp-modes button.is-on { border-color: var(--sp-accent); background: var(--sp-accent); color: var(--sp-accent-ink); }
.sp-modes-note { color: var(--sp-muted); }
.sp-tabs button.is-on { background: var(--sp-ink); color: var(--sp-card); border-color: var(--sp-ink); }
.sp-stage { grid-template-columns: minmax(0, 1fr) 350px; }
.sp-side { display: flex; flex-direction: column; gap: 10px; }
.sp-coach { background: var(--sp-card); border: 1px solid var(--sp-line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--sp-shadow); }
.sp-coach h2 { font-size: 18px; margin: 2px 0 6px; }
.sp-next { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--sp-soft); border-left: 4px solid var(--sp-sun); }
.sp-stepchecks { list-style: none; margin: 8px 0; padding: 0; }
.sp-stepchecks li { padding: 2px 0; color: var(--sp-muted); }
.sp-stepchecks li.done { color: var(--sp-ok); font-weight: 700; }
.sp-ch summary { cursor: pointer; font-weight: 800; padding: 4px 0; min-height: 32px; }
.sp-ice canvas { display: block; width: 100%; border-radius: 8px; margin: 6px 0; }
.sp-ice input[type=range] { width: 100%; accent-color: var(--sp-accent); }
.sp-zoom { position: absolute; left: 10px; bottom: 34px; display: flex; flex-direction: column; gap: 6px; }
.sp-zoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,26,48,.85); color: #fff; font: 800 20px/1 system-ui; cursor: pointer; }
.sp-adv { background: #0d223b; border-top: 1px solid rgba(255,255,255,.08); }
.sp-adv summary { cursor: pointer; padding: 10px 14px; font-weight: 800; color: #ffd27a; min-height: 44px; }
.sp-adv-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 4px 14px 14px; }
.sp-adv-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1 1 100%; }
.sp-adv .sp-metric { background: #16304d; border-color: rgba(255,255,255,.12); color: #eaf3f8; }
.sp-adv .sp-metric span, .sp-adv .sp-metric b, .sp-adv .sp-metric small { color: #eaf3f8; }
.sp-seed { display: flex; align-items: center; gap: 10px; }
.sp-seed b { font-size: 20px; color: #ffd27a; }
.sp-ctl small { font-weight: 500; color: #c3dce6; }
.sp-scene select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: #16304d; color: #eef6fb; padding: 6px 8px; }
.sp-flash { animation: crFlash 2.4s ease-out; border-radius: 10px; }
@keyframes crFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,184,0,0); } 15%, 55% { box-shadow: 0 0 0 5px #ffb800; } }
.sp-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: min(640px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px; background: #10253b; color: #fff; font-weight: 700; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
/* pre-lab */
.sp-prelab h3 { margin-top: 18px; }
.sp-qbox { padding: 12px 14px; border-radius: 12px; background: var(--sp-soft); border-left: 5px solid var(--sp-accent); margin: 10px 0; }
.sp-qbox small { display: block; color: var(--sp-muted); font-weight: 700; }
.sp-qbox b { font-size: 19px; }
.sp-prelab-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
.sp-vocab { display: flex; flex-wrap: wrap; gap: 8px; }
.sp .sp-term { position: relative; appearance: none; font: inherit; color: var(--sp-accent); font-weight: 800; background: none; border: 0; border-bottom: 2px dotted currentColor; padding: 0 1px; cursor: help; }
.sp-vocab .sp-term { border: 1px solid var(--sp-line); border-radius: 999px; padding: 6px 12px; background: var(--sp-soft); min-height: 40px; }
.sp-tip { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(320px, 80vw); padding: 10px 12px; border-radius: 10px; background: #10253b; color: #fff; font-weight: 500; text-align: left; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.sp-term:hover .sp-tip, .sp-term:focus .sp-tip, .sp-term:focus-visible .sp-tip { display: block; }
.sp-safety { padding-left: 0; list-style: none; }
.sp-safety li { padding: 6px 10px; margin: 6px 0; border-radius: 8px; background: #fff4d6; color: #5a3b00; }
html[data-theme="dark"] .sp-safety li { background: #3d2c0b; color: #ffe2a8; }
.sp-frame { line-height: 2.4; font-size: 17px; }
.sp-frame select { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 2px solid var(--sp-accent); background: var(--sp-card); color: var(--sp-ink); padding: 4px 8px; }
.sp-because { display: flex; flex-direction: column; font-weight: 700; }
.sp-because textarea { font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 80px; padding: 10px; margin-top: 4px; border: 1px solid var(--sp-line); border-radius: 10px; background: var(--sp-card); color: var(--sp-ink); }
.sp-varpool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border: 1px dashed var(--sp-line); border-radius: 12px; }
.sp-varbins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.sp-varbin { min-height: 120px; padding: 8px; border: 2px solid var(--sp-line); border-radius: 12px; background: var(--sp-soft); display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; cursor: pointer; }
.sp-varbin h4 { flex: 1 1 100%; margin: 0 0 4px; }
.sp .sp-varchip { appearance: none; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); cursor: pointer; }
.sp .sp-varchip.picked { border-color: var(--sp-sun); box-shadow: 0 0 0 3px rgba(232,154,44,.35); }
.sp .sp-varchip.right { border-color: var(--sp-ok); } .sp .sp-varchip.wrong { border-color: var(--sp-no); }
/* data + CER */
.sp-data h3 { margin: 14px 0 6px; font-size: 18px; }
#labGraph { margin-top: 14px; border-radius: 10px; }
.sp-pick { margin: 10px 0; border: 1px solid var(--sp-line); border-radius: 12px; padding: 8px 12px; }
.sp-pick summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.sp-rowpick { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.sp-rowpick input { width: 18px; height: 18px; margin-top: 3px; }
#rowPick { max-height: 220px; overflow: auto; }
.sp-done { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(31,122,61,.10); border: 2px solid var(--sp-ok); }
.sp-more { position: relative; }
.sp-more summary { list-style: none; }
.sp-more summary::-webkit-details-marker { display: none; }
.sp-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--sp-card); border: 1px solid var(--sp-line); box-shadow: var(--sp-shadow); min-width: 240px; }
@media (max-width: 1100px) { .sp-prelab-grid { grid-template-columns: minmax(0, 1fr); } .sp-stage { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .sp-varbins { grid-template-columns: minmax(0, 1fr); } .sp-adv-metrics { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .tlg-header, .tlg-footer, .sp-bar .sp-actions, .sp-modes, .sp-tabs, #stageWrap, .sp-pick, .sp-turnin, .sp-toast, #testCard { display: none !important; }
  .sp { background: #fff; color: #000; }
  #tab-data, #tab-cer { display: block !important; box-shadow: none; }
}
/* compact header rows so the scene and its controls fit at 1366×768 */
.sp-titles .sp-eyebrow { display: none; }
.sp-bar { padding: 8px 0 6px; }
.sp-bar h1 { font-size: 26px; white-space: nowrap; }
.sp-bar .sp-btn { min-height: 40px; padding: 7px 12px; }
.sp-modes { padding: 0 0 6px; }
.sp-modes button, .sp-tabs button { min-height: 40px; padding: 7px 13px; }
.sp-tabs { padding: 0 0 8px; }
@media (max-width: 760px) { .sp-bar h1 { white-space: normal; } }
/* scene full width; coach, readouts and graph in a row underneath */
.sp-stage { grid-template-columns: minmax(0, 1fr); }
.sp-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px; align-items: start; }
.sp-side .sp-metrics { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .sp-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sp-side .sp-year { grid-column: 1 / -1; } }
@media (max-width: 760px) { .sp-side { grid-template-columns: minmax(0, 1fr); } }

/* ── Electrochemistry Lab additions ── */
.sp-gate { background: linear-gradient(140deg, #0d1a2e, #1d4f8a 50%, #c8763f); }
.sp-scene { background: #0b1722; }
.sp-zoom { top: 44px; bottom: auto; left: 10px; flex-direction: row; }
.sp-side { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.05fr); }
.sp-metrics { grid-template-columns: 1fr 1fr; }
.sp-metric b { font-size: 20px; white-space: normal; }
.sp-metric--t { border-left-color: #2f8fd8; }
.sp .sp-btn--go { background: #f3b54a; border-color: #f3b54a; color: #1a1408; }
.sp .sp-btn--go:hover { border-color: #fff; }
.sp .sp-btn[aria-pressed="true"] { background: #7ce0c3; border-color: #7ce0c3; color: #062521; }
.sp-pair { display: flex; gap: 6px; }
.sp-pair select { flex: 1; }
.sp-ctl select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: #16304d; color: #eef6fb; padding: 6px 8px; width: 100%; }
.sp-ctl--btn { justify-content: flex-end; min-width: 150px; flex: 0 1 auto; }
.sp-row--tight { margin: 0; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sp-label { margin: 8px 0 0; font-weight: 800; }
.sp-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.sp-run .sp-readout { flex: 1 1 100%; }
.sp-q b { color: var(--sp-accent); }
.sp-choices + .sp-run { margin-top: 12px; }
.sp-fit { margin: 6px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--sp-soft); border-left: 4px solid var(--sp-ok); font-weight: 700; }
.sp-compare { margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--sp-line); border-radius: 10px; }
.sp-compare select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); padding: 4px 6px; max-width: 100%; }
.sp-compare-out { margin: 6px 0 0; font-weight: 700; }
.sp-compare-out.no { color: var(--sp-no); } .sp-compare-out.ok { color: var(--sp-ok); }
.sp-seed { flex-direction: row; align-items: center; gap: 12px; }
.sp-seed b { font-size: 20px; color: #ffd27a; }
.sp dialog sub, .sp dialog sup { line-height: 0; }
html[data-theme="dark"] .sp-dialog sub { color: inherit; }
@media (max-width: 1100px) { .sp-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sp-side .sp-year { grid-column: 1 / -1; } }
@media (max-width: 760px) { .sp-side { grid-template-columns: minmax(0, 1fr); } }

.sp-ctl--sel { min-width: 180px; }
.sp-views button { padding: 8px 12px; }
.sp-zoom { top: auto; bottom: 46px; left: auto; right: 12px; }
/* practice links (Pre-lab and the completion card) */
.sp-practice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--sp-soft); border-left: 4px solid var(--sp-accent); }
.sp-practice span[aria-hidden] { font-size: 26px; line-height: 1; }
.sp-practice b { display: block; }
.sp-practice a { color: var(--sp-accent); font-weight: 800; }
.sp-toast { pointer-events: none; }   /* informational only: never blocks a tap on the scene below it */

/* ── Body Systems & Immune Response Lab additions ── */
.sp-ctl output { font-weight: 800; color: #ffd27a; font-variant-numeric: tabular-nums; }
.sp-ctl--chk { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
.sp-ctl--chk input { width: 22px; height: 22px; accent-color: #f3b54a; }
.sp-ident { margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--sp-line); border-radius: 10px; }
.sp-cands { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 6px 0; max-height: 260px; overflow: auto; }
.sp-cands label { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.sp-cands input { width: 20px; height: 20px; accent-color: var(--sp-accent); }
.sp-cands small { margin-left: auto; color: var(--sp-muted); font-variant-numeric: tabular-nums; }
.sp-graph { margin: 14px 0 0; }
.sp-graph canvas { display: block; width: 100%; border-radius: 10px; }
.sp-graph figcaption { margin-top: 4px; }
.sp-views button { white-space: nowrap; }

/* ── Body Systems lab specifics ── */
.sp-gate { background: linear-gradient(140deg, #2a0d1f, #7a1f3d 45%, #1f6f78); }
.sp-scene { background: #0b1722; }
.sp-graph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .sp-graph-grid { grid-template-columns: minmax(0, 1fr); } }
.sp-role { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; font-weight: 600; }
.sp-role select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid var(--sp-line); background: var(--sp-card); color: var(--sp-ink); padding: 4px 6px; max-width: 100%; }
.sp-role span { font-weight: 800; min-height: 1em; }
.sp-ok { color: var(--sp-ok); } .sp-no { color: var(--sp-no); }
.sp-table { overflow-x: auto; }
.sp-table th { white-space: normal; min-width: 90px; }

/* ── Respiratory Physiology & Spirometry Lab (layout shared with the Wave H labs) specifics ── */
.sp-gate { background: linear-gradient(140deg, #071d2b, #0f5c6e 48%, #3f8a4a); }
.sp-scene { background: #0b1722; }
.sp-series { margin: 8px 0; border: 1px solid var(--sp-line); border-radius: 10px; padding: 6px 10px; background: var(--sp-card); }
.sp-series summary { cursor: pointer; font-weight: 800; min-height: 32px; display: flex; align-items: center; }
.sp-series .sp-table { max-height: 360px; overflow: auto; }
@media (max-width: 640px) { .sp-zoom { bottom: 8px; } }
.sp-tests { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; background: #0d223b; border-top: 1px solid rgba(255,255,255,.08); }
.sp-tests-label { font-weight: 800; color: #ffd27a; }
.sp-tests .sp-btn { background: #16304d; border-color: rgba(255,255,255,.2); color: #eef6fb; min-height: 40px; padding: 8px 12px; }
.sp-tests .sp-btn.is-done { background: #0f5446; border-color: #7ce0c3; }
.sp-tests .sp-btn.is-done::after { content: " ✓"; }
.sp-classify .sp-rowpick { min-height: 32px; }
.sp-eq { font-size: 18px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sp .sp-coef { width: 3.2em; min-height: 40px; font: 700 18px "Atkinson Hyperlegible", system-ui, sans-serif; text-align: center; border: 2px solid var(--sp-accent); border-radius: 8px; background: var(--sp-card); color: var(--sp-ink); }
.sp-compare input[type=text] { min-height: 40px; font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; border: 1px solid var(--sp-line); border-radius: 8px; padding: 4px 8px; background: var(--sp-card); color: var(--sp-ink); }
.sp-graph h3 { margin: 14px 0 6px; font-size: 18px; }

/* ══ Respiratory Physiology & Spirometry Lab: its own layout (everything above is the shared Wave H lab sheet) ══ */
.sp-gate { background: linear-gradient(140deg, #0a1a2c, #1c4a7a 48%, #c9a23f); }
.sp-titles .sp-eyebrow { display: none; }
/* tap targets: 44 px everywhere */
.sp .sp-btn, .sp-bar .sp-btn, .sp-scene .sp-btn, .sp-modes button, .sp-tabs button, .sp .sp-varchip, .sp .sp-chip { min-height: 44px; }
.sp .sp-btn--small { min-height: 44px; }
.sp-scene select, .sp-speed select, .sp-controls select, .sp-ctl select, .sp-frame select, .sp-compare select { min-height: 44px; }
.sp-vocab .sp-term { min-height: 44px; }
.sp-pick summary, .sp-ch summary { min-height: 44px; display: flex; align-items: center; }
.sp-rowpick { min-height: 44px; align-items: center; padding: 2px 0; cursor: pointer; }
.sp-rowpick input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--sp-accent); }
.sp-choice { min-height: 48px; }

/* start screen */
.sp-gate-card h2 { font-size: clamp(28px, 3.6vw, 40px); }
.sp-how { margin: 10px 0; padding-left: 26px; font-size: 18px; }
.sp-how li { padding: 2px 0; }
.sp-gate-note { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--sp-soft); border-left: 4px solid var(--sp-sun); }
.sp-gate-pick { margin: 16px 0 0; font-weight: 800; font-size: 18px; }
.sp-gate-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.sp-gate-grid button.is-first { border-color: var(--sp-accent); background: var(--sp-card); box-shadow: 0 0 0 3px rgba(13, 102, 112, .18); }
.sp-gate-grid em { order: -1; font-size: 16px; }
@media (max-width: 760px) { .sp-gate-grid--4 { grid-template-columns: minmax(0, 1fr); } }

/* bench: scene on the left, coach and readouts on the right */
.sp-stage { grid-template-columns: minmax(0, 1fr) 350px; }
.sp-stage.sp-stage--solo { grid-template-columns: minmax(0, 1fr); }
.sp-side { display: flex; flex-direction: column; gap: 10px; }
.sp-side .sp-metrics { grid-template-columns: 1fr 1fr; }
.sp-scene canvas { display: block; width: 100%; }
.sp-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 0 8px; }
.sp-duo .sp-canvas-wrap { border-radius: 14px; overflow: hidden; }
.sp-controls { gap: 8px 22px; padding: 10px 14px 6px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sp-ctl { min-width: 230px; flex: 1 1 230px; max-width: 460px; color: #eaf3f8; }
.sp-ctl input[type=range] { min-height: 44px; }
.sp-ctl .sp-out { margin-left: 4px; }
.sp-viewbar { background: #10263f; border-bottom: 0; padding: 6px 14px 12px; justify-content: flex-start; gap: 10px 22px; }
.sp-check { min-height: 44px; color: #eaf3f8; cursor: pointer; }
.sp-check input { width: 22px; height: 22px; }
.sp-check input:disabled + span { opacity: .7; }
.sp .sp-btn--go { font-size: 18px; padding: 10px 20px; }
.sp-heartkey { margin: 0; padding: 8px 14px 8px 38px; background: #0d2238; color: #eaf3f8; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 2px 30px; }
.sp-heartkey li { padding: 1px 0; }
.sp-heartkey .sp-nokey { list-style: none; grid-column: 1 / -1; margin-left: -24px; color: #c3d6e4; }
.sp-refrkey { margin: 0; padding: 8px 14px 0; color: #eaf3f8; }
.sp-sw { display: inline-block; width: 22px; height: 16px; vertical-align: -2px; border-radius: 3px; margin-right: 2px; border: 1px solid rgba(255, 255, 255, .5); }
.sp-sw--abs { background: repeating-linear-gradient(135deg, rgba(255, 110, 110, .9) 0 2px, rgba(255, 96, 96, .25) 2px 7px); }
.sp-sw--rel { background: radial-gradient(circle, rgba(255, 214, 130, .95) 1.5px, rgba(255, 196, 80, .2) 2px) 0 0 / 7px 7px; }
.sp-phasebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px 4px; }
.sp-phasebar-label { font-weight: 800; color: #ffd27a; }
.sp-phases { display: flex; flex-wrap: wrap; gap: 6px; }
.sp .sp-phase { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); background: #16304d; color: #eef6fb; cursor: pointer; }
.sp .sp-phase:hover { border-color: #f3b54a; }
.sp .sp-phase:disabled { opacity: .55; cursor: not-allowed; }
.sp .sp-phase.is-on { background: #f3b54a; border-color: #f3b54a; color: #1a1408; }
.sp .sp-phase.is-on::before { content: "▶ "; }
.sp-scrub { display: flex; align-items: center; gap: 12px; padding: 2px 14px 6px; font-weight: 700; color: #eaf3f8; }
.sp-scrub input { flex: 1; min-width: 0; min-height: 44px; accent-color: #f3b54a; }
.sp-scrub output { min-width: 108px; text-align: right; font-variant-numeric: tabular-nums; color: #ffd27a; font-weight: 800; }
.sp-caption { min-height: 4.6em; }
/* coach */
.sp-next { font-size: 17px; }
.sp-row--rec { align-items: center; margin: 10px 0 4px; }
.sp-row--rec .sp-muted { flex: 1 1 140px; }
.sp-row--calc { align-items: center; }
.sp-row--calc label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sp-compare input[type=text] { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; width: 96px; padding: 6px 8px; border-radius: 8px; border: 2px solid var(--sp-accent); background: var(--sp-card); color: var(--sp-ink); }
.sp-compare p { margin: 4px 0 6px; }
.sp-later { margin: 8px 0 0; }
.sp-metric b { font-size: 20px; white-space: normal; }
/* pre-lab sentence frames: one per line, the menu under its sentence on narrow screens */
.sp-frame { line-height: 1.5; display: grid; gap: 8px; }
.sp-frame-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sp-frame-row select { max-width: 100%; }
/* graphs */
.sp-keys { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
.sp-key { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sp-key canvas { width: 26px; height: 22px; display: inline-block; }
.sp-graph { max-width: 760px; }
.sp-graph-grid .sp-graph { max-width: none; }
.sp-graph h3 { margin: 0 0 6px; }
/* test */
.sp-test-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; }
#benchTest { display: flex; flex-direction: column; gap: 14px; }
.sp-links a { color: var(--sp-accent); font-weight: 700; }
@media (max-width: 1100px) {
  .sp-stage { grid-template-columns: minmax(0, 1fr); }
  .sp-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 760px) {
  .sp-duo { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .sp-duo .sp-canvas-wrap { border-radius: 0; }
  .sp-side { grid-template-columns: minmax(0, 1fr); }
  .sp-viewbar { flex-direction: row; align-items: center; }
  .sp-ctl { flex-basis: 100%; max-width: none; }
}
@media print { .sp-gate, #benchTest { display: none !important; } }
.sp-msg { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--sp-soft); border-left: 4px solid var(--sp-accent); font-weight: 700; }
/* readouts sit under the scene; the coach has the side column to itself */
.sp-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sp-main .sp-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-side { display: flex; flex-direction: column; }
.sp-tabs { flex-wrap: wrap; overflow-x: visible; }
@media (max-width: 1100px) { .sp-side { display: flex; } }
@media (max-width: 760px) { .sp-main .sp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sp-x { min-width: 44px; min-height: 44px; }
.sp-table { max-height: none; overflow-y: visible; }
.sp th { position: static; }
.sp-dialog h2 { overflow: hidden; min-height: 44px; display: flow-root; }
.sp-links { display: grid; gap: 6px; }
.sp-links a { display: block; min-height: 28px; }
.sp-frame, .sp-frame-row { min-width: 0; }
.sp-frame-row > * { min-width: 0; max-width: 100%; }
@media (max-width: 760px) { .sp-frame-row select { width: 100%; } }
#rowPick { max-height: 300px; }
/* the site's "Sign in to save your progress" chip docks here, in the page flow under the title row, so it never floats over the bench */
.sp-signin { max-width: 1500px; margin: 0 auto; }
.sp-signin:empty { display: none; }
.sp-signin .tlg-signin-note { margin: 0 0 8px; }
/* ── cardiac bench ── */
.sp-duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 10px; padding: 8px 10px 0; }
.sp-fig { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: #eaf3f8; padding: 2px 4px 4px; }
.sp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sp-legend svg { flex: none; }
.sp-sw--red { background: linear-gradient(135deg, #ec5157, #a3161f); }
.sp-sw--blue { background: linear-gradient(135deg, #6c86de, #2c3d8f); }
.sp-heartkey { border-radius: 10px; }
.sp-outline { margin: 0; flex: 1 1 100%; color: #eaf3f8; }
.sp-outline b { color: #ffd27a; }
.sp-controls { display: flex; flex-wrap: wrap; align-items: center; }
.sp .sp-phase--valve { border-color: rgba(143, 240, 176, .55); }
.sp-transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sp-speed { display: inline-flex; align-items: center; gap: 8px; color: #eaf3f8; font-weight: 700; }
.sp-speed select { min-height: 44px; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; border-radius: 8px; padding: 4px 8px; }
.sp-transport--test { display: none; }
.sp-scrub output { min-width: 150px; }
.sp-caption { color: #eaf3f8; padding: 4px 14px 12px; margin: 0; }
@media (max-width: 1240px) { .sp-duo { grid-template-columns: minmax(0, 1fr); } .sp-duo .sp-fig:first-child .sp-canvas-wrap { max-width: 640px; margin: 0 auto; width: 100%; } }
@media (max-width: 760px) { .sp-duo { padding: 0; } .sp-legend { padding: 2px 10px 6px; } }
.sp-outline { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.sp-outline span { display: inline-block; }
/* ── spirometry bench ── */
.sp-controls label.sp-ctl { display: flex; flex-direction: column; gap: 4px; }
.sp-controls select { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25); background: #16304d; color: #eef6fb; padding: 6px 8px; max-width: 100%; }
.sp-controls select:disabled { opacity: .6; }
.sp-mans { display: flex; flex-wrap: wrap; gap: 8px; }
.sp .sp-man { min-height: 44px; }
.sp-manmsg { margin: 6px 0 0; color: #ffd27a; font-weight: 700; flex: 1 1 100%; }
.sp-graphseg { display: inline-flex; gap: 6px; padding: 0 2px; }
.sp-graphseg button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .22); background: #16304d; color: #d7e7f2; cursor: pointer; }
.sp-graphseg button.is-on { background: #f3b54a; color: #1a1408; border-color: #f3b54a; }
#graph { cursor: crosshair; }
#graph:focus-visible { outline: 3px solid #eaa33d; outline-offset: -3px; }
.sp-chev { display: inline-block; font-size: 20px; line-height: 1; }
.sp-chev--in { color: #8ff0b0; transform: scaleX(-1); }
.sp-chev--out { color: #ffd27a; }
.sp-sw--trace { background: #4fd1ff; height: 6px; vertical-align: 3px; }
.sp-sw--rv { background: repeating-linear-gradient(135deg, rgba(200, 150, 255, .7) 0 2px, rgba(200, 120, 255, .15) 2px 7px); }
.sp-sw--a { background: #b85c00; } .sp-sw--b { background: #0b62a8; } .sp-sw--c { background: rgba(91, 60, 180, .55); }
.sp-sw--hatch { background: repeating-linear-gradient(135deg, #5b3cb4 0 2px, rgba(91, 60, 180, .2) 2px 7px); }
html[data-theme="dark"] .sp-sw--a { background: #ffb454; } html[data-theme="dark"] .sp-sw--b { background: #8fd3ff; } html[data-theme="dark"] .sp-sw--c { background: rgba(183, 155, 255, .55); }
.sp-card { border: 1px solid var(--sp-line); border-left: 4px solid #7a5cd6; border-radius: 10px; padding: 8px 10px; margin: 8px 0; background: var(--sp-soft); }
.sp-card p { margin: 4px 0 0; }
.sp-hid { color: var(--sp-muted); font-style: italic; }
.sp-ok { color: var(--sp-ok); font-weight: 800; font-size: 20px; }
.sp-gasfig { margin: 10px 0; max-width: 520px; }
.sp-gasfig svg { width: 100%; min-width: 0; height: auto; display: block; }
.sp-gasfig figcaption { color: var(--sp-muted); }
.sp-compare select { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; border-radius: 8px; padding: 4px 8px; max-width: 100%; }
.sp-tag { font-weight: 800; color: var(--sp-accent); margin: 0; }
.sp-test input[type=text] { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; width: 120px; padding: 6px 8px; border-radius: 8px; border: 2px solid var(--sp-accent); background: var(--sp-card); color: var(--sp-ink); }
.sp-legend .sp-legend-note { display: block; flex: 1 1 100%; }
