/* The web HUD of the motion-based agentic control pipeline (docs/design/WEB_HUD.md section 8.1).
   Colours are tokens on :root: the page sets data-theme before it renders (light, unless the visitor chose dark or
   ?theme=dark); without it the tokens follow the system setting. Each actor has a hue (dots, glows, fills) and an ink
   (its hue tuned for text). */

:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #13161b;
  --panel-2: #171b21;
  --panel-3: #1d222a;
  --hair: rgba(255, 255, 255, .08);
  --hair-2: rgba(255, 255, 255, .14);
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --faint: #687183;
  --llm: #a78bfa;
  --llm-ink: #c4b5fd;
  --jev: #2dd4bf;
  --jev-ink: #5eead4;
  --engine: #f59e0b;
  --engine-ink: #fbbf24;
  --memory: #94a3b8;
  --memory-ink: #cbd5e1;
  --ok: #34d399;
  --ok-ink: #6ee7b7;
  --fail: #f87171;
  --fail-ink: #fca5a5;
  --task: #e7e9ee;
  --task-ink: #e7e9ee;
  --world: #cbd5e1;
  --world-ink: #cbd5e1;
  --run: #687183;
  --run-ink: #9aa3b2;
  --on-accent: #06201c;
  --shadow: 0 1px 0 rgba(255, 255, 255, .025) inset, 0 16px 36px -24px rgba(0, 0, 0, .7);
  --radius: 12px;
  --gutter: 16px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-2: #f6f7f9;
    --panel-3: #eef0f3;
    --hair: rgba(15, 23, 42, .09);
    --hair-2: rgba(15, 23, 42, .16);
    --text: #0f172a;
    --muted: #556070;
    --faint: #8a93a3;
    --llm-ink: #7c3aed;
    --jev-ink: #0f766e;
    --engine-ink: #b45309;
    --memory-ink: #475569;
    --ok-ink: #047857;
    --fail-ink: #dc2626;
    --task: #0f172a;
    --task-ink: #0f172a;
    --world: #64748b;
    --world-ink: #475569;
    --run-ink: #556070;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 36px -26px rgba(15, 23, 42, .35);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --panel-3: #eef0f3;
  --hair: rgba(15, 23, 42, .09);
  --hair-2: rgba(15, 23, 42, .16);
  --text: #0f172a;
  --muted: #556070;
  --faint: #8a93a3;
  --llm-ink: #7c3aed;
  --jev-ink: #0f766e;
  --engine-ink: #b45309;
  --memory-ink: #475569;
  --ok-ink: #047857;
  --fail-ink: #dc2626;
  --task: #0f172a;
  --task-ink: #0f172a;
  --world: #64748b;
  --world-ink: #475569;
  --run-ink: #556070;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 36px -26px rgba(15, 23, 42, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-feature-settings: 'zero' 0, 'calt' 0; }

code {
  font: 11.5px var(--mono);
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--text);
  overflow-wrap: anywhere;
}

button, input, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

/* ---- page layout ------------------------------------------------------------------------------------------------ */
/* the page fills the window; the panel's blocks never shrink, so when they need more height than the window gives
   (a very short window, a long burst of JEV's steps) the page grows and scrolls instead of the panel spilling over the
   memory strip */
.app {
  display: grid;
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  gap: 12px;
  min-height: 680px;
  min-height: max(680px, 100vh);
  min-height: max(680px, 100dvh);
  padding: 0 var(--gutter) var(--gutter);
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(430px, 35vw, 580px);
  grid-template-rows: minmax(min-content, 1fr) auto;
  grid-template-areas: "view panel" "mem mem";
  column-gap: var(--gutter);
  row-gap: 12px;
  min-height: 0;
}

/* ---- header ------------------------------------------------------------------------------------------------------- */
.top {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 54px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.mark { display: grid; grid-template-columns: repeat(3, 6px); gap: 3px; flex: none; }
.mark i { width: 6px; height: 6px; border-radius: 2px; }
.mark i:nth-child(1) { background: var(--llm); }
.mark i:nth-child(2) { background: var(--jev); }
.mark i:nth-child(3) { background: var(--engine); }

/* the project's name (its full title is the page's and the link's title); it gives way (an ellipsis) before the controls do */
.wordmark {
  font-weight: 500; font-size: 14px; letter-spacing: -.01em; white-space: nowrap;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.wordmark b { font-weight: 800; }

.ep { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.spacer { flex: 1 1 auto; }

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--hair-2);
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .1em;
  white-space: nowrap;
}
.mode-badge.live { color: var(--fail-ink); border-color: color-mix(in srgb, var(--fail) 45%, transparent); }
.mode-badge.live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fail);
  animation: live 1.6s ease-in-out infinite;
}
.mode-badge.waiting { color: var(--engine-ink); }

.picker select {
  max-width: 300px;
  height: 30px;
  padding: 0 30px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239aa3b2' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 9px center / 12px;
  font-size: 12px;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

/* ?embed=1 (the project page's replays): the replay chosen by the page around it, nothing to pick, record or connect */
.embed .picker, .embed .rec-btn, .embed .connect { display: none !important; }

.connect { position: relative; }
.connect summary {
  list-style: none;
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.connect summary::-webkit-details-marker { display: none; }
.connect[open] summary { background: var(--panel-3); }
/* Record: the page records itself (src/util/recorder.js); while it does, a red dot blinks before the elapsed time */
.rec-btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  flex: none;
}
.rec-btn:hover { background: var(--panel-3); }
.rec-label { font-size: 11.5px; }
.rec-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--fail); flex: none; }
.rec-btn.recording { color: var(--fail-ink); border-color: color-mix(in srgb, var(--fail) 45%, transparent); }
.rec-btn.recording .rec-dot { display: block; animation: rec-blink 1s steps(1, end) infinite; }
@keyframes rec-blink {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rec-btn.recording .rec-dot { animation: none; }
}
.pop {
  position: absolute;
  right: 0;
  top: 38px;
  z-index: 30;
  width: 340px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--hair-2);
  background: var(--panel);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .6);
}
.pop label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 8px; }
.pop .hint { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }

.row { display: flex; gap: 8px; }
.row input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  background: var(--panel-2);
  font-size: 12px;
}
.row button, .empty button {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--jev) 55%, transparent);
  background: color-mix(in srgb, var(--jev) 16%, transparent);
  color: var(--jev-ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--hair-2);
  background: transparent;
  cursor: pointer;
  flex: none;
}
.icon-btn svg { width: 16px; height: 16px; }

button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible, .scrub:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--jev) 70%, transparent);
  outline-offset: 2px;
}

/* ---- the viewport ------------------------------------------------------------------------------------------------- */
.viewport {
  grid-area: view;
  position: relative;
  min-height: 340px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--panel-3) 70%, transparent), transparent 70%),
    var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.vp-canvas { position: absolute; inset: 0; }
.vp-canvas canvas { display: block; width: 100%; height: 100%; }
.vp-ui { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.vp-tl { position: absolute; left: 14px; top: 12px; display: flex; align-items: baseline; gap: 10px; }
.vp-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.vp-sub { font-size: 11px; color: var(--muted); }
.vp-info { pointer-events: auto; }
/* closed, the list is not laid out at all (a closed details element still lays it out and could widen the page) */
.vp-info:not([open]) ul { display: none; }
.vp-info summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--faint);
  border-bottom: 1px dotted var(--hair-2);
}
.vp-info summary::-webkit-details-marker { display: none; }
.vp-info[open] summary { color: var(--text); }
.vp-info ul {
  position: absolute;
  left: 0;
  top: 24px;
  z-index: 5;
  width: min(440px, calc(100vw - 64px));
  margin: 0;
  padding: 10px 12px 10px 26px;
  border-radius: 10px;
  border: 1px solid var(--hair-2);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .6);
}
/* the scene's own description, first in the notes, under a small label of its own */
.vp-info li.about { color: var(--text); }
.vp-info li.about .lbl { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.cams { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 4px; pointer-events: auto; }
.cams button {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--hair);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--muted);
  font: 11px var(--mono);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cams button:hover { color: var(--text); border-color: var(--hair-2); }
.vp-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  backdrop-filter: blur(6px);
}
.vp-hint.flash { color: var(--text); border-color: color-mix(in srgb, var(--engine) 50%, transparent); }
/* the fast-forward badge (app.js showSkim): over the world while the replay skims a long wait, its arrows running in the
   colour of whom the pipeline waits for (the LA thinking, DM building the menu); it fades in and out with the pace */
.ff {
  position: absolute;
  top: 10px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--hair-2);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--text);
  font-size: 11.5px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity .25s ease, transform .25s ease;
}
.ff.on { opacity: 1; transform: translate(-50%, 0); }
.ff-arrows { display: block; width: 19px; height: 11px; fill: var(--llm-ink); }
.ff[data-kind="dm"] .ff-arrows { fill: var(--jev-ink); }
.ff.on .ff-arrows path { animation: ff-run .6s linear infinite; }
.ff.on .ff-arrows path:nth-child(2) { animation-delay: .3s; }
.ff-k { font-weight: 600; }
.ff-what { color: var(--muted); }
.vp-note {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
}
.vp-note p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.vp-note.error p { color: var(--muted); }
.vp-note.error p::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 1.5px dashed var(--hair-2);
}

.empty {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}
.empty-card { max-width: 500px; }
.empty-card h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.empty-card h3 { margin: 18px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.empty-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.empty-card .row { margin-top: 10px; max-width: 420px; }

/* ---- the panel and its blocks ----------------------------------------------------------------------------------------- */
/* the blocks sit 30 px apart: the spine between them carries the pulses and their labels */
.panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-height: 0;
  min-width: 0;
}

.block {
  --a: var(--muted);
  --ink: var(--muted);
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 12px 14px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: border-color 240ms ease, box-shadow 240ms ease, background-color 240ms ease;
}
.block[data-actor="llm"] { --a: var(--llm); --ink: var(--llm-ink); flex: none; }
/* JEV never shrinks: its steps and its card keep their shape (a short window takes the compact density instead) */
.block[data-actor="jev"] { --a: var(--jev); --ink: var(--jev-ink); flex: none; }
.block[data-actor="engine"] { --a: var(--engine); --ink: var(--engine-ink); flex: none; }
.block.busy {
  border-color: color-mix(in srgb, var(--a) 40%, var(--hair));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--a) 14%, transparent), 0 18px 48px -22px color-mix(in srgb, var(--a) 60%, transparent);
}

.bh { display: flex; align-items: center; gap: 8px; height: 18px; min-width: 0; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--a); opacity: .9; }
.block.busy .dot, .memory.busy .dot { animation: breathe 1.6s ease-in-out infinite; }
.bt { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.bt .sub { margin-left: 7px; font-weight: 500; color: var(--muted); letter-spacing: .06em; }
.hb { margin-left: auto; display: flex; gap: 6px; min-width: 0; overflow: hidden; }
.hb .badge { height: 18px; font-size: 10px; color: var(--jev-ink); border-color: color-mix(in srgb, var(--jev) 30%, transparent); background: color-mix(in srgb, var(--jev) 8%, transparent); }
.tag { margin-left: 8px; font-size: 11px; color: var(--faint); white-space: nowrap; }
.block.busy .tag { color: var(--ink); }

.status {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 20px;
  margin: 7px 0 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.005em;
  min-width: 0;
}
.status .st { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* JEV's status can be the menu in one sentence (the counts at its end matter): it wraps onto a second line */
.block[data-actor="jev"] .status .st {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.38;
}
.think { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--llm-ink); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--llm); animation: dotwave 1.6s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
.secs { font-size: 12px; font-weight: 400; }

.lbl { font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.row-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

/* LA */
.llm-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; margin-top: 10px; align-items: start; }
.block.bare .llm-body { display: none; }
.cam {
  position: relative;
  width: 176px;
  aspect-ratio: 16 / 9;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--hair);
  background: var(--panel-3);
}
.cam img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter 240ms ease; }
/* the head moved after the image was taken: it no longer shows what the camera sees */
.cam.stale img { filter: saturate(.4) brightness(.85); }
.cam .boxes { position: absolute; inset: 0; width: 100%; height: 100%; }
.boxes rect { fill: none; vector-effect: non-scaling-stroke; }
.boxes rect.object { stroke: var(--llm); stroke-width: 1.5px; fill: color-mix(in srgb, var(--llm) 12%, transparent); }
.boxes rect.region { stroke: var(--llm); stroke-width: 1px; stroke-dasharray: 3 2; }
.boxes text { font-family: var(--mono); fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 2px; }
.cam figcaption {
  position: absolute;
  right: 4px;
  top: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0 5px;
  border-radius: 4px;
  max-width: calc(100% - 8px);
  background: rgba(10, 12, 16, .62);
  color: #e7e9ee;
  font-size: 9.5px;
  line-height: 14px;
  text-align: right;
}
.cam figcaption .moved { color: #fbbf24; line-height: 13px; padding-bottom: 1px; }
.llm-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.words {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.choice { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; transition: opacity 240ms ease; }
.choice.stale .chip.pick { background: transparent; }
.choice.stale, .insight.stale { opacity: .62; }
.bind { font-size: 11.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight {
  margin: 0;
  padding-left: 9px;
  border-left: 2px solid color-mix(in srgb, var(--llm) 60%, transparent);
  font-size: 12px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* chips (the menu, the LA's pick) */
.chip {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--hair-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  transition: opacity 240ms ease, transform 240ms ease, background-color 240ms ease, border-color 240ms ease, color 240ms ease, box-shadow 240ms ease;
}
.chip.pick {
  border-color: color-mix(in srgb, var(--llm) 50%, transparent);
  background: color-mix(in srgb, var(--llm) 16%, transparent);
  color: var(--llm-ink);
}
.menu { margin-top: 9px; }
.menu-lbl { align-self: center; margin-right: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.fit { border-color: color-mix(in srgb, var(--jev) 58%, transparent); color: var(--jev-ink); }
/* undecided: the decider could not choose a grasp confidently; the LA may still pick it with an insight */
.chip.undecided { border-style: dashed; border-color: color-mix(in srgb, var(--engine) 62%, transparent); color: var(--engine-ink); }
.chip.nofit { opacity: .42; }
.chip.pending { border-style: dashed; color: var(--faint); }
.chip.alt { border-style: dashed; }
.chip.dim { opacity: .22; }
.chip.chosen {
  opacity: 1;
  border-color: var(--jev);
  background: var(--jev);
  color: var(--on-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -10px var(--jev);
}
.chip.more { border-style: dotted; color: var(--faint); }
.chip.enter { animation: chip-in 320ms cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.chip.considering { animation: consider 2.4s ease-in-out infinite; animation-delay: calc(var(--k, 0) * 180ms); }

/* the steps of the current command: one line each, the newest at the bottom, joined by a thin rail */
.steps { display: flex; flex-direction: column; margin: 9px 0 0; padding: 0; list-style: none; }
.step {
  position: relative;
  display: grid;
  grid-template-columns: 6px 48px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  height: 19px;
  font-size: 12px;
}
.step::before { content: ''; position: absolute; left: 2.5px; top: 0; bottom: 0; width: 1px; background: var(--hair-2); }
.steps .earlier[hidden] + .step::before { top: 50%; }
.step:last-child::before { bottom: 50%; }
.steps .earlier[hidden] + .step:last-child::before { display: none; }
.step .sd { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--jev); box-shadow: 0 0 0 2px var(--panel); }
.step[data-tone="warn"] .sd { background: var(--engine); }
.step[data-tone="fail"] .sd { background: var(--fail); }
.step time { font-size: 10.5px; color: var(--faint); text-align: right; white-space: nowrap; }
.step .tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.step:last-child .tx { color: var(--text); }
.step[data-tone="fail"]:last-child .tx { color: var(--fail-ink); }
.step.enter { animation: step-in 240ms ease-out backwards; }
.steps .earlier { position: relative; height: 16px; padding-left: 14px; font-size: 10.5px; line-height: 16px; color: var(--faint); }
.steps .earlier::before { content: ''; position: absolute; left: 2.5px; top: 3px; bottom: 0; width: 1px; border-left: 1px dotted var(--hair-2); }

/* the decision card: a fixed shape (a title row, a meta row, one row of fields, a two-line reason), so a new decision
   changes values, not the layout */
.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--hair);
  background: var(--panel-2);
}
.card-main { min-width: 0; }
.card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text); }
.card-meta { margin: 2px 0 0; min-height: 16px; font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.redecided .card-meta::before { content: 're-decided · '; color: var(--engine-ink); }
.card.spliced .card-meta::before { content: 'spliced · '; color: var(--engine-ink); }
/* a track that joined the run (a gaze track beside the hands): one small line under the decision's meta */
.card-joined { margin: 1px 0 0; font-size: 10.5px; line-height: 14px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0 8px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; animation: rise 360ms ease-out backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.fl { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a value that differs from the decision shown before it glows amber, then settles */
.fv.changed { animation: changed 1.5s ease-in-out; }
.fb { height: 2px; margin-top: 3px; border-radius: 2px; background: var(--hair); overflow: hidden; }
.fb i { display: block; height: 100%; background: var(--jev); transform-origin: 0 50%; transition: width 240ms ease; animation: bar-grow 600ms cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.field.exempt .fb i { background: color-mix(in srgb, var(--jev) 40%, var(--hair-2)); }
.reason {
  margin: 7px 0 0;
  min-height: calc(2em * 1.45);
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--faint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.edit { width: 96px; height: 64px; align-self: center; overflow: visible; }
.edit .ghost { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2.5 2.5; opacity: .75; }
.edit .edited { fill: none; stroke: var(--jev); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.edit .goal { fill: none; stroke: var(--jev); stroke-width: 1.2; }
.edit .here { fill: var(--engine); }
.edit .cap { font: 7.5px var(--mono); fill: var(--faint); }

/* the watch: JEV follows every tick of the running motion (the three bars tick while it runs) and the decider checks
   it periodically (a check brightens the line for a moment; an intervention turns it amber) */
.watch {
  --wd: var(--jev);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 7px 0 0 -6px;
  padding: 2px 6px;
  border-radius: 6px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted);
}
.watch .wb { display: inline-flex; align-items: center; gap: 2px; width: 10px; height: 10px; flex: none; }
.watch .wb i { width: 2px; height: 9px; border-radius: 1px; background: var(--wd); opacity: .55; transform: scaleY(.75); }
.watch.live .wb i { animation: tick 300ms ease-out infinite; }
.watch.live .wb i:nth-child(2) { animation-delay: 100ms; }
.watch.live .wb i:nth-child(3) { animation-delay: 200ms; }
.watch:not(.live) .wb i { opacity: .3; }
.watch .wt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a swinging target's report (what the lane's fit sees, when the turn comes, when the hand meets it) wraps once */
.watch.wrap { align-items: flex-start; }
.watch.wrap .wb { margin-top: 3px; }
.watch.wrap .wt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.watch.intervene { --wd: var(--engine); color: var(--engine-ink); }
.watch.blink { animation: watch-blink 800ms ease-out; }

/* the refusal pill on JEV's status line, after "Refused <motion>" */
.status .rp { flex: none; align-self: center; height: 20px; font-weight: 400; letter-spacing: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--hair);
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--hair-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.pill.ok { color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.fail { color: var(--fail-ink); border-color: color-mix(in srgb, var(--fail) 50%, transparent); background: color-mix(in srgb, var(--fail) 12%, transparent); }

/* Engine */
.run { display: flex; flex-direction: column; gap: 8px; margin-top: 9px; }
.run-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.run .motion { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.badge.channel { color: var(--engine-ink); border-color: color-mix(in srgb, var(--engine) 40%, transparent); background: color-mix(in srgb, var(--engine) 10%, transparent); }
.arm { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mode { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.run .outcome { margin-left: auto; flex: none; }
.phase { display: flex; align-items: center; gap: 10px; }
.track { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--hair); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--engine); transition: width 200ms linear; }
.block.paused .fill { background: repeating-linear-gradient(90deg, var(--engine) 0 6px, color-mix(in srgb, var(--engine) 50%, transparent) 6px 9px); }
.marks i { position: absolute; }
.marks i.wm { top: -6px; width: 1px; height: 4px; background: var(--muted); opacity: .55; }
.marks i.rm { top: -1px; width: 6px; height: 6px; margin-left: -3px; transform: rotate(45deg); background: var(--jev); border-radius: 1px; }
/* a changed decision spliced into the running motion: a ring on the track (a follow is a solid diamond); its title is the step */
.marks i.sm { top: -3px; width: 10px; height: 10px; margin-left: -5px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--jev); background: var(--panel); }
.pct { width: 34px; text-align: right; font-size: 11px; color: var(--muted); }
/* a looping run's percentage carries the loop sign: a little more room for it */
.phase.loop .pct { width: 42px; }
/* a real-time motion's key moments so far, after its name on the run line ("keep_up · strikes 12") */
.run .rtc { flex: none; font-size: 12px; color: var(--engine-ink); white-space: nowrap; }
.pause { margin: 0; font-size: 12px; color: var(--engine-ink); }
/* a real-time run's last reason for not taking the target: muted, two lines at most, until the next launch */
.rtwhy {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.block.paused {
  border-color: color-mix(in srgb, var(--engine) 55%, var(--hair));
  background: color-mix(in srgb, var(--engine) 7%, var(--panel));
}

/* the Score block (hud/score.js): the scorecard's record under the three blocks, indented so that the spine from the
   Engine to the motion memory runs past it, and closer to the Engine than the blocks are to each other (no wire runs
   between them); closed it is one header line */
.block[data-actor="score"] { --a: var(--task); --ink: var(--text); flex: none; margin: -12px 0 0 34px; padding: 8px 12px; }
.sc-head { cursor: pointer; user-select: none; }
.sc-head .bt .sub { text-transform: none; letter-spacing: 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.sc-head .bt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sc-now { margin-left: auto; flex: none; font-size: 12px; color: var(--text); white-space: nowrap; }
.sc-now.ok { color: var(--ok-ink); }
.sc-now.fail { color: var(--fail-ink); }
.sc-caret { flex: none; width: 10px; font-size: 10px; color: var(--faint); text-align: center; }
.sc-body { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; min-width: 0; }
.sc-task { margin: 0; font-size: 12.5px; line-height: 1.4; }
.sc-rules { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 11.5px; line-height: 1.4; }
.sc-rules dt { padding-top: 2px; }
.sc-rules dd {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sc-trials-head { margin-top: 2px; }
.sc-count { font-size: 10.5px; color: var(--faint); }
.sc-none { margin: 0; font-size: 11.5px; color: var(--faint); }
.sc-trials, .sc-sub { margin: 0; padding: 0; list-style: none; }
/* the trials so far: five lines at a time, the newest at the bottom, as in the feed */
.sc-trials { max-height: calc(19px * 5); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }
.sc-line { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: start; }
.sc-line.grp > .sc-sub { grid-column: 1 / -1; padding-left: 14px; }
.sc-tog {
  width: 14px; height: 19px; padding: 0; border: 0; background: transparent; color: var(--faint); font-size: 10px; cursor: pointer;
}
.sc-tog:hover { color: var(--text); }
.sc-seek {
  display: grid;
  grid-template-columns: 48px 12px auto minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  width: 100%;
  height: 19px;
  padding: 0 4px 0 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.sc-seek:hover { background: var(--panel-3); }
.sc-seek time { font-size: 10.5px; color: var(--faint); text-align: right; white-space: nowrap; }
.sc-seek .mk { font-style: normal; font-size: 11px; text-align: center; color: var(--faint); }
.sc-line[data-ok="true"] > .sc-seek .mk { color: var(--ok-ink); }
.sc-line[data-ok="false"] > .sc-seek .mk { color: var(--fail-ink); }
.sc-seek .lb { font-size: 11px; color: var(--text); white-space: nowrap; }
.sc-seek .fx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.sc-line.sub .sc-seek .lb { color: var(--muted); }
.sc-result { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
/* after the end the result holds the pass rule, and the trials take less room */
.score-block.ended .sc-pass-l, .score-block.ended .sc-pass { display: none; }
.score-block.ended .sc-trials { max-height: calc(19px * 4); }
.sc-rhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 0; }
.sc-rv { font-size: 15px; font-weight: 500; color: var(--text); }
.sc-rl { font-size: 12px; color: var(--muted); }
.sc-verdict { align-self: center; height: 19px; font-size: 10.5px; }
.sc-rrule { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.sc-metrics { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sc-metrics th { padding: 1px 10px 1px 0; font-weight: 400; color: var(--muted); text-align: left; white-space: nowrap; }
.sc-metrics td { padding: 1px 0; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.sc-more summary { font-size: 10.5px; color: var(--faint); cursor: pointer; }
.sc-more[open] summary { color: var(--text); }

/* a message arriving: the receiving block glows once in the sender's colour */
.block.recv, .memory.recv { animation: recv 900ms ease-out; }
.fresh { animation: rise 420ms ease-out backwards; }

/* ---- the connectors --------------------------------------------------------------------------------------------------- */
.wires { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.stage.is-empty .wires { display: none; }
.wires-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.wire { fill: none; stroke: var(--hair-2); stroke-width: 1; transition: stroke 240ms ease, stroke-width 240ms ease; }
.wire.off { display: none; }
.wire.ghostwire { stroke: transparent; }
.wire.hot { stroke: color-mix(in srgb, var(--text) 28%, transparent); }
/* a pulse is travelling the wire (a pulse-only wire shows while it carries one) */
.wire.lit { stroke: color-mix(in srgb, var(--text) 55%, transparent); stroke-width: 1.5; }
.pulse-dot { filter: drop-shadow(0 0 5px currentColor); }
.pulse-dot.trail { filter: none; }
.pulse-label {
  position: absolute;
  transform: translate(0, -50%);
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid;
  background: var(--panel);
  font-size: 10.5px;
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 8px 22px -12px rgba(0, 0, 0, .7);
}
.pulse-label.end { transform: translate(-100%, -50%); }

/* ---- the motion memory -------------------------------------------------------------------------------------------------- */
.memory {
  --a: var(--memory);
  /* the graph's sizes in px (memory.js reads them): compact, so the panel above keeps its room; the compact density
     below shrinks them further */
  --mem-font: 9.5;
  --mem-node-h: 15;
  --mem-line-gap: 3;
  --mem-row-gap: 4;
  --mem-child-h: 13;
  --mem-child-gap: 2;
  grid-area: mem;
  position: relative;
  min-width: 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.mh { display: flex; align-items: center; gap: 8px; height: 18px; min-width: 0; }
.mmeta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.legend { margin-left: auto; display: flex; gap: 14px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.lg.cand::before { border: 1.5px solid var(--jev); }
.lg.active::before { background: var(--engine); }
.lg.kept::before { border: 1px solid var(--ok); background: color-mix(in srgb, var(--ok) 25%, transparent); }
.mscroll { margin-top: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.mgraph { display: block; overflow: visible; }
.mempty { margin: 10px 0 4px; font-size: 12px; color: var(--faint); }
.rowlabel { font: 500 10px var(--font); letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }
.rowcount { font-family: var(--mono); letter-spacing: 0; fill: var(--faint); }
.mnode { transition: transform 240ms ease; }
.mnode rect { fill: var(--memory); fill-opacity: calc(.04 + var(--sr, .5) * .14); stroke: transparent; stroke-width: 1.25; transition: stroke 240ms ease, fill 240ms ease, fill-opacity 240ms ease; }
.mnode text { font-family: var(--mono); font-size: calc(var(--mem-font, 9.5) * 1px); fill: var(--muted); transition: fill 240ms ease; }
.mnode.child rect { fill: var(--ok); fill-opacity: .14; stroke: color-mix(in srgb, var(--ok) 55%, transparent); stroke-width: 1; }
.mnode.child text { font-size: calc((var(--mem-font, 9.5) - .5) * 1px); fill: var(--ok-ink); }
.mnode.cand rect { stroke: var(--jev); }
.mnode.cand text { fill: var(--text); }
.mnode.active rect { fill: var(--engine); fill-opacity: .92; stroke: var(--engine); animation: node-breathe 1.6s ease-in-out infinite; }
.mnode.active text { fill: #1c1302; }
.mnode.kept rect { stroke: var(--ok); }
.medge { fill: none; stroke: color-mix(in srgb, var(--ok) 55%, transparent); stroke-width: 1; }
.medge.grow { stroke-dasharray: 80; animation: grow 520ms ease-out backwards; }
.inner { transform-box: fill-box; transform-origin: 0% 50%; }
.inner.sprout { animation: sprout 560ms cubic-bezier(.2, .8, .25, 1.25) backwards; animation-delay: 160ms; }

/* ---- the bar --------------------------------------------------------------------------------------------------------------- */
.bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px 12px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 32px; min-width: 0; }
.play {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hair-2);
  background: var(--panel-2);
  cursor: pointer;
}
.play svg { width: 16px; height: 16px; fill: currentColor; }
.play.on { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.speeds { display: flex; flex: none; border: 1px solid var(--hair-2); border-radius: 8px; overflow: hidden; }
.speeds button { padding: 4px 8px; border: 0; background: transparent; color: var(--faint); font: 500 11px var(--mono); cursor: pointer; }
.speeds button.on { background: var(--panel-3); color: var(--text); }
/* the skim toggle (feed.js): on, the long waits play faster; its arrows run while the playhead is in one */
.skim-btn {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--hair-2);
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  font: 500 11px var(--mono);
  cursor: pointer;
}
.skim-btn.on { background: var(--panel-3); color: var(--text); }
.skim-glyph { display: block; width: 15px; height: 9px; fill: currentColor; }
.skim-btn.on .skim-glyph { fill: var(--llm-ink); }
.skim-btn.on.active .skim-glyph path { animation: ff-run .6s linear infinite; }
.skim-btn.on.active .skim-glyph path:nth-child(2) { animation-delay: .3s; }
/* the skimmed cores hatched over the track (hidden while the skim is off) */
.scrub .skims { position: absolute; left: 0; right: 0; top: 16px; height: 9px; pointer-events: none; }
.scrub .skims.off { display: none; }
.scrub .skims i {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 2px;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--llm) 38%, transparent) 0 2px, transparent 2px 5px);
}
.scrub { position: relative; flex: 1 1 260px; min-width: 140px; height: 30px; cursor: pointer; touch-action: none; }
.scrub .ticks { position: absolute; left: 0; top: 1px; width: 100%; height: 14px; }
.tk { stroke-width: 1.5; opacity: .8; }
.scrub .track { position: absolute; left: 0; right: 0; top: 19px; height: 3px; border-radius: 3px; background: var(--hair-2); }
/* the scorecard's trials under the track (feed.js setScoreTicks): thin marks, clipped at the playhead */
.scrub .sticks { position: absolute; left: 0; top: 23px; width: 100%; height: 6px; pointer-events: none; }
.stk { stroke-width: 1.25; }
.stk.ok { stroke: var(--ok); }
.stk.no { stroke: var(--fail); }
.stk.na { stroke: var(--faint); opacity: .7; }
.played { height: 100%; width: 0; border-radius: 3px; background: color-mix(in srgb, var(--text) 55%, transparent); }
.knob {
  position: absolute;
  top: 15px;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--panel);
}
.scrub.dragging .knob { transform: scale(1.15); }
.tip {
  position: absolute;
  top: -20px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel-3);
  font-size: 10.5px;
  pointer-events: none;
  white-space: nowrap;
}
.time { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live-ind { display: flex; align-items: center; gap: 8px; flex: none; font-size: 12px; color: var(--fail-ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fail); animation: live 1.6s ease-in-out infinite; }
.live-t { color: var(--muted); }
.bar .spacer { flex: 1 1 0; min-width: 0; }
.bar:not(.is-live):not(.is-empty) .transport .spacer { display: none; }
.preds { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; min-width: 0; }
.pred {
  position: relative;
  padding: 2px 8px 2px 18px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  color: var(--faint);
  font-size: 10.5px;
  white-space: nowrap;
  transition: color 240ms ease, border-color 240ms ease;
}
.pred::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--hair-2);
  transition: background-color 240ms ease;
}
.pred.on { color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pred.on::before { background: var(--ok); }
/* a component goal's counter (`taken 2/3`): the pill fills as the count grows; its label is as wide as its widest value,
   so the bar never moves while it counts */
.pred.counter { overflow: hidden; isolation: isolate; color: var(--muted); }
.pred.counter .cf {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--text) 15%, transparent);
  transition: width 240ms ease, background-color 240ms ease;
}
.pred.counter.on { color: var(--ok-ink); }
.pred.counter.on .cf { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.pred.counter .cl { display: inline-block; text-align: left; font-variant-numeric: tabular-nums; }
.bar .outcome { flex: none; }
/* the score chip (feed.js): the scorecard's primary at the playhead where the goal pills are; after the end its verdict.
   A click opens the Score block. */
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 22px;
  max-width: min(420px, 100%);
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--hair-2);
  background: var(--panel-2);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  min-width: 0;
  flex: 0 1 auto;
}
.score-chip:hover { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.score-chip .sc-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.score-chip .sc-v { flex: none; color: var(--text); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: left; }
.score-chip .sc-m { flex: none; font-size: 11px; }
.score-chip.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.score-chip.ok .sc-m, .score-chip.ok .sc-v { color: var(--ok-ink); }
.score-chip.fail { border-color: color-mix(in srgb, var(--fail) 50%, transparent); background: color-mix(in srgb, var(--fail) 10%, transparent); }
.score-chip.fail .sc-m, .score-chip.fail .sc-v { color: var(--fail-ink); }

.feed-wrap { position: relative; border-top: 1px solid var(--hair); padding-top: 4px; }
.feed {
  height: 64px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  font-size: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--hair-2) transparent;
}
.ln {
  display: grid;
  grid-template-columns: 54px 58px minmax(0, 1fr);
  gap: 8px;
  padding: 0 2px;
  line-height: 20px;
  white-space: nowrap;
}
.ln.new { animation: rise 300ms ease-out backwards; }
.ln time { text-align: right; font-size: 11px; color: var(--faint); }
.ln .who { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.ln .tx { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ln:last-child .tx { color: var(--text); }
.ln[data-tone="fail"] .tx { color: var(--fail-ink); }
.ln[data-tone="ok"] .tx { color: var(--ok-ink); }
/* a quiet line (a pan toss's shake): there, but it does not ask for attention, even as the newest */
.ln[data-tone="quiet"] .tx, .ln[data-tone="quiet"]:last-child .tx { color: var(--faint); }
.feed-empty { padding: 0 2px; line-height: 20px; color: var(--faint); }
.feed-jump {
  position: absolute;
  right: 6px;
  bottom: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--hair-2);
  background: var(--panel-3);
  font-size: 10.5px;
  cursor: pointer;
}

#debug {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 100;
  max-width: min(760px, calc(100vw - 24px));
  max-height: 40vh;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--fail) 45%, transparent);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--fail-ink);
  font: 11px/1.5 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- motion ---------------------------------------------------------------------------------------------------------------- */
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--a) 0%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--a) 22%, transparent); }
}
@keyframes dotwave {
  0%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes live {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
@keyframes chip-in {
  from { opacity: 0; transform: translateY(4px) scale(.96); }
}
@keyframes consider {
  0%, 60%, 100% { box-shadow: 0 0 0 0 transparent; }
  25% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--llm) 55%, transparent); border-color: var(--llm); }
}
@keyframes recv {
  0% { box-shadow: 0 0 0 1px var(--recv, var(--a)), 0 0 30px -6px var(--recv, var(--a)); }
  100% { box-shadow: var(--shadow); }
}
@keyframes node-breathe {
  0%, 100% { fill-opacity: .92; }
  50% { fill-opacity: .55; }
}
@keyframes sprout {
  from { transform: scale(0); opacity: 0; }
}
@keyframes bar-grow {
  from { transform: scaleX(0); }
}
@keyframes grow {
  from { stroke-dashoffset: 80; }
  to { stroke-dashoffset: 0; }
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(6px); }
}
@keyframes changed {
  0%, 35% { color: var(--engine-ink); }
  100% { color: var(--text); }
}
@keyframes tick {
  0% { opacity: .95; transform: scaleY(1); }
  60%, 100% { opacity: .3; transform: scaleY(.55); }
}
@keyframes ff-run {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}
@keyframes watch-blink {
  0% { color: var(--text); background-color: color-mix(in srgb, var(--wd) 16%, transparent); }
  100% { background-color: transparent; }
}

/* ?still=1: no animation at all, so a headless capture shows every element in its final state */
.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
}

/* ---- narrower screens -------------------------------------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(0, 1fr) clamp(380px, 42vw, 480px); }
  .cam { width: 144px; }
  .legend .lg.kept { display: none; }
}

/* a window up to 1130 px tall (a laptop, a 1080p screen): the same layout, denser, so the panel's three blocks with
   JEV's steps and its card fit beside the 3-D view (the comfortable sizes need about 1130 px for a full burst) */
@media (max-height: 1130px) and (min-width: 761px) {
  .app { gap: 10px; }
  .top { height: 46px; }
  .panel { gap: 24px; }
  .block { padding: 10px 12px; }
  .status { margin-top: 5px; font-size: 13.5px; }
  .llm-body { margin-top: 8px; }
  .cam { width: 136px; }
  .words, .insight { -webkit-line-clamp: 1; }
  .menu { margin-top: 7px; }
  .card { margin-top: 8px; padding: 8px 10px; }
  .fields { margin-top: 6px; }
  .reason { margin-top: 6px; }
  .run { margin-top: 7px; gap: 6px; }
  .steps { margin-top: 7px; }
  .step { height: 18px; }
  .watch { margin-top: 5px; }
  .memory { padding: 6px 12px; --mem-font: 9; --mem-node-h: 14; --mem-line-gap: 2; --mem-row-gap: 3; --mem-child-h: 12; --mem-child-gap: 2; }
  .mscroll { margin-top: 5px; }
  .bar { gap: 4px; padding: 6px 12px 4px; }
  .feed { height: 44px; }
}

/* shorter still (800 px): the page scrolls down to the memory and the bar rather than squeezing the panel */
@media (max-height: 820px) and (min-width: 761px) {
  .stage { grid-template-rows: minmax(540px, auto) auto; }
}

@media (max-width: 760px) {
  .app { display: block; height: auto; min-height: 0; padding: 0 var(--gutter) var(--gutter); }
  .top { flex-wrap: wrap; height: auto; padding: 12px 0; row-gap: 8px; }
  .wordmark { font-size: 13px; }
  .ep { order: 5; flex-basis: 100%; }
  .picker select { max-width: 160px; }
  .pop { width: min(340px, calc(100vw - 32px)); right: -40px; }
  .stage { display: flex; flex-direction: column; gap: 22px; }
  .viewport { height: 50vh; min-height: 260px; }
  .panel { gap: 30px; }
  .bar { margin-top: 14px; }
  .transport { flex-wrap: wrap; height: auto; row-gap: 8px; }
  .scrub { order: 10; flex-basis: 100%; }
  .legend { display: none; }
  .llm-body { grid-template-columns: 1fr; }
  .cam { width: 100%; max-width: 360px; }
  .card { grid-template-columns: minmax(0, 1fr); }
  .edit { justify-self: start; }
  .ln { grid-template-columns: 46px 44px minmax(0, 1fr); gap: 6px; }
  .run-head { flex-wrap: wrap; }
  .mode { flex-basis: 100%; order: 5; }
  .card .row-head { flex-wrap: wrap; row-gap: 2px; }
  .card-title { flex: 1 1 auto; }
  .vp-hint { display: none !important; }
  .ff { top: 38px; }
  .cam { max-width: 280px; }
  .hb .badge { display: none; }
}
