/* lab.css — the Test Lab's glass (lab-panel.js): same tokens as style.css (glass, accent, Bricolage), mobile first */
#lab { position: fixed; inset: 0; z-index: 7; pointer-events: none; }
#lab > * { pointer-events: auto; }
#lab.booting > :not(#lab-card), #lab.booting #lab-card .x, #lab.booting #lab-card .act { visibility: hidden; }
body.lab-on #card, body.lab-on #hint, body.lab-on #scale, body.lab-on #bench { display: none !important; }
body.lab-on #crumbs { display: none; }
body.lab-opening #stage { visibility: hidden; }
.glass-strong { background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: inset 0 1px 0 var(--edge), var(--shadow); }

#lab-strip { position: fixed; top: calc(var(--pad) + env(safe-area-inset-top)); left: var(--pad); right: calc(var(--pad) + 110px); display: flex; gap: 2px; padding: 5px; border-radius: 22px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
#lab-strip::-webkit-scrollbar { display: none; }
/* every instrument is a plain button: icon, short name, and the number key that picks it. Desktop stacks icon over name; the phone has a scrolling row of chips */
#lab-strip button { position: relative; flex: none; min-width: 64px; height: 54px; padding: 6px 10px 0; border: 0; border-radius: 16px; background: transparent; color: var(--ink-dim); font: 600 12.5px/1.1 var(--font); cursor: pointer; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; scroll-snap-align: center; }
#lab-strip button svg { width: 20px; height: 20px; flex: none; }
#lab-strip button kbd { position: absolute; top: 3px; right: 5px; font: 600 12px/1 var(--font); color: var(--ink-faint); }
#lab-strip button kbd:empty { display: none; }
#lab-strip button:hover { background: var(--glass-light); color: var(--ink); }
#lab-strip button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#lab-strip button.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(11, 122, 109, 0.35); }
#lab-strip button svg path { stroke: currentColor; stroke-width: 1.6; }
#lab-strip button.on kbd { color: var(--accent-ink); opacity: 0.7; }

/* the sample on the bench, always named and one tap from its close-up; the reference only when you compare */
#lab-specs { position: fixed; top: calc(var(--pad) + 72px + env(safe-area-inset-top)); left: var(--pad); display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 22px; max-width: calc(100vw - 2 * var(--pad)); }
#lab-specs .spec { min-height: 44px; padding: 4px 12px 4px 6px; border: 0; border-radius: 18px; background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 9px; max-width: 62vw; text-align: left; font: inherit; }
#lab-specs .spec:hover { background: var(--glass-light); }
#lab-specs .spec[data-ab="A"] { background: var(--glass-light); }
#lab-specs .spec .sw { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 1.5px rgba(20, 30, 40, 0.38), 0 2px 8px rgba(20, 30, 40, 0.22); }
#lab-specs .spec span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
#lab-specs .spec small { font-size: 12px; font-weight: 600; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.05em; }
#lab-specs .spec[data-ab="B"] small { color: var(--ink-dim); }
#lab-specs .spec b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lab-specs .spec em { font-style: normal; font-size: 12px; color: var(--ink-dim); white-space: nowrap; flex: none; padding-right: 4px; }
#lab-specs .spec em::after { content: " ›"; }
#lab-specs .x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-dim); cursor: pointer; font-size: 16px; flex: none; }
#lab-specs .ghost { min-height: 44px; padding: 0 14px; border: 0; border-radius: 18px; background: transparent; color: var(--accent-text); font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap; }

/* the Sample sheet: the close-up, its name and source, two big actions, the key numbers with their badge */
#lab .sv { position: relative; margin: 0 -4px; border-radius: 18px; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, rgba(11, 122, 109, 0.06), rgba(20, 30, 40, 0.08)); }
#lab .sv canvas { display: block; width: 100%; height: min(42vh, 360px); touch-action: none; cursor: grab; }
#lab .sv-hint { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 14px 12px 8px; font-size: 12px; color: var(--ink-dim); pointer-events: none; background: linear-gradient(transparent, rgba(255, 255, 255, 0.9)); }   /* legible over the atoms */
#lab .sv-lv { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
#lab .sv-lv button, #lab .sv-form button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.85); color: var(--ink-dim); font: 600 12.5px/1 var(--font); cursor: pointer; box-shadow: inset 0 0 0 1px var(--edge-strong); }
#lab .sv-lv button[aria-pressed="true"], #lab .sv-form button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
#lab .sv-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
#lab .sv-form small { font-size: 12px; color: var(--ink-dim); margin-right: 2px; }
#lab .sv-form button { background: var(--glass-light); }
#lab-sheet h3.sv-name { margin: 12px 0 0; font-size: 22px; font-weight: 700; color: var(--ink); text-transform: none; letter-spacing: -0.02em; }
#lab .sv-f { margin: 2px 0 0; font-size: 15px; color: var(--ink-dim); }
#lab .sv-kind { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-dim); }
#lab .sv-kind a { color: var(--accent-text); }
#lab .sv-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
#lab .sv-act .big { flex: 1 1 160px; min-height: 48px; border: 0; border-radius: 24px; background: var(--glass-light); color: var(--ink); font: 700 15px/1 var(--font); cursor: pointer; box-shadow: inset 0 0 0 1px var(--edge-strong); }
#lab .sv-act .big.go { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
#lab-sheet h4.sv-h { margin: 14px 0 6px; font-size: 13px; font-weight: 700; }
#lab .sv-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
#lab .kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center; text-align: left; padding: 9px 11px; border: 0; border-radius: 14px; background: var(--glass-light); color: var(--ink); cursor: pointer; font: inherit; }
#lab .kv small { grid-column: 1 / -1; font-size: 12px; color: var(--ink-dim); }
#lab .kv b { font-size: 15px; font-variant-numeric: tabular-nums; }
#lab .kv b u { text-decoration: none; font-weight: 500; font-size: 12px; color: var(--ink-dim); }
#lab .kv em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--ink-faint); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#lab .hint { margin: 2px 0 6px; font-size: 12.5px; color: var(--ink-dim); }
#lab .pour { padding-bottom: 6px; }

#lab-card { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); width: min(620px, calc(100vw - 2 * var(--pad))); max-height: 42vh; display: flex; flex-direction: column; border-radius: 22px; padding: 12px 14px 12px 16px; }
#lab-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
#lab-card h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
#lab-card .sub { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-dim); }
#lab-card .x, #lab-sheet .x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--glass-light); color: var(--ink); cursor: pointer; font-size: 18px; line-height: 1; flex: none; }
#lab-card .body { overflow-y: auto; margin-top: 6px; min-height: 0; }
#lab-card .act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#lab-card .roads .place { margin: 8px 0 0; font-size: 12px; color: var(--ink-dim); }
#lab-card .roads .compute-roads { font-size: 12px; max-height: 50vh; overflow: auto; }
#lab-card .roads .compute-roads .row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
#lab-card .roads .compute-roads button { height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: var(--glass-light); color: var(--ink); font: 600 12px/1 var(--font); cursor: pointer; }
#lab-card .act button, #lab-sheet .tools button, #lab-sheet .file { height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: var(--glass-light); color: var(--ink); font: 600 13px/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; }
#lab-card .act button.go, #lab-sheet .tools button.go { background: var(--accent); color: var(--accent-ink); }
#lab-card .act button:disabled { opacity: 0.6; cursor: progress; }

.vals { display: flex; flex-wrap: wrap; gap: 5px; }
.lv { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 8px 5px 10px; border-radius: 12px; background: var(--glass-light); font-size: 13px; }
.lv small { color: var(--ink-dim); font-size: 12px; }
.lv b { font-weight: 700; font-variant-numeric: tabular-nums; }
.lv u { text-decoration: none; color: var(--ink-dim); font-size: 12px; }
.lv em { font-style: normal; color: var(--ink-faint); font-size: 12px; }
/* the provenance badge is .badge.word of _engines/ui/ui.css (lab-number.js), shared with every lab */
.lv lab-number, .kv lab-number { white-space: nowrap; }
/* the badge in words is wider than the old letter: in the overview's tiles it takes its own line under the number */
#lab .quick button > .badge.word, #lab .kv > .badge.word { grid-column: 1 / -1; justify-self: start; }
.pc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; align-self: center; margin-left: 4px; flex: none; cursor: help; }
.pc-error { background: #ff5a4f; box-shadow: 0 0 0 2px rgba(255, 90, 79, .25); } .pc-warn { background: #ffb02e; box-shadow: 0 0 0 2px rgba(255, 176, 46, .2); }
.unk { color: #b3361b; font-weight: 600; }
#lab .why { margin: 8px 0 0; font-size: 13px; color: var(--ink-dim); }
#lab .amp { margin: 6px 0 0; font-size: 12px; color: #8a5200; font-weight: 600; }
#lab .law { margin: 8px 0 0; display: flex; flex-direction: column; gap: 2px; }
#lab .law code { font: 500 12.5px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
#lab .law small { font-size: 12px; color: var(--ink-faint); }
#lab .vs { margin: 8px 0 0; font-size: 13px; color: var(--ink-dim); display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
#lab .vs b { color: var(--ink); }
#lab .eng, #lab .lin { margin: 6px 0 0; font-size: 12px; color: var(--ink-dim); }
#lab .quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#lab .quick button { display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; gap: 2px 6px; padding: 8px 10px; border: 0; border-radius: 14px; background: var(--glass-light); color: var(--ink); cursor: pointer; font: inherit; }
#lab .stab { margin: 8px 0 0; padding: 8px 10px; border-radius: 14px; background: var(--glass-light); }
#lab .stab small { display: block; color: var(--ink-dim); font-size: 12px; }
#lab .stab.v-dynamically_unstable b, #lab .stab.v-above_hull b { color: #b3361b; }
#lab .quick small { grid-column: 1 / -1; color: var(--ink-dim); font-size: 12px; }
#lab .quick b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lab .ctl { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--ink-dim); }
#lab .ctl label { display: flex; align-items: center; gap: 6px; }
/* the room (gravity, pressure, temperature, gas): a chip on the overview, a line on every reading, sliders in the sheet */
#lab .roomchip { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; text-align: left; padding: 7px 12px; border: 1px solid var(--edge-strong); border-radius: 12px; background: var(--glass-light); color: var(--ink); font: 500 13px/1.3 var(--font); cursor: pointer; min-height: 40px; max-width: 100%; }
#lab .roomchip small { color: var(--ink-dim); font-size: 12px; }
#lab .roomchip span { grid-column: 1 / -1; color: var(--ink-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
#lab p.cond { margin: 4px 0 8px; font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
#lab-sheet .presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
#lab-sheet .presets button { min-height: 36px; padding: 0 12px; border: 1px solid var(--edge-strong); border-radius: 18px; background: var(--glass-light); color: var(--ink); font: 600 12.5px var(--font); cursor: pointer; }
#lab-sheet .presets button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#lab-sheet label.rs { display: block; margin: 0 0 14px; font-size: 13px; color: var(--ink); }
#lab-sheet label.rs > span { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
#lab-sheet label.rs b { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
#lab-sheet label.rs input[type=range] { width: 100%; height: 32px; accent-color: var(--accent-text); }
#lab-sheet label.rs .ticks { position: relative; display: block; height: 15px; color: var(--ink-dim); font-size: 12px; }
#lab-sheet label.rs .ticks i { position: absolute; top: 0; font-style: normal; white-space: nowrap; transform: translateX(-50%); }
#lab-sheet label.rs .ticks i:first-child { left: 0; transform: none; }
#lab-sheet label.rs .ticks i:last-child { right: 0; transform: none; }
#lab select, #lab input:not([type=range]):not([type=file]), #lab textarea { background: var(--glass-light); color: var(--ink); border: 1px solid var(--edge-strong); border-radius: 10px; padding: 6px 8px; font: 500 13px var(--font); }
#lab input.pct { width: 56px; }
#lab textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, monospace; }
#lab input[type=range] { accent-color: var(--accent-text); width: 130px; }
#lab .prog { margin-top: 8px; }
#lab .prog small { color: var(--ink-dim); font-size: 12px; }
#lab svg { width: 100%; height: auto; display: block; touch-action: none; }
#lab svg .ax line { stroke: rgba(20, 30, 40, 0.30); }
#lab svg text { fill: var(--ink-dim); font: 500 12px var(--font); }
#lab svg path { fill: none; stroke: var(--accent); stroke-width: 1.8; }
#lab svg .pt { fill: var(--accent); stroke: #ffffff; stroke-width: 2; cursor: grab; }
#lab svg .lbl { fill: var(--ink); font-weight: 600; }
#lab svg .dot { fill: #c77700; }
#lab svg .tip { fill: var(--ink); font-weight: 600; }

#lab-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-height: 70vh; display: flex; flex-direction: column; border-radius: 24px 24px 0 0; padding: 0 16px calc(12px + env(safe-area-inset-bottom)); }
#lab-sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
#lab-sheet h2 { margin: 0; font-size: 17px; }
#lab-sheet .body { overflow-y: auto; min-height: 0; padding-bottom: 8px; }
#lab-sheet h3 { margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
#lab-sheet .list button { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 6px; border: 0; border-top: 1px solid var(--edge); background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
#lab-sheet .list button.on { color: var(--accent-text); }
#lab-sheet .list small { color: var(--ink-dim); font-size: 12px; }
#lab-sheet .tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
#lab-sheet .file input { display: none; }
#lab-sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#lab-sheet th { text-align: left; font-weight: 500; color: var(--ink-dim); padding: 4px 8px 4px 0; vertical-align: top; }
#lab-sheet td { padding: 4px 8px 4px 0; border-top: 1px solid var(--edge); vertical-align: top; font-variant-numeric: tabular-nums; }
#lab-sheet td small { color: var(--ink-faint); }
#lab-sheet td em { font-style: normal; color: var(--ink-faint); }
#lab-sheet .scroll { overflow-x: auto; }
#lab-sheet table.cmp td { white-space: nowrap; }
#lab-sheet table.cmp tbody th { position: sticky; left: 0; z-index: 1; background: #f4f7f8; min-width: 92px; }
#lab-sheet details { border-top: 1px solid var(--edge); padding: 6px 0; }
#lab-sheet summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
#lab-sheet summary small { color: var(--ink-faint); font-weight: 500; }
#lab-sheet .charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
#lab-sheet figure { margin: 0; padding: 8px; border-radius: 14px; background: var(--glass-light); }
#lab-sheet figcaption { font-size: 12px; color: var(--ink-dim); margin-bottom: 4px; }
#lab-drop { position: fixed; inset: 12px; border: 2px dashed var(--accent); border-radius: 24px; display: grid; place-items: center; font-size: 18px; font-weight: 600; color: var(--accent-text); background: rgba(255, 255, 255, 0.78); z-index: 20; }
#lab-toast { position: fixed; left: 50%; top: calc(110px + env(safe-area-inset-top)); transform: translate(-50%, -8px); max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 16px; font-size: 13px; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; z-index: 21; }
#lab-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* desktop: the card is a left column, the sheet a right one, each at most --panel-w (style.css); the bench keeps the middle.
 * While a sheet is open the card folds to its tab (lab-panel.js), so the two never take more than one column together. */
@media (min-width: 760px) {
  #lab-card { left: var(--pad); transform: none; width: var(--panel-w); max-height: calc(100vh - 220px); bottom: calc(86px + env(safe-area-inset-bottom)); }
  #lab-sheet { left: auto; right: var(--pad); bottom: calc(84px + env(safe-area-inset-bottom)); width: var(--panel-w); max-height: calc(100vh - 180px); border-radius: 24px; }
  /* a lesson (class-panel.js) takes the top of the left column, the card its bottom */
  body[data-class] #lab-card { max-height: calc(50vh - 130px); }
}
@media (min-width: 900px) {
  #lab-strip { right: auto; max-width: calc(100vw - 2 * var(--pad) - 120px); }
}
@media (max-width: 520px) {
  #lab-card { max-height: 36vh; padding: 10px 12px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  #lab .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #lab-card h2 { font-size: 15.5px; }
}
/* default: the sentence; Advanced (the viewer's global switch, body.advanced): numbers, law, levels, engine details */
body:not(.advanced) #lab .adv-only { display: none !important; }
#lab .say { margin: 4px 0 2px; font-size: 15px; line-height: 1.45; color: var(--ink); }
#lab .lvl { margin: 6px 0 0; font-size: 12px; color: var(--ink-dim); }
#lab .link { border: 0; background: none; color: var(--accent-text); font: 600 12px var(--font); cursor: pointer; padding: 0; }
/* phone: one station full screen, controls in the bottom sheet, every target ≥ 44 px */
@media (max-width: 520px) {
  #lab-card .act button, #lab-card .x, #lab-sheet .x, #lab .quick button, #lab select { min-height: 44px; }
  #lab-strip { top: calc(var(--pad) + 54px + env(safe-area-inset-top)); right: var(--pad); gap: 4px; border-radius: 999px; }
  #lab-strip button { flex-direction: row; height: 44px; min-width: 44px; padding: 0 14px 0 11px; border-radius: 22px; gap: 7px; font-size: 13px; }
  #lab-strip button kbd { display: none; }
  #lab-strip button.ov { margin-right: 2px; }
  #lab-specs { top: calc(var(--pad) + 114px + env(safe-area-inset-top)); }
  /* both chips share the width: the names shorten, the × stays on screen */
  #lab-specs { right: var(--pad); }
  #lab-specs .spec { flex: 1 1 0; min-width: 0; max-width: none; }
  #lab-specs .spec em { display: none; }
  #lab-specs .ghost { flex: none; }
  #lab-card { border-radius: 22px 22px 0 0; left: 0; right: 0; width: auto; transform: none; bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body.lab-on #dock { display: none; }
}
/* the overview: not an instrument, set apart from them */
#lab-strip button.ov { color: var(--ink); margin-right: 6px; box-shadow: inset 0 0 0 1px var(--edge-strong); }
#lab-strip button.ov.on { box-shadow: 0 2px 10px rgba(11, 122, 109, 0.35); color: var(--accent-ink); }
/* a reading in the overview: an unknown says why and offers the computation where the engine has one */
#lab .quick .qi { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#lab .quick .qi > button[data-go] { width: 100%; }
#lab .quick .qwhy { margin: 0 2px; font-size: 12px; line-height: 1.3; color: var(--ink-faint); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#lab .quick .qc { min-height: 32px; padding: 4px 10px; border: 1px solid var(--accent); border-radius: 12px; background: transparent; color: var(--accent-text); font: 600 12px/1.2 var(--font); cursor: pointer; text-align: center; }
#lab .quick .qc:hover { background: var(--accent); color: var(--accent-ink); }
/* the reading a run has just taken */
@keyframes lab-fresh { from { background: rgba(127, 227, 214, 0.28); } to { background: transparent; } }
#lab .say.fresh { animation: lab-fresh 1.6s ease-out; border-radius: 10px; }
/* phone: the Sample sheet leaves the top half to the bench, where the camera has gone to the block itself */
@media (max-width: 720px) {
  #lab-sheet:has(.sv) { max-height: var(--sheet-max, 46vh); }
  #lab .sv canvas { height: min(26vh, 230px); }
}
/* touch: every control is at least 44 px */
@media (max-width: 520px), (pointer: coarse) {
  #lab-card .x, #lab-sheet .x, #lab-specs .x { width: 44px; height: 44px; }
  #lab .quick .qc { min-height: 44px; }
}
/* the chip row says it scrolls: a fade on the side that has more */
#lab-strip.fr { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); }
#lab-strip.fl { -webkit-mask-image: linear-gradient(90deg, transparent, #000 34px); mask-image: linear-gradient(90deg, transparent, #000 34px); }
#lab-strip.fl.fr { -webkit-mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent); }
/* a running test: still readable, with a spinner, not a faded button */
#lab-card .act button.go:disabled { opacity: 1; background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
#lab-card .act button.go:disabled::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: lab-spin 0.8s linear infinite; }
@keyframes lab-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #lab-card .act button.go:disabled::before { animation: none; } }
/* the Sample sheet's "why it looks like this" (why-look.js) */
#lab-sheet table.whylook th { text-align: left; font-weight: 600; padding: 4px 8px 4px 0; vertical-align: top; }
#lab-sheet table.whylook td:nth-child(2) { white-space: nowrap; }
#lab-sheet table.whylook .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 6px -2px 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
/* phone: a sheet over the lower half at most; in a lesson the card folds to its title and the lesson sits above it */
@media (max-width: 759px) {
  #lab-sheet { max-height: var(--sheet-max, 46vh); }
  body[data-class] #lab-card .body, body[data-class] #lab-card .act { display: none; }
}
