/* Lab: the seven tabbed demos (templates/lab_demos/lt-*.html, lab/lab-tools.js). Uses the site's identity tokens. */
:root {
    --lt-ok: #6fbf8f; --lt-warn: #e0b35a; --lt-bad: #e07a6e; --lt-orange: #d9925a; --lt-idle: #59606a;
    --lt-ok-bg: rgba(111, 191, 143, 0.12); --lt-warn-bg: rgba(224, 179, 90, 0.13); --lt-bad-bg: rgba(224, 122, 110, 0.13);
    --lt-base: #7b8590;
}
body.light-theme {
    --lt-ok: #24653f; --lt-warn: #7a5309; --lt-bad: #9a3524; --lt-orange: #a95a1c; --lt-idle: #9aa1a9;
    --lt-ok-bg: rgba(47, 125, 79, 0.10); --lt-warn-bg: rgba(154, 106, 18, 0.10); --lt-bad-bg: rgba(178, 68, 47, 0.10);
    --lt-base: #8b939c;
}

.lt-section { max-width: 1000px; margin: 4rem auto 0; }

.lt-intro { color: var(--text-secondary); max-width: 68ch; margin: 1rem 0 1.25rem; line-height: 1.55; }

.lt-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--border-radius-lg); padding: 1.5rem; margin-top: 0.75rem; }
.lt-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5rem; }
.lt-what { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.55; max-width: 75ch; margin: 0 0 1.25rem; }
.lt-sub { font: 600 0.78rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 1.5rem 0 0.5rem; }
.lt-note { font-size: 0.8rem; color: var(--text-muted); margin: 0.25rem 0 0.75rem; }

.lt-controls { display: flex; flex-wrap: wrap; gap: 0.9rem 1.25rem; align-items: flex-end; margin-bottom: 0.9rem; }
.lt-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; font-size: 0.8rem; color: var(--text-secondary); margin: 0 0 0.75rem; border: 0; padding: 0; }
.lt-controls .lt-field { margin: 0; flex: 0 1 12rem; }
.lt-controls .lt-grow { flex: 1 1 16rem; }
.lt-field > span, .lt-field > legend { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 500; padding: 0; }
.lt-field output { font-family: var(--font-mono); color: var(--text-primary); }
.lt-field-end { justify-content: flex-end; }
.lt-field-inline { flex: 0 1 auto !important; }
.lt-panel input[type="text"], .lt-panel textarea, .lt-panel select, .lt-table input {
    font: 0.88rem/1.4 var(--font-body); color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 6px; padding: 0.5rem 0.6rem; width: 100%; min-width: 0; box-sizing: border-box;
}
.lt-panel textarea { font-family: var(--font-mono); font-size: 0.8rem; resize: vertical; }
.lt-panel input[type="file"] { font-size: 0.8rem; color: var(--text-secondary); max-width: 100%; }
.lt-panel input[type="range"] { accent-color: var(--accent); width: 100%; }
.lt-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--text-primary); cursor: pointer; }
.lt-check input { accent-color: var(--accent); }
fieldset.lt-field { flex-direction: column; }

.lt-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.lt-actions .btn { padding: 0.6rem 1rem; font-size: 0.85rem; cursor: pointer; }
.lt-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.lt-out:empty { display: none; }
.lt-out { margin-top: 0.5rem; }
.lt-scroll { overflow-x: auto; max-width: 100%; }
.lt-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.lt-table th, .lt-table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.lt-table th { font: 600 0.72rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); white-space: nowrap; }
.lt-table td.num, .lt-table th.num { text-align: right; }
.lt-table td.mono { font-family: var(--font-mono); font-size: 0.78rem; }
.lt-table input { padding: 0.3rem 0.4rem; font-size: 0.82rem; min-width: 6.5rem; }
.lt-table tr.lt-new td { background: var(--lt-ok-bg); }
.lt-table tr.lt-closed td { color: var(--text-muted); }
.lt-table tr.lt-closed-now td { background: var(--lt-warn-bg); }
.lt-table tr.lt-fail td { background: var(--lt-bad-bg); }
/* a failed row is already tinted, so its pill and code text sit on that tint without a second layer */
.lt-table tr.lt-fail .lt-pill.bad { background: transparent; border: 1px solid currentColor; }
.lt-table tr.lt-fail .lt-code-name { color: var(--text-secondary, var(--text)); }
.lt-x { background: none; border: 1px solid var(--line); color: var(--text-secondary); border-radius: 4px; cursor: pointer; padding: 0.2rem 0.5rem; }
.lt-x:hover { border-color: var(--lt-bad); color: var(--lt-bad); }

.lt-pill { display: inline-block; font: 600 0.7rem/1 var(--font-mono); padding: 0.28rem 0.45rem; border-radius: 4px; letter-spacing: 0.03em; white-space: nowrap; }
.lt-pill.ok { color: var(--lt-ok); background: var(--lt-ok-bg); }
.lt-pill.warn { color: var(--lt-warn); background: var(--lt-warn-bg); }
.lt-pill.bad { color: var(--lt-bad); background: var(--lt-bad-bg); }
.lt-pill.idle { color: var(--text-muted); border: 1px solid var(--line); }

.lt-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; margin: 0.5rem 0 1rem; }
.lt-score-num { font: 700 3rem/1 var(--font-display); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.lt-score-num small { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }
.lt-score-text { color: var(--text-secondary); font-size: 0.9rem; max-width: 52ch; }
.lt-callout { border-left: 2px solid var(--lt-warn); background: var(--lt-warn-bg); padding: 0.6rem 0.85rem; border-radius: 0 6px 6px 0; font-size: 0.85rem; margin: 0.5rem 0 1rem; }
.lt-callout.bad { border-left-color: var(--lt-bad); background: var(--lt-bad-bg); }
.lt-callout.ok { border-left-color: var(--lt-ok); background: var(--lt-ok-bg); }

.lt-bars { display: grid; gap: 0.55rem; margin: 0.5rem 0 1.25rem; }
.lt-bar { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr 3.5rem; gap: 0.75rem; align-items: center; font-size: 0.82rem; }
.lt-bar-track { display: block; height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.lt-bar-fill { display: block; height: 100%; background: var(--accent); transition: width 0.2s ease; }
.lt-bar-val { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }

.lt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.6rem; margin: 0.5rem 0 1rem; }
.lt-kpi { border: 1px solid var(--line); border-radius: 6px; padding: 0.65rem 0.75rem; background: var(--surface-2); }
.lt-kpi dt { font-size: 0.72rem; color: var(--text-muted); }
.lt-kpi dd { margin: 0.2rem 0 0; font: 600 1.15rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.lt-kpi dd small { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); }

.lt-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; }
.lt-fig { margin: 0; }
.lt-fig figcaption { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
.lt-svg { width: 100%; height: auto; display: block; overflow: visible; }
.lt-svg text { fill: var(--text-secondary); font: 11px var(--font-mono); }
.lt-svg .ax { stroke: var(--line); stroke-width: 1; }
.lt-svg .base { fill: var(--lt-base); }
.lt-svg .cur { fill: var(--accent); }
.lt-svg .ok { fill: var(--accent); }
.lt-svg .late { fill: var(--lt-warn); }
.lt-svg .drop { fill: none; stroke: var(--lt-bad); stroke-width: 2; }
.lt-svg .wait { fill: none; stroke: var(--lt-idle); stroke-width: 1.5; stroke-dasharray: 2 2; }
.lt-svg .win { fill: var(--accent); fill-opacity: 0.08; stroke: var(--accent); stroke-opacity: 0.5; }
.lt-svg .win.fired { fill-opacity: 0.18; }
.lt-svg .win.closed { fill: var(--lt-idle); fill-opacity: 0.12; stroke: var(--lt-idle); }
.lt-svg .wm { stroke: var(--lt-warn); stroke-width: 2; }
.lt-svg .ev { cursor: pointer; }
.lt-svg .ev:focus { outline: none; stroke: var(--text-primary); stroke-width: 2; }
.lt-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.78rem; color: var(--text-secondary); margin: 0.4rem 0 0.75rem; padding: 0; list-style: none; }
.lt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }

/* time travel */
.lt-snaps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 1rem; }
.lt-snaps button { font: 500 0.75rem/1.2 var(--font-mono); padding: 0.4rem 0.55rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-primary); cursor: pointer; text-align: left; }
.lt-snaps button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lt-snaps button small { display: block; color: var(--text-muted); }
.lt-snaps button:disabled { opacity: 0.45; cursor: default; text-decoration: line-through; }
.lt-tree { font: 0.78rem/1.6 var(--font-mono); color: var(--text-secondary); margin: 0; padding: 0.75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; white-space: pre; }
.lt-tree b { color: var(--text-primary); font-weight: 600; }
.lt-tree .del { color: var(--lt-bad); }
.lt-tree .gone { color: var(--text-muted); text-decoration: line-through; }
.lt-code { font: 0.78rem var(--font-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0.15rem 0.4rem; }

/* data contract and DAG */
.lt-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0 0 0.5rem; }
.lt-chips li { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; border: 1px solid var(--line); border-radius: 4px; padding: 0.25rem 0.25rem 0.25rem 0.5rem; }
.lt-chips button { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; padding: 0 0.3rem; }
.lt-dag-grid { border-collapse: separate; border-spacing: 4px; font-size: 0.8rem; }
.lt-dag-grid th { font: 500 0.72rem var(--font-mono); color: var(--text-muted); text-align: left; padding-right: 0.5rem; white-space: nowrap; }
.lt-dag-grid td { padding: 0; }
.lt-cell { width: 2.4rem; height: 1.9rem; border-radius: 4px; border: 1px solid var(--line); cursor: pointer; font: 600 0.7rem var(--font-mono); color: var(--accent-ink); background: var(--surface-2); }
.lt-cell.success { background: var(--lt-ok); border-color: var(--lt-ok); }
.lt-cell.failed { background: var(--lt-bad); border-color: var(--lt-bad); }
.lt-cell.upstream_failed { background: var(--lt-orange); border-color: var(--lt-orange); }
.lt-cell.waiting { background: transparent; border-style: dashed; color: var(--text-muted); }
.lt-cell[aria-pressed="true"] { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.lt-dag-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font: 0.78rem var(--font-mono); margin: 0 0 1rem; color: var(--text-secondary); }
.lt-dag-flow span.t { border: 1px solid var(--line); border-radius: 4px; padding: 0.3rem 0.5rem; background: var(--surface-2); color: var(--text-primary); }

@media (max-width: 560px) {
    .lt-panel { padding: 1rem; }
    .lt-controls .lt-field { flex: 1 1 100%; }
    .lt-bar { grid-template-columns: 6.5rem 1fr 3rem; gap: 0.5rem; }
    .lt-score-num { font-size: 2.5rem; }
    .lt-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .lt-panel * { transition: none !important; animation: none !important; } }

/* 2026-10-28: the new demos are full cards in one stack, like the older ones above, each opening with a plain
   sentence and a numbered "try this" (the steps are a real order). */
.lab-group-head { max-width: 1000px; margin: 0 auto 2rem; }
.lab-group-head .section-title { margin: 0; }
.lab-group-head p, .lt-intro { color: var(--text-secondary); max-width: 68ch; margin: 1rem 0 0; line-height: 1.55; }
.lt-section { margin-top: 5rem; }
.lt-section > .section-title, .lt-section > .lt-intro { max-width: 1000px; }
.lt-section > .lt-panel { margin-top: 3rem; }
.lt-section > .lt-intro { margin-bottom: 0; }
.lt-lede { color: var(--text-primary); font-size: 0.98rem; line-height: 1.55; max-width: 72ch; margin: 0 0 0.9rem; }
.lt-steps { margin: 0 0 1.1rem; padding: 0.75rem 0.9rem 0.75rem 2.1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
            color: var(--text-secondary); font-size: 0.88rem; line-height: 1.55; display: grid; gap: 0.2rem; max-width: 72ch; }
.lt-steps b { color: var(--text-primary); font-weight: 600; }
.lt-source { font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--line); padding-top: 0.75rem; margin: 1.25rem 0 0; line-height: 1.55; max-width: 80ch; }
.lt-mini { font: 600 0.82rem/1.3 var(--font-body); color: var(--text-primary); margin: 0 0 0.6rem; }
.lt-code-name { display: block; font: 0.7rem/1.4 var(--font-mono); color: var(--text-muted); margin-top: 0.2rem; overflow-wrap: anywhere; }
.lt-bar-fill.alt { background: var(--lt-warn); }
.lt-more { margin: 0 0 1rem; }
.lt-more summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); margin-bottom: 0.75rem; }
.lt-panel .lt-sub:first-of-type { margin-top: 0.5rem; }

/* Trained-model demos (templates/lab_demos/lm-*.html, lab/lab-models.js) */
.lm-thumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.25rem; }
.lm-thumb { padding: 2px; border: 2px solid var(--line); border-radius: 6px; background: var(--surface-2); cursor: pointer; line-height: 0; }
.lm-thumb[aria-selected="true"] { border-color: var(--accent); }
.lm-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lm-thumb img { width: 48px; height: 48px; image-rendering: pixelated; border-radius: 3px; }
.lm-stage { display: grid; grid-template-columns: minmax(0, 256px) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin: 0.75rem 0; }
.lm-stage canvas { width: 100%; max-width: 256px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); touch-action: auto; }
.lm-stage canvas.lm-drawing { touch-action: none; cursor: crosshair; }
.lm-out { margin-top: 0; }
.lm-verdict { margin: 0 0 0.75rem; font-size: 0.95rem; }
.lm-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.lm-bars li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) 4.2rem; gap: 0.5rem; align-items: center; font-size: 0.8rem; }
.lm-name { color: var(--text-secondary); }
.lm-track { height: 0.6rem; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.lm-fill { display: block; height: 100%; background: var(--lt-idle); }
.lm-fill.lm-top { background: var(--accent); }
.lm-val { font: 0.75rem var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .lm-stage { grid-template-columns: minmax(0, 1fr); } .lm-stage canvas { justify-self: center; } }
@media (prefers-reduced-motion: no-preference) { .lm-fill { transition: width 0.3s ease; } }
.ls-view { position: relative; width: 100%; max-width: 400px; display: grid; gap: 0.5rem; }
.ls-view video { width: 100%; border-radius: 8px; transform: scaleX(-1); background: var(--surface-2); }
.ls-stage { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
.ls-stage canvas { max-width: 400px; aspect-ratio: 400 / 260; }
@media (max-width: 640px) { .ls-stage { grid-template-columns: minmax(0, 1fr); } .ls-view { justify-self: center; } }

/* Survival curves (lab/lab-trials.js): one colour and one dash pattern per arm, so arms read apart without colour too */
.tr-chart { min-width: 420px; }
.tr-line { fill: none; stroke-width: 2.25; }
.tr-control { stroke: var(--lt-base); background: var(--lt-base); stroke-dasharray: 6 4; }
.tr-low { stroke: var(--lt-warn); background: var(--lt-warn); stroke-dasharray: 2 3; }
.tr-high { stroke: var(--accent); background: var(--accent); }
.lt-svg .tr-grid { stroke: var(--line); stroke-width: 1; opacity: 0.5; }
.lt-svg .tr-half { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tr-key { display: inline-block; width: 0.9rem; height: 0.22rem; border-radius: 2px; vertical-align: middle; margin-right: 0.35rem; }
.tr-tests { margin: 0 0 0.5rem; padding-left: 1.1rem; font-size: 0.85rem; display: grid; gap: 0.3rem; }
.tr-chi { font-size: 0.85rem; margin: 0 0 0.5rem; }

/* Benford audit (lab/lab-benford.js) */
.lt-svg .bf-bar { fill: var(--lt-base); opacity: 0.75; }
.lt-svg .bf-law { fill: none; stroke: var(--accent); stroke-width: 2; }
.lt-svg .bf-dot { fill: var(--accent); }

/* Fraud rule tester (lab/lab-fraud.js) */
.fr-total td { font-weight: 600; border-top: 1px solid var(--line); }
.lm-row-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin: 0.75rem 0 0.25rem; }
.lm-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.lm-file-input:focus-visible + .lm-file-btn, .lm-file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.lm-file-btn { cursor: pointer; }
.lm-pipeline { margin: 1rem 0 0.5rem; }
.lm-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.75rem; }
.lm-steps figure { margin: 0; display: grid; gap: 0.35rem; align-content: start; }
.lm-steps canvas { width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.lm-steps figcaption { font-size: 0.72rem; line-height: 1.35; color: var(--text-secondary); }
.lm-geo { font-size: 0.85rem; margin: 0.75rem 0 0.5rem; }
.lm-trust { border-left: 3px solid var(--lt-ok); background: var(--lt-ok-bg); padding: 0.5rem 0.75rem; border-radius: 4px; font-size: 0.82rem; margin: 0.5rem 0; }
.lm-trust.bad { border-left-color: var(--lt-bad); background: var(--lt-bad-bg); }
.lm-trust p { margin: 0 0 0.35rem; } .lm-trust ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.lm-stage-one { grid-template-columns: minmax(0, 256px); }
.lm-verdict .lt-pill { white-space: normal; line-height: 1.3; }
.lt-panel [hidden] { display: none !important; }
.ps-list { margin: 0 0 0.5rem; padding-left: 1.1rem; font-size: 0.85rem; display: grid; gap: 0.3rem; overflow-wrap: anywhere; }
#ps-draft { font: 0.85rem/1.5 var(--font-body); }
.qa-list { list-style: none; margin: 0.25rem 0 0.5rem; padding: 0; display: grid; gap: 0.4rem; }
.qa-list li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 0.6rem; align-items: baseline; font-size: 0.85rem; padding: 0.35rem 0.5rem; border-radius: 4px; }
.qa-list li.qa-top { background: var(--surface-2); }
.qa-sim { font: 0.75rem var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.qa-text { overflow-wrap: anywhere; }

/* RFM segment explorer */
.rf-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-block: .5rem; }
.rf-figs figure { margin: 0; }
.rf-figs figcaption { font-size: .8rem; color: var(--text-secondary); text-align: center; }
.rf-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.rf-dot { fill: var(--bg-dark); stroke: var(--accent); stroke-width: 2; }
.rf-dot.rf-on { fill: var(--accent); }
.rf-key { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }

/* Land-use emissions forecast explorer */
#em-chart { margin-block: .5rem; }
.lt-svg .em-test { fill: var(--accent); opacity: .08; }
.lt-svg .em-act { fill: none; stroke: var(--text-secondary); stroke-width: 1.6; }
.lt-svg .em-lr { fill: none; stroke: var(--accent); stroke-width: 2; }
.lt-svg .em-lr-pt { fill: var(--accent); }
.lt-svg .em-rf { fill: none; stroke: var(--lt-warn); stroke-width: 2; }
.lt-svg .em-rf-pt { fill: var(--lt-warn); }
.lt-svg .em-naive { fill: none; stroke: var(--lt-bad); stroke-width: 2; stroke-dasharray: 5 3; }
.lt-svg .em-naive-pt { fill: var(--lt-bad); }
.em-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; font-size: .8rem; color: var(--text-secondary); margin: 0 0 .5rem; }
.em-li { white-space: nowrap; }
.em-k { display: inline-block; width: 1.1rem; height: 0; border-top: 2px solid; margin-right: .3rem; vertical-align: middle; }
.em-k-act { border-color: var(--text-secondary); }
.em-k-lr { border-color: var(--accent); }
.em-k-rf { border-color: var(--lt-warn); }
.em-k-naive { border-color: var(--lt-bad); border-top-style: dashed; }

/* Lab index */
.lab-index { margin-block: 1.5rem 2.5rem; }
.lab-index-title { font-size: 1.1rem; margin: 0 0 .75rem; }
.lab-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.lab-chip { font: 500 .85rem var(--font-sans, inherit); padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text-secondary); cursor: pointer; }
.lab-chip span { font-family: var(--font-mono); font-size: .75rem; opacity: .85; }
body.light-theme .lab-chip span { opacity: 1; }
.lab-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg-dark); }
.lab-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: .75rem; }
.lab-list li[hidden] { display: none; }
.lab-list a { display: flex; flex-direction: column; gap: .3rem; height: 100%; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.lab-list a:hover, .lab-list a:focus-visible { border-color: var(--accent); }
.lab-list b { font-size: .95rem; }
.lab-list span { font-size: .83rem; color: var(--text-secondary); line-height: 1.4; }
.lab-list em { align-self: flex-start; margin-top: auto; font: normal 500 .7rem var(--font-mono); color: var(--accent); }
@media (max-width: 560px) {
    .lab-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .lab-list a { padding: .6rem .65rem; }
    .lab-list b { font-size: .84rem; }
    .lab-list span, .lab-list em { display: none; }
    .lab-list b { line-height: 1.3; }
}

/* "Your own data" sections inside a simulated demo */
.lt-own { margin-block: 1rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; }
.lt-own > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.lt-own[open] > summary { margin-bottom: .6rem; }
.lt-own textarea { width: 100%; font: .8rem/1.45 var(--font-mono); }

/* Lab page: tour button under the intro */
.lab-tour-cta { margin-top: 1rem; }
/* Category sections: every demo block (panel or widget card) gets the same gap under the section intro. */
.lab-cat > .glass-card, .lab-cat > .lt-panel { margin-top: 3rem; }
.lab-cat[hidden] { display: none; }
.lab-list i { font-style: normal; font-family: var(--font-mono); font-size: .72rem; color: var(--text-secondary); }
.lab-filter-note { margin: 0 0 1rem; color: var(--text-secondary); font-size: .9rem; min-height: 1.2em; }
/* Square-or-rectangle stretch test inside the shape classifier */
.lm-sr { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: .25rem; }
.lm-sr-text { max-width: 72ch; }
.lm-sr-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.lm-sr-stage { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-top: 1rem; }
.lm-sr-stage canvas { width: 192px; max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 6px; }
.lm-sr-out { flex: 1 1 16rem; min-width: 0; }
.lm-sr-out dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0; font-size: .92rem; }
.lm-sr-out dt { color: var(--text-secondary); }
.lm-sr-out dd { margin: 0; font-variant-numeric: tabular-nums; }
#lm-sr-chart { margin-top: 1rem; }
.lt-svg .sr-band { fill: var(--accent); opacity: .14; }
.lt-svg .sr-cnn { fill: none; stroke: var(--accent); stroke-width: 2; }
.lt-svg .sr-dot { fill: var(--accent); }
.lt-svg .sr-now { fill: none; stroke: var(--text-primary, currentColor); stroke-width: 2; }
.lt-svg .sr-rule { stroke: var(--text-secondary); stroke-dasharray: 4 3; }
.lt-svg .sr-geo-sq { fill: var(--lt-warn); }
.lt-svg .sr-geo-rect { fill: var(--accent); }
/* ASL practice: the reference player, the live timeline and the comparison at the flagged frame */
.ls-learn { display: grid; gap: .75rem; align-content: start; min-width: 0; }
.ls-player { margin: 0; }
.ls-live { display: grid; gap: .5rem; margin: .5rem 0 1rem; min-width: 0; }
.ls-timeline { display: grid; grid-template-columns: repeat(var(--cells, 32), minmax(0, 1fr)); gap: 2px; min-height: 1.1rem; }
.ls-timeline span { height: 1.1rem; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--line); }
.ls-timeline span.wait { background: var(--lt-idle); border-color: transparent; }
.ls-timeline span.ok { background: var(--lt-ok); border-color: transparent; }
.ls-timeline span.warn { background: var(--lt-warn); border-color: transparent; }
.ls-timeline span.bad { background: var(--lt-bad); border-color: transparent; }
.ls-timeline span.unused { opacity: .35; }
.ls-status { margin: 0; font-size: .95rem; }
.ls-status .lt-pill { margin-right: .35rem; }
.ls-compare { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .75rem; }
.ls-compare figure { margin: 0; flex: 1 1 14rem; max-width: 300px; }
.ls-compare canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.ls-compare figcaption { font-size: .8rem; color: var(--text-secondary); margin-top: .3rem; }
.ls-all { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); column-gap: 1.5rem; }
.ls-all li.ls-target .lm-name { color: var(--text-primary); font-weight: 600; }
.ls-all li.ls-target .lm-name::after { content: " (your sign)"; font-weight: 400; color: var(--text-secondary); }
.ls-all li { grid-template-columns: 10.5rem minmax(0, 1fr) 4.2rem; }
.ls-timeline span.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--line) 3px, var(--line) 5px); }
.ls-legend { margin: 0; font-size: .75rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.ls-legend i { font-style: normal; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; margin-right: .6rem; }
.ls-legend span { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; }
.ls-legend .ok { background: var(--lt-ok); } .ls-legend .warn { background: var(--lt-warn); } .ls-legend .bad { background: var(--lt-bad); }
.ls-legend .wait { background: var(--lt-idle); }
.ls-legend .none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--line) 3px, var(--line) 5px); border: 1px solid var(--line); }
