/* VialBot Lab (the 3D lab): a full-screen view with a glass heads-up display. Dark by design; every text meets 4.5:1. */
:root {
  --ink: #e8eef8; --muted: #a9b6c9; --glass: rgba(10, 16, 30, 0.74); --glass-2: rgba(15, 23, 42, 0.86); --line: rgba(148, 163, 184, 0.28);
  --accent: #38bdf8; --accent-2: #0ea5e9; --amber: #f59e0b; --green: #22c55e; --red: #f87171; --violet: #c4b5fd; --sim: #a78bfa;
  --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --mono: "IBM Plex Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0f17; color: var(--ink); font: 15px/1.45 var(--sans); }
canvas#lab-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at 50% 46%, transparent 58%, rgba(2, 6, 14, 0.42) 100%); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: rgba(30, 41, 59, 0.85); padding: 7px 12px; }
button:hover:not([disabled]) { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
button[disabled] { opacity: 0.45; cursor: default; }
button.primary, a.primary { background: linear-gradient(135deg, #2563eb, #0ea5e9); border: 0; color: #fff; font-weight: 700; }
button.mini { padding: 4px 9px; font-size: 0.82rem; border-radius: 8px; }
a { color: #7dd3fc; }
a.as-btn { display: inline-block; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: rgba(30, 41, 59, 0.85); }
kbd { font: 600 0.72rem var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(148, 163, 184, 0.5); background: rgba(15, 23, 42, 0.9); color: #e2e8f0; }
select, input[type="number"] { background: rgba(15, 23, 42, 0.92); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
small, .small { color: var(--muted); font-size: 0.82rem; }
.good { color: #4ade80; } .bad { color: var(--red); }
.mono { font-family: var(--mono); font-size: 0.85em; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font: 700 0.68rem var(--sans); background: rgba(167, 139, 250, 0.18); color: var(--violet); }

/* the loading screen */
.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; padding: 16px;
  background: radial-gradient(120% 120% at 20% 0%, rgba(37, 99, 235, 0.28), transparent 55%), rgba(6, 10, 18, 0.82); backdrop-filter: blur(6px); transition: opacity 0.6s; }
.loading.gone { opacity: 0; pointer-events: none; }
@media (max-height: 560px) {
  .loading { place-items: start center; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .load-card { padding: 16px 18px; margin: auto 0; }
  .load-card h1 { font-size: 1.5rem; }
  .load-mark { width: 40px; height: 40px; }
}
.load-card { width: min(640px, 100%); background: var(--glass-2); border: 1px solid var(--line); border-radius: 18px; padding: 26px 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.load-mark { width: 54px; height: 54px; }
.load-card h1 { margin: 6px 0 4px; font-size: 2.1rem; letter-spacing: -0.02em; }
.load-sub { margin: 0 0 14px; color: var(--muted); }
.load-keys { margin: 0 0 14px; padding-left: 18px; color: #cbd5e1; }
.load-keys li { margin: 3px 0; }
.load-notice { margin: 0 0 16px; padding: 10px 12px; border-left: 3px solid var(--sim); background: rgba(167, 139, 250, 0.1); border-radius: 8px; font-size: 0.9rem; }
.load-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.load-row .primary { padding: 10px 20px; font-size: 1.02rem; }
.load-flat { font-size: 0.88rem; }
.load-status { margin: 12px 0 0; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

/* the start page: the film on the left, the way in on the right, the controls below, over the blurred room.
   A flex box with an auto margin centres it and still scrolls from the top when it is taller than the screen. */
.loading.start { display: flex; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  background: radial-gradient(120% 120% at 20% 0%, rgba(37, 99, 235, 0.26), transparent 55%), rgba(6, 10, 18, 0.66); }
.start-wrap { margin: auto; width: min(1180px, 100%); display: grid; gap: 12px; }
.start-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.start-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.start-brand .load-mark { width: 40px; height: 40px; }
.start-title { flex: 1 1 320px; min-width: 0; }
.start-title h1 { margin: 0; font-size: 1.75rem; letter-spacing: -0.02em; line-height: 1.15; }
.start-title .load-sub { margin: 2px 0 0; color: #cbd5e1; }
.start-card { background: var(--glass-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.start-card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.start-card h2 .small { font-weight: 500; margin-left: 6px; }
.start-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 12px; }
.start-video { position: relative; aspect-ratio: 16 / 9; margin-inline: auto; border-radius: 12px; overflow: hidden; background: #000; }
.start-video video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.start-video video:focus-visible { outline: 3px solid #fbbf24; outline-offset: -3px; }   /* inset: the box's clip would hide it */
.start-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 76px; height: 76px; padding: 0 0 0 6px;
  display: grid; place-items: center; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); background: rgba(37, 99, 235, 0.9);
  color: #fff; font-size: 1.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.start-play:hover:not([disabled]) { background: rgba(14, 165, 233, 0.95); border-color: #fff; }
.start-chapters { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.start-chapters button { padding: 3px 10px; font-size: 0.8rem; border-radius: 999px; }
.start-enter { display: flex; flex-direction: column; gap: 9px; border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.3), transparent 55%), var(--glass-2); }
.start-enter h2 { margin: 0; font-size: 1.65rem; letter-spacing: -0.02em; }
.start-enter p { margin: 0; }
.start-kicker { font: 700 0.72rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.start-mission { padding: 9px 12px; border-radius: 12px; background: rgba(2, 6, 23, 0.45); border: 1px solid var(--line); }
.start-mission ol { margin: 4px 0 0; padding-left: 22px; color: #cbd5e1; font-size: 0.88rem; }
.start-mission li { margin: 1px 0; }
.start-enter .load-row { margin-top: auto; padding-top: 2px; }
.start-enter .load-row .primary { padding: 12px 28px; font-size: 1.1rem; }
.start-enter .load-status { margin: 0; }
.start-alt { font-size: 0.86rem; color: var(--muted); }
.start-quick { display: none; font-size: 0.88rem; color: #cbd5e1; }
.start-quick kbd { font-size: 0.72rem; }
.keys-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 8px; }
.keys-head h2 { margin: 0; }
.keys-head p { margin: 0; }
.keys-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.keys-grid li { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 10px; border-radius: 12px; background: rgba(2, 6, 23, 0.45); border: 1px solid var(--line); }
.keys-grid .caps { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.keys-grid .caps kbd { font-size: 0.8rem; padding: 2px 7px; }
.keys-grid small { line-height: 1.35; }
.start .load-notice { margin: 0; padding: 8px 12px; font-size: 0.82rem; background: rgba(30, 27, 75, 0.82); }
@media (min-width: 981px) {
  /* two columns: the film gives way on a short screen so the controls stay on the first screen (it letterboxes) */
  .start-video { max-height: max(240px, calc(100vh - 392px)); }
  .start-watch { order: -1; }          /* the way in is first in the page; on a wide screen the film is drawn on its left */
}
@media (max-width: 980px) {
  .start-grid { grid-template-columns: 1fr; }
  .keys-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) and (pointer: coarse) { .start-quick-touch { display: block; } }
@media (max-width: 980px) and (pointer: fine) { .start-quick-keys { display: block; } }
@media (max-width: 560px) {
  .loading.start { padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .start-play { width: 60px; height: 60px; font-size: 1.5rem; }
  .start-title h1 { font-size: 1.5rem; }
  .start-enter h2 { font-size: 1.4rem; }
  .keys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (pointer: coarse) { .keys-touch { order: -1; } }   /* on a touch screen the touch controls come first */

/* the heads-up display */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud > * { pointer-events: auto; }
.hud .labels, .hud .crosshair, .hud .prompt, .hud .toasts { pointer-events: none; }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(10px); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35); }
.hud-top-right { position: absolute; top: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 60vw; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; font-size: 0.8rem; background: var(--glass); border: 1px solid var(--line); }
.chip.sim { background: rgba(109, 40, 217, 0.82); border-color: rgba(196, 181, 253, 0.6); color: #fff; font-weight: 700; }
.chip.btn { cursor: pointer; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.6); opacity: 0; transition: opacity 0.2s; }
body.locked .crosshair { opacity: 1; }
.prompt { position: absolute; left: 50%; top: calc(50% + 30px); transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line);
  font-weight: 600; max-width: min(560px, 90vw); text-align: center; }
.prompt kbd { margin-right: 6px; background: #fbbf24; color: #111827; border-color: #fbbf24; }
.prompt.muted { color: var(--muted); font-weight: 500; }
body:not(.locked) .prompt { top: auto; bottom: 22px; }
.labels .lbl { position: absolute; left: 0; top: 0; margin: -30px 0 0 0; translate: -50% 0; padding: 3px 9px; border-radius: 999px; font: 700 0.78rem var(--sans); white-space: nowrap;
  background: rgba(15, 23, 42, 0.82); border: 1px solid var(--line); }
.labels .lbl.hover { background: rgba(251, 191, 36, 0.95); color: #111827; border-color: #fbbf24; }
.labels .lbl.station { color: #bae6fd; }
.labels .lbl.bottle { background: rgba(245, 158, 11, 0.9); color: #111827; border-color: #f59e0b; }
.labels .lbl.ghost { background: rgba(124, 58, 237, 0.92); color: #fff; border-color: #c4b5fd; }
.labels .lbl.ghost.bad { background: rgba(185, 28, 28, 0.92); border-color: #fca5a5; }
/* the path through an experiment: five steps, where you are, what is next */
.flow { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: min(760px, calc(100vw - 24px)); padding: 6px 10px 7px; }
.flow ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; justify-content: space-between; }
.flow li { flex: 1; min-width: 0; }
.flow .step { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 6px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: #cbd5e1; font: 600 0.8rem var(--sans); cursor: pointer; white-space: nowrap; }
.flow .step .n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(148, 163, 184, 0.8); font: 700 0.66rem var(--mono); }
.flow .step.done { color: #86efac; } .flow .step.done .n { background: var(--green); border-color: var(--green); color: #052e16; }
.flow .step.current { color: #fff; border-color: var(--amber); background: rgba(245, 158, 11, 0.14); } .flow .step.current .n { border-color: var(--amber); color: var(--amber); }
.flow .step:hover, .flow .step:focus-visible { border-color: rgba(148, 163, 184, 0.7); outline: none; }
.flow .next { margin: 5px 2px 0; font-size: 0.82rem; color: #e2e8f0; text-align: center; }
.flow .next b { color: var(--amber); font-weight: 700; }
body.focus-mode .flow { top: 58px; padding-bottom: 6px; }
@media (max-width: 1540px) and (min-width: 701px) { .flow { left: 404px; transform: none; width: min(760px, calc(100vw - 416px)); } }   /* right of the mission card */
body.focus-mode .flow .next { display: none; }      /* in a close view the steps alone: the order card says what is next, and the deck stays clear */
.focus-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 6px 8px 6px 14px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); font-weight: 700; }

/* the mission card */
.quest { position: absolute; top: 12px; left: 12px; width: min(380px, calc(100vw - 24px)); padding: 12px 14px; max-height: calc(100vh - 220px); overflow: auto; }
.quest header { display: flex; align-items: center; gap: 8px; }
.quest header b { flex: 1; font-size: 1.02rem; }
.quest .lvl, .card .lvl { font: 700 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 6px; background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.quest .brief { margin: 8px 0; color: #cbd5e1; font-size: 0.88rem; }
.quest ol { list-style: none; margin: 6px 0; padding: 0; }
.quest li { display: flex; gap: 8px; margin: 5px 0; font-size: 0.9rem; }
.quest li .box { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid rgba(148, 163, 184, 0.7); display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; }
.quest li.done { color: #86efac; } .quest li.done .box { background: var(--green); border-color: var(--green); color: #052e16; }
.quest li.next { color: #fff; font-weight: 600; } .quest li.next .box { border-color: var(--amber); }
.quest li small { display: block; font-weight: 400; margin-top: 2px; }
/* a reference case's checks on the mission card: the goal, then one row per gate with its verdict as a word and a mark */
.quest .gates { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(2, 6, 23, 0.55); border: 1px solid var(--line); }
.quest .gates .goal { margin: 0 0 6px; font-size: 0.86rem; color: #e2e8f0; }
.quest .gates .fixed { font: 700 0.64rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: #fcd34d; margin-left: 4px; white-space: nowrap; }
.quest .gates ul { list-style: none; margin: 0; padding: 0; }
.quest .gates li.gate { display: flex; gap: 8px; margin: 6px 0; font-size: 0.84rem; color: #e2e8f0; }
.quest .gate .v { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.78rem; }
.quest .gate.pass .v { background: var(--green); color: #052e16; }
.quest .gate.fail .v { background: var(--red); color: #450a0a; }
.quest .gate.unknown .v { background: var(--amber); color: #451a03; }
.quest .gate .vw { font: 700 0.68rem var(--mono); letter-spacing: 0.06em; margin-left: 6px; }
.quest .gate.pass .vw { color: #86efac; } .quest .gate.fail .vw { color: #fca5a5; } .quest .gate.unknown .vw { color: #fcd34d; }
.quest .gate.pending .v { background: transparent; border: 2px dashed rgba(148, 163, 184, 0.8); color: #cbd5e1; }
.quest .gate.pending .vw { color: #cbd5e1; font-weight: 600; text-transform: none; letter-spacing: 0; }
.quest .gate small { display: block; color: #cbd5e1; margin-top: 1px; line-height: 1.35; font-size: 0.8rem; }
.quest .gates .tocome { margin: 6px 0 0; font-size: 0.78rem; color: #cbd5e1; }
.quest .gates .attempt { margin: 10px 0 2px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 0.84rem; color: #e2e8f0; }
.quest .gates .attempt small { display: block; color: #cbd5e1; font-size: 0.78rem; margin-top: 1px; }
.quest .gates .status { margin: 8px 0 0; padding: 6px 8px; border-radius: 8px; background: rgba(15, 23, 42, 0.8); font-size: 0.82rem; color: #e2e8f0; }
.quest .q { margin-top: 10px; padding: 10px; border-radius: 10px; background: rgba(15, 23, 42, 0.7); border: 1px solid var(--line); }
.quest .q p { margin: 0 0 8px; }
.quest .opt { display: block; width: 100%; text-align: left; margin: 5px 0; }
.quest .opt.right { border-color: var(--green); background: rgba(34, 197, 94, 0.18); } .quest .opt.wrong { border-color: var(--red); background: rgba(248, 113, 113, 0.15); }
.quest .explain { font-size: 0.86rem; margin: 8px 0 0; }
.quest .done-msg { color: #86efac; font-weight: 600; font-size: 0.9rem; }
.quest .quest-actions { display: flex; gap: 6px; margin-top: 8px; }
.quest.collapsed .quest-body { display: none; }

/* the order card */
.order { position: absolute; left: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); padding: 12px 14px; }
.order header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.order label { display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; color: var(--muted); }
.order .amt { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; color: var(--muted); }
.order .amt-row { display: flex; gap: 6px; align-items: center; }
.order .amt-row input { width: 110px; text-align: right; }
.order .chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.order .chip { cursor: pointer; padding: 3px 10px; font-size: 0.78rem; }
.order .chip.on { background: #2563eb; border-color: #60a5fa; }
.order .row { display: flex; gap: 8px; margin-top: 8px; }
.ghost-line { margin: 4px 0; font-size: 0.86rem; color: #ddd6fe; }
.next-line { margin: 6px 0 2px; font-size: 0.86rem; color: #e2e8f0; } .next-line b { color: var(--amber); }
.flow .next .mini { margin-left: 8px; vertical-align: middle; }
.warn-line { margin: 4px 0; font-size: 0.84rem; color: #fcd34d; }
.bad-line { margin: 4px 0; font-size: 0.86rem; color: var(--red); font-weight: 600; }
.phase { font: 700 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; background: rgba(148, 163, 184, 0.2); }
.ph-awaiting_server { background: rgba(245, 158, 11, 0.25); color: #fcd34d; } .ph-playing { background: rgba(34, 197, 94, 0.22); color: #86efac; }
.ph-refused { background: rgba(248, 113, 113, 0.22); color: #fecaca; } .ph-preview { background: rgba(167, 139, 250, 0.25); color: #ddd6fe; } .ph-review { background: rgba(34, 197, 94, 0.22); color: #86efac; }

/* the robot bar */
.robotbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(760px, calc(100vw - 460px)); min-width: 320px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.robotbar .what { flex: 1 1 260px; font-weight: 600; }
.robotbar .ack { font: 600 0.72rem var(--mono); padding: 2px 8px; border-radius: 999px; background: rgba(34, 197, 94, 0.18); color: #86efac; }
.robotbar .ack.bad { background: rgba(248, 113, 113, 0.22); color: #fecaca; }
.rb-track { flex: 1 1 100%; height: 5px; border-radius: 999px; background: rgba(148, 163, 184, 0.25); overflow: hidden; }
.rb-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #38bdf8); }
.robotbar .seg { display: inline-flex; gap: 4px; }
.robotbar .seg .on { background: #2563eb; border-color: #60a5fa; }

/* the reading, the tube in hand, the actions */
.readout { position: absolute; right: 12px; top: 60px; width: min(470px, calc(100vw - 24px)); padding: 12px 14px; max-height: calc(100vh - 230px); overflow: auto; }
.readout h3 { margin: 0 0 6px; font-size: 1rem; }
.readout p { margin: 4px 0; font-size: 0.88rem; }
.readout .close { position: absolute; top: 8px; right: 8px; }
table.states { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.84rem; }
table.states th, table.states td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
table.states thead th { font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.lvl-chip { display: inline-block; margin-top: 2px; padding: 1px 6px; border-radius: 6px; font: 700 0.62rem var(--mono); text-transform: uppercase; letter-spacing: 0.03em; }
.l-ANALYTICAL_REFERENCE { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; } .l-SIMULATED_ASSUMED { background: rgba(167, 139, 250, 0.22); color: #ddd6fe; }
.l-BENCH_CALIBRATED { background: rgba(34, 197, 94, 0.2); color: #86efac; } .l-HELD_OUT_VALIDATED { background: rgba(34, 197, 94, 0.3); color: #bbf7d0; } .l-LIVE_OBSERVED { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
.held { position: absolute; right: 12px; bottom: 12px; width: min(330px, calc(100vw - 24px)); padding: 10px 12px; display: grid; gap: 3px; }
.held .row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.actions { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto; padding: 14px 16px; z-index: 20; }
.actions header { display: flex; justify-content: space-between; align-items: center; }
.actions h4 { margin: 12px 0 6px; font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
label.inline { display: inline-flex; gap: 6px; align-items: center; }

/* toasts */
.toasts { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); display: grid; gap: 5px; width: min(480px, calc(100vw - 24px)); }
.toast { padding: 7px 12px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line); font-size: 0.84rem; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32); transition: opacity 0.4s, transform 0.4s; }
.toasts { top: calc(58px + var(--flow-h, 48px) + 10px); }     /* messages below the strip, not over it */
body.focus-mode .toasts { top: auto; bottom: 64px; }
.readout { top: calc(58px + var(--flow-h, 48px) + 12px); }   /* a reading's panel sits below the strip */
@media (max-width: 1540px) and (min-width: 701px) { .toasts { left: 404px; transform: none; width: min(380px, calc(100vw - 900px)); } }   /* messages under the strip, clear of a reading's panel */
.toast.good { border-color: rgba(34, 197, 94, 0.6); } .toast.bad { border-color: rgba(248, 113, 113, 0.7); } .toast.warn { border-color: rgba(245, 158, 11, 0.7); }
.toast.out { opacity: 0; transform: translateY(-6px); }

/* the terminal and the menu */
.terminal, .pause { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 14, 0.72); backdrop-filter: blur(4px); }
.term-win { width: min(1100px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; background: #0d1526; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.term-win header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; background: linear-gradient(90deg, #0b2447, #0d1526); border-bottom: 1px solid var(--line); }
.term-win h2 { margin: 0; font-size: 1.05rem; }
.term-tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.term-tabs button { padding: 5px 11px; font-size: 0.84rem; background: transparent; }
.term-tabs button.on { background: #1d4ed8; border-color: #60a5fa; }
.term-body { flex: 1; overflow: auto; padding: 14px 18px; }
.term-body h3 { margin: 18px 0 8px; font-size: 1rem; }
.term-body iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(15, 23, 42, 0.8); display: flex; flex-direction: column; gap: 6px; }
.card.on { border-color: var(--accent); }
.card h3 { margin: 4px 0 0; }
.card p { margin: 0; font-size: 0.86rem; color: #cbd5e1; }
.card .form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.card .form label { display: flex; flex-direction: column; font-size: 0.74rem; color: var(--muted); gap: 2px; }
.card button { margin-top: auto; }
.nb-tube { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.nb-steps li { margin: 4px 0; font-size: 0.88rem; }
dl.levels dt { margin-top: 8px; } dl.levels dd { margin: 2px 0 6px 0; font-size: 0.88rem; color: #cbd5e1; }
table.keys th { width: 110px; }
.pause-win { width: min(640px, 100%); max-height: 100%; overflow: auto; padding: 20px 22px; background: #0d1526; border: 1px solid var(--line); border-radius: 16px; }
.pause-win h2 { margin: 0 0 12px; }
.pause-win .row { flex-wrap: wrap; }
.settings { display: grid; gap: 10px; }
.settings label { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.settings label.check { justify-content: flex-start; }
.leave { margin: 0 0 14px; padding: 12px; border-radius: 10px; border: 1px solid rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.1); }

/* touch */
.touch { position: absolute; right: 16px; bottom: 120px; display: grid; gap: 10px; justify-items: end; }
.touch-act { width: 72px; height: 72px; border-radius: 50%; font-size: 1.8rem; background: rgba(37, 99, 235, 0.75); border: 2px solid rgba(147, 197, 253, 0.8); }
.touch-menu { border-radius: 999px; }
.joy { position: absolute; width: 100px; height: 100px; border-radius: 50%; border: 2px solid rgba(148, 163, 184, 0.6); background: rgba(15, 23, 42, 0.35); pointer-events: none; }
.joy i { position: absolute; left: 30px; top: 30px; width: 40px; height: 40px; border-radius: 50%; background: rgba(56, 189, 248, 0.75); }
body.modal-open .hud { filter: blur(1px); }

/* small screens: the panels stack and shrink */
@media (max-width: 900px) {
  .robotbar { width: calc(100vw - 24px); bottom: auto; top: 56px; }
  .readout { top: auto; bottom: 12px; max-height: 45vh; }
  .quest { max-height: 38vh; }
  .hud-top-right .chip.sim { display: none; }
}
@media (max-width: 700px) {
  .hud-top-right { left: 12px; right: 12px; max-width: none; }
  .flow { top: 52px; left: 12px; right: 12px; width: auto; transform: none; padding: 5px 8px 6px; }
  .flow .step { padding: 4px 2px; font-size: 0.72rem; gap: 3px; } .flow .step .w { display: none; } .flow .step.current .w { display: inline; }
  .flow .next { font-size: 0.78rem; }
  body.focus-mode .flow { top: 108px; }
  .quest { top: calc(60px + var(--flow-h, 0px)); max-height: 38vh; }
  .toasts { top: auto; bottom: 108px; width: calc(100vw - 120px); left: 12px; transform: none; }
  .readout { top: 52px; bottom: auto; max-height: 50vh; }
}
@media (max-width: 560px) {
  .order { bottom: 96px; }
  .order .grid { grid-template-columns: 1fr; }
  .load-card { padding: 18px; }
  .load-card h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .loading, .toast { transition: none; } }

/* ---------------------------------------------------------------- the reference demo (labdemo.js): the room performs DUV-001 by itself */
.start-demo { display: grid; gap: 5px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.08); }
.start-demo p { margin: 0; font-size: 0.86rem; color: #e2e8f0; }
.demo-btn { justify-self: start; padding: 9px 16px; font-weight: 700; color: #fde68a; border-color: rgba(245, 158, 11, 0.85); background: rgba(245, 158, 11, 0.16); }
.demo-btn:hover:not([disabled]) { border-color: #fbbf24; background: rgba(245, 158, 11, 0.28); }
.demo-btn span { margin-right: 4px; }
.demo-btn .nowrap { white-space: nowrap; margin-right: 0; }
.start-demo .demo-pick { display: grid; gap: 4px; }
.start-demo .demo-pick + .demo-pick { border-top: 1px solid rgba(245, 158, 11, 0.25); padding-top: 7px; margin-top: 2px; }
.start-demo .demo-lead { color: #cbd5e1; }
.start-demo .demo-case { color: #fde68a; font-size: 0.92rem; }
.start-demo .demo-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.start-demo .do-btn { padding: 9px 14px; font-weight: 600; }
.quest-actions .demo-go { color: #fde68a; border-color: rgba(245, 158, 11, 0.7); background: rgba(245, 158, 11, 0.14); }

/* while it runs: the room is watched, not driven; the mission card and the messages give way to the demo's own words */
body.demo #lab-canvas, body.demo .hud .panel, body.demo .terminal { pointer-events: none; }
body.demo #quest, body.demo .hud .toasts, body.demo #prompt, body.demo #crosshair, body.demo #focus-bar, body.demo #touch, body.demo #joy,
body.demo #hud-actions, body.demo #hud-menu, body.demo #hud-how, body.demo .flow .next { display: none !important; }
body.demo .order, body.demo .robotbar, body.demo .held { bottom: calc(var(--demo-h, 84px) + 22px); }
body.demo:not(.focus-mode) .order { display: none; }     /* away from the deck the order card gives way: the caption says what is next */
body.demo .readout { max-height: calc(100vh - var(--demo-h, 84px) - 190px); }
body.demo .terminal { padding-bottom: calc(var(--demo-h, 84px) + 28px); }

.demo-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 45; border-radius: 16px; overflow: hidden;
  background: rgba(8, 13, 25, 0.9); border: 1px solid rgba(245, 158, 11, 0.45); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); backdrop-filter: blur(10px); }
.demo-progress { height: 3px; background: rgba(148, 163, 184, 0.18); }
.demo-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f59e0b, #fbbf24); transition: width 0.6s ease; }
.demo-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px 11px; }
.demo-tag { display: inline-flex; flex-direction: column; align-items: flex-start; font: 700 0.62rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #fbbf24; line-height: 1.25; flex: none; }
.demo-tag b { font: 700 0.84rem var(--sans); letter-spacing: 0; text-transform: none; color: #fff; }
.demo-stage { flex: none; padding: 3px 10px; border-radius: 999px; font: 700 0.74rem var(--sans); letter-spacing: 0.04em; border: 1px solid currentColor; }
.demo-stage.s-goal { color: #c4b5fd; } .demo-stage.s-plan { color: #7dd3fc; } .demo-stage.s-exec { color: #93c5fd; } .demo-stage.s-verify { color: #86efac; }
.demo-stage.s-decide { color: #fbbf24; } .demo-stage.s-correct { color: #fdba74; } .demo-stage.s-report { color: #f0abfc; }
.demo-caption { flex: 1 1 auto; margin: 0; font-size: 1.04rem; line-height: 1.42; color: #f8fafc; font-weight: 500; min-width: 0; }
.demo-ctl { display: flex; gap: 6px; flex: none; }
.demo-ctl button { padding: 6px 11px; font-size: 0.82rem; white-space: nowrap; }
#demo-stop { border-color: rgba(248, 113, 113, 0.55); }
body.demo-paused .demo-bar { border-color: rgba(148, 163, 184, 0.6); }
body.demo-paused .demo-caption::after { content: "  · paused"; color: var(--muted); font-weight: 600; }

.demo-card { position: fixed; top: 12px; left: 12px; z-index: 12; width: min(368px, calc(100vw - 24px)); padding: 11px 13px 12px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35); }
.demo-card header { display: flex; align-items: center; gap: 8px; }
.demo-card header b { font-size: 1.02rem; }
.demo-card header .chip { margin-left: auto; padding: 2px 9px; font-size: 0.68rem; }
.demo-kicker { font: 700 0.64rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #fbbf24; }
.demo-goal { margin: 6px 0 2px; font-size: 0.86rem; color: #e2e8f0; }
.demo-goal b { color: #c4b5fd; margin-right: 4px; }
.demo-line { display: block; width: 100%; height: auto; margin: 2px 0 4px; }
.demo-line .z-rej { fill: rgba(248, 113, 113, 0.42); } .demo-line .z-und { fill: rgba(245, 158, 11, 0.38); } .demo-line .z-acc { fill: rgba(34, 197, 94, 0.5); }
.demo-line .zw { font: 700 8.5px var(--sans); fill: #f8fafc; text-anchor: middle; letter-spacing: 0.06em; text-transform: uppercase; }
.demo-line .tk { stroke: rgba(226, 232, 240, 0.55); stroke-width: 1; }
.demo-line .tl { font: 500 8.5px var(--mono); fill: #cbd5e1; text-anchor: middle; }
.demo-line .tm line { stroke: #f8fafc; stroke-width: 1.6; } .demo-line .tm circle { fill: #f8fafc; stroke: #0b0f17; stroke-width: 1.2; }
.demo-line .tm.bad circle { fill: #f87171; } .demo-line .tm.ok circle { fill: #22c55e; } .demo-line .tm.und circle { fill: #fbbf24; }
.demo-line .tn { font: 700 9px var(--sans); fill: #f8fafc; text-anchor: middle; }
.demo-tubes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 5px; }
.demo-tubes li { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 2px 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: rgba(15, 23, 42, 0.6); border: 1px solid var(--line); font-size: 0.84rem; }
.demo-tubes li.bad { border-color: rgba(248, 113, 113, 0.6); } .demo-tubes li.ok { border-color: rgba(34, 197, 94, 0.65); }
.demo-tubes .no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(148, 163, 184, 0.25); font: 700 0.72rem var(--mono); }
.demo-tubes li.bad .no { background: #f87171; color: #1f0a0a; } .demo-tubes li.ok .no { background: #22c55e; color: #052e16; }
.demo-tubes .what { min-width: 0; }
.demo-tubes .rec { display: block; color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.demo-tubes li.ok .rec, .demo-tubes li.bad .rec { color: #cbd5e1; }
.demo-tubes .got { font: 600 0.84rem var(--mono); white-space: nowrap; } .demo-tubes .got small { color: var(--muted); font-weight: 500; }
.demo-tubes .word { font: 800 0.74rem var(--sans); letter-spacing: 0.06em; }
.demo-tubes li.bad .word { color: #fca5a5; } .demo-tubes li.ok .word { color: #86efac; }
.demo-tubes .why { grid-column: 2 / -1; color: #fde68a; font-size: 0.78rem; }
.demo-none { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
.demo-card.flash { animation: demo-flash 1.1s ease; }
@keyframes demo-flash { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.75); } 100% { box-shadow: 0 0 0 16px rgba(251, 191, 36, 0); } }

.demo-arrow { position: fixed; left: 0; top: 0; z-index: 46; pointer-events: none; opacity: 0; transition: opacity 0.25s ease; will-change: transform; }
.demo-arrow.on { opacity: 1; } .demo-arrow.on.away { opacity: 0; }
.demo-tip { position: absolute; left: -4px; top: -60px; animation: demo-bob 1.1s ease-in-out infinite; }
.demo-tip svg { display: block; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.55)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
.demo-tip path { fill: #fbbf24; stroke: #111827; stroke-width: 2.4; stroke-linejoin: round; }
.demo-arrow.press .demo-tip { animation: none; transform: translate(-3px, 3px) scale(0.92); transition: transform 0.12s ease; }
.demo-keys { position: absolute; left: 50px; top: -6px; display: flex; gap: 3px; white-space: nowrap; padding: 4px 6px; border-radius: 9px; background: rgba(8, 13, 25, 0.88); border: 1px solid rgba(251, 191, 36, 0.6); }
.demo-keys:empty { display: none; }
.demo-arrow.edge .demo-keys { display: none; }       /* turned toward a thing off the screen: the keys would read sideways */
.demo-keys kbd { background: #fbbf24; color: #111827; border-color: #fbbf24; font-size: 0.72rem; }
@keyframes demo-bob { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(7px, -7px); } }
.demo-ring { position: fixed; z-index: 46; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid #fbbf24; pointer-events: none; animation: demo-ring 0.8s ease-out forwards; }
@keyframes demo-ring { from { transform: scale(0.5); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
#ord-uL.demo-typing { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35); }

.demo-end { position: fixed; inset: 0; z-index: 48; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 14, 0.62); backdrop-filter: blur(3px); }
.demo-end[hidden] { display: none; }
.demo-end-win { width: min(560px, 100%); padding: 20px 22px; border-radius: 18px; background: #0d1526; border: 1px solid rgba(245, 158, 11, 0.5); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.demo-end-win h2 { margin: 4px 0 8px; font-size: 1.7rem; letter-spacing: -0.02em; }
.demo-end-win p { margin: 0 0 12px; color: #e2e8f0; }
.demo-end-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.demo-end-acts .primary { padding: 10px 18px; font-weight: 700; }
.demo-end-acts a { color: #7dd3fc; font-size: 0.92rem; margin-left: 4px; }
.demo-bar[hidden], .demo-card[hidden] { display: none; }

@media (max-width: 700px) {
  .demo-card { display: none; }
  .demo-row { flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px 9px; }
  .demo-caption { flex-basis: 100%; order: 3; font-size: 0.95rem; }
  .demo-ctl { margin-left: auto; }
  body.demo .readout { top: 52px; max-height: 34vh; }
}
@media (prefers-reduced-motion: reduce) { .demo-tip { animation: none; } .demo-ring { animation-duration: 0.01s; } .demo-progress i { transition: none; } }

/* the KCl bench's panel (VCW-001): the station's controls, the next step of the procedure, the notebook */
.kcl { right: 12px; left: auto; bottom: 12px; width: min(460px, calc(100vw - 24px)); max-height: 62vh; overflow: auto; }
.kcl header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kcl .kline, .kcl .kstatus, .kcl .knext { font-size: 0.84rem; margin: 4px 0; color: #e2e8f0; }
.kcl .kstatus { color: #fcd34d; } .kcl .knext .mini { margin-left: 8px; }
.kcl .kctl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.kcl .kin { font-size: 0.8rem; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.kcl .kin input, .kcl .kin select { background: #0b1220; color: #e2e8f0; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.kcl .hint { font-size: 0.74rem; color: #fcd34d; }
.kcl .knote { margin: 6px 0 0 18px; padding: 0; font-size: 0.78rem; color: #cbd5e1; } .kcl .knote li.bad { color: #fca5a5; }
.kcl .ksim { font-size: 0.7rem; color: #a78bfa; margin: 6px 0 0; }

/* how it works: the credibility engine in the lab (labhow.js); every colour comes with its word */
.how-btn { color: #c7d2fe; border-color: rgba(129, 140, 248, 0.7); }
.how-win header .how-tagline { color: #94a3b8; font-size: 0.85rem; flex: 1; }
.how-body { font-size: 0.92rem; line-height: 1.5; }
.how-body h3 { color: #93c5fd; } .how-body h4 { margin: 0 0 6px; font-size: 1rem; }
.how-lead { margin: 0 0 8px; } .how-legend { margin: 0 0 10px; } .how-hint, .how-sub, .how-rule { color: #94a3b8; font-size: 0.86rem; }
.lvc { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; vertical-align: 1px; }
.lvc-measured { background: #14532d; color: #dcfce7; } .lvc-law { background: #1e3a8a; color: #dbeafe; } .lvc-checked { background: #166534; color: #dcfce7; }
.lvc-established { background: #0c4a6e; color: #e0f2fe; border-color: #38bdf8; } .lvc-calibrated { background: #4c1d95; color: #ede9fe; border-color: #a78bfa; }
.lvc-estimate { background: #164e63; color: #cffafe; border-color: #22d3ee; } .lvc-placeholder { background: #78350f; color: #fef3c7; border-color: #f59e0b; }
.lvc-not_modelled { background: #334155; color: #e2e8f0; border-color: #64748b; } .lvc-scenario { background: #3b0764; color: #ede9fe; border-color: #a78bfa; }
.how-chip { text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 3px 5px; color: #e2e8f0; font: inherit; font-size: 0.82rem; cursor: pointer; }
.how-chip:hover, .how-chip:focus-visible { border-color: #818cf8; background: rgba(99, 102, 241, 0.12); } .how-chip.on { border-color: #a5b4fc; background: rgba(99, 102, 241, 0.22); }
.how-detail { margin: 10px 0; padding: 10px 12px; border: 1px solid #334155; border-radius: 10px; background: rgba(15, 23, 42, 0.75); }
.how-detail dl { display: grid; grid-template-columns: 110px 1fr; gap: 3px 12px; margin: 0; } .how-detail dt { color: #94a3b8; } .how-detail dd { margin: 0; }
.how-detail ul { margin: 0; padding-left: 18px; } .how-detail code { white-space: normal; color: #fde68a; }
.how-q { width: 100%; border-collapse: collapse; } .how-q th, .how-q td { border-bottom: 1px solid #1e293b; padding: 4px 6px; text-align: left; vertical-align: top; }
.how-q .num { text-align: right; } .how-v-supported { color: #4ade80; font-weight: 700; } .how-v-uncertain { color: #fbbf24; font-weight: 700; } .how-v-unsupported { color: #f87171; font-weight: 700; }
.how-body details { margin: 4px 0; } .how-body summary { cursor: pointer; color: #93c5fd; }
.how-links a, .start-demo .how-link { color: #93c5fd; }
.start-demo .how-link { font-size: 0.85rem; }
@media (max-width: 720px) { .how-detail dl { grid-template-columns: 1fr; } .how-win header .how-tagline { display: none; } }

/* the instruments' figures (drawn by the server, web/figures.py: this block is its CSS, kept identical by tests/test_instrument_figures.py),
   in the lab's dark colours */
.how-body, .kcl, .readout { --fig-surface: #0d1526; --fig-ink: #e8eef8; --fig-muted: #a9b6c9; --fig-grid: #1f2a40; --fig-axis: #3a4660; --fig-line: rgba(148, 163, 184, 0.28); --fig-1: #3987e5; --fig-2: #d95926; --fig-3: #199e70; }
.vfig { margin: 10px 0 16px; padding: 10px 12px 8px; border: 1px solid var(--fig-line); border-radius: 10px; background: var(--fig-surface); color: var(--fig-ink); }
.vfig > figcaption { margin: 0 0 6px; } .vfig > figcaption b { display: block; } .vfig > figcaption span { color: var(--fig-muted); font-size: 0.88em; }
.vfig svg { width: 100%; max-width: 560px; height: auto; display: block; overflow: visible; }
.vfig svg text { fill: var(--fig-muted); font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.vfig svg text.lab { fill: var(--fig-ink); }
.vfig .gr { stroke: var(--fig-grid); stroke-width: 1; } .vfig .ax { stroke: var(--fig-axis); stroke-width: 1; }
.vfig .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.vfig .l0 { stroke: var(--fig-muted); } .vfig .l1 { stroke: var(--fig-1); } .vfig .l2 { stroke: var(--fig-2); } .vfig .l3 { stroke: var(--fig-3); }
.vfig .p0 { fill: var(--fig-muted); } .vfig .p1 { fill: var(--fig-1); } .vfig .p2 { fill: var(--fig-2); } .vfig .p3 { fill: var(--fig-3); }
.vfig .pt { stroke: var(--fig-surface); stroke-width: 2; } .vfig .hollow { fill: var(--fig-surface); stroke-width: 2; }
.vfig .b0 { fill: var(--fig-muted); fill-opacity: 0.14; } .vfig .b1 { fill: var(--fig-1); fill-opacity: 0.12; } .vfig .b2 { fill: var(--fig-2); fill-opacity: 0.16; }
.vfig .b3 { fill: var(--fig-3); fill-opacity: 0.16; } .vfig .eb { fill: none; stroke-width: 1.5; } .vfig .rule { stroke: var(--fig-muted); stroke-width: 1.2; }
.vfig .hit { fill: transparent; stroke: none; }
.vfig .fig-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 4px; padding: 0; list-style: none; font-size: 0.85em; color: var(--fig-ink); }
.vfig .fig-legend li { display: inline-flex; align-items: center; gap: 6px; }
.vfig .sw { display: inline-block; flex: none; } .vfig .sw-line { width: 18px; height: 0; border-top: 2px solid; }
.vfig .sw-dot { width: 9px; height: 9px; border-radius: 50%; } .vfig .sw-band { width: 14px; height: 10px; border-radius: 2px; opacity: 0.45; }
.vfig .c0 { border-color: var(--fig-muted); background: var(--fig-muted); } .vfig .c1 { border-color: var(--fig-1); background: var(--fig-1); }
.vfig .c2 { border-color: var(--fig-2); background: var(--fig-2); } .vfig .c3 { border-color: var(--fig-3); background: var(--fig-3); }
.vfig .sw-line.c0, .vfig .sw-line.c1, .vfig .sw-line.c2, .vfig .sw-line.c3 { background: none; }
.vfig .fig-read { margin: 4px 0; font-size: 0.92em; } .vfig .fig-src { margin: 4px 0 0; color: var(--fig-muted); font-size: 0.8em; }
.vfig details { margin: 4px 0; font-size: 0.86em; } .vfig summary { cursor: pointer; }
.vfig table { border-collapse: collapse; margin: 4px 0; } .vfig th, .vfig td { border-bottom: 1px solid var(--fig-line); padding: 2px 8px; text-align: left; }
.vfig td.n { text-align: right; font-variant-numeric: tabular-nums; }
.how-fig { border: 1px solid #1e293b; border-radius: 10px; padding: 4px 10px; margin: 6px 0; background: rgba(15, 23, 42, 0.5); }
.how-fig[open] { padding-bottom: 8px; } .how-fig > summary { color: #e2e8f0; } .how-fig .vfig { margin: 8px 0 0; }
/* the workflow picture of How it works (drawn by the server, web/flowdiagram.py: this block is its CSS, kept identical by
   tests/test_flowdiagram.py), in the lab's dark colours; .flow is the lab's own step strip, hence .wflow */
.how-body { --flow-ink: #e2e8f0; --flow-muted: #94a3b8; --flow-card: #0f1a30; --flow-line: #334155; --flow-accent: #fda4af; }
.wflow { margin: 6px 0 10px; } .wflow svg { width: 100%; height: auto; display: block; }
.wflow .flow-v { display: none; } @media (max-width: 640px) { .wflow .flow-h { display: none; } .wflow .flow-v { display: block; } }
.wflow svg text { font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--flow-ink); }
.wflow svg .fl-what { fill: var(--flow-muted); font-size: 11px; } .wflow svg .fl-name { font-weight: 700; font-size: 13px; }
.wflow svg .fl-box { fill: var(--flow-card); stroke: var(--flow-line); stroke-width: 1.2; }
.wflow svg .fl-stage:hover .fl-box, .wflow svg .fl-stage:focus .fl-box, .wflow svg .fl-stage.on .fl-box { stroke: var(--flow-accent); stroke-width: 2.2; }
.wflow svg .fl-stage { cursor: pointer; outline: none; } .wflow svg .fl-arrow { stroke: var(--flow-muted); stroke-width: 1.6; fill: none; }
.wflow svg .fl-head { fill: var(--flow-muted); } .wflow svg .fl-loop { stroke: var(--flow-accent); stroke-width: 1.6; fill: none; }
.wflow svg .fl-loophead { fill: var(--flow-accent); } .wflow svg .fl-looptext { fill: var(--flow-accent); font-size: 11.5px; }
.wflow svg .fl-track { fill: var(--flow-line); }
.wground { margin: 6px 0 10px; } .wground p { margin: 0 0 6px; } .wground .gbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.wground .gbar span { display: block; height: 100%; } .wground ul { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 6px 0 0; padding: 0;
  font-size: 0.85em; } .wground li { display: inline-flex; align-items: center; gap: 6px; } .wground i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.how-parts { margin: 4px 0 8px; padding: 8px 10px; border: 1px solid #334155; border-radius: 10px; background: rgba(15, 23, 42, 0.6); }
.how-parts > small { color: #94a3b8; } .how-parts > div { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.how-steps { display: flex; flex-wrap: wrap; gap: 4px; } .how-steps .how-chip.on { border-color: #a5b4fc; }
.how-more > summary { font-weight: 600; }
.kcl .kfig, .readout .rfig { margin: 8px 0 0; font-size: 0.8rem; } .kcl .kfig > summary, .readout .rfig > summary { cursor: pointer; color: #93c5fd; }
.kcl .kfig .vfig, .readout .rfig .vfig { margin: 6px 0 0; padding: 8px; }
