/* The lab's chrome: the site's header (the lab's pills in its tool row) and footer, the page bar under the header,
   two editor panels (the code and the stage) and the lab's drawers, all in the site's one gray (style.css
   --site-panel) and its controls (.site-act, .site-fold, .site-field) in every style. The style's tokens are
   re-pointed to the panel's inside #lab-root, so these rules and style.css's textarea follow; fields, hovers and the
   stage's checks only darken the gray. The exported page shares none of it. */
/* The window's height at least, taller when the stage's and the code's floors need it: a fixed 100vh left a short
   window's stage nothing. */
/* minmax(0, 1fr): an auto column took the width of anything wider than the window. */
#lab-root { display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 100vh;
  --lab-stage-min: min(40vh, 240px); --lab-code-min: min(40vh, 12rem);
  --text-primary: var(--site-panel-ink); --text-muted: var(--site-panel-muted); --surface: var(--ui-field);
  --surface-hover: var(--ui-wash); --border: rgba(255, 255, 255, .15); --border-strong: var(--ui-line);
  --accent: var(--site-panel-ink); --accent-fill: var(--site-panel-ink); --label: #1c1c1c; --bad: #ffa3a3; --radius: 6px;
  color: var(--site-panel-ink); color-scheme: dark; }
#lab-root ::placeholder { color: var(--text-muted); opacity: 1; }
/* The site's action, compact: the lab is dense. */
#lab-root :is(#lab-bar, #lab-main, .lab-drawer) .site-act { font-size: .8125rem; min-height: 30px; padding: .15rem .7rem; }
#lab-root :is(#lab-main, .lab-drawer) :is(input[type="text"], input[type="number"], input[type="search"], select) {
  font: inherit; color: inherit; background: var(--ui-field); border: 1px solid var(--ui-line); border-radius: 6px; padding: .2rem .45rem; }
#lab-root :is(#lab-main, .lab-drawer) :is(input[type="checkbox"], input[type="range"]) { accent-color: var(--ui-ink); }
.lab-hint { color: var(--text-muted); }

/* The page bar: the piece's name, its actions and the status; nothing in it toggles. */
#lab-bar { margin: 0 12px 12px; padding: .45rem .75rem .45rem 1.1rem; background: var(--site-panel); border-radius: var(--site-panel-radius);
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1.1rem; }
#lab-name-line { display: flex; gap: .55rem; align-items: baseline; min-width: 0; max-width: min(40ch, 40vw); }
#lab-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); white-space: nowrap; }
/* One line, cut with an ellipsis: a long sequence's phrases, wrapped, squeezed the canvas to nothing. */
#lab-text { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lab-acts { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.lab-acts .lab-hint { font-size: .8rem; }
/* One filled action a panel: run, while it shows, is the step; keep waits for it. */
#lab-bar .site-act[aria-expanded="true"] { background: var(--ui-press); }
#lab-bar:has(#lab-run:not([hidden])) #lab-keep { background: transparent; color: var(--site-panel-ink); border-color: var(--ui-line); font-weight: inherit; }
#lab-example-note[hidden], #lab-level[hidden], #lab-keep-confirm[hidden] { display: none; }
#lab-keep-confirm { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .85rem;
  padding: .25rem .6rem; border-radius: 6px; background: var(--ui-field); }
#lab-said { display: flex; gap: .4rem .75rem; align-items: center; flex: 1 1 14rem; min-width: 0; }
/* At most about six lines: the bar sits above the editor, so a long status grew it and pushed the canvas off the window. */
#lab-status { font-size: .85rem; color: var(--text-muted); flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 7.2em; overflow-y: auto; }
#lab-status.lab-bad { color: var(--bad); }
#lab-status .lab-status-code { font: .8rem/1.45 ui-monospace, Menlo, monospace; white-space: pre; }
#lab-status .lab-status-pad { font-size: 0; tab-size: 0; }
#lab-status .lab-status-pad::before { content: attr(data-over); font-size: .8rem; tab-size: 8; visibility: hidden; }
#lab-build { margin-left: auto; font-size: .75rem; font-family: monospace; color: var(--text-muted); }
#lab-storage-note { flex: 1 0 100%; margin: 0; font-size: .85rem; color: var(--bad); }
#lab-storage-note[hidden] { display: none; }
@media (max-width: 44rem) {
  #lab-bar { margin: 0 10px 10px; padding: .45rem .6rem; }
  #lab-name-line { max-width: 100%; }
  /* Each group on lines of its own, wrapped: scrolled sideways, "run" and the exports sat past a phone's edge unseen. */
  .lab-acts { flex: 1 0 100%; }
  #lab-keep-confirm { flex-basis: min(22rem, 80vw); }
  #lab-build { display: none; }
}

body.lab-dropping::after { content: "drop the piece to open it"; position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent); outline: 3px dashed var(--accent); outline-offset: -12px;
  font-size: 1.2rem; pointer-events: none; }
/* While a file is dragged in, the host script's frame takes no hits, so the drop lands on the page. */
body.lab-dropping-here #lab-host-stage > .lab-host-frame { pointer-events: none; }

/* The lab's drawers (shared/drawer.js, style.css .site-drawer): Reference, History, low-res export, publish. */
.site-drawer.lab-drawer-wide { width: min(30rem, calc(100vw - 24px)); }
.lab-drawer { font-size: .875rem; }
:is(#lab-history, #lab-lowres, #lab-publish, #lab-publish-form) > :not(.site-drawer-head) + * { margin-top: .65rem; }
.lab-drawer .site-drawer-note { font-size: .85rem; }
.lab-drawer label { display: flex; gap: .5rem; align-items: center; }
.lab-drawer label.lab-drawer-field { display: grid; gap: .3rem; }
.lab-drawer-acts { display: flex; gap: .5rem; flex-wrap: wrap; }
.lab-drawer a { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
#lab-lowres input { width: 6rem; }
#lab-publish-form[hidden], #lab-publish-done[hidden], #lab-publish-parent[hidden], #lab-publish-name-said[hidden], #lab-history-empty[hidden] { display: none; }
#lab-publish-name.lab-bad { border-color: var(--bad); }
#lab-publish-link { word-break: break-all; }
#lab-publish-status:empty { display: none; }
#lab-publish-status.lab-bad { color: var(--bad); }
#lab-history-list { list-style: none; display: flex; flex-direction: column; gap: .25rem; }
#lab-history-list:empty, #lab-history-status:empty { display: none; }
.lab-history-row { display: grid; grid-template-columns: 5rem 1fr; grid-template-rows: auto auto; column-gap: .7rem; align-items: center;
  width: 100%; padding: .3rem; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lab-history-row:hover { background: var(--ui-wash); }
.lab-history-still { grid-row: span 2; width: 5rem; height: 2.8rem; object-fit: cover; border-radius: 4px; background: var(--ui-field); }
.lab-history-phrase { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lab-filter { width: 100%; margin: .2rem 0 .3rem; }
#lab-reference { font-size: .85rem; }
#lab-reference h3 { margin: 1.1rem 0 .4rem; font-size: .75rem; font-weight: normal; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.lab-entry { margin: 0 0 .8rem; }
.lab-entry b { color: var(--accent); font-weight: 600; }
.lab-entry p { margin: .15rem 0 .3rem; line-height: 1.45; }
.lab-entry pre { margin: 0; padding: .4rem .6rem; border-radius: 4px; background: var(--ui-field); overflow-x: auto;
  font: .8rem/1.45 ui-monospace, Menlo, monospace; }
@media (max-width: 44rem) {
  .site-drawer.lab-drawer-wide { width: auto; }
}

/* No min-height: 0 here, nor on its columns: their floors are what make
   the page taller than a short window. */
#lab-main { display: grid; grid-template-columns: minmax(20rem, 40%) 1fr; gap: 12px; padding: 0 12px 12px; }
#lab-root + .site-foot { margin-top: 0; }
#lab-main.lab-code-folded { grid-template-columns: 1fr; }
#lab-main.lab-code-folded #lab-code { display: none; }
#lab-code, #lab-view { background: var(--site-panel); border-radius: var(--site-panel-radius); }
/* The file shown keeps some lines: on a landscape phone it was one, the key hint over the code. */
#lab-code { display: grid; grid-template-rows: auto auto auto minmax(var(--lab-code-min), 1fr) auto; padding: .5rem .75rem; }
#lab-code > textarea { grid-row: 4; }
#lab-code > #lab-pos { grid-row: 5; }
#lab-about-box { margin: 0 0 .4rem; font-size: .85rem; }
/* The about box's summary in the site's fold look (style.css .site-fold): one ▸/▾. */
.lab-summary { display: inline-block; list-style: none; cursor: pointer; border-radius: 4px; padding: .2rem .1rem; }
.lab-summary::-webkit-details-marker { display: none; }
.lab-summary::before { content: "\25B8\00A0"; }
details[open] > .lab-summary::before { content: "\25BE\00A0"; }
.lab-summary:hover { text-decoration: underline; text-underline-offset: .25em; }
/* Grows with its text to about six lines (field-sizing; three rows where a browser lacks it). */
#lab-code #lab-about { display: block; width: 100%; box-sizing: border-box; margin-top: .25rem; font: .85rem/1.45 system-ui, sans-serif;
  white-space: pre-wrap; resize: vertical; padding: .4rem .6rem; field-sizing: content; min-height: 3.2rem; max-height: 9.5rem; }
#lab-about.lab-bad { outline: 2px solid var(--bad); outline-offset: -2px; }
#lab-code textarea[hidden] { display: none; }
#lab-files { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; }
#lab-files [role="tablist"] { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; min-width: 0; }
#lab-tabs { display: contents; }
#lab-tabs[hidden], #lab-wgsl-tab[hidden] { display: none; }
/* The file tabs: which file the code panel shows. */
.lab-file { font: .8rem ui-monospace, Menlo, monospace; padding: .25rem .6rem; border-radius: 6px 6px 0 0; cursor: pointer;
  background: none; color: var(--text-muted); border: 1px solid transparent; border-bottom-color: var(--ui-line); }
.lab-file:hover { color: var(--text-primary); background: var(--ui-wash); }
.lab-file[aria-selected="true"] { color: var(--text-primary); font-weight: 600; border-color: var(--ui-line); border-bottom-color: transparent;
  background: var(--ui-field); }
.lab-file.lab-bad { color: var(--bad); }
#lab-tabs .lab-file::after { content: ".wgsl"; font-weight: normal; }
#lab-uses { display: flex; gap: .2rem .75rem; flex-wrap: wrap; align-items: center; margin: 0 0 .35rem; font: .75rem ui-monospace, Menlo, monospace;
  color: var(--text-muted); }
#lab-uses[hidden] { display: none; }
#lab-uses label { display: inline-flex; gap: .25rem; align-items: center; cursor: pointer; }
#lab-code textarea { font: .85rem/1.45 ui-monospace, Menlo, monospace; white-space: pre; overflow: auto; resize: none;
  tab-size: 4; min-height: 0; padding: .75rem; border-radius: 6px; background: var(--ui-field); border: 1px solid var(--ui-line); }
#lab-sequence { display: grid; gap: .35rem; max-height: 35vh; overflow: auto; font-size: .85rem; }
#lab-sequence[hidden] { display: none; }
#lab-sequence a { color: var(--accent); }
#lab-name-row { display: flex; gap: .5rem; align-items: center; }
#lab-sequence input[type="text"], #lab-sequence input[type="number"], #lab-seq select { box-sizing: border-box; min-width: 0; }
/* The colors above hid the browser's own disabled look, so read-only rows looked editable. */
#lab-sequence input:disabled, #lab-seq select:disabled { opacity: .55; cursor: not-allowed; }
#lab-name { flex: 1; }
#lab-seq { width: 100%; border-collapse: collapse; }
#lab-seq th { font-weight: normal; text-align: left; color: var(--text-muted); padding: 0 .25rem .15rem; }
#lab-seq td { padding: .1rem .25rem; }
#lab-seq td:first-child input { width: 100%; }
#lab-seq input[type="number"] { width: 4.5rem; }
#lab-seq select { max-width: 16rem; }
.lab-font-cell { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
#lab-root #lab-main .lab-font-adder { min-height: 26px; padding: .1rem .5rem; }
@media (max-width: 600px) {
  #lab-seq select { max-width: 10rem; }
  #lab-seq input[type="number"] { width: 3.5rem; }
}
#lab-seq td:last-child { width: 1%; }
/* A container query: the panel's width decides, not the window's. As one table line the phrase got 41 px of a
   320 px page. */
#lab-sequence { container-type: inline-size; }
@container (max-width: 36rem) {
  #lab-seq, #lab-seq tbody { display: block; }
  #lab-seq thead { display: none; }
  #lab-seq tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .2rem .5rem; align-items: end;
    padding: .3rem 0; border-bottom: 1px solid var(--border); }
  #lab-seq td { padding: 0; min-width: 0; width: auto; }
  #lab-seq td:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  #lab-seq td:nth-child(5) { grid-column: 3; grid-row: 1; }
  #lab-seq td:nth-child(2) { grid-column: 1; }
  #lab-seq td:nth-child(3) { grid-column: 2 / 4; }
  #lab-seq td:nth-child(4) { grid-column: 1 / -1; }
  #lab-seq td:nth-child(2)::before, #lab-seq td:nth-child(3)::before { display: block; font-size: .75rem; color: var(--text-muted); }
  #lab-seq td:nth-child(2)::before { content: "hold, s"; }
  #lab-seq td:nth-child(3)::before { content: "transition, s"; }
  #lab-seq input[type="number"] { width: 100%; }
  #lab-seq select { max-width: 100%; }
  .lab-remove { padding: .2rem .5rem; }
}
#lab-seq tr.lab-bad input[type="text"], #lab-seq input.lab-bad { border-color: var(--bad); }
.lab-remove { font: inherit; background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0 .3rem; }
.lab-remove:hover:not(:disabled) { color: var(--text-primary); }
.lab-remove:disabled { opacity: .2; cursor: default; }
#lab-seq-foot { display: flex; gap: 1rem; align-items: center; }
/* The stage's tools: the settings fold, which opens on a line of its own under it, and the cost. */
#lab-stage-tools { position: relative; z-index: 3; display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; font-size: .85rem; }
#lab-settings { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; align-items: center; padding: .15rem 0 .2rem; }
#lab-settings[hidden] { display: none; }
#lab-settings label:has(:disabled) { opacity: .5; cursor: not-allowed; }
#lab-settings-readonly { margin: 0; flex: 1 0 100%; }
#lab-settings:not(:has(:disabled)) > #lab-settings-readonly { display: none; }
#lab-settings-readonly:focus { outline: none; box-shadow: none; }
#lab-cost { margin-left: auto; font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; cursor: default; }
#lab-settings label { display: flex; gap: .5rem; align-items: center; }
#lab-settings input[type="number"] { width: 4.5rem; }
#lab-aspect.lab-bad { border-color: var(--bad); }
#lab-em.lab-bad, #lab-reach.lab-bad { border-color: var(--bad); }
#lab-font-need { margin: 0; font-size: .85rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; color: var(--bad); }
#lab-font-need[hidden] { display: none; }
#lab-font-need .site-act { color: var(--text-primary); }
#lab-pos { margin: .25rem 0 0; font-size: .75rem; color: var(--text-muted); display: flex; gap: 1rem; justify-content: space-between; }

/* The stage keeps a floor, so open panels push the page longer rather than the canvas to nothing. */
#lab-view { display: grid; grid-template-rows: auto minmax(var(--lab-stage-min), 1fr); grid-template-columns: minmax(0, 1fr); min-width: 0;
  padding: .5rem .75rem .75rem; gap: .5rem; }
#lab-view > * { grid-column: 1 / -1; }
#lab-view > #lab-stage-tools { grid-column: 1 / 2; grid-row: 1; }
#lab-view > #lab-stage { grid-column: 1 / 2; grid-row: 2; }
#lab-stage { position: relative; min-width: 0; }
#lab-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 6px; }
#lab-stage canvas { background: repeating-conic-gradient(rgba(0, 0, 0, .22) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
#lab-host-stage { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#lab-host-stage > * { pointer-events: auto; }
/* Its color-scheme is the frame document's own: a frame whose scheme differs from its element's is painted
   opaque, hiding the canvas. */
#lab-host-stage > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; color-scheme: normal; }
#lab-message { position: absolute; inset: 0; display: grid; place-content: center; margin: 0; padding: 1rem; text-align: center; }
#lab-message[hidden] { display: none; }
#lab-piece-settings { font-size: .8rem; }
#lab-piece-settings[hidden] { display: none; }
#lab-piece-settings .style-settings { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; align-items: center; }
#lab-piece-settings .style-presets { display: flex; flex-wrap: wrap; gap: .35rem; }
/* Presets in the action look, the chosen one pressed (filled), as in the Style drawer. */
#lab-piece-settings .style-presets button { font: inherit; color: inherit; background: none; border: 1px solid var(--ui-line); border-radius: 6px;
  min-height: 26px; padding: .1rem .6rem; cursor: pointer; }
#lab-piece-settings .style-presets button:hover { background: var(--ui-wash); }
#lab-piece-settings .style-presets button[aria-pressed="true"] { background: var(--ui-ink); border-color: var(--ui-ink); color: var(--ui-on-ink); font-weight: 600; }
#lab-piece-settings .style-setting { display: flex; gap: .4rem; align-items: center; }
#lab-piece-settings .style-setting span { color: var(--text-muted); }
/* A piece's labels are any length (style_schema.js has no cap): cut here, not refused, so no piece that opened
   before stops opening. */
#lab-piece-settings .style-setting span, #lab-piece-settings .style-presets button, #lab-piece-settings select {
  max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lab-piece-settings input[type="range"] { width: 7rem; accent-color: var(--ui-ink); }
#lab-piece-settings output { min-width: 2.5rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }

#lab-new { position: absolute; inset: 0; display: grid; align-content: center; justify-items: start; gap: .75rem;
  max-width: 28rem; margin: 0 auto; padding: 1rem; }
#lab-new[hidden] { display: none; }
#lab-new h2 { margin: 0; font-size: 1rem; }
#lab-new label { display: grid; gap: .25rem; width: 100%; font-size: .85rem; }
#lab-new input[type="text"] { font-size: 1rem; padding: .4rem .6rem; }
#lab-new input[type="file"]::file-selector-button { font: inherit; color: var(--site-panel-ink); background: transparent; border: 1px solid var(--ui-line);
  border-radius: 6px; min-height: 30px; padding: .15rem .7rem; margin-right: .6rem; cursor: pointer; }
#lab-new input[type="file"]::file-selector-button:hover { background: var(--ui-wash); }
#lab-new label.lab-new-check { display: inline-flex; align-items: center; gap: .4rem; width: auto; }
#lab-new .lab-hint { margin: 0; font-size: .8rem; overflow-wrap: anywhere; }
#lab-new-status { margin: 0; font-size: .85rem; white-space: pre-wrap; }
#lab-new-link[hidden] { display: none; }

#lab-keep[hidden], #lab-seq-readonly[hidden] { display: none; }
#lab-seq-readonly { margin: 0; }

/* The strip wraps to a row of its own before it is squeezed under 16rem (at 720 px its labels were cut to three letters). */
#lab-timeline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .8rem; }
#lab-timeline[hidden] { display: none; }
#lab-play { min-width: 4.5rem; }
#lab-strip { position: relative; flex: 1 1 16rem; min-width: 0; height: 1.9rem;
  border-radius: 6px; user-select: none; }
#lab-blocks { display: flex; height: 100%; gap: 1px; border-radius: 6px; overflow: hidden; }
.lab-block { flex: 1 1 0; min-width: 0; display: flex; align-items: center; padding: 0 .4rem; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; background: var(--surface); }
.lab-block.lab-cross { padding: 0; opacity: .7;
  background: repeating-linear-gradient(135deg, var(--surface) 0 4px, var(--border-strong) 4px 5px); }
#lab-playhead { position: absolute; top: -.2rem; bottom: -.2rem; width: 2px; margin-left: -1px; background: var(--accent);
  pointer-events: none; }
#lab-clock { font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 7.5rem; text-align: right; }
#lab-seq-toggle, #lab-inspect-toggle { font-size: .85rem; white-space: nowrap; }
#lab-timeline .site-act { min-height: 28px; }
#lab-seq tr.lab-now td:first-child input { border-color: var(--accent); }

/* One height while open, whatever a read holds: growing with its rows, it moved the canvas with every read
   (test/lab/check.py lab_page_inspect_rows). */
#lab-inspect { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: calc(30vh + 3.5rem); gap: .35rem; font-size: .8rem; }
#lab-inspect[hidden] { display: none; }
#lab-inspect-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
#lab-inspect-bar label { display: flex; gap: .4rem; align-items: center; }
#lab-inspect-bar input[type="number"] { width: 4.5rem; }
#lab-inspect-status { margin: 0; color: var(--text-muted); }
#lab-inspect-status.lab-bad { color: var(--bad); }
#lab-inspect-scroll { min-height: 0; overflow: auto; border-radius: 6px; }
#lab-inspect-table { border-collapse: collapse; font: .78rem/1.4 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
/* Opaque, so rows scroll under it unseen, and darker than the gray over any ground. */
#lab-inspect-table th { position: sticky; top: 0; background: #1e1e1e; font-weight: normal; text-align: right; color: var(--text-muted);
  padding: 0 .6rem .15rem; }
#lab-inspect-table td { text-align: right; padding: .05rem .6rem; white-space: nowrap; }
#lab-inspect-table td:first-child { color: var(--text-muted); }
#lab-inspect-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, .2); }

@media (max-width: 700px) {
  #lab-root { height: auto; min-height: 100vh; }
  #lab-main { grid-template-columns: 1fr; gap: 10px; padding: 0 10px 10px; }
  #lab-view { order: -1; grid-template-rows: auto; }
  #lab-stage { height: 60vh; }
  #lab-stage.lab-shaped { height: auto; aspect-ratio: var(--piece-aspect); max-height: 75vh; }
  #lab-build { display: none; }
  #lab-code { min-height: 70vh; }
  /* Two phrases and the clock's width overran a 390 px screen. */
  #lab-clock { min-width: 0; }
  #lab-play { min-width: 0; }
}

/* No previews: the CSP keeps fonts to 'self'. */
.lab-fs { display: grid; gap: .35rem; width: 100%; min-width: 0; font-size: .85rem; }
.lab-fs input[type="text"] { width: 100%; box-sizing: border-box; font-size: 1rem; padding: .4rem .6rem; }
.lab-fs select { max-width: 100%; }
.lab-fs label { display: inline-flex; gap: .35rem; align-items: center; width: auto; }
.lab-fs .lab-fs-label { display: block; }
.lab-fs-filters, .lab-fs-variant { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.lab-fs-filters[hidden], .lab-fs-list[hidden], .lab-fs-chosen[hidden], .lab-fs label[hidden] { display: none; }
.lab-fs-list { list-style: none; margin: 0; padding: .2rem; max-height: 14rem; overflow-y: auto; border-radius: 6px;
  background: var(--ui-field); border: 1px solid var(--ui-line); }
.lab-fs-option { display: flex; justify-content: space-between; gap: .75rem; padding: .3rem .5rem; border-radius: 4px; cursor: pointer; }
.lab-fs-option:hover { background: var(--surface-hover); }
.lab-fs-option[aria-selected="true"] { background: var(--accent-fill); color: var(--label); }
.lab-fs-name { overflow-wrap: anywhere; }
.lab-fs-meta { color: var(--text-muted); white-space: nowrap; font-size: .75rem; align-self: center; }
.lab-fs-option[aria-selected="true"] .lab-fs-meta { color: inherit; }
.lab-fs-status { margin: 0; font-size: .8rem; overflow-wrap: anywhere; }
.lab-fs-chosen { display: grid; gap: .35rem; }
.lab-fs-chosen p { margin: 0; overflow-wrap: anywhere; }
#lab-root #lab-main .lab-fs-clear { min-height: 26px; padding: .1rem .5rem; }
#lab-new { overflow-y: auto; }
/* A modal step of a phrase row's "by name…": the gray made opaque, as a drawer's is. */
#lab-font-find { width: min(30rem, calc(100vw - 2rem)); box-sizing: border-box; margin: auto; padding: 1rem; border-radius: var(--site-panel-radius);
  color: var(--text-primary); border: 1px solid var(--ui-line);
  background: linear-gradient(var(--site-panel), var(--site-panel)), linear-gradient(var(--bg), var(--bg)); }
#lab-font-find::backdrop { background: rgba(0, 0, 0, .55); }
#lab-font-find form { display: grid; gap: .6rem; }
#lab-font-find h2 { margin: 0; font-size: 1rem; }
#lab-font-find-status { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.lab-font-find-buttons { display: flex; gap: .5rem; }
#lab-new .lab-fs label { display: inline-flex; width: auto; }
#lab-new .lab-fs .lab-fs-label { display: block; width: 100%; }
#lab-new .lab-fs label[hidden] { display: none; }
