/* Global prototype styling — shared design-system rules imported by every prototype (see each <head>).

   THE TOKENS (below) are the Slate/Emerald defaults, written once here so a workspace never has to
   carry its own palette copy: the values are exactly shared/theme.js's registry defaults (SPEC §2
   colour, §3 shape), and Theme.apply() writes any edited token onto :root at higher priority, so the
   Theme page still re-themes every workspace live. A prototype that still declares its own :root
   block simply restates these; new work should not add another copy (connect-dont-fork).

   Scrollbars: themed to the Slate/Emerald palette so they read as part of the UI, not the browser
   chrome — a subtle thumb (inset by a transparent border so it looks thin) that brightens on hover. */
:root{
  /* surfaces — depth is a surface step, never a border */
  --bg:#15161B; --panel:#1C1E24; --card:#23252E; --chip:#23252E; --hover:#2D3140;
  --control:#262935; --well:#101116; --line:#2F323D; --divider:#23252E; --border-subtle:#3A3E4C;
  /* text */
  --ink:#E6E7EE; --text2:#B7BAC6; --muted:#8F93A3; --faint:#565B6B;
  /* the one accent + its tints */
  --accent:#3ECF8E; --accent-text:#6FDCAA; --on-accent:#0A160F;
  --accent-soft:rgba(62,207,142,.15); --accent-sel:rgba(62,207,142,.20);
  /* semantic status */
  --danger:#EF6A7A; --danger-soft:rgba(239,106,122,.16);
  --warn:#E0B350; --warn-soft:rgba(224,179,80,.15); --ok:#7FC78F;
  /* axis colours (vector rows · gizmo handles) */
  --x:#EF6A7A; --y:#7FC78F; --z:#6FA8EF;
  /* shape scale */
  --r-input:8px; --r-row:6px; --r-card:9px; --r-panel:12px;
}
*{scrollbar-width:thin;scrollbar-color:var(--faint,#565B6B) transparent}
::-webkit-scrollbar{width:12px;height:12px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--faint,#565B6B);border-radius:8px;border:3px solid transparent;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background:var(--muted,#8F93A3)}
::-webkit-scrollbar-corner{background:transparent}

/* ---------------------------------------------------------------------------
   THE APP FRAME — one window, the size of the browser.

   A prototype IS the editor screen (prototype-standard §0), and an editor fills
   its window. A 624px stage centred in a 1520px column is a picture of the screen
   at one size: every pane inside was proportioned against that picture, so the
   layout was only ever right at that one viewport and the desk below it went to
   waste. The frame is therefore stated ONCE, here — page → win → workspace body —
   and it is the ONLY place a height is declared. Seventeen surfaces used to carry
   their own copy of these two rules plus a fixed stage height, which is the
   two-implementations-of-one-verb defect (theme-and-component-library §4): each
   copy individually fine, the set silently disagreeing about how tall a screen is.

   THE CONTRACT a workspace body honours: it declares NO height of its own — it is
   the flex child that takes the slack. `.win`'s other children (the header, a
   read-only/lock strip, a toolbar, the sound dock) keep their natural height and
   are pinned in place around it. The page never scrolls; the panes inside do.

   AND IT IS SCOPED TO PAGES THAT HAVE A FRAME. This same stylesheet is loaded by 63
   `_verify/` batteries, which are long scrolling reports with no `.win` at all — an
   unscoped `body{overflow:hidden}` would clip every one of them to a single screen
   with no way to reach the rows below, and each would still LOOK fine, because the
   first screenful is the summary. So the viewport lock keys off the frame's own
   structure (`body > .page`) rather than off a class each page must remember to add.
   -------------------------------------------------------------------------- */
html:has(> body > .page){height:100%}
body:has(> .page){height:100%;overflow:hidden}
/* border-box on the frame itself: sixteen pages declare `*{box-sizing:border-box}` and one does
   not, and without it `height:100%` plus the padding is a page 16px taller than the window — the
   one surface that scrolls while the other sixteen fit. The frame does not depend on the page. */
.page,.win{box-sizing:border-box}
.page{height:100%;max-width:none;margin:0;padding:8px;display:flex;flex-direction:column;min-height:0}
.win{flex:1 1 auto;display:flex;flex-direction:column;min-height:0;
     background:var(--bg);border:1px solid var(--line);border-radius:var(--r-panel);
     overflow:hidden;box-shadow:0 10px 40px rgba(0,0,0,.5)}
/* A flex/grid child's default `min-height:auto` refuses to shrink below its content,
   which is what turns one long pane into a clipped column instead of a scrolling one. */
.win>*,.win>.layout>*,.win>.stage>*,.win>.ws>*,.win>.ds-stage>*{min-height:0}
.win>.titlebar{flex:0 0 40px}
/* The workspace body — the closed set of names the surfaces give it. */
.win>.layout,.win>.stage,.win>.ws,.win>.ds-stage{flex:1 1 auto}

/* ---------------------------------------------------------------------------
   Editor shell header — the SPEC §6 EditorHeaderBar (editor-shell-standard.mdc).
   The one identical header on every workspace: logo · File/Edit/View/Add menus ·
   workspace segmented tabs · play controls · file chip · status chips · window
   controls. Markup is emitted by shared/shell.js (shellHeader); these are the
   canonical tokens so every prototype — including the legacy ones that never had a
   tab bar — renders the same header. Modern prototypes may also carry equivalent
   inline copies; identical values, so the cascade is a no-op.
   -------------------------------------------------------------------------- */
.titlebar{display:flex;align-items:center;gap:6px;background:var(--panel);border-bottom:1px solid var(--line);padding:5px 12px;font-size:12px;color:var(--text2);height:40px;position:relative}
.titlebar .logo{flex:0 0 20px;height:20px;border-radius:6px;background:var(--accent);color:var(--on-accent);font-weight:700;font-size:11px;display:inline-flex;align-items:center;justify-content:center}
.titlebar .mbtn{padding:3px 8px;border-radius:6px;cursor:pointer}
.titlebar .mbtn:hover{background:var(--hover)}
.titlebar .mbtn.act{background:var(--hover);color:var(--ink)}
.titlebar .wstabs{display:inline-flex;background:var(--well);border-radius:8px;padding:3px;gap:2px;margin:0 6px}
.titlebar .wseg{padding:2px 9px;border-radius:6px;color:var(--text2);cursor:pointer;font-size:11.5px;white-space:nowrap;text-decoration:none}
.titlebar .wseg:hover{background:var(--hover)}
.titlebar .wseg.on{background:var(--accent);color:var(--on-accent);font-weight:600}
.titlebar .pctl{display:inline-flex;background:var(--well);border-radius:8px;padding:3px;gap:2px}
.titlebar .pbtn{padding:1px 7px;border-radius:6px;color:var(--muted);font-size:10px;cursor:pointer}
.titlebar .pbtn:hover{background:var(--hover)}
/* the active transport state carries the accent, like any other active segment (SPEC §5); a verb that
   cannot apply right now reads disabled and says why on hover, rather than doing nothing silently */
.titlebar .pbtn.on{background:var(--accent);color:var(--on-accent)}
.titlebar .pbtn.dis{color:var(--faint);cursor:not-allowed}
.titlebar .pbtn.dis:hover{background:transparent}
.titlebar .file{background:var(--chip);border-radius:6px;padding:1px 8px;font-family:Consolas,monospace;font-size:11.5px;font-variant-numeric:tabular-nums;white-space:nowrap}
.titlebar .spacer{flex:1}
.titlebar .tchip{background:var(--chip);border:1px solid var(--line);border-radius:8px;padding:2px 9px;color:var(--text2);font-size:11.5px;font-variant-numeric:tabular-nums;white-space:nowrap}
.titlebar .tchip.ok,.titlebar .tchip.ok2{border-color:rgba(62,207,142,.4);color:var(--accent-text)}
.titlebar .tchip.warn{border-color:rgba(240,180,80,.45);color:var(--warn)}
.titlebar .tchip.err,.titlebar .tchip.over{border-color:rgba(239,106,122,.45);color:var(--danger);background:var(--danger-soft)}
.titlebar .wctl{color:var(--muted);letter-spacing:2px}
/* Shell dropdowns — the always-present View menu (design-system screens) and the
   optional workspace-specific Add menu (sky-graph nodes, scene entities). One
   treatment for both: the header menu grammar lives in shared/shell.js. */
/* A menu is BOUNDED AND SCROLLS rather than growing without limit: the View menu gains a row
   every time a surface registers a channel or a mode, and the faux window clips, so an unbounded
   menu loses its last rows entirely. The exact cap is measured against the window on open
   (`shell.js` fitMenu); this max-height is the floor for a menu opened before that runs.
   `overscroll-behavior` stops a flick at the end of the list from scrolling the page underneath. */
.titlebar .hmenu{position:absolute;top:38px;z-index:40;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 34px rgba(0,0,0,.55);padding:6px;min-width:192px;max-height:min(62vh,560px);overflow-y:auto;overscroll-behavior:contain}
.titlebar .hmenu .hmh{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:4px 10px 6px}
.titlebar .hmenu .hrow{display:flex;align-items:center;gap:9px;padding:6px 10px;border-radius:7px;cursor:pointer;color:var(--text2);font-size:12.5px;text-decoration:none}
.titlebar .hmenu .hrow:hover{background:var(--hover);color:var(--ink)}
.titlebar .hmenu .hrow .ico{width:14px;text-align:center;color:var(--accent-text)}
.titlebar .hmenu .hrow .note{margin-left:auto;color:var(--faint);font-family:Consolas,monospace;font-size:10.5px}
/* the row for the screen you are already on */
.titlebar .hmenu .hrow.on{background:var(--accent-soft);color:var(--accent-text)}
.titlebar .hmenu .hrow.on .note::after{content:" ✓";color:var(--accent-text)}
/* View ▸ Debug overlays (world-debug-visualization §10): a channel row is an ordinary
   shell row — the colour swatch takes the icon slot, because it names the wire colour
   you are hunting for in the viewport. */
.titlebar .hmenu .hrow .sw{display:inline-block;width:9px;height:9px;border-radius:2px}
/* View ▸ View mode (world-debug-visualization §10): the EXCLUSIVE axis. A group sub-heading
   separates the mode sets; the radio glyph in the icon slot is what says "one at a time", so
   the row suppresses the channel rows' trailing ✓ — two affirmations of the same state read as
   two different states. An unavailable mode is dimmed with its reason in the note, never hidden. */
.titlebar .hmenu .hmh.sub{padding:7px 10px 3px;font-size:9.5px;opacity:.85}
.titlebar .hmenu .hrow.vm.on .note::after{content:none}
.titlebar .hmenu .hrow.vm.off{opacity:.45;cursor:not-allowed}
.titlebar .hmenu .hrow.vm.off:hover{background:none;color:var(--text2)}
/* The viewport legend (§10.2): which non-default overlays a frame was taken with. Sits in the
   viewport corner, never intercepts a click — it reports, it does not control. */
.dbgleg{position:absolute;left:8px;bottom:8px;z-index:6;display:flex;gap:6px;pointer-events:none}
.dbgleg-i{display:flex;align-items:center;gap:5px;background:var(--panel);color:var(--text2);border-radius:6px;padding:3px 7px;font-size:10.5px;font-variant-numeric:tabular-nums;box-shadow:0 4px 14px rgba(0,0,0,.45)}
.dbgleg-i i{width:8px;height:8px;border-radius:2px;display:inline-block}
/* The view-mode chip (§13.3): the ONE exclusive mode this frame is shaded in. It sits above the
   overlay legend in the same corner — both answer "what am I looking at", and separating them
   would make the reader hunt two corners. Hidden while the mode is the default `lit`: there is no
   alarm state for being normal. Like the legend it reports and never controls. */
.vmchip{position:absolute;left:8px;bottom:34px;z-index:6;pointer-events:none;background:var(--panel);color:var(--accent-text);border-radius:6px;padding:3px 8px;font-size:10.5px;font-variant-numeric:tabular-nums;box-shadow:0 4px 14px rgba(0,0,0,.45)}
.vmchip[hidden]{display:none}
/* ---------------------------------------------------------------------------
   Slider value — the readout beside a range IS the field you type the value into
   (shared/slider-value.js). It keeps whatever class its host gave it (.val, .gi-val,
   .v, .tr-v, .mp-dv …) so it still sits in the same slot and carries the same chip;
   these rules add only the affordance: a text caret, a tab stop you can see, and the
   accent focus ring every other input wears. A refusal borrows the danger tokens —
   the same signal an invalid inspector field gives, not a second vocabulary.
   -------------------------------------------------------------------------- */
[data-slval]{cursor:text}
[data-slval]:hover{color:var(--ink)}
[data-slval]:focus,[data-slval].slval-on{outline:none;box-shadow:0 0 0 1.5px var(--accent);background:var(--well);color:var(--ink);border-radius:var(--r-row,6px);min-width:3.2em;display:inline-block;white-space:nowrap}
[data-slval].slval-err{box-shadow:0 0 0 1.5px var(--danger);background:var(--danger-soft);color:var(--danger)}

/* The shell's fallback toast has no style of its own: shell.js builds it from the
   components.css molecule (`.tst-float` > `.tst`) like every other surface. */
