/* Relay Sculpture Machine, v4 "the relay" (web/DESIGN.md). Quiet, precise, warm: hairlines instead of shadows, ink
   for the chrome, colour only for the five builders. Two families: Geist for the interface and display, JetBrains Mono
   for machine data. Type scale 12 · 13 · 14 · 16 · 18 · 20 · 28 · display; space 4 · 8 · 12 · 16 · 24 · 32 · 48 · 64.
   Every page is one viewport: only panel bodies scroll, inside themselves. */

@font-face {
  font-family: "Geist";
  src: url("/vendor/fonts/geist-variable.woff2") format("woff2-variations"), url("/vendor/fonts/geist-variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"),
       url("/vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/vendor/fonts/jetbrains-mono-symbols-400.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+2190, U+2192, U+21E7, U+2318, U+2325, U+25B8, U+25BE;
}

/* ------------------------------------------------------------ tokens */
:root {
  --bg: #f3f1ec; --panel: #f8f7f3; --raised: #ffffff; --sunken: #eae7e0;
  --line: #e2ded6; --line-2: #ccc7bd;
  --ink: #171614; --ink-2: #3a3833; --muted: #6b675f; --faint: #9a958b;
  --warn: #9a6200; --danger: #b3361f;
  --b1: #c8583e; --b2: #b8861f; --b3: #2b8a7e; --b4: #3a69b0; --b5: #8a56b8;
  --on-ink: #f8f7f3;
  --scrim: rgba(23, 22, 20, .4);
  --shadow: 0 24px 64px -32px rgba(23, 22, 20, .35);
  --sx-kw: #8a3b12; --sx-str: #2f6b3a; --sx-num: #8a5a00; --sx-fn: #1f4e8c; --sx-bi: #6a3f8a;
  /* the stage: dark in both themes */
  --st-1: #2a2825; --st-2: #121110; --st-panel: #1b1a18; --st-line: rgba(255, 255, 255, .10); --st-line-2: rgba(255, 255, 255, .2);
  --st-ink: #f2efe9; --st-muted: rgba(242, 239, 233, .62); --st-bad: #f08a70;
  --sb1: #ef7a57; --sb2: #e2ad45; --sb3: #4fc3b2; --sb4: #7aa7ee; --sb5: #b98fe6;
  --floor: #4a463f; --grid: #8a8478; --grid-alpha: .2; --shadow-alpha: .5; --cage: #8f897d;

  --font-ui: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms; --t-panel: 200ms;
  --side-w: 280px; --insp-w: 360px;
  --m: 48px;                    /* the landing's page margin */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0e; --panel: #151514; --raised: #1d1d1b; --sunken: #0a0a09;
    --line: #262624; --line-2: #34332f;
    --ink: #eceae4; --ink-2: #cfccc4; --muted: #9a968d; --faint: #6e6a63;
    --warn: #e2b35a; --danger: #f08a70;
    --b1: #e5714f; --b2: #d9a33b; --b3: #45b8a8; --b4: #6c9be3; --b5: #b086dc;
    --on-ink: #0f0f0e; --scrim: rgba(0, 0, 0, .5); --shadow: 0 24px 64px -32px rgba(0, 0, 0, .8);
    --sx-kw: #e3936a; --sx-str: #9cc58a; --sx-num: #e2b35a; --sx-fn: #8db4ee; --sx-bi: #c3a0e4;
    --floor: #403c36; --shadow-alpha: .55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0e; --panel: #151514; --raised: #1d1d1b; --sunken: #0a0a09;
  --line: #262624; --line-2: #34332f;
  --ink: #eceae4; --ink-2: #cfccc4; --muted: #9a968d; --faint: #6e6a63;
  --warn: #e2b35a; --danger: #f08a70;
  --b1: #e5714f; --b2: #d9a33b; --b3: #45b8a8; --b4: #6c9be3; --b5: #b086dc;
  --on-ink: #0f0f0e; --scrim: rgba(0, 0, 0, .5); --shadow: 0 24px 64px -32px rgba(0, 0, 0, .8);
  --sx-kw: #e3936a; --sx-str: #9cc58a; --sx-num: #e2b35a; --sx-fn: #8db4ee; --sx-bi: #c3a0e4;
  --floor: #403c36; --shadow-alpha: .55;
  color-scheme: dark;
}
@media (prefers-contrast: more) {
  :root { --line: var(--line-2); --muted: var(--ink-2); }
}

/* builder colours: --c on the page, --sc on the stage */
[data-b="1"] { --c: var(--b1); --sc: var(--sb1); } [data-b="2"] { --c: var(--b2); --sc: var(--sb2); }
[data-b="3"] { --c: var(--b3); --sc: var(--sb3); } [data-b="4"] { --c: var(--b4); --sc: var(--sb4); }
[data-b="5"] { --c: var(--b5); --sc: var(--sb5); }

/* ------------------------------------------------------------ base: one viewport, no page scroll */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); color: var(--ink);
       font: 400 13px/20px var(--font-ui); -webkit-font-smoothing: antialiased; font-synthesis-weight: none;
       font-feature-settings: "ss01" off;
       padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
main { min-height: 0; min-width: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.stage :focus-visible, .stage:focus-visible { outline-color: var(--st-ink); }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-variant-ligatures: none; }
.label { font: 500 11px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 6px 12px; border-radius: 6px;
        background: var(--ink); color: var(--bg); text-decoration: none; }
.skip:focus { top: 8px; }
kbd { font: 500 11px/16px var(--font-mono); padding: 0 5px; border: 1px solid var(--line-2); border-radius: 4px;
      color: var(--muted); background: var(--panel); white-space: nowrap; }
svg { flex: none; }

/* the logo: five builder squares, stepped */
.logo { display: inline-grid; grid-template-columns: repeat(5, 6px); gap: 2px; align-items: end; height: 12px; flex: none; }
.logo i { width: 6px; height: 6px; border-radius: 1px; background: var(--c); }
.logo i:nth-child(2n) { transform: translateY(-3px); }

/* ------------------------------------------------------------ controls */
.ib { position: relative; width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; flex: none;
      border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-2);
      transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.ib:hover { background: var(--sunken); color: var(--ink); }
.ib svg { width: 16px; height: 16px; }
.ib[aria-disabled="true"], .ib:disabled { color: var(--faint); cursor: default; }
.ib[aria-disabled="true"]:hover, .ib:disabled:hover { background: transparent; }
.ib.ink { background: var(--ink); color: var(--on-ink); }
.ib.ink:hover { background: var(--ink-2); }
.ib.kbd-ib { width: auto; padding: 0 6px; }
.ib.kbd-ib kbd { background: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px;
       border-radius: 6px; border: 1px solid var(--line-2); background: var(--raised); color: var(--ink); white-space: nowrap;
       font: 500 13px/1 var(--font-ui); text-decoration: none;
       transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 14px; height: 14px; }
.link { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
        text-decoration-color: var(--line-2); }
.link:hover { text-decoration-color: var(--ink); }
/* large buttons: the landing and the studio */
.btn-lg { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 8px;
          font: 500 15px/1 var(--font-ui); letter-spacing: -.005em; text-decoration: none; white-space: nowrap;
          border: 1px solid var(--line-2); background: transparent; color: var(--ink);
          transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.btn-lg:hover { border-color: var(--ink); }
.btn-lg.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-lg.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-lg .arr { transition: transform var(--t-fast) var(--ease); }
.btn-lg:hover .arr { transform: translateX(2px); }
/* tooltips: CSS only, on hover and keyboard focus */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; z-index: 40; pointer-events: none; opacity: 0;
  left: 50%; top: calc(100% + 6px); transform: translate(-50%, -4px); white-space: nowrap;
  font: 500 12px/16px var(--font-ui); padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--on-ink);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
[data-tip]:hover::after, [data-tip]:focus-visible::after, [data-tip].tip-on::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
[data-tip].tip-on::after { transition-delay: 0s; }
[data-tip-pos="above"]::after { top: auto; bottom: calc(100% + 6px); }
[data-tip-pos="end"]::after { left: auto; right: 0; transform: translate(0, -4px); }
[data-tip-pos="end"]:hover::after, [data-tip-pos="end"]:focus-visible::after, [data-tip-pos="end"].tip-on::after { transform: none; }

.spinner { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor;
           border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; display: inline-block; }
.dot.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* chips: a 2 px-radius swatch and the builder's name */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/16px var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }

/* popovers: --raised, hairline, radius 8; placed by placePopover() through --px / --py */
.pop { position: fixed; inset: auto; left: var(--px, 50%); top: var(--py, 50%); margin: 0; padding: 0;
       border: 1px solid var(--line-2); border-radius: 8px; background: var(--raised); color: var(--ink);
       box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .3); }
.pop:popover-open { animation: pop-in var(--t-panel) var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* ------------------------------------------------------------ the stage */
.stage { position: relative; overflow: hidden; color: var(--st-ink);
         background: radial-gradient(75% 70% at 50% 55%, var(--st-1), var(--st-2)); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.is-waiting canvas { animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
/* stage chrome: solid, never glass */
.sb { position: relative; width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; flex: none;
      border: 0; border-radius: 6px; background: transparent; color: var(--st-ink);
      transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.sb:hover { background: rgba(255, 255, 255, .08); }
.sb svg { width: 16px; height: 16px; }
.sb[aria-pressed="true"] { background: var(--st-ink); color: var(--st-2); }
.sb[data-tip]::after { background: var(--st-ink); color: var(--st-2); }

/* the agent status line: on the IDE's stage and in the landing's window */
.hud { position: absolute; left: 12px; bottom: 12px; z-index: 4; display: flex; align-items: center; gap: 10px; height: 32px;
       padding: 0 12px; border-radius: 8px; background: var(--st-panel); border: 1px solid var(--st-line); color: var(--st-ink);
       font: 500 12px/16px var(--font-mono); white-space: nowrap; overflow: hidden; max-width: calc(100% - 120px); }
.hud .dot { background: var(--sc); width: 8px; height: 8px; }
.hud { font-family: var(--font-ui); font-size: 13px; }
.sl-who { color: var(--sc); font-weight: 600; }
.sl-id { color: var(--st-muted); font: 400 11px/16px var(--font-mono); margin-left: -4px; }
.sl-now { color: var(--st-ink); font-weight: 500; }
.sl-just { color: var(--st-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sl-just::before { content: "· "; }
.sl-just.bad { color: var(--st-bad); }
.sl-turn { color: var(--st-muted); font: 400 12px/16px var(--font-mono); }
.sl-time { margin-left: 2px; color: var(--st-muted); font: 400 12px/16px var(--font-mono); }

/* ============================================================ the landing */
.page-landing { display: grid; grid-template-rows: 64px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); font-size: 16px; line-height: 24px; }
.l-wrap { width: 100%; max-width: calc(1344px + 2 * var(--m)); margin: 0 auto; padding: 0 var(--m); }
.l-bar { display: flex; align-items: center; gap: 8px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; border-radius: 6px; min-width: 0; }
.brand-name { font: 600 15px/20px var(--font-ui); letter-spacing: -.01em; white-space: nowrap; }
.l-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.navlink { height: 36px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
           font: 500 14px/20px var(--font-ui); text-decoration: none; display: inline-flex; align-items: center; }
.navlink:hover { color: var(--ink); background: var(--sunken); }
.l-bar .ib { width: 36px; height: 36px; }
.hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: center;
        padding-top: 16px; padding-bottom: 48px; min-height: 0; }
.hero-copy { grid-column: 1 / span 5; min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 12px; font: 500 12px/16px var(--font-mono); letter-spacing: .08em;
           text-transform: uppercase; color: var(--muted); }
.display { margin-top: 16px; font: 600 clamp(40px, min(4.4vw + 8px, 8.6vh), 76px)/1.02 var(--font-ui); letter-spacing: -.04em; color: var(--ink); }
.display span { display: block; }
.lead { margin-top: 24px; font: 400 18px/28px var(--font-ui); color: var(--ink-2); max-width: 34ch; text-wrap: pretty; }
.actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.note { margin-top: 16px; font: 400 13px/20px var(--font-ui); color: var(--muted); }

.window { margin: 0; grid-column: 6 / span 7; height: min(640px, calc(100dvh - 64px - 64px)); min-height: 280px; position: relative;
          display: grid; grid-template-rows: 40px minmax(0, 1fr); border-radius: 12px; overflow: hidden;
          border: 1px solid var(--line); background: var(--st-2); box-shadow: var(--shadow); }
.w-bar { display: flex; align-items: center; gap: 12px; padding: 0 6px 0 16px; background: var(--st-panel); border-bottom: 1px solid var(--st-line);
         color: var(--st-muted); font: 400 12px/16px var(--font-mono); min-width: 0; }
.w-bar .logo { opacity: .9; }
.w-bar .w-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-bar .w-t b { color: var(--st-ink); font-weight: 500; }
.w-bar .sb { margin-left: auto; }
.w-bar .sb .i-play, .w-bar .sb[aria-pressed="true"] .i-pause { display: none; }
.w-bar .sb[aria-pressed="true"] .i-play { display: block; }
.w-bar .sb[aria-pressed="true"] { background: transparent; color: var(--st-ink); }
.w-body { display: grid; grid-template-columns: minmax(0, 1fr) 168px; min-height: 0; }
.w-stage { min-height: 0; cursor: grab; }
.w-stage:active { cursor: grabbing; }
.w-stage canvas { transition: opacity 450ms var(--ease); }
.w-stage.fading canvas { opacity: 0; }
.w-stage .hud { bottom: 44px; max-width: calc(100% - 24px); }
.w-agents { background: var(--st-panel); border-left: 1px solid var(--st-line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.w-agents .label { color: var(--st-muted); padding: 0 8px 8px; }
.w-agent { position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px;
           font: 400 12px/16px var(--font-mono); color: var(--st-muted); }
.w-agent::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sc); flex: none; opacity: .7; }
.w-agent .w-s { margin-left: auto; }
.w-agent[data-state="working"] { color: var(--st-ink); background: rgba(255, 255, 255, .06); }
.w-agent[data-state="working"]::before { opacity: 1; }
.w-agent[data-state="working"] .w-s { color: var(--sc); }
.w-agent[data-state="working"] .w-s::before { content: "● "; animation: pulse 1.6s ease-in-out infinite; }
.w-agent[data-state="next"] .w-s { color: var(--st-ink); }
.w-stats { margin-top: auto; display: grid; gap: 4px; padding: 12px 8px 4px; border-top: 1px solid var(--st-line); font: 400 12px/16px var(--font-mono); }
.w-stats div { display: flex; justify-content: space-between; }
.w-stats dt { color: var(--st-muted); }
.w-stats dd { color: var(--st-ink); }
.w-ticks { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 20px; display: flex; align-items: flex-end; gap: 2px; z-index: 2; pointer-events: none; }
.w-ticks i { flex: 1; height: calc(var(--h, .3) * 100%); min-height: 2px; background: var(--sc); opacity: .16; border-radius: 1px 1px 0 0;
             transition: opacity 300ms var(--ease); }
.w-ticks i.on { opacity: .9; }
.show-title { position: absolute; left: 0; right: 0; top: 8%; text-align: center; font: 500 clamp(18px, 1.8vw, 24px)/1.3 var(--font-ui);
              letter-spacing: -.01em; color: var(--st-ink); opacity: 0; transition: opacity 600ms var(--ease); pointer-events: none; z-index: 2; padding: 0 24px; }
.show-title.on { opacity: 1; }
.stage-empty::after { content: "The example couldn’t load."; position: absolute; inset: 0; display: grid; place-items: center;
                      font: 12px var(--font-mono); color: var(--st-muted); }

.about { width: 320px; padding: 16px; }
.about ul { display: grid; gap: 8px; margin-top: 8px; }
.about li { position: relative; padding-left: 16px; color: var(--ink-2); font-size: 13px; line-height: 20px; }
.about li::before { content: ""; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 1px; background: var(--line-2); }

@media (max-width: 1099px) {
  :root { --m: 32px; }
  .hero-copy { grid-column: 1 / span 6; }
  .window { grid-column: 7 / span 6; }
  .w-body { grid-template-columns: minmax(0, 1fr); }
  .w-agents { display: none; }
}
/* phone: the copy, then the window in the remaining height */
@media (max-width: 759px) {
  :root { --m: 20px; }
  .page-landing { grid-template-rows: 56px minmax(0, 1fr); }
  .l-bar { height: 56px; }
  .brand-name { font-size: 14px; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: stretch; row-gap: 20px; padding-top: 8px; padding-bottom: 20px; }
  .hero-copy, .window { grid-column: 1; }
  .window { height: auto; min-height: 200px; }
  .display { font-size: 40px; margin-top: 12px; }
  .lead { margin-top: 12px; font-size: 16px; line-height: 24px; }
  .actions { margin-top: 20px; flex-wrap: nowrap; gap: 8px; }
  .actions .btn-lg { flex: 1; padding: 0 12px; font-size: 14px; }
  .note { margin-top: 12px; }
  .w-bar { height: 36px; }
  .window { grid-template-rows: 36px minmax(0, 1fr); }
  .w-stage .hud { bottom: 40px; left: 8px; height: 28px; padding: 0 8px; gap: 8px; }
  .w-ticks { left: 8px; right: 8px; bottom: 8px; height: 16px; }
}
@media (max-width: 759px) and (max-height: 700px) { .note { display: none; } }

/* ============================================================ the IDE and the studio */
.page-ide { display: grid; grid-template-rows: 48px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.titlebar { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 16px; background: var(--bg);
            border-bottom: 1px solid var(--line); min-width: 0; position: relative; z-index: 20; }
.tb-home { display: inline-flex; align-items: center; height: 32px; padding: 0 4px; border-radius: 6px; }
.tb-sep { color: var(--faint); font: 14px var(--font-ui); }
.tb-crumb { font: 500 14px/20px var(--font-ui); color: var(--muted); text-decoration: none; border-radius: 4px; padding: 2px 4px; }
.tb-crumb:hover { color: var(--ink); }
.tb-name { font: 500 14px/20px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 40ch; }
.tb-name.is-title { font: 600 14px/20px var(--font-ui); letter-spacing: -.005em; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px;
        font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; flex: none; margin-left: 4px; }
.pill .dot { display: none; }
.pill[data-kind="live"] .dot { display: inline-block; background: var(--c, var(--b3)); animation: pulse 1.6s ease-in-out infinite; }
.pill[data-kind="live"] { border-color: color-mix(in srgb, var(--c, var(--b3)) 45%, var(--line-2)); }
.pill[data-kind="done"] { border-color: var(--ink); color: var(--ink); }
.pill[data-kind="warn"] { color: var(--warn); border-color: currentColor; }
.pill[data-kind="danger"] { color: var(--danger); border-color: currentColor; }
.pill-count { text-transform: none; letter-spacing: 0; color: var(--muted); }
.pill-count:empty { display: none; }
.tb-end { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.tb-end .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
/* what shows where: the studio's crumb, and run-only chrome hidden on the start screen */
body:not([data-mode="studio"]) .studio-only { display: none; }
body[data-view="start"] .run-only { display: none !important; }

/* rating: five 16 px stars, half steps */
.rating { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.stars { display: inline-flex; gap: 1px; padding: 4px 2px; border-radius: 4px; cursor: pointer; touch-action: none; }
.star { position: relative; width: 16px; height: 16px; display: block; }
.star svg { position: absolute; inset: 0; width: 16px; height: 16px; }
.star-bg { fill: none; stroke: var(--faint); stroke-width: 1.1; }
.star-fg { fill: var(--ink); clip-path: inset(0 100% 0 0); }
.star.half .star-fg { clip-path: inset(0 50% 0 0); }
.star.full .star-fg { clip-path: none; }
.stars.previewing .star-fg { fill: var(--muted); }
.stars-v { font: 500 12px/1 var(--font-mono); color: var(--muted); min-width: 4ch; }
.note-pop { width: 300px; padding: 12px; gap: 8px; }
.note-pop:popover-open { display: grid; }
.note-pop textarea { width: 100%; resize: none; height: 84px; padding: 8px; border: 1px solid var(--line-2); border-radius: 6px;
                     background: var(--sunken); font: 13px/20px var(--font-ui); }
.note-foot { display: flex; align-items: center; gap: 8px; }
.note-foot .count { margin-right: auto; font-size: 11px; color: var(--muted); }
.rate-msg { font-size: 12px; color: var(--muted); }
.rate-msg[data-kind="error"] { color: var(--danger); }
.rate-msg[data-kind="ok"] { color: var(--ink-2); }

/* keepsakes */
.keep-pop { width: 340px; padding: 4px 0; }
.keep-h { padding: 8px 16px; }
.keep-list { display: grid; }
.keep-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 32px; align-items: center; gap: 12px; padding: 8px 8px 8px 16px;
            border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.keep-row:hover { background: var(--panel); }
.keep-badge { font: 600 10.5px/18px var(--font-mono); letter-spacing: .04em; text-align: center; border: 1px solid var(--line-2);
              border-radius: 4px; color: var(--ink-2); }
.keep-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keep-size { font: 12px/1 var(--font-mono); color: var(--muted); }
.keep-dl { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: var(--ink); }
.keep-row:hover .keep-dl { background: var(--sunken); }
.keep-dl svg { width: 15px; height: 15px; }
.keep-empty { padding: 12px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ the studio's start screen */
.start { grid-row: 2; display: grid; place-items: center; padding: 32px 24px; min-height: 0; overflow: hidden; }
body:not([data-view="start"]) .start { display: none; }
body[data-view="start"] .workbench, body[data-view="start"] .phone-strip, body[data-view="start"] .sheet { display: none !important; }
.start-in { width: min(880px, 100%); display: grid; gap: 32px; }
.start-h { font: 600 28px/36px var(--font-ui); letter-spacing: -.02em; }
.start-sub { margin-top: 4px; font: 400 16px/24px var(--font-ui); color: var(--muted); }
.start-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.card { display: flex; flex-direction: column; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-width: 0; }
.card-p { font: 400 14px/20px var(--font-ui); color: var(--ink-2); }
.fields { display: grid; }
.fields div { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 36px; border-top: 1px solid var(--line); font: 400 14px/20px var(--font-ui); }
.fields div:last-child { border-bottom: 1px solid var(--line); }
.fields dt { color: var(--muted); }
.fields dd { color: var(--ink); font-weight: 500; text-align: right; }
.fields dd.mono { font-weight: 400; font-size: 13px; }
.fields select { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raised); padding: 0 8px; font-size: 13px; }
.card-foot { margin-top: auto; display: grid; gap: 8px; }
.cta { display: flex; align-items: stretch; height: 44px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; width: 100%;
       background: var(--ink); color: var(--on-ink); font: 500 15px/1 var(--font-ui); position: relative; }
.cta-label { flex: 1; display: inline-flex; align-items: center; padding: 0 16px; }
.cta-price { display: inline-flex; align-items: center; padding: 0 16px; border-left: 1px solid color-mix(in srgb, var(--on-ink) 22%, transparent);
             font: 500 14px/1 var(--font-mono); transition: background-color var(--t-fast) var(--ease); }
.cta:hover .cta-price { background: color-mix(in srgb, var(--on-ink) 12%, transparent); }
.cta:hover { background: var(--ink-2); }
.cta:active { transform: translateY(1px); }
.cta .spinner { position: absolute; right: 16px; top: 15px; }
.cta[aria-busy="true"] .spinner { display: block; }
.cta[aria-busy="true"] .cta-price { color: transparent; }
.cta:disabled { cursor: default; background: var(--sunken); color: var(--faint); }
.cta:disabled .cta-price { border-left-color: var(--line-2); background: none; }
.card-msg { font: 400 13px/20px var(--font-ui); color: var(--danger); }
.card-msg[data-kind="warn"] { color: var(--muted); }
.drop { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px;
        border: 1.5px dashed var(--line-2); border-radius: 8px; background: var(--bg); text-align: center; min-height: 200px;
        transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.drop.over { border-color: var(--ink); background: var(--raised); }
.drop.reading { opacity: .7; }
.drop.has-error { border-color: color-mix(in srgb, var(--danger) 50%, var(--line-2)); }
.drop-i { width: 24px; height: 24px; color: var(--muted); }
.drop-t { font: 500 14px/20px var(--font-ui); color: var(--ink); max-width: 28ch; }
.drop-note { font: 400 13px/20px var(--font-ui); color: var(--muted); }
.drop-err { font: 400 13px/20px var(--font-ui); color: var(--danger); max-width: 40ch; overflow-wrap: anywhere; }
.examples { display: grid; gap: 8px; }
.ex-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto auto; align-items: center; gap: 16px; height: 56px; padding: 0 16px;
          border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-decoration: none; color: var(--ink);
          transition: border-color var(--t-fast) var(--ease); }
.ex-row:hover { border-color: var(--line-2); }
.ex-row:hover .ex-go { color: var(--ink); }
.spark { display: flex; align-items: flex-end; gap: 1px; height: 24px; }
.spark i { flex: 1; height: calc(var(--h, .3) * 100%); background: var(--c); border-radius: 1px 1px 0 0; min-width: 0; }
.ex-t { font: 500 14px/20px var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-m { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ex-go { font: 500 14px/20px var(--font-ui); color: var(--muted); white-space: nowrap; }

/* ------------------------------------------------------------ the workbench (v4: the v2 studio, quiet by default) */
.page-ide:not([data-view="start"]) { grid-template-rows: 48px minmax(0, 1fr) 24px; }
.workbench { position: relative; display: flex; min-height: 0; min-width: 0; }
.side, .inspector { flex: none; min-height: 0; background: var(--panel); display: flex; flex-direction: column; position: relative; z-index: 5; }
.side { width: var(--side-w); }
.inspector { width: var(--insp-w); }
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-collapsed .side, .side-collapsed #split-side { display: none; }
.insp-collapsed .inspector, .insp-collapsed #split-insp { display: none; }

/* the activity bar: icons with their names, so nobody has to guess */
.activity { width: 60px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0;
            border-right: 1px solid var(--line); background: var(--bg); z-index: 6; min-height: 0; overflow: hidden; }
.act { position: relative; width: 52px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
       padding: 4px 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
       font: 500 10.5px/12px var(--font-ui); letter-spacing: .01em;
       transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.act svg { width: 20px; height: 20px; }
.act:hover { color: var(--ink); background: var(--sunken); }
.act[aria-pressed="true"] { color: var(--ink); }
.act[aria-pressed="true"]::before { content: ""; position: absolute; left: -4px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--ink); }
.act-sep { width: 24px; height: 1px; background: var(--line); margin: 6px 0; flex: none; }
.act-gap { flex: 1; }

/* splitters: 1 px visible, 8 px hit area, ink on hover or drag (the WAI-ARIA window-splitter pattern) */
.splitter { flex: none; position: relative; background: var(--line); z-index: 7; }
.splitter.v { width: 1px; cursor: col-resize; }
.splitter.h { height: 1px; cursor: row-resize; }
.splitter.v::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; right: -4px; }
.splitter.h::before { content: ""; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }
.splitter:hover, .splitter.dragging, .splitter:focus-visible { background: var(--ink); }
.splitter:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--ink); }
body.resizing { user-select: none; }
body.resizing.v-resize { cursor: col-resize; }
body.resizing.h-resize { cursor: row-resize; }

.pane { display: flex; flex-direction: column; min-height: 0; flex: 1; min-width: 0; }
.pane-h { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 16px; flex: none; }
.pane-h .label { white-space: nowrap; }
.pane-meta { margin-left: auto; font: 400 12px/16px var(--font-ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-meta.mono { font-family: var(--font-mono); }
.pane-empty { padding: 16px; color: var(--muted); font-size: 13px; }
.pane-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
q.qt { quotes: "“" "”"; }

/* ------------------------------------------------------------ the relay: the communication, shown as hand-offs */
.relay-how { padding: 0 16px 12px; font: 400 13px/20px var(--font-ui); color: var(--ink-2); text-wrap: pretty; flex: none; }
.hint { margin: 0 12px 12px; padding: 10px 12px 12px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--raised); flex: none; display: grid; gap: 6px; }
.hint-top { display: flex; align-items: center; gap: 8px; }
.hint-top .hint-h { margin-right: auto; }
.phone-hint { display: none; }
.hint-h { font: 600 14px/20px var(--font-ui); }
.hint-l { list-style: decimal; padding-left: 18px; display: grid; gap: 2px; font: 400 12.5px/18px var(--font-ui); color: var(--ink-2); }
.hint-l b { font-weight: 600; color: var(--ink); }
.baton { display: flex; gap: 4px; padding: 0 12px 12px; flex: none; border-bottom: 1px solid var(--line); }
.baton li { flex: 1; min-width: 0; }
.bt { width: 100%; display: grid; gap: 2px; padding: 6px 5px 5px; border: 1px solid var(--line); border-radius: 6px; background: transparent;
      text-align: left; color: var(--ink-2); min-width: 0; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.bt:hover { border-color: var(--line-2); }
.bt-top { display: flex; align-items: center; gap: 6px; font: 500 12px/16px var(--font-ui); min-width: 0; }
.bt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-state { display: flex; align-items: center; gap: 3px; font: 400 11px/14px var(--font-ui); color: var(--muted); white-space: nowrap; overflow: hidden; }
.bt-state .flag { width: 10px; height: 10px; color: var(--ink-2); }
.bt[data-state="working"] { background: var(--raised); border-color: color-mix(in srgb, var(--c) 60%, var(--line-2)); box-shadow: inset 0 -2px 0 var(--c); color: var(--ink); }
.bt[data-state="working"] .bt-state { color: var(--ink); font-weight: 500; }
.bt[data-state="working"] .sw { animation: pulse 1.6s ease-in-out infinite; }
.bt[data-state="next"] .bt-state { color: var(--ink-2); }
.bt[aria-pressed="true"] { background: var(--sunken); border-color: var(--ink-2); }

.thread-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.thread { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.thread > * { flex: none; }
.thread { scroll-padding-top: 40px; scroll-padding-bottom: 8px; }
.thread-wrap .pane-empty { position: absolute; inset: 0 0 auto; }
.t-story { padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 8px; display: grid; gap: 4px; margin-bottom: 4px; }
.s-line { font: 400 13px/19px var(--font-ui); color: var(--ink-2); overflow-wrap: anywhere; }
.s-line .c-who { margin-right: 2px; }
.s-lead { font: 500 12px/19px var(--font-mono); color: var(--muted); margin-right: 6px; }
.s-done { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.s-done .flag { width: 11px; height: 11px; align-self: center; }
.s-line .qt { color: var(--ink); }
.t-round { display: grid; gap: 4px; }
.r-head { position: sticky; top: -8px; min-width: 0; z-index: 1; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px; margin-top: 4px; border: 0;
          background: var(--panel); text-align: left; color: var(--ink-2); font: 500 12px/16px var(--font-ui); }
.r-head .chev { width: 10px; height: 10px; color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.r-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.r-head:hover { color: var(--ink); }
.r-t { white-space: nowrap; }
.r-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font: 400 12px/16px var(--font-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-round.closed .r-body { display: none; }
.r-body { display: grid; gap: 4px; }
.r-meta .flag { width: 10px; height: 10px; color: var(--ink-2); }
.rc { scroll-margin-top: 36px; }

/* a card: one turn. Closed: who, which turn, what it added, its guess in two lines. Open: the hand-off. */
.rc { position: relative; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.rc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.c-head { width: 100%; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 14px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.c-head.static { cursor: default; }
button.c-head:hover { background: color-mix(in srgb, var(--raised) 70%, transparent); }
.c-who { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/18px var(--font-ui); color: var(--ink); white-space: nowrap; }
.c-id { font: 400 11px/16px var(--font-mono); color: var(--muted); }
.c-turn { font-size: 12px; color: var(--muted); white-space: nowrap; }
.c-add { margin-left: auto; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.c-flag { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font: 500 11px/16px var(--font-ui); color: var(--ink);
          padding: 0 6px; border: 1px solid var(--ink-2); border-radius: 4px; white-space: nowrap; }
.c-flag .flag { width: 10px; height: 10px; }
.c-clock { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.c-guess { padding: 0 12px 0 14px; margin-bottom: 8px; font: 400 13px/19px var(--font-ui); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2;
           -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.c-conf { font: 400 11.5px/16px var(--font-mono); color: var(--muted); white-space: nowrap; }
.c-none { color: var(--muted); font-style: italic; }
.rc[data-kind="pass"] .c-guess { color: var(--muted); }
.rc.open { background: var(--raised); border-color: var(--line-2); box-shadow: 0 1px 0 var(--line); }
.rc.open > .c-guess { display: none; }
.c-body { padding: 0 12px 12px 14px; display: grid; gap: 12px; }
.c-body .label { margin-bottom: 6px; display: block; }
.handoff { display: grid; }
.ho-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ho-col { padding: 8px 10px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); display: grid; align-content: start; gap: 4px; min-width: 0; }
.ho-h { display: flex; align-items: center; gap: 6px; font: 500 12px/16px var(--font-ui); color: var(--ink); }
.ho-q { font: 400 13px/19px var(--font-ui); color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.ho-int { font: 400 12px/17px var(--font-ui); color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ho-int .qt { color: var(--ink-2); }
.ho-note { margin-top: 8px; font: 400 12px/17px var(--font-ui); color: var(--ink-2); }
.ho-note::before { content: "↳ "; color: var(--muted); }
.handoff.first .ho-note { margin-top: 0; }
.handoff.first .ho-note::before { content: none; }
.c-what { font: 400 13px/19px var(--font-ui); color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.c-what b { font-weight: 600; }
.c-sub { font: 400 12px/17px var(--font-ui); color: var(--muted); margin-top: 4px; }
.c-steps { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-tools { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.c-body { gap: 10px; grid-template-columns: minmax(0, 1fr); }
.c-did, .handoff { min-width: 0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.sm[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.rc.now .c-seen { display: block; font: 400 12px/17px var(--font-ui); color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--line); }
.c-seen .label { display: inline; margin: 0 6px 0 0; }
.ho-note .c-seen { color: var(--muted); }
/* the builder at work now: its finished steps, in plain words; the current one pulses */
.rc.now { background: var(--raised); border-color: color-mix(in srgb, var(--c) 45%, var(--line-2)); padding-bottom: 10px; }
.now-steps { display: grid; gap: 2px; padding: 0 12px 0 14px; }
.ns { display: flex; align-items: center; gap: 8px; font: 400 13px/20px var(--font-ui); color: var(--ink-2); }
.ns-m { width: 12px; text-align: center; font: 400 12px/1 var(--font-mono); color: var(--muted); flex: none; }
.ns.bad { color: var(--danger); } .ns.bad .ns-m { color: var(--danger); }
.ns.cur { color: var(--ink); font-weight: 500; }
.ns.cur .dot { width: 8px; height: 8px; margin: 0 2px; background: var(--c); }
.rc.now .c-sub { padding: 0 12px 0 14px; }
.rc.now .c-seen { margin: 8px 12px 0 14px; }
.t-end { padding: 12px; border: 1px solid var(--ink-2); border-radius: 8px; display: grid; gap: 6px; margin-top: 8px; }
.end-t { font: 500 13px/19px var(--font-ui); color: var(--ink); }
.thread-wrap .newpill { bottom: 16px; }

/* ------------------------------------------------------------ the builders view */
.agents-model { font: 400 12px/16px var(--font-ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.agents-model:not(:empty)::before { content: "· "; }
.col-h { margin-left: auto; padding-right: 8px; color: var(--faint); }
.agent-list { display: grid; gap: 2px; padding: 0 8px 12px; }
.agent { position: relative; width: 100%; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
         height: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: var(--ink); }
.agent .chip { font-family: var(--font-ui); }
.agent:hover { background: var(--sunken); }
.agent .a-state { font: 400 13px/20px var(--font-ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .a-model { font: 400 12px/16px var(--font-ui); color: var(--faint); white-space: nowrap; }
.agent .a-model:empty { display: none; }
.agent .a-fig { font-size: 12px; color: var(--muted); }
.agent .a-share { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; border-radius: 1px; background: var(--line); display: none; }
.agent .a-share::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--v, 0) * 100%); background: var(--c); border-radius: 1px; }
.agent[data-state="done"] .a-share { display: block; }
.agent[data-state="working"] { background: var(--raised); box-shadow: inset 2px 0 0 var(--c), 0 0 0 1px var(--line); }
.agent[data-state="working"] .a-state { color: var(--ink); font-weight: 500; }
.agent[data-state="working"] .a-state::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%;
                                                 background: var(--c); vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
.agent[data-state="next"] .a-state { color: var(--ink-2); }
.agent[aria-pressed="true"] { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line-2); }
.bstats { display: grid; gap: 8px; padding: 4px 12px 16px; border-top: 1px solid var(--line); }
.bs { padding: 10px 0 0; display: grid; gap: 2px; }
.bs-h { display: flex; align-items: center; gap: 6px; font: 600 13px/18px var(--font-ui); }
.bs-f { font: 400 12px/17px var(--font-ui); color: var(--muted); }
.bs-g { font: 400 12px/17px var(--font-ui); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bs-l { color: var(--muted); }

/* ------------------------------------------------------------ Turns: one line a turn, one mark a step */
.turns-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.turns { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; outline-offset: -2px; padding: 0 0 8px; }
.trow { position: relative; height: 32px; padding: 0 16px; display: grid; grid-template-columns: 3ch 36px minmax(0, 1fr) auto 5ch;
        align-items: center; gap: 8px; cursor: pointer; font: 400 12px/16px var(--font-mono); font-variant-numeric: tabular-nums; }
.trow:hover { background: color-mix(in srgb, var(--raised) 70%, transparent); }
.trow.round-start { box-shadow: inset 0 1px 0 var(--line); }
.trow.current { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.trow[aria-selected="true"] { background: var(--raised); }
.trow[aria-selected="true"]::before, .trow.current::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--c); }
.trow.active-desc { box-shadow: inset 0 0 0 1px var(--line-2); }
.turns:focus-visible .trow.active-desc { box-shadow: inset 0 0 0 2px var(--ink); }
.trow.future { opacity: .4; }
.trow .chip { font-size: 12px; }
.t-n { text-align: right; color: var(--muted); }
.t-add { color: var(--ink-2); text-align: right; }
.t-dur { color: var(--muted); text-align: right; }
.trow.live { cursor: default; }
.trow.live .t-add { color: var(--c); font-family: var(--font-ui); }
.strip { display: flex; align-items: center; gap: 3px; min-width: 0; overflow: hidden; }
.strip i { width: 6px; height: 6px; border-radius: 1px; background: var(--faint); flex: none; }
.strip i.t-guess { border-radius: 50%; }
.strip i.t-submit { background: var(--ink-2); }
.strip i.t-look { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.strip i.bad { background: var(--danger); box-shadow: none; }
.strip i.now { background: var(--c); animation: pulse 1.6s ease-in-out infinite; border-radius: 50%; }
.newpill { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2; height: 28px; padding: 0 12px; border-radius: 14px;
           border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); font: 500 12px/1 var(--font-ui); white-space: nowrap; }
.turns-wrap .pane-empty { position: absolute; inset: 0 0 auto; }

/* ------------------------------------------------------------ the editor area: tabs and the viewport */
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { height: 36px; flex: none; display: flex; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); }
.etab { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-right: 1px solid var(--line);
        background: transparent; color: var(--muted); font: 500 13px/1 var(--font-ui); white-space: nowrap; }
.etab[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.etab.preview { font-style: italic; font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.etab-wrap { display: inline-flex; align-items: stretch; }
.etab-x { width: 28px; border: 0; background: transparent; color: var(--muted); border-right: 1px solid var(--line); display: grid; place-items: center; padding: 0; }
.etab-x:hover { color: var(--ink); background: var(--sunken); }
.etab-x svg { width: 12px; height: 12px; }
.vp { flex: 1; min-height: 0; position: relative; }
.vp > .stage { position: absolute; inset: 0; isolation: isolate; }
.vp > .stage:focus-visible { outline-offset: -3px; }
.code-view { position: absolute; inset: 0; background: var(--sunken); overflow: auto; z-index: 2; }
.code-view .code { padding: 12px 0; border: 0; border-radius: 0; min-height: 100%; }

/* the floating toolbar, top centre, solid */
.toolbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 2px;
           height: 40px; padding: 0 4px; background: var(--st-panel); border: 1px solid var(--st-line); border-radius: 8px; }
.toolbar .tsep { width: 1px; height: 20px; background: var(--st-line); margin: 0 4px; }
.toolbar .sb[data-tip]::after { top: calc(100% + 8px); }
.view-menu { width: 224px; padding: 4px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
             background: transparent; text-align: left; font-size: 13px; color: var(--ink); }
.menu-item:hover, .menu-item:focus-visible { background: var(--sunken); }
.menu-item kbd { margin-left: auto; }
.menu-item[aria-checked="true"]::after { content: "✓"; margin-left: 8px; font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-label { padding: 8px 8px 4px; }
.phone-menu { display: none; }

.jump-live { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 4; height: 28px; padding: 0 12px;
             display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; border: 1px solid var(--st-line-2);
             background: var(--st-ink); color: var(--st-2); font: 500 12px/1 var(--font-ui); }
.jump-live svg { width: 12px; height: 12px; }
.banner { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px;
          padding: 6px 6px 6px 12px; border-radius: 8px; background: var(--st-panel); border: 1px solid var(--st-line); color: var(--st-ink);
          max-width: calc(100% - 24px); animation: pop-in var(--t-panel) var(--ease); }
.banner-t { font: 400 12px/18px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-t.prose { font: 400 13px/18px var(--font-ui); white-space: normal; }
.banner .bbtn { height: 28px; padding: 0 12px; border: 1px solid var(--st-line-2); border-radius: 6px; background: transparent; color: var(--st-ink);
                font: 500 12px/1 var(--font-ui); text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.banner .bbtn:hover { background: rgba(255, 255, 255, .08); }
.banner .bbtn.ink { background: var(--st-ink); color: var(--st-2); border-color: var(--st-ink); }
.banner[data-kind="error"] { border-color: color-mix(in srgb, var(--sb1) 50%, transparent); }

/* the waiting states: centred on the cage */
.vp-state { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; text-align: center; display: grid; gap: 8px;
            justify-items: center; pointer-events: none; max-width: min(420px, 90%); }
.vp-state .vs-h { font: 500 16px/24px var(--font-ui); color: var(--st-ink); letter-spacing: -.01em; }
.vp-state .vs-p { font: 400 13px/20px var(--font-ui); color: var(--st-muted); text-wrap: balance; }
.vp-state a { pointer-events: auto; margin-top: 4px; color: var(--st-ink); font: 500 13px/20px var(--font-ui); }
.vp-state .dot { background: var(--st-muted); }

/* the layer slicer: a vertical two-thumb rail on the right edge */
.slicer { position: absolute; right: 16px; top: 72px; bottom: 112px; width: 44px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.slicer-label { font: 500 11px/16px var(--font-mono); color: var(--st-ink); background: var(--st-panel); border: 1px solid var(--st-line);
                border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.rail { position: relative; flex: 1; width: 28px; min-height: 60px; }
.rail::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--st-line-2); border-radius: 1px; }
.rail-fill { position: absolute; left: 13px; width: 2px; background: var(--st-ink); top: calc((1 - var(--hi, 1)) * 100%); bottom: calc(var(--lo, 0) * 100%); }
.thumb { position: absolute; left: 4px; width: 20px; height: 12px; margin-top: -6px; border-radius: 3px; background: var(--st-ink);
         border: 2px solid var(--st-2); cursor: ns-resize; touch-action: none; padding: 0; }
.thumb.hi { top: calc((1 - var(--hi, 1)) * 100%); }
.thumb.lo { top: calc((1 - var(--lo, 0)) * 100%); }
.thumb:focus-visible { outline: 2px solid var(--st-ink); outline-offset: 2px; }

.legend { position: absolute; left: 12px; top: 12px; z-index: 4; display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px;
          background: var(--st-panel); border: 1px solid var(--st-line); }
.legend .lg { display: flex; align-items: center; gap: 8px; font: 400 12px/18px var(--font-mono); color: var(--st-ink); }
.legend .lg::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sc); }
.legend .lg span { margin-left: auto; padding-left: 12px; color: var(--st-muted); }

/* the zoom and the axis gizmo, bottom right */
.nav-corner { position: absolute; right: 12px; bottom: 12px; z-index: 4; display: flex; align-items: flex-end; gap: 8px; }
.zoom { display: flex; align-items: center; height: 32px; padding: 0 2px; background: var(--st-panel); border: 1px solid var(--st-line); border-radius: 8px; }
.zoom .sb { width: 28px; height: 28px; }
.zoom-v { min-width: 44px; text-align: center; font: 500 11px/1 var(--font-mono); color: var(--st-ink); border: 0; background: none; padding: 0; height: 28px; }
.gizmo { position: relative; width: 72px; height: 72px; border-radius: 50%; cursor: grab; touch-action: none; }
.gizmo:hover { background: rgba(255, 255, 255, .05); }
.gz { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; padding: 0;
      transform: translate(calc(var(--gx, 0) * 26px), calc(var(--gy, 0) * -26px)); z-index: var(--gzi, 1);
      border: 1.5px solid var(--st-ink); background: var(--st-2); color: var(--st-2); font: 700 9px/13px var(--font-mono); display: grid; place-items: center; }
.gz.pos { background: var(--st-ink); }
.gz.neg { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-color: var(--st-muted); opacity: .8; }
.gz:hover { box-shadow: 0 0 0 2px var(--st-line-2); }
.gzl { position: absolute; left: 50%; top: 50%; height: 1.5px; width: calc(var(--gl, 0) * 26px); background: var(--st-muted); transform-origin: 0 50%;
       transform: rotate(var(--ga, 0deg)); opacity: .7; pointer-events: none; }

/* ------------------------------------------------------------ the bottom panel: every guess, the log (closed by default) */
.bottom { height: var(--bottom-h); flex: none; min-height: 0; display: none; flex-direction: column; background: var(--panel); }
body:not(.bottom-open) #split-bottom { display: none; }
.bottom-open .bottom { display: flex; }
.btabs { height: 36px; flex: none; display: flex; align-items: stretch; padding: 0 4px 0 8px; border-bottom: 1px solid var(--line); }
.btablist { display: flex; align-items: stretch; gap: 4px; }
.btab { border: 0; background: transparent; padding: 0 8px; font: 500 13px/1 var(--font-ui); color: var(--muted); }
.btab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.btab:hover { color: var(--ink); }
.btabs .ends { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.rd-tools { display: flex; align-items: center; gap: 12px; padding: 6px 12px; flex: none; border-bottom: 1px solid var(--line); min-height: 40px; }
.rd-note { flex: 1; min-width: 0; font: 400 12px/17px var(--font-ui); color: var(--ink-2); }
.rd-tools .btn { height: 28px; font-size: 12px; }
.rd-tools .btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.rtable { display: grid; }
.rrow { display: grid; grid-template-columns: 3ch 64px minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.rrow:hover { background: var(--raised); }
.rrow .rn { font-size: 12px; color: var(--muted); text-align: right; }
.rrow .chip { font-family: var(--font-ui); }
.rrow .rt { font: 400 13px/19px var(--font-ui); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.r-tag { font: 500 11px/16px var(--font-ui); color: var(--muted); }
.r-tag:not(:empty) { margin-left: 6px; padding: 0 6px; border: 1px dashed var(--line-2); border-radius: 4px; white-space: nowrap; }
.rrow.unseen .rt .qt { color: var(--muted); }
.rrow.later { opacity: .45; }
.conf { display: flex; align-items: center; gap: 6px; font: 400 11.5px/1 var(--font-mono); color: var(--muted); }
.conf .bar { flex: 1; height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.conf .bar i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--c); }
.rgroup-h { padding: 8px 12px 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
/* the Log */
.con-tools { display: flex; align-items: center; gap: 8px; padding: 6px 12px; flex: none; border-bottom: 1px solid var(--line); }
.con-tools input { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--sunken); font: 12px var(--font-mono); }
.con-tools .btn { height: 28px; font-size: 12px; }
.con-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.con { flex: 1; min-height: 0; overflow: auto; padding: 8px 0; font: 400 12px/18px var(--font-mono); overscroll-behavior: contain; }
.cl-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 0 12px; white-space: pre; }
.cl-row .ts { color: var(--faint); }
.cl-row .msg { overflow: hidden; text-overflow: ellipsis; }
.cl-row .q { color: var(--muted); }
.cl-row[data-kind="warn"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.cl-row[data-kind="error"] { color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.cl-row[data-kind="status"] .msg { color: var(--ink-2); }
.cl-row .bn { color: var(--c); }

/* ------------------------------------------------------------ the timeline (56 px), always there: how far along */
.timeline { flex: none; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 12px 0 8px; border-top: 1px solid var(--line); background: var(--panel); min-width: 0; }
.transport { display: flex; align-items: center; gap: 0; flex: none; }
.transport .ib .i-pause { display: none; }
.transport .ib.playing .i-pause { display: block; }
.transport .ib.playing .i-play { display: none; }
.readout { flex: none; font: 500 12px/1 var(--font-mono); color: var(--ink-2); min-width: 6ch; text-align: right; }
.readout .of { color: var(--muted); }
.speed { flex: none; height: 28px; min-width: 40px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: transparent;
         font: 500 12px/1 var(--font-mono); color: var(--ink-2); }
.speed:hover { border-color: var(--muted); color: var(--ink); }
.timeline [data-tip]::after { top: auto; bottom: calc(100% + 6px); }   /* above: below would overflow the page */
.track { position: relative; flex: 1; height: 32px; min-width: 0; cursor: pointer; touch-action: none; border-radius: 2px; }
.track:focus-visible { outline-offset: 4px; }
.slots { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.slot { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; min-width: 0; }
.slot i { display: block; width: 100%; height: calc(max(.08, var(--h, 0)) * 100%); background: var(--c); border-radius: 1px 1px 0 0; }
.slot.future { border-bottom: 1px dashed var(--line-2); }
.slot.future i { display: none; }
.slot.after i { opacity: .3; }
.slot.dim i { opacity: .2; }
.slot.said-done::before { content: ""; position: absolute; left: 50%; top: -7px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%;
                          background: var(--c); box-shadow: 0 0 0 1.5px var(--panel); }
.slot.round-start::after { content: ""; position: absolute; left: -1px; bottom: -4px; height: 3px; width: 1px; background: var(--line-2); }
.track.shaded::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; left: calc(var(--end, 1) * 100%);
                       background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px); pointer-events: none; }
.playhead { position: absolute; top: -4px; bottom: -2px; left: calc(var(--p, 0) * 100%); width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; z-index: 2; border-radius: 1px; }
.playhead span { display: none; }
.livemark { position: absolute; top: -2px; left: calc(var(--p, 0) * 100%); z-index: 1; pointer-events: none; display: flex; align-items: center; gap: 4px;
            font: 600 10px/14px var(--font-mono); letter-spacing: .06em; color: var(--ink-2); transform: translate(6px, 0); }
.hovercard { position: absolute; bottom: calc(100% + 12px); z-index: 6; width: 280px; padding: 8px 12px; pointer-events: none;
             left: clamp(0px, calc(var(--p, 0) * 100% - 140px), calc(100% - 280px)); background: var(--raised); border: 1px solid var(--line-2); border-radius: 8px; display: grid; gap: 4px;
             box-shadow: 0 12px 32px -16px rgba(0, 0, 0, .3); }
.hovercard .hc1 { display: flex; gap: 8px; align-items: center; font: 12px/16px var(--font-mono); }
.hovercard .hc2 { font: 400 13px/18px var(--font-ui); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------ Details (the Inspector), closed by default */
.insp-top { border-bottom: 1px solid var(--line); }
.insp-top .insp-x { margin-left: auto; }
.insp-h { padding: 16px 12px 12px 16px; display: grid; gap: 4px; flex: none; }
.insp-h1 { display: flex; align-items: center; gap: 12px; }
.insp-n { font: 500 20px/28px var(--font-mono); letter-spacing: -.02em; }
.insp-h1 .chip { font-family: var(--font-ui); }
.insp-nav { margin-left: auto; display: flex; gap: 2px; }
.insp-meta { font-size: 12px; line-height: 16px; color: var(--muted); }
.insp-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
.insp-desc { font: 400 15px/22px var(--font-ui); color: var(--ink); text-wrap: pretty; overflow-wrap: anywhere; padding-bottom: 16px; }
.no-turn .insp-body > :not(.insp-desc) { display: none; }
.no-turn .insp-desc { font-size: 14px; line-height: 20px; color: var(--muted); }
.no-turn .insp-h1 .insp-nav, .no-turn .insp-h1 .chip { display: none; }
.blk { border-top: 1px solid var(--line); padding: 12px 0 16px; }
.blk .label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.label-meta { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.reading-q { font: 400 14px/20px var(--font-ui); color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; }
.confbar { margin-top: 8px; display: flex; align-items: center; gap: 8px; font: 400 12px/1 var(--font-mono); color: var(--muted); }
.confbar .bar { flex: 1; height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.confbar .bar i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--c); }
.trace { display: grid; gap: 2px; }
.tr { display: grid; grid-template-columns: 12px minmax(0, 1.6fr) minmax(0, 1fr) 5ch; align-items: center; gap: 8px; min-height: 24px; font: 400 12px/16px var(--font-ui); }
.tr-mark { color: var(--muted); text-align: center; font-family: var(--font-mono); }
.tr.bad .tr-mark, .tr.bad .tr-tool { color: var(--danger); }
.tr-tool { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-bar { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.tr-bar i { display: block; height: 100%; width: calc(var(--w, 0) * 100%); background: var(--ink-2); border-radius: 3px; opacity: .55; }
.tr.bad .tr-bar i { background: var(--danger); opacity: .8; }
.tr-ms { color: var(--muted); text-align: right; font-family: var(--font-mono); }
.tr-none { color: var(--muted); font-size: 13px; }
.sect { border-top: 1px solid var(--line); }
.sect-h { width: 100%; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0; border: 0; background: transparent; text-align: left;
          font: 500 13px/20px var(--font-ui); color: var(--ink-2); }
.sect-h:hover { color: var(--ink); }
.sect-h .chev { width: 10px; height: 10px; color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.sect-h[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sect-b { padding: 0 0 16px; font: 400 14px/22px var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
.sect-h[aria-expanded="false"] + .sect-b { display: none; }
.sect-note { font-size: 12px; line-height: 17px; color: var(--muted); margin-bottom: 8px; }
.prog-meta { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.plan { display: grid; gap: 4px; counter-reset: plan; font: 400 12px/18px var(--font-mono); color: var(--ink-2); }
.plan li { display: grid; grid-template-columns: 2ch 1fr; gap: 8px; }
.plan li::before { counter-increment: plan; content: counter(plan); color: var(--faint); text-align: right; }
.plan.plan-prose { display: block; font: 400 14px/22px var(--font-ui); color: var(--ink-2); }
.plan.plan-prose li { display: block; }
.plan.plan-prose li::before, .plan li.dash::before { content: none; }
.plan li.dash { display: block; }
.dash { color: var(--faint); font: 13px var(--font-mono); }
.prog-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.prog-tools kbd { margin-left: 2px; padding: 0 4px; }
.code { margin: 0; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; overflow: auto; padding: 8px 0;
        font: 400 12.5px/20px var(--font-mono); font-variant-ligatures: none; tab-size: 4; color: var(--ink); max-height: 100%; }
.code .cl { display: grid; grid-template-columns: 4ch max-content; gap: 12px; padding: 0 12px 0 0; white-space: pre; }
.code .cn { text-align: right; color: var(--faint); user-select: none; }
.code .cc { white-space: pre; }
.t-kw { color: var(--sx-kw); } .t-str { color: var(--sx-str); } .t-num { color: var(--sx-num); }
.t-fn { color: var(--sx-fn); } .t-bi { color: var(--sx-bi); } .t-com { color: var(--muted); font-style: italic; }
.sect.prog .code { max-height: 360px; }
.code-view .code .cl { padding-left: 8px; }
.sect-b, .sheet-body, .insp-body, .pane { min-width: 0; }
.insp-pane { min-height: 0; }

/* ------------------------------------------------------------ the status bar: plain words, always there */
.statusbar { display: flex; align-items: stretch; height: 24px; padding: 0 6px; background: var(--bg); border-top: 1px solid var(--line);
             font: 400 12px/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--muted); min-width: 0; overflow: hidden; }
body[data-view="start"] .statusbar { display: none; }
.sbi { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 0; background: transparent; color: inherit; white-space: nowrap; font: inherit; }
button.sbi:hover { background: var(--sunken); color: var(--ink); }
.sbi .dot { width: 6px; height: 6px; background: var(--faint); }
.sbi[data-conn="live"] .dot, .sbi[data-conn="connected"] .dot { background: var(--b3); }
.sbi[data-conn="live"] .dot { animation: pulse 1.6s ease-in-out infinite; }
.sbi[data-conn="reconnecting"] { color: var(--warn); } .sbi[data-conn="reconnecting"] .dot { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.sbi[data-conn="offline"] { color: var(--danger); } .sbi[data-conn="offline"] .dot { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.sb-now { color: var(--ink); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.sb-now[data-b]:not([data-b=""])::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); flex: none; }
.sb-gap { flex: 1; }
#sb-zoom { font-family: var(--font-mono); }

/* ------------------------------------------------------------ dialogs and popovers: the command palette, shortcuts, How it works */
dialog.dlg { padding: 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raised); color: var(--ink);
             box-shadow: 0 24px 64px -20px rgba(0, 0, 0, .4); max-height: 70vh; }
dialog.dlg::backdrop { background: var(--scrim); }
dialog.dlg[open] { animation: pop-in var(--t-panel) var(--ease); }
.palette { width: min(560px, calc(100vw - 24px)); margin: 16vh auto auto; flex-direction: column; }
.palette[open] { display: flex; }
.pal-in { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; height: 48px; border-bottom: 1px solid var(--line); flex: none; }
.pal-in svg { width: 16px; height: 16px; color: var(--muted); }
.pal-in input { flex: 1; border: 0; background: transparent; outline: none; font: 15px var(--font-ui); height: 100%; }
.pal-list { overflow: auto; padding: 4px; max-height: min(360px, 50vh); }
.pal-g { padding: 8px 8px 4px; }
.pal-o { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pal-o[aria-selected="true"] { background: var(--sunken); }
.pal-o .po-t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-o .po-t b { font-weight: 600; }
.pal-o kbd { flex: none; }
.pal-o .chip { flex: none; }
.pal-none { padding: 16px 12px; color: var(--muted); }
.shortcuts { width: min(720px, calc(100vw - 24px)); }
.sc-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; padding: 8px 16px; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sc-row .keys { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sc-foot { padding: 12px 16px 16px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.sc-foot input { width: 16px; height: 16px; accent-color: var(--ink); }
.how-pop { width: min(440px, calc(100vw - 24px)); max-height: min(640px, calc(100dvh - 72px)); overflow: auto; padding: 16px 20px 20px; }
.how-pop:popover-open { display: grid; gap: 12px; }
.how-head { display: flex; align-items: center; justify-content: space-between; }
.how-h { font: 600 18px/24px var(--font-ui); letter-spacing: -.01em; }
.how-lead { font: 400 14px/21px var(--font-ui); color: var(--ink-2); }
.how-ways { list-style: decimal; padding-left: 20px; display: grid; gap: 6px; font: 400 14px/21px var(--font-ui); color: var(--ink-2); }
.how-ways b { color: var(--ink); font-weight: 600; }
.gloss { display: grid; border-top: 1px solid var(--line); }
.gloss div { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font: 400 13px/19px var(--font-ui); }
.gloss dt { font-weight: 600; }
.gloss dd { color: var(--ink-2); }
.how-foot { font: 400 12px/18px var(--font-ui); color: var(--muted); }

/* small parts */
.rating-slot:empty { display: none; }
#t-follow .i-replay, #t-follow.is-replay .i-follow { display: none; }
#t-follow.is-replay .i-replay { display: block; }
.start-only { display: none; }
body[data-view="start"] .start-only { display: inline-grid; }
.cmd { margin: 0 auto; width: min(360px, 30vw); height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 10px;
       border: 1px solid var(--line); border-radius: 6px; background: var(--sunken); color: var(--muted); font-size: 13px; flex: none; }
.cmd:hover { border-color: var(--line-2); color: var(--ink-2); }
.cmd span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd svg { width: 14px; height: 14px; }
.cmd kbd { background: var(--panel); }
body[data-view="start"] .tb-end { margin-left: auto; }

/* ------------------------------------------------------------ narrower: Details becomes a drawer; the side panel narrows */
@media (max-width: 1279px) and (min-width: 760px) {
  .cmd { width: 200px; }
  .toolbar .tb-desk { display: none; }
  .phone-menu { display: flex; }
}
@media (max-width: 1099px) and (min-width: 760px) {
  .inspector { position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--insp-w), 92%); border-left: 1px solid var(--line-2); z-index: 9;
               box-shadow: -16px 0 32px -24px rgba(0, 0, 0, .35); }
  #split-insp { display: none !important; }
  body:not(.insp-open) .inspector { display: none; }
  body.insp-open .inspector { display: flex !important; }
  .tb-name { max-width: 20ch; }
  .cmd span { display: none; }
  .cmd { width: auto; margin: 0 0 0 auto; }
  .sb-hide-narrow, #sb-round, #sb-blocks { display: none !important; }
  .ho-cols { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ phone: the viewport, a timeline strip, a bottom sheet */
.sheet, .phone-strip, .phone-only { display: none; }
@media (max-width: 759px) {
  .page-ide, .page-ide:not([data-view="start"]) { grid-template-rows: 48px 44dvh 48px minmax(0, 1fr); }
  body[data-view="start"].page-ide { grid-template-rows: 48px minmax(0, 1fr); }
  .titlebar { padding: 0 4px 0 12px; }
  .page-ide .tb-end > :not(.phone-only):not([data-theme-toggle]):not(.start-only), .tb-sep, .tb-name, .page-ide .cmd { display: none !important; }
  body[data-view="run"].page-ide .tb-end > [data-theme-toggle] { display: none !important; }
  body[data-mode="studio"][data-view="run"] .tb-crumb { display: none; }
  .statusbar, .activity { display: none !important; }
  .phone-only { display: inline-grid; }
  .page-ide .ib { width: 44px; height: 44px; }
  .pill { margin-left: auto; }
  .workbench { grid-row: 2; }
  .side, .inspector, .splitter, .tabs, .bottom { display: none !important; }
  .phone-strip { grid-row: 3; display: flex; align-items: center; padding: 0 8px 0 0; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
  .phone-strip .timeline { flex: 1; height: 48px; border: 0; padding: 0; gap: 4px; background: transparent; }
  .phone-strip .transport .ib { width: 40px; height: 44px; }
  .phone-strip .speed, .phone-strip .readout, .phone-strip #tl-live { display: none; }
  .phone-strip .track { height: 24px; margin-left: 4px; }
  .phone-strip .livemark { display: none; }
  .sheet { grid-row: 4; display: flex; flex-direction: column; min-height: 0; background: var(--panel); position: relative; z-index: 12; }
  body[data-detent="peek"] { grid-template-rows: 48px minmax(0, 1fr) 48px 56px; }
  body[data-detent="full"] .sheet { position: fixed; left: 0; right: 0; bottom: 0; top: calc(48px + env(safe-area-inset-top, 0px));
                                   border-top: 1px solid var(--line-2); box-shadow: 0 -16px 32px -20px rgba(0, 0, 0, .4); }
  .sheet-grip { position: relative; height: 16px; flex: none; display: grid; place-items: center; cursor: grab; touch-action: none; border: 0; background: transparent; width: 100%; padding: 0; }
  .sheet-grip::before { content: ""; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); }
  .sheet-grip::after { content: ""; position: absolute; left: 25%; right: 25%; top: -14px; bottom: -14px; }
  .sheet-tabs { display: flex; height: 44px; flex: none; border-bottom: 1px solid var(--line); }
  .sheet-tabs button { flex: 1; border: 0; background: transparent; font: 500 13px/1 var(--font-ui); color: var(--muted); min-height: 44px; padding: 0 2px; }
  .sheet-tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
  .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .sheet-body > .pane, .sheet-body > .insp-pane { flex: 1; min-height: 0; }
  .sheet-body #pane-relay > .pane-h { display: none; }
  /* the first-visit tips on a phone: one line that opens How it works, so the relay keeps its room */
  .hint { margin: 8px 12px; padding: 6px 8px 6px 12px; }
  .hint-l { display: none; }
  .phone-hint { display: inline-flex; }
  .hint .btn.sm { min-height: 36px; }
  .sheet-body .relay-how { padding-top: 8px; }
  .sheet-body .baton { padding-bottom: 8px; }
  .sheet-body .relay-how { font-size: 12.5px; line-height: 18px; padding-bottom: 8px; }
  .bt { padding: 5px 4px; }
  .bt-state { display: none; }
  .bt.said-done .bt-name::after { content: " ⚑"; font-size: 10px; color: var(--muted); }
  .ho-cols { grid-template-columns: 1fr; }
  .sheet-body .insp-top { display: none; }
  body[data-detent="peek"] .sheet-body { display: none; }
  .toolbar { top: auto; bottom: 10px; left: auto; right: 10px; transform: none; height: 48px; padding: 0 2px; }
  .toolbar .sb { width: 44px; height: 44px; }
  .toolbar #t-follow, .toolbar .tsep, .toolbar .tb-desk { display: none; }
  .phone-menu { display: flex; }
  .nav-corner { display: none; }
  .hud { left: 8px; bottom: 10px; height: 28px; padding: 0 8px; gap: 6px; max-width: calc(100% - 196px); }
  .hud .sl-just, .hud .sl-turn, .hud .sl-id { display: none; }
  .slicer { right: 6px; top: 12px; bottom: 64px; }
  .legend { top: 8px; left: 8px; }
  .jump-live, .banner { top: 10px; }
  .banner { flex-wrap: wrap; justify-content: center; width: calc(100% - 20px); }
  .trow { height: 44px; }
  .c-head { height: 40px; }
  .rrow { grid-template-columns: 3ch 56px minmax(0, 1fr); }
  .rrow .conf { display: none; }
  .rd-tools { flex-wrap: wrap; }
  .more-menu { width: 240px; padding: 4px; }
  .more-menu .menu-item { height: 44px; }
  .more-menu .rating { padding: 8px; }
  .more-menu .stars { padding: 6px 0; }
  .more-menu .star, .more-menu .star svg { width: 28px; height: 28px; }
  .pill[data-kind="live"] #p-status { display: none; }
  .rating-slot { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .insp-h { padding-top: 12px; }
  /* the studio's start screen on a phone: stacked, compact */
  .start { place-items: start stretch; padding: 16px 16px 16px; }
  .start-in { gap: 16px; }
  .start-h { font-size: 22px; line-height: 28px; }
  .start-sub { font-size: 14px; line-height: 20px; }
  .start-cards { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; gap: 12px; }
  .card-p { display: none; }
  .fields { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .fields div { height: 32px; font-size: 13px; }
  .fields div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .drop { min-height: 0; padding: 16px; gap: 8px; }
  .drop-i { display: none; }
  .ex-row { grid-template-columns: 64px minmax(0, 1fr) auto; height: 52px; gap: 12px; padding: 0 12px; }
  .spark { gap: 0; }
  .ex-m { display: none; }
}
@media (max-width: 759px) and (max-height: 700px) { .start-sub { display: none; } .drop-note { display: none; } }
@media (pointer: coarse) {
  .ib, .sb, .btn, .etab, .btab { min-height: 44px; }
}

/* ------------------------------------------------------------ the 404 page */
.page-404 { display: grid; grid-template-rows: 64px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.lost { display: grid; align-content: center; justify-items: start; gap: 16px; }
.lost .display { font-size: clamp(36px, 5vw, 64px); margin: 0; }
.lost p { color: var(--muted); font-size: 16px; line-height: 24px; }
.lost-art { display: flex; gap: 4px; }
.lost-art i { width: 14px; height: 14px; border-radius: 2px; background: var(--ink); }
.lost-art i.gap { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

/* ------------------------------------------------------------ motion and forced colours */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
  .dot.live, .pill[data-kind="live"] .dot { animation: none !important; }
}
@media (forced-colors: active) {
  .chip::before, .logo i, .legend .lg::before, .slot i, .w-ticks i, .spark i, .confbar .bar i, .strip i, .tr-bar i { forced-color-adjust: none; border: 1px solid CanvasText; }
}
