/* The simulation layout (3V Phase 0 decision 7, Ugur 2026-11-05). Linked only on a page whose
   layout is "simulation" (Calculators.cshtml), so every other calculator page keeps its budget.
   Drawing tones are named here and nowhere else: ui.json names a tone, never a colour. */
/* The first-paint reservation (the plot, playback bar and residual chart), here rather than in the
   page's shared <style>, which has no room left in its compression budget. */
@media (scripting: enabled) {
    #island[data-calc-layout="simulation"] { min-height:900px; }
}
.template-workspace.simulation {
    --sim-blue:#1f5fa8; --sim-red:#c0392b; --sim-green:#1e8449; --sim-purple:#8e44ad;
    --sim-amber:#f2b705; --sim-grey:#6b6960; --sim-next:#f2b705; --sim-next-ink:#5c4500;
    --sim-hl:#fff4cc; --sim-plot-bg:#fff; --sim-grid:#e7e5df; --sim-axis:#8a877e; --sim-tick:#55534c;
    --sim-warn:#b3261e;
    display:flex; flex-direction:column; gap:14px; max-width:none; min-width:0;
}
@media (prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) .template-workspace.simulation { --sim-hl:#4a4020; }
}
.sim-levels { display:flex; flex-wrap:wrap; gap:4px; }
.sim-level { padding:7px 14px; border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
    border-radius:8px; cursor:pointer; font:inherit; }
.sim-level[aria-selected="true"] { background:var(--accent); border-color:var(--accent); color:#fff; }
.sim-columns { display:grid; grid-template-columns:minmax(260px,330px) minmax(0,1fr); gap:14px; align-items:start; }
/* A page without a plot: its inputs (often a table of several columns) get the wider share. */
.sim-columns.sim-noplot { grid-template-columns:minmax(0,3fr) minmax(300px,2fr); }
/* The input panel keeps the one standard width at every level, with or without a table (Ugur, 2026-11-11: "Inputs
   container doesn't have to be that wide when Advanced enabled"); a table fits inside it and never pushes it wider. */
.sim-inputs { display:flex; flex-direction:column; gap:10px; min-width:0; }
.sim-inputs .fields { display:flex; flex-direction:column; gap:10px; }
/* A CONTROL A CHALLENGE FIXES LOOKS OFF, ALL KINDS ALIKE (sweep 3 D1, 2026-11-14: on 15 labs a fixed typed box kept the
   live look, white with dark text): a typed box (its .affix frame), a slider, a dropdown and a choice button that are
   disabled, inside a fixed field (panel.js fixedField, a disabled fieldset) or on their own, share one greyed look at one
   opacity with a not-allowed cursor, as the canvas draws its own fixed controls (r35.38.5). */
/* ...sweep 3 A P2 (2026-11-14) adds segmented choices, value pills and grid-cell buttons: every control inside a fixed
   field is greyed once (a control inside a greyed grid or choice group is not greyed again). */
.sim-inputs .affix:has(input:disabled), .sim-inputs input:disabled:not(.affix input),
.sim-inputs select:disabled, .sim-inputs textarea:disabled,
.sim-inputs .sim-fixed-field :is(button, [role="radio"], [role="radiogroup"], .slider-value, .grid-in, .seg, .choice-seg, .segmented):not(:is(.grid-in, [role="radiogroup"], .seg, .choice-seg, .segmented) *)
  { opacity:.4; filter:grayscale(1); cursor:not-allowed; }
.sim-inputs .sim-fixed-field, .sim-inputs .sim-fixed-field * { cursor:not-allowed; }
/* a label's or a card title's bracketed unit keeps the case it is written in where the text is set in capitals
   (sweep 4 B P3, 2026-11-14: "(HZ)", "(M/S)"; wrapper.js simCaption, panel.js unitCase, typed-field.js) */
.unit-case { text-transform:none; }
/* an input table's cell a challenge fixes (input-table.js .sim-fixed-cell; sweep 4 A P3, buoyancy's Cargo) */
.sim-inputs .sim-fixed-cell { display:inline-block; opacity:.4; filter:grayscale(1); cursor:not-allowed; }
/* AN OUT-OF-RANGE GRID CELL IS MARKED BY THE CELL (sweep 3 A P2, 2026-11-14): its trigger takes the field error colour,
   and its editor's first line is the range message (cells.js); a typed cell's message sits under its box (grid-entry.js). */
.sim-inputs .grid-slider-popover-trigger.grid-cell-out-of-range { box-shadow:inset 0 0 0 2px var(--required-ink, #b42318); }
.grid-slider-popover .grid-slider-popover-range { margin:0 28px 6px 0; font-size:.78rem; }
/* ...and a cell's message wraps inside its own cell, never widening the column (sweep 4 A P2, 2026-11-14: interpolation's
   "Above the maximum of 10.0000." in a Y cell widened Y, clipped the message at 1280 and cut Remove to "R" at 375): its
   inline size is contained, so the column keeps the width of its values and the message takes the lines it needs. */
.sim-inputs .grid-slider-entry-refusal { white-space:normal; overflow-wrap:anywhere; contain:inline-size; }
/* A LABEL NEVER BREAKS INSIDE A WORD (sweep 3 D5, 2026-11-14: predator-prey's "PREDATI / ON RATE" beside a long readout,
   "0.1 per thousand predators per year"): the label column is never narrower than its longest word, labels break only
   between words, and a long readout wraps its unit under its number instead of squeezing the label. */
.sim-inputs .field:has(> .slider-control) { grid-template-columns:minmax(min-content, 1fr) minmax(0, max-content); }
body .sim-inputs .field > label, body .sim-inputs .field > legend { overflow-wrap:normal; word-break:normal; hyphens:manual; }
/* (sweep 3 A, 2026-11-14: "FEED CONCENTRATIO/N" at 375) and a table heading or row label in the panel likewise */
body .sim-inputs :is(th, .sim-derived-label, .grid-slider-popover-label) { overflow-wrap:normal; word-break:normal; hyphens:manual; }
.sim-inputs .slider-value { flex-wrap:wrap; justify-content:flex-end; text-align:right; max-width:100%; }
.sim-inputs .field.sim-hl > label { color:#7a5c00; }
.sim-inputs .field.sim-hl input, .sim-inputs .field.sim-hl select { box-shadow:0 0 0 2px var(--sim-amber); }
.sim-tol select, .sim-challenge select { font:inherit; padding:6px 8px; border:1px solid var(--line-strong); border-radius:8px;
    background:var(--surface); color:var(--ink); width:100%; }
.sim-challenge { border:1px solid var(--line); border-radius:10px; padding:8px 10px; display:flex; flex-direction:column; gap:4px; }
.sim-challenge label, .sim-tol label { font-weight:600; font-size:.9rem; }
.sim-help, .sim-note { color:var(--muted); font-size:.82rem; margin:2px 0 0; }
.sim-marker-line { font-size:.82rem; color:var(--muted); margin:0; padding:8px 10px; border:1px dashed var(--line-strong); border-radius:8px; }
.sim-plot { min-width:0; }
.sim-stage { position:relative; min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:14px 16px; }
.sim-results { min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:14px 16px; }
.sim-results.results-stale .sim-groups { opacity:.55; }
/* The result cards under the plot, full width (Ugur's review, 2026-11-05). */
.sim-status-card { margin:8px 0 12px; }
/* Each group is a titled grid of output cards, the other calculators' result cards (.dash-metrics .stat; Ugur's
   review, 2026-11-10: "change the results section to Cards like in other calculators"). A long text value (a
   sentence) takes the grid's full width. */
.sim-groups { display:grid; gap:16px; }
.sim-group { min-width:0; }
.sim-group-title { margin:0 0 8px; font-size:.9rem; font-weight:700; }
.sim-figures { margin:0; }
.sim-stat { margin:0; min-width:0; }
.sim-stat dt, .sim-stat dd { margin:0; }
.sim-stat .stat-value { overflow-wrap:anywhere; }
.sim-stat.sim-long { grid-column:1 / -1; }
.sim-stat.sim-long .stat-value { font-weight:400; font-size:1rem; }
/* THE STEPS CARD (the 3W "How we got this" card, 2026-11-11, DESIGN-WORKING-STEPS section 6): one list item per line of
   the workbook's text, no numbers, each line wrapping inside the card at 375 px (no horizontal scroll). The live parts
   of Results are the prompt line and each ordinary card; this card is outside them. */
.sim-results-live:empty { display:none; }
.sim-steps-group .sim-figures { grid-template-columns:1fr; }
.sim-steps-card { grid-column:1 / -1; }
.sim-steps { list-style:none; margin:0; padding:0; }
.sim-steps li { margin:0 0 6px; overflow-wrap:anywhere; line-height:1.5; font-weight:400; font-size:1rem; }
.sim-steps li:last-child { margin-bottom:0; }
/* THE MODEL STATUS IS A RESULTS CARD (Ugur, 2026-11-11, "move it into Results"): the first card of Results reads the
   workbook's Model_Status with the model-health note under it; the canvas's own status line (every lab view's
   [data-part="status"], "Model_Status: OK" above the drawing) is not drawn, so the status shows once. */
.sc-view [data-part="status"] { display:none !important; }
/* WORKED EXAMPLES FIT THE PANEL (Coordination, 2026-11-11: "Choose an exa…" at 1280 in the 330 px panel, 065 and
   069). In the simulation panel the head is a small grid: "Worked examples" (and its (i)) with Reset on the first
   row, the select on its own full-width row under them, the required legend after. Every other layout keeps its
   one-row head (Calculators.cshtml). */
.sim-inputs .calc-head:has(> .preset-bar) { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px 12px; }
.sim-inputs .calc-head:has(> .preset-bar) > .preset-bar { display:contents; }
.sim-inputs .calc-head:has(> .preset-bar) .preset-heading { grid-column:1; grid-row:1; }
.sim-inputs .calc-head:has(> .preset-bar) > .reset-btn { grid-column:2; grid-row:1; margin-left:0; }
.sim-inputs .calc-head:has(> .preset-bar) .preset-select { grid-column:1 / -1; grid-row:2; width:100%; min-width:0; }
.sim-inputs .calc-head:has(> .preset-bar) > .required-legend { grid-column:1 / -1; grid-row:3; margin:0; }
.sim-model-status .sim-model-status-note { margin-top:4px; color:var(--muted); font-size:.74rem; line-height:1.35; }
.sim-model-status-check .stat-value { color:var(--warn, #9a5b00); }
.sim-model-status-invalid .stat-value { color:var(--danger, #b42318); }
/* THE CANVAS NEVER REPEATS RESULTS (Ugur's review, 2026-11-10, standing rule for every 3V lab: "Don't repeat
   results in Canvas area. Results should be in Results section in Cards"). What the lab views draw beside the
   drawing as figures (summary card grids, verdict and figure lines, readout lists, values worked into a formula,
   the version text) is not drawn on a simulation page; Results carries those values as cards. The canvas keeps the
   drawing, the player and the frame or time readout of the animation, the labels on drawn objects, chart axes and
   legends, the controls, the Model_Status line, the symbolic formula and the explanatory notes.
   3V Phase 4 (by data-sc-lab): everything in the summary hero but its status line and 036's read note, and the
   Advanced KPI tiles and the version text. */
:is([data-sc-lab="isolation-tuner"], [data-sc-lab="loop-response"], [data-sc-lab="cam-follower"],
    [data-sc-lab="motion-plan"], [data-sc-lab="brake-road"], [data-sc-lab="gear-train"],
    [data-sc-lab="grid-search"], [data-sc-lab="truss-design"], [data-sc-lab="mechanism-sketch"])
    :is(.sc-view-hero > :not([data-part="status"], .it-model-status, .it-read-note), [data-part="advanced-kpis"], [data-part="versions"],
        .it-design-line, .gt-coverage, .cf-advanced, .mk-advanced)
    { display:none !important; }
/* 3V Phase 2 and Phase 1 (by their own class names): the readout lists and KPI grids, the verdict lines, the
   figure strips and ledgers, the workbook tables copied beside the drawing (they are in Supporting metrics), a
   formula line worked out with the numbers (.sc-f-line.evaluated; the symbolic line above it stays), and the Phase 1
   hero KPI tiles (.sc-view-hero .kpis on the projectile and interpolation labs: range, flight time, apex, impact
   speed and target; errors, overshoot, jumps and smoothness, each one of the lab's Results outputs; the hero's
   formula stays).
   Only the figures go: a card or strip that also holds an explanatory note or a control keeps them (REVIEW LC on
   #1597, 2026-11-10). So the four-bar speed and window strips keep their titles and hints (.fb-strip-vals goes),
   the heat ledger keeps its title and its insulated-edge note (.hg-ledger-rows goes), the standing-wave bead table
   host keeps its "blank for an air column" or no-answer line (only the table goes), the orbit burns row keeps the
   burn prediction buttons, which are that lab's only prediction control (form_skip), and the Doppler pitch note
   goes only while it carries the on-path pitches (the speed readouts are drawn), not while it says the speed is
   hidden in a challenge. */
.sim-view-host :is(.sc-view-hero .kpis, .pl-readouts, .pl-compare, .fb-strip-vals, .fb-verdict, .fb-kpis, .fb-table-wrap, .ds-readouts,
    .hg-kpis, .hg-ledger-rows, .sw-kpis, .sw-table-wrap > :not(.sw-hint), .wt-readout, .ra-readout,
    .cp-verdict, .cp-routh, .dc-readout, .dc-arc, .op-burns > :not(.op-predict), .op-readouts, .ss-readouts, .ss-details, .ss-chain-values,
    .sc-f-line.evaluated) { display:none !important; }
.sim-view-host .sc-view-doppler-scene:has(.ds-ro[data-out="machNumber"], .ds-ro[data-out="sourceSpeedUsed"]) .ds-hint[data-part="pitch-note"]
    { display:none !important; }
/* Four-bar Advanced: the 7 x 7 coupler-point grid is in Supporting metrics, so its disclosure is not drawn (no
   summary to open onto a hidden table); the note under it stays in view and points there (ui.json searchNote). */
.sim-view-host .fb-details > summary { display:none !important; }
.sim-view-host .fb-details::details-content { content-visibility:visible; display:block; }
.sim-problem { color:var(--sim-warn); font-weight:600; }
/* A NOT VALID answer: one short line on the stage pointing to the Model status card (sweep 1 on 5243, 2026-11-13). */
/* (no bar down its left edge, CardFingernailAbsenceTests: a thin frame all round carries the warning colour) */
.sim-stage-note { margin:0 0 8px; padding:6px 10px; border:1px solid var(--sim-warn); border-radius:6px; color:var(--sim-warn); font-weight:600; font-size:.9rem; }

/* The equation is the hero of its panel (Ugur, review 2). */
.sim-equation { border:1px solid var(--line); border-radius:12px; padding:14px 18px 12px; margin-bottom:14px;
    background:color-mix(in srgb, var(--surface) 92%, var(--accent)); }
.sim-equation-kicker { font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin:0 0 6px; font-weight:700; }
.sim-equation-live { font:500 clamp(30px, 7.2vw, 52px)/1.2 "Cambria Math", "STIX Two Math", Cambria, Georgia, serif; margin:4px 0;
    overflow-wrap:anywhere; word-break:normal; }
.sim-lead { color:var(--muted); white-space:nowrap; }
.sim-term { border-radius:8px; padding:0 2px; transition:background-color .15s, box-shadow .15s; }
.sim-term[data-input] { display:inline-block; padding:0 4px; }
.sim-term.sim-missing { color:var(--sim-warn); }
.sim-term.sim-hl { background:var(--sim-hl); box-shadow:0 0 0 2px var(--sim-amber) inset; }
.sim-equation-note { font-size:.8rem; color:var(--muted); margin:6px 0 0; }

/* The plot, its legend, caption and playback. */
.sim-plot-head { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:6px 14px; }
/* The method choice uses the platform's own choice control (fieldset.segmented-choice / .seg). */
.sim-method-pick { margin:0 0 8px; }
.sim-marker-hint { margin:0 0 8px; color:var(--sim-warn); font-size:.85rem; font-weight:600; }
.sim-marker-hint:empty { display:none; }
.sim-chart-host { position:relative; width:100%; height:420px; border:1px solid var(--line); border-radius:10px;
    background:var(--sim-plot-bg); overflow:hidden; }
.sim-chart-host.sim-main { touch-action:pan-y; }
.sim-chart-host.sim-small { height:250px; }
.sim-chart-host svg { display:block; user-select:none; -webkit-user-select:none; }
.sim-legend { list-style:none; display:flex; flex-wrap:wrap; gap:4px 16px; margin:8px 0 0; padding:0; font-size:.8rem; color:var(--muted); }
.sim-legend li { display:flex; align-items:center; gap:6px; }
.sim-swatch { display:inline-block; width:20px; height:10px; position:relative; }
.sim-sw-line::before { content:""; position:absolute; left:0; right:0; top:4px; height:2.5px; background:var(--sim-c); border-radius:2px; }
.sim-sw-bar::before { content:""; position:absolute; left:0; right:0; top:2px; height:6px; background:var(--sim-c); opacity:.5; border-radius:3px; }
.sim-sw-dot::before { content:""; position:absolute; left:5px; top:0; width:10px; height:10px; border-radius:50%; background:var(--sim-c); }
.sim-sw-next::before { background:var(--sim-next); border:1.5px solid var(--sim-next-ink); box-sizing:border-box; }
.sim-sw-hollow::before { background:#fff; border:2px solid var(--sim-c); box-sizing:border-box; }
.sim-sw-faded::before { opacity:.3; }
.sim-caption { min-height:2.6em; font-size:.85rem; margin:8px 0; }
.sim-playback { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.sim-playback button { min-width:40px; padding:6px 10px; border:1px solid var(--line-strong); background:var(--surface); color:var(--ink);
    border-radius:8px; font:inherit; cursor:pointer; }
.sim-playback button.sim-play { min-width:92px; font-weight:600; }
.sim-playback input[type="range"] { flex:1 1 140px; }
.sim-pos { font-size:.85rem; color:var(--muted); min-width:92px; font-variant-numeric:tabular-nums; }
.sim-speed, .sim-toggle { font-size:.85rem; display:flex; align-items:center; gap:5px; }
.sim-residual-block { margin-top:16px; }
.sim-residual-block h3 { margin:0 0 8px; font-size:.95rem; }

/* The SVG chart. A tone class sets --sim-c; marks read it. */
.sim-chart .sim-gridline { stroke:var(--sim-grid); stroke-width:1; shape-rendering:crispEdges; }
.sim-chart .sim-zeroline { stroke:var(--sim-axis); stroke-width:1.4; shape-rendering:crispEdges; }
.sim-chart .sim-frame { fill:none; stroke:#cfccc3; shape-rendering:crispEdges; }
.sim-chart .sim-tick { font-size:11.5px; fill:var(--sim-tick); font-variant-numeric:tabular-nums; }
.sim-chart .sim-axis-label { font-size:12.5px; fill:#3d3b36; font-weight:600; }
.sim-chart, .sim-legend { --sim-c:var(--sim-blue); }
.sim-tone-blue { --sim-c:var(--sim-blue); }
.sim-tone-red { --sim-c:var(--sim-red); }
.sim-tone-green { --sim-c:var(--sim-green); }
.sim-tone-purple { --sim-c:var(--sim-purple); }
.sim-tone-amber { --sim-c:var(--sim-amber); }
.sim-tone-grey { --sim-c:var(--sim-grey); }
.sim-chart .sim-polyline { fill:none; stroke:var(--sim-c); stroke-linejoin:round; }
.sim-chart .sim-segment, .sim-chart .sim-bar { fill:none; stroke:var(--sim-c); stroke-linecap:round; }
.sim-chart .sim-point { fill:var(--sim-c); stroke:none; }
.sim-chart .sim-point.sim-ring { stroke:#fff; }
.sim-chart .sim-point.sim-hollow { fill:#fff; stroke:var(--sim-c); }
.sim-chart .sim-point.sim-next { fill:var(--sim-next); stroke:var(--sim-next-ink); }
.sim-chart .sim-segment.sim-next-guide { stroke:var(--sim-next-ink); }
.sim-chart .sim-label { font-size:12px; font-weight:600; fill:var(--sim-c); paint-order:stroke; stroke:#fff; stroke-width:3px; }
.sim-chart .sim-label.sim-next-label { fill:#3a2c00; }
/* The prediction control on the stage, during a prediction challenge. */
.sim-predict { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:8px 0; }
.sim-predict-label { font-size:13px; font-weight:600; margin-right:4px; }
.sim-predict-choice { padding:6px 12px; border:1px solid var(--line, #c9cdd6); border-radius:999px; background:var(--surface, #fff); color:inherit; font:inherit; font-size:14px; cursor:pointer; }
.sim-predict-choice[aria-pressed="true"] { background:var(--accent, #1f5fa8); border-color:var(--accent, #1f5fa8); color:#fff; }
/* A plain typed number box (typed_inputs): no slider; a refused draft keeps its message under the box. */
.sim-typed-field .affix { width:100%; }
/* A challenge's derived input (derived_inputs, 3V-047 challenge 3): the workbook's value, read-only, in the field's place. */
.sim-derived-field .sim-derived-label { display:block; font-weight:600; margin-bottom:4px; }
.sim-derived-field .sim-derived-value { display:block; padding:6px 10px; border:1px dashed var(--line, #c9cdd6); border-radius:6px; background:var(--surface-2, #f4f6f9); font-variant-numeric:tabular-nums; }
.sim-derived-field .sim-help { margin:4px 0 0; }
/* Numbered scalar inputs as one table in the input panel (input_tables): the platform's table, full width. */
.sim-input-table .grid-in-wrap { width:100%; overflow-x:auto; }
/* The root the workbook marks on the plot (root_marker). */
.sim-chart .sim-point.sim-root { fill:#fff; stroke:var(--sim-grey); stroke-width:2.5; }
.sim-chart .sim-label.sim-root { fill:var(--sim-grey); }

/* The draggable markers (Ugur, review 3). */
.sim-chart .sim-marker { cursor:ew-resize; touch-action:none; outline:none; }
.sim-chart .sim-marker-hit { fill:transparent; pointer-events:all; }
.sim-chart .sim-marker-shape { fill:var(--sim-c); stroke:#fff; stroke-width:2; filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); transition:transform .12s; }
.sim-chart .sim-marker:hover .sim-marker-shape, .sim-chart .sim-marker.sim-dragging .sim-marker-shape,
.sim-chart .sim-marker:focus-visible .sim-marker-shape { transform:scale(1.25); }
.sim-chart .sim-marker.sim-diamond:hover .sim-marker-shape, .sim-chart .sim-marker.sim-diamond.sim-dragging .sim-marker-shape,
.sim-chart .sim-marker.sim-diamond:focus-visible .sim-marker-shape { transform:rotate(45deg) scale(1.25); }
.sim-chart .sim-marker:focus-visible .sim-marker-hit { stroke:var(--sim-blue); stroke-width:2; stroke-dasharray:3 3; }
.sim-chart .sim-marker-guide { stroke:var(--sim-grey); stroke-width:1; stroke-dasharray:3 4; opacity:.55; pointer-events:none; }
.sim-chart .sim-marker-label { font-size:13px; font-weight:700; fill:#2a2925; paint-order:stroke; stroke:#fff; stroke-width:3.5px; pointer-events:none; }
.sim-chart .sim-marker-value { font-size:12.5px; font-weight:600; fill:#1d1d1b; paint-order:stroke; stroke:#fff; stroke-width:4px;
    pointer-events:none; font-variant-numeric:tabular-nums; }
.sim-chart .sim-marker.sim-outside { opacity:.55; }
.sim-chart .sim-marker.sim-warn .sim-marker-shape { fill:var(--sim-warn); stroke:#ffd54f; stroke-width:3; }
.sim-chart .sim-marker-band { fill:rgba(31,95,168,.08); pointer-events:none; }
.sim-chart .sim-marker-band.sim-warn { fill:rgba(179,38,30,.09); }
.sim-pop { position:absolute; top:12px; width:220px; background:var(--surface); border:1px solid var(--line-strong); border-radius:10px;
    padding:10px 12px; box-shadow:0 6px 22px rgba(0,0,0,.18); z-index:5; font-size:.85rem; }
.sim-pop label { display:block; font-weight:600; margin-bottom:4px; }
.sim-pop input { width:100%; box-sizing:border-box; font:inherit; padding:6px 8px; border:1px solid var(--line-strong); border-radius:6px; }
.sim-pop-help { color:var(--muted); margin:4px 0; }
.sim-pop-refused { color:var(--sim-warn); margin:4px 0; }
.sim-pop-actions { display:flex; gap:6px; justify-content:flex-end; }
.sim-pop-actions button { padding:5px 12px; border-radius:6px; border:1px solid var(--line-strong); background:var(--surface); font:inherit; cursor:pointer; }
.sim-pop-actions button.sim-pop-set { background:var(--accent); color:#fff; border-color:var(--accent); }

.sim-grid-wrap { overflow:auto; max-height:360px; margin-bottom:12px; }
/* The workbook's tables are the platform's standard result table (table.grid-out; Ugur's rule 21, 2026-11-06):
   its font, header, borders, padding and alignment all come from calculator-page.css. Only behaviour is
   added here: the header stays in view while a long table scrolls in its box, and a row can be picked. */
.sim-table thead th { position:sticky; top:0; background:var(--surface); }
.sim-table tbody tr { cursor:pointer; }
.sim-table tr.sim-current td { background:var(--sim-hl); }

/* A PANELLESS page (3W Physics Lab 101, SHELL-DESIGN-101 §4): no input panel at any level, so the stage takes the
   full content width and the level tabs, the challenge picker with its goal, the worked-example head and the run
   status sit in one lab bar above it. On a predict_first page Lock in on the stage replaces Calculate. */
.sim-panelless { display:flex; flex-direction:column; gap:14px; }
.sim-labbar { display:flex; flex-wrap:wrap; align-items:flex-start; gap:8px 16px; min-width:0; }
/* the challenge picker shows its whole selected title (ux8 SS4, 2026-11-12: "2. Where must the small child sit? (intrc"
   at 1280): the select is as wide as its longest title, up to the bar's width, and the box takes the room it needs,
   on a line of its own when the bar is too narrow.
   It always keeps ONE place (ux10 N7, 2026-11-13: beside the tabs for a short goal, below them for a long one, so the
   page jumped between challenges): its own full-width line of the bar, under the tabs and the examples head */
.sim-labbar .sim-challenge { flex:1 1 100%; order:10; min-width:0; max-width:100%; }
.sim-labbar .sim-challenge select { width:auto; max-width:100%; }
.sim-labbar .run-bar { flex:1 1 220px; min-width:0; }
.sim-labbar.sim-lockin-runs .run-btn { display:none; }
/* No panel, so no required inputs to mark (Coordination for Ugur, 2026-11-11): the "* Required" legend is not shown. */
.sim-labbar .required-legend { display:none; }
/* r35.9 (the ux re-test at 375, challenge mode: the worked-example select and Reset ran past the lab bar's edge): the
   worked-example head fits the bar's width, its select shrinks, and the head wraps (Reset onto its own line if needed). */
.sim-labbar .calc-head { min-width:min(22rem, 100%); max-width:100%; flex:1 1 280px; }
.sim-labbar .preset-bar { min-width:min(13.5rem, 100%); max-width:100%; flex:1 1 220px; flex-wrap:wrap; gap:6px 10px; }
/* the Worked examples menu shows its own words (ux9 FF5, 2026-11-12: "Choose an examp" at 1280): never narrower than
   "Choose an example", up to the bar's width; the head wraps under the other lab-bar items when the row is full */
.sim-labbar .preset-select { min-width:min(13.5rem, 100%); max-width:100%; flex:1 1 13.5rem; }
.sim-panelless > .sim-stage { width:100%; box-sizing:border-box; }

@media (max-width:1100px) {
    .sim-columns, .sim-columns.sim-noplot { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:700px) {
    .sim-chart-host { height:320px; }
    .sim-chart-host.sim-small { height:210px; }
    .sim-equation { padding:12px 12px 10px; }
    .sim-stage, .sim-results, .sim-tables { padding:12px; }
    .sim-playback input[type="range"] { flex-basis:100%; order:10; }
}


/* Every workbook table sits in the page's Supporting metrics (the shared details.an-supporting),
   collapsed; each table is its own expandable block titled with its row count (Ugur, 2026-11-06). */
.sim-supporting { min-width:0; }
/* A stale answer's tables dim through the platform's own rule (.run-page.results-stale .grid-out), once. */
.sim-tables, .sim-outtables { display:flex; flex-direction:column; gap:8px; min-width:0; }
.sim-tables + .sim-outtables { margin-top:8px; }
.sim-table-block { border:1px solid var(--line); border-radius:12px; padding:8px 12px; background:var(--surface); min-width:0; }
.sim-table-block > summary { cursor:pointer; font-weight:600; font-size:.9rem; }
.sim-table-block > summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.sim-table-block[open] > summary { margin-bottom:8px; }

/* Hidden parts stay hidden whatever their own display rule. */
.sim-playback[hidden], .sim-residual-block[hidden], .sim-supporting[hidden] { display:none; }
/* A generic CHECK line is secondary while the challenge's own guidance is shown. */
.sim-marker-hint.sim-secondary { color:var(--muted); font-weight:400; font-size:.8rem; }
.sim-status-card.sim-secondary { opacity:.8; }
/* A prediction challenge before its prediction. */
.sim-conceal { border:1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius:12px; padding:12px 14px; margin:0 0 12px;
    background:color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.sim-conceal-title { margin:0 0 4px; font-weight:700; }
.sim-conceal-go { margin-top:8px; padding:6px 12px; border-radius:8px; border:1px solid var(--accent); background:var(--surface); color:var(--accent);
    font:inherit; font-weight:600; cursor:pointer; }
/* "New seed" (ui.json seed_inputs; Ugur, 2026-11-10): a small button under the seed's own field, which stays. */
.sim-seed { display:flex; flex-direction:column; gap:6px; min-width:0; margin-bottom:8px; }
/* Ugur, 2026-11-10: the button belongs to the seed slider above it, not the next field. The field's
   reserved required-error space collapses while empty (it returns when the seed is blank), so the
   button sits right under the slider, with a wider gap below it. */
.sim-seed .required-field-error:not(:has(> span:not(:empty))) { display:none; }
.sim-new-seed { align-self:flex-start; padding:5px 12px; border-radius:8px; border:1px solid var(--accent); background:var(--surface);
    color:var(--accent); font:inherit; font-size:.85rem; font-weight:600; cursor:pointer; }
.sim-new-seed:hover { background:color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.sim-new-seed:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* A SimulationCanvas lab view (option A): the view draws inside its host; its own rules come from the
   pinned simulation-canvas.css. */
.sim-view, .sim-view-host { min-width:0; }
/* ux4 P1 (2026-11-12): while the canvas's answer belongs to other inputs, its drawing is dimmed (after a short delay, so
   a quick answer does not flash), never shown as if it answered the new input. */
.sim-stage[data-results="stale"] .sim-view-host { opacity:.55; transition:opacity .2s ease .15s; }
/* ux5 P2 (2026-11-12): while the answer is stale the playback is held (components/simulation/playback-guard.js): its
   Play, steps and scrubber are aria-disabled and inert, with a short "Updating…" note. */
.sim-stage [data-sim-held="true"].sc-pb, .sim-stage .sc-pb-scrub[data-sim-held="true"] { opacity:.45; cursor:not-allowed; }
.sim-pb-held { display:inline-block; margin:4px 0 0 8px; color:var(--muted); font-size:.8rem; font-style:italic; }
/* A lab view not built yet (ui.json view_pending): a placeholder the size of a view, plain text only. */
.sim-view-pending { min-height:320px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px;
    text-align:center; padding:24px; border:2px dashed var(--line-strong); border-radius:12px;
    background:repeating-linear-gradient(135deg, var(--surface), var(--surface) 12px, color-mix(in srgb, var(--accent) 4%, var(--surface)) 12px, color-mix(in srgb, var(--accent) 4%, var(--surface)) 24px); }
.sim-view-pending-title { margin:0; font-weight:700; font-size:1.05rem; color:var(--ink); }
.sim-view-pending-text { margin:0; max-width:52ch; color:var(--muted); font-size:.9rem; }

/* THE OUTCOME CARD, IN ONE FIXED, RESERVED SLOT (Ugur, 2026-11-11 23:46Z; his P1 on the live preview, 2026-11-12:
   "Met banner appears in multiple locations and flicker"; and "Bring the text in answer to the popup even in Play
   mode"; components/simulation/outcome-popup.js). The slot is its own line in the stage card's top bar: the canvas's
   own top row where it has one (Lab 101's .sc-lab101-strip, a wrapping flex row), else the page's .sim-outcome-bar.
   Its space is reserved (a full line, two lines of the card high, kept while the card is hidden), so the card never
   overlaps the stage drawing and never moves. The card is compact and two-line: the verdict, then the sentence; there
   is nothing to expand. Its own tokens, light and dark: every text colour on the surface at 4.5:1 or more, computed by
   tests/js/simulation-challenge-outcome.test.js. */
.sim-outcome-bar { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:8px; margin:0 0 10px; }
.sim-outcome-bar:empty { display:none; }
/* ...and none while its only content is a slot that reserves nothing (sweep 3 P3, 2026-11-14: a ~22 px empty bar, its
   padding and margin, where no card can come): a shown card, a placeholder line or a selected challenge sets the slot's
   sim-outcome-reserve (outcome-popup.js), which brings the bar back. */
.sim-outcome-bar:not(:has(> :not(.sim-outcome-slot))):not(:has(> .sim-outcome-slot.sim-outcome-reserve)):not(:has(.sim-outcome-placeholder:not([hidden]))) { display:none; }
.sim-outcome-slot, .sim-outcome-pinbar {
    --so-surface:#fff; --so-ink:#10131c; --so-muted:#4b5563; --so-line:#d5d9e2; --so-met:#146c2e; --so-notyet:#8a4500;
    --so-link:#3730a3; --so-hover:#eef0f5;
}
@media (prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) .sim-outcome-slot, :root:not([data-theme="light"]) .sim-outcome-pinbar { --so-surface:#1c2130; --so-ink:#f3f4f6;
        --so-muted:#c7ccd6; --so-line:#3a4152; --so-met:#74e39a; --so-notyet:#ffc56b; --so-link:#a9b4ff; --so-hover:#2a3142; }
}
:root[data-theme="dark"] .sim-outcome-slot, :root[data-theme="dark"] .sim-outcome-pinbar { --so-surface:#1c2130; --so-ink:#f3f4f6;
    --so-muted:#c7ccd6; --so-line:#3a4152; --so-met:#74e39a; --so-notyet:#ffc56b; --so-link:#a9b4ff; --so-hover:#2a3142; }
/* Reserved at the verdict line plus two lines of the sentence, at every width (ux7 4: a two- or three-line card moved the
   canvas by about 20 px at 1280): the sentence is folded to two lines, so the card never outgrows it on arrival. */
/* ...only while a card can come (Coordination's 5243 re-check: an empty 78 px band on 13 labs, the regression left by
   sweep 1 P2 3 removing the line where there is nothing to lock in): outcome-popup.js gives the slot sim-outcome-reserve
   while a card is shown, a placeholder line is set or a challenge is selected; otherwise the slot takes no height. */
.sim-outcome-slot { flex:1 0 100%; order:98; box-sizing:border-box; width:100%; min-height:0;
    display:flex; justify-content:flex-end; align-items:flex-start; }
.sim-outcome-slot.sim-outcome-reserve { min-height:78px; }
/* What the empty slot is for (Coordination, 2026-11-12): a faint line, gone while a card is shown. */
.sim-outcome-placeholder { margin:0; padding:8px 4px 0; color:var(--so-muted); font-size:.82rem; font-style:italic; text-align:right; }
.sim-outcome-placeholder[hidden] { display:none; }
/* THE CARD STAYS IN SIGHT, THE TOP ROW DOES NOT STICK, AT EVERY WIDTH (Coordination, 2026-11-12: a learner scrolled
   down to the drawing did not see the card; a 194 px sticky band over the drawing at 375 was too much; ux8 X2: at
   1280x800 the 140 px sticky top row covered the top of the drawing while scrolling). The canvas card's top row (the
   canvas's own row, or the page's bar) scrolls with the page. Only the CARD sticks, as a one-line PIN (the verdict and
   the sentence cut short; a tap shows it in full in place) in the page's zero-height sticky pin bar, first in the stage
   card, just below the site header (panel.js measures it into --site-header-h), under the header (z-index 4 against
   its 5). outcome-popup.js shows the pin only while a card is shown and its slot has scrolled up under the header;
   unstuck, the card shows in full in its slot. The pin is at most 48 px tall (one 28 px row and its border and
   padding). */
.sim-stage .sc-lab101-strip { background:var(--sc-surface, var(--surface)); padding-block:6px; }
.sim-outcome-bar { background:var(--surface); padding-block:6px; }
/* zero height: it takes no room and no presses; outcome-popup.js lets the pin go before the card ends, so it never
   hangs below the card */
.sim-outcome-pinbar { display:block; position:sticky; top:var(--site-header-h, 69px); height:0; z-index:4; }
/* r35.38.6 (ux16 P2, Coordination 2026-11-14: on a phone the pin cut the sentence off, "✓ Met Half the weight needs
   twice the dista…"): the pin's sentence wraps in full at every width, as the card's does (r35.38.3) */
.sim-outcome-pin { display:flex; align-items:center; gap:4px; box-sizing:border-box; padding:3px 4px 3px 10px;
    border:1px solid var(--so-line); border-radius:0 0 10px 10px; background:var(--so-surface);
    color:var(--so-ink); font-size:.85rem; line-height:1.4; box-shadow:0 4px 10px rgba(15,23,42,.12); }
/* No bar down the card's left edge (CardFingernailAbsenceTests): the verdict's own colour carries Met or Not yet. */
.sim-outcome-pin[hidden] { display:none; }
.sim-outcome-pin-text { flex:1 1 auto; min-width:0; min-height:28px; margin:0; padding:2px 0; border:0; background:transparent; color:inherit;
    font:inherit; text-align:left; white-space:normal; overflow:visible; overflow-wrap:anywhere; cursor:pointer; }
.sim-outcome-pin-text:focus-visible { outline:2px solid var(--so-link); outline-offset:1px; }
.sim-outcome-pin-verdict { margin-right:6px; font-weight:750; color:var(--so-notyet); }
.sim-outcome-pin.sim-outcome-met .sim-outcome-pin-verdict { color:var(--so-met); }
.sim-outcome-pin.sim-outcome-neutral .sim-outcome-pin-verdict { color:var(--so-ink); }
.sim-outcome-live { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0);
    clip-path:inset(50%); white-space:nowrap; border:0; }
.sim-outcome { box-sizing:border-box; max-width:min(40rem, 100%); padding:3px 4px 5px 10px;
    border:1px solid var(--so-line); border-radius:10px; background:var(--so-surface);
    color:var(--so-ink); font-size:.88rem; line-height:1.4; }
.sim-outcome[hidden] { display:none; }
.sim-outcome-head { display:flex; align-items:center; gap:8px; margin:0; }
.sim-outcome-kicker { flex:0 0 auto; color:var(--so-muted); font-size:.72rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.sim-outcome-verdict { flex:1 1 auto; min-width:0; font-weight:750; color:var(--so-notyet); }
.sim-outcome-notyet .sim-outcome-verdict { color:var(--so-notyet); }
.sim-outcome-met .sim-outcome-verdict { color:var(--so-met); }
.sim-outcome-neutral .sim-outcome-verdict { color:var(--so-ink); }
.sim-outcome-check { margin-right:4px; }
.sim-outcome-check[hidden] { display:none; }
.sim-outcome-word { color:inherit; }
.sim-outcome-x { width:28px; height:28px; margin:0 0 0 auto; padding:0; display:inline-flex; flex:0 0 auto;
    align-items:center; justify-content:center; border:0; border-radius:6px; background:transparent; color:var(--so-muted);
    font:inherit; font-size:1.15rem; line-height:1; cursor:pointer; }
.sim-outcome-x:hover { background:var(--so-hover); color:var(--so-ink); }
/* The sentence IN FULL at every width (Ugur, 2026-11-13, via Coordination, r35.38.3: the seesaw verdict was cut off at
   "pick a lighter loa…"; the verdict must never be cut off). While a card can come the slot still reserves 78 px (118 px
   at phone width), so a sentence of up to two (four) lines never moves the drawing; a longer one grows the card rather
   than hiding words. */
.sim-outcome-feedback { display:block; overflow:visible;
    box-sizing:border-box; width:100%; margin:0; padding:0 8px 0 0; border:0; background:transparent; color:var(--so-ink);
    font:inherit; text-align:left; overflow-wrap:anywhere; cursor:pointer; }
@media (max-width:600px) {
    .sim-outcome-slot.sim-outcome-reserve { min-height:118px; }
}
.sim-outcome-feedback:focus-visible { outline:2px solid var(--so-link); outline-offset:1px; }
.sim-outcome-feedback[hidden] { display:none; }
.sim-outcome-details { color:var(--so-link); font-size:.8rem; font-weight:600; text-decoration:underline; white-space:nowrap; }
.sim-outcome-details[hidden] { display:none; }
.sim-outcome-details:focus-visible, .sim-outcome-x:focus-visible { outline:2px solid var(--so-link); outline-offset:2px; }
/* The Results card the pop-up's Details focuses. */
.sim-challenge-record:focus { outline:2px solid var(--accent); outline-offset:3px; border-radius:8px; }
.sim-challenge-record:focus:not(:focus-visible) { outline-color:color-mix(in srgb, var(--accent) 60%, transparent); }
