/* swarm lab: app family look (@dmarz/kit app.* tokens). Project hue 274 = sha256("swarm-lab") mod 360. */

@font-face { font-family: "Space Mono"; src: url(fonts/SpaceMono-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url(fonts/SpaceMono-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Doto"; src: url(fonts/Doto.ttf) format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --hue: 274;
  --void: #040306;
  --ink: rgb(233, 231, 225);
  --dim: rgb(178, 176, 170);
  --faint: rgb(132, 130, 124);
  --line: rgba(255, 255, 255, 0.11);
  --line-2: rgba(255, 255, 255, 0.2);
  --panel: rgba(255, 255, 255, 0.028);
  --band: rgba(255, 255, 255, 0.045);
  --bone: rgb(221, 201, 166);
  --accent: hsl(var(--hue) 90% 70%);
  --accent-dim: hsla(var(--hue), 90%, 70%, 0.45);
  --run: rgb(71, 199, 245);
  --amber: hsl(40 95% 66%);
  --fail: rgb(248, 79, 101);
  --stale: rgba(233, 231, 225, 0.45);
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --display: "Doto", var(--mono);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --rail: 208px;
  --feedw: 380px;
  --barh: 52px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--ink); }
body {
  font: 14px/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(1200px 700px at 12% -10%, hsla(var(--hue), 70%, 14%, 0.55), transparent 70%),
    radial-gradient(900px 600px at 105% 110%, hsla(var(--hue), 70%, 11%, 0.45), transparent 70%),
    var(--void);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: hsla(var(--hue), 90%, 60%, 0.35); }

/* ---------------------------------------------------------------- frame */
#hud { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 5; }
#hud path { fill: none; stroke: var(--accent); vector-effect: non-scaling-stroke; }
#hud .corner { stroke-opacity: 0.5; stroke-width: 1.6; }
#hud .edge { stroke-opacity: 0.15; stroke-width: 0.7; }
#hud .diamond { fill: var(--accent); fill-opacity: 0.35; stroke: none; }
#hud .tick { stroke-opacity: 0.12; stroke-width: 0.7; }

#app {
  height: 100vh;
  display: grid;
  grid-template: var(--barh) 1fr / var(--rail) minmax(0, 1fr) var(--feedw);
  grid-template-areas: "bar bar bar" "rail view feed";
  padding: 14px 18px 18px;
  gap: 0 18px;
}

/* ---------------------------------------------------------------- status bar */
#bar { grid-area: bar; display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); padding: 0 4px 0 0; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
#solid { width: 30px; height: 30px; }
.word { font: 900 26px/1 var(--display); letter-spacing: 0.02em; color: var(--ink); text-shadow: 0 0 6px hsla(var(--hue), 90%, 70%, 0.35); }
.inst { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.inst b { color: var(--ink); font-weight: 400; letter-spacing: 0.02em; font-size: 15px; }
.inst .sep { color: var(--faint); margin: 0 10px; }
.inst .n-run { color: var(--run); }
.inst .n-fail { color: var(--fail); }
.grow { flex: 1; }
#mode { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; display: flex; align-items: center; gap: 8px; color: var(--dim); }
#mode .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--run); box-shadow: 0 0 6px var(--run); }
#mode.down .dot { background: var(--fail); box-shadow: none; }
#mode .tag { border: 1px solid var(--line-2); padding: 2px 7px; color: var(--dim); }

/* ---------------------------------------------------------------- rail */
#rail { grid-area: rail; padding-top: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
#rail a { display: grid; grid-template-columns: 26px 1fr; align-items: baseline; padding: 6px 8px 6px 4px; color: var(--dim); border-left: 1px solid transparent; transition: color 150ms var(--ease); }
#rail a:hover { color: var(--ink); }
#rail a.on { color: var(--ink); border-left-color: var(--accent); background: linear-gradient(90deg, hsla(var(--hue), 90%, 70%, 0.08), transparent); }
#rail a .num { font-size: 11px; color: var(--faint); letter-spacing: 0.1em; }
#rail .sub { padding: 4px 8px 8px 30px; display: flex; flex-direction: column; gap: 2px; }
#rail .sub a { display: block; padding: 5px 0 5px 10px; font-size: 13px; }
#rail .sub a .qbar { margin-top: 5px; }
#rail .foot { margin-top: auto; padding: 14px 4px 4px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); line-height: 1.8; }

/* ---------------------------------------------------------------- main + sections */
#view { grid-area: view; overflow-y: auto; padding: 18px 2px 40px; min-width: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sec { border: 1px solid var(--line); background: var(--panel); margin-bottom: 18px; min-width: 0; }
.sec-h { display: flex; align-items: baseline; gap: 14px; padding: 9px 14px; background: var(--band); border-bottom: 1px solid var(--line); min-height: 38px; flex-wrap: wrap; }
.sec-h b { font-weight: 400; font-size: 11px; letter-spacing: 0.12em; color: var(--accent); }
.sec-h h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.sec-h .q { color: var(--dim); font-size: 13px; }
.sec-h .meta { margin-left: auto; font-size: 13px; color: var(--dim); }
.sec-h .readout { flex-basis: 100%; font-size: 13px; color: var(--ink); min-height: 18px; margin-top: 2px; }
.sec-h .readout:empty::before { content: "hover a cell"; color: var(--faint); }
.sec-b { padding: 16px; min-width: 0; }
.empty { color: var(--faint); margin: 0; }

/* page title for experiment / run pages */
.title { margin: 6px 0 18px; display: grid; gap: 6px; }
.title .crumbs { font-size: 13px; color: var(--dim); }
.title .crumbs a:hover { color: var(--ink); }
.title h1 { margin: 0; font: 900 34px/1.1 var(--display); letter-spacing: 0.01em; text-transform: lowercase; text-shadow: 0 0 8px hsla(var(--hue), 90%, 70%, 0.25); overflow-wrap: anywhere; }
.title .sub { color: var(--dim); max-width: 80ch; }
.title .hyp { color: var(--ink); max-width: 90ch; }
.title .hyp::before { content: "H "; color: var(--accent); }

/* numbers row */
.nums { display: flex; flex-wrap: wrap; gap: 8px 40px; margin-bottom: 18px; }
.nums div { display: grid; gap: 2px; }
.nums b { font: 400 28px/1 var(--mono); letter-spacing: -0.01em; }
.nums span { font-size: 12px; color: var(--dim); }
.nums .c-run b { color: var(--run); }
.nums .c-fail b { color: var(--fail); }

/* ---------------------------------------------------------------- live */
.live { display: grid; grid-template-columns: minmax(240px, 400px) minmax(0, 1fr); gap: 24px; }
.stage { position: relative; aspect-ratio: 1; background: #000; border: 1px solid var(--line); }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage .corner-l { position: absolute; left: 10px; bottom: 8px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.stage .nostage { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; }
.feat { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.feat [data-feat] { display: flex; flex-direction: column; gap: 10px; }
.feat .hero { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.feat .big { font: 900 76px/0.9 var(--display); color: var(--amber); text-shadow: 0 0 10px hsla(40, 95%, 60%, 0.35); }
.feat .big small { font-size: 0.45em; }
.feat .metric { font-size: 13px; color: var(--dim); }
.feat .runid { font-size: 15px; }
.feat .runid a:hover { color: var(--accent); }
.feat .params { color: var(--dim); }
.feat .who { color: var(--dim); font-size: 13px; }
.feat .prog { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--dim); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 4px; }
.tile { text-align: left; display: grid; gap: 4px; padding: 6px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); transition: border-color 150ms var(--ease); min-width: 0; }
.tile:hover, .tile.on { border-color: var(--accent-dim); }
.tile.on { box-shadow: inset 0 0 0 1px var(--accent-dim); }
.tile canvas { width: 100%; aspect-ratio: 1.6; display: block; background: #000; }
.tile .tsp { aspect-ratio: 1.6; display: grid; place-items: center; background: #000; }
.tile .tl1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; min-width: 0; }
.tile .tl1 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tile .tl1 b { font-weight: 400; color: var(--ink); }
.tile .tl2 { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- sweep */
.sweep { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.sweep .fig { min-width: 0; overflow-x: auto; }
.sweep svg, svg.series, svg.curves { max-width: 100%; height: auto; display: block; }
.heat .cell .bg { fill: rgba(255, 255, 255, 0.025); }
.heat .cell .v { fill: var(--bone); transition: fill-opacity 400ms var(--ease); }
.heat .cell .run { fill: none; stroke: var(--run); stroke-width: 1.2; }
.heat .cell[data-cell] { cursor: pointer; }
.heat .cell:hover .bg { stroke: var(--line-2); }
.heat .cell.landed .v { animation: land 900ms var(--ease); }
@keyframes land { from { fill: #fff; filter: drop-shadow(0 0 6px var(--amber)); } to { fill: var(--bone); filter: none; } }
.heat .tick { fill: var(--faint); }
.heat .tick.t-done { fill: rgba(0, 0, 0, 0.55); }
.heat .tick.t-running, .heat .tick.t-assigned { fill: var(--run); }
.heat .tick.t-failed, .heat .tick.t-stale { fill: var(--fail); }
.heat .tick.t-planned { fill: rgba(255, 255, 255, 0.16); }
svg .tl { fill: var(--dim); font: 12px var(--mono); }
svg .al { fill: var(--dim); font: 11px var(--mono); letter-spacing: 0.06em; }
svg .frame { stroke: var(--faint); stroke-width: 1; }
.curves .line { fill: none; stroke: var(--bone); stroke-width: 1.6; }
.curves .seed { fill: var(--bone); }
.curves .lab { fill: var(--bone); }
.scalekey { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-top: 10px; }
.scalekey i { width: 120px; height: 8px; background: linear-gradient(90deg, rgba(221, 201, 166, 0.05), var(--bone)); }
.scalekey em { font-style: normal; color: var(--dim); font-size: 12px; margin-left: 6px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--dim); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; }

/* final frames contact sheet */
.sheet { display: grid; gap: 4px; }
.sheet .row { display: grid; gap: 4px; align-items: center; }
.sheet .yl, .sheet .xl { font-size: 11px; color: var(--dim); }
.sheet .yl { text-align: right; padding-right: 6px; }
.sheet .xl { text-align: center; }
.sheet .ph { aspect-ratio: 1; background: #000; border: 1px solid var(--line); display: block; position: relative; min-width: 0; }
.sheet .ph img { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 300ms var(--ease); }
.sheet .ph img.ok { opacity: 1; }
.sheet .ph.running { border-color: var(--run); }
.sheet .ph:hover { border-color: var(--accent-dim); }

/* ---------------------------------------------------------------- tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 400; font-size: 12px; letter-spacing: 0.02em; color: var(--dim); padding: 0 14px 8px 0; white-space: nowrap; }
.tbl td { padding: 6px 14px 6px 0; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(255, 255, 255, 0.025); }
.tbl .mute { color: var(--faint); }
.tbl .dim { color: var(--dim); }
.scroll { overflow-x: auto; }
.st { white-space: nowrap; font-size: 13px; }
.st::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--faint); }
.st.s-running::before, .st.s-assigned::before { background: var(--run); box-shadow: 0 0 5px var(--run); }
.st.s-running, .st.s-assigned { color: var(--run); }
.st.s-done { color: var(--dim); } .st.s-done::before { background: var(--ink); }
.st.s-failed, .st.s-stale { color: var(--fail); } .st.s-failed::before, .st.s-stale::before { background: var(--fail); }
.st.s-planned { color: var(--faint); } .st.s-planned::before { background: transparent; box-shadow: inset 0 0 0 1px var(--faint); }
.st.name { font-size: 14px; }
.st.s-online::before { background: var(--ink); } .st.s-offline { color: var(--faint); }
details.fold > summary { cursor: pointer; list-style: none; padding: 10px 0 2px; color: var(--dim); font-size: 13px; letter-spacing: 0; text-transform: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+ "; color: var(--accent); }
details.fold[open] > summary::before { content: "– "; }

.bar { display: inline-block; height: 3px; background: rgba(255, 255, 255, 0.1); vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--ink); transition: width 500ms var(--ease); }
.bar.run i { background: var(--run); }
.bar.hot i { background: var(--amber); }
.qbar { display: flex; height: 3px; background: rgba(255, 255, 255, 0.07); }
.qbar i { display: block; height: 100%; transition: width 500ms var(--ease); }
.qbar .q-done { background: var(--ink); }
.qbar .q-running, .qbar .q-assigned { background: var(--run); }
.qbar .q-failed, .qbar .q-stale { background: var(--fail); }
.qbar .q-planned { background: transparent; }
.spark polyline { fill: none; stroke: var(--bone); stroke-width: 1.2; }
.spark circle { fill: var(--bone); }
.spark.run polyline { stroke: var(--run); } .spark.run circle { fill: var(--run); }
.series .line { fill: none; stroke: var(--bone); stroke-width: 1.5; }
.series .end { fill: var(--amber); }
.series .val { fill: var(--amber); }
.series.run .line { stroke: var(--run); }

.lr { white-space: nowrap; }
.lr-late { color: var(--amber); }
.lr-stale { color: var(--fail); }
.tile.stale { border-color: rgba(248, 79, 101, 0.45); }
.tile [data-bar] { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.pick span { font-size: 13px; color: var(--dim); margin-right: 6px; }
.pick button { border: 1px solid var(--line-2); padding: 3px 10px; font-size: 13px; color: var(--dim); }
.pick button:hover { color: var(--ink); }
.pick button.on { color: var(--ink); border-color: var(--accent-dim); background: hsla(var(--hue), 90%, 70%, 0.08); }
#totals a:hover b, #totals a:hover { color: var(--ink); }
.railn { color: var(--fail); font-size: 11px; margin-left: 4px; }

/* people */
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { border-radius: 50%; flex: none; display: inline-block; object-fit: cover; box-shadow: 0 0 0 1px var(--line-2); background: #000; }
.av-none { display: inline-grid; place-items: center; font-size: 10px; color: var(--dim); text-transform: uppercase; }
#rail .sub a .who { display: flex; }

/* experiment header */
.title .desc { margin: 2px 0 0; color: var(--ink); opacity: 0.86; max-width: 88ch; line-height: 1.6; }
.statusline { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; color: var(--dim); font-size: 14px; margin-top: 4px; }
.statusline .state { padding: 1px 9px; border: 1px solid var(--line-2); color: var(--ink); }
.statusline .state.act { border-color: var(--run); color: var(--run); }
.statusline .c-done { color: var(--ink); } .statusline .c-running, .statusline .c-assigned { color: var(--run); }
.statusline .c-failed, .statusline .c-stale { color: var(--fail); }
.tbl td.wrap { white-space: normal; min-width: 260px; max-width: 70ch; line-height: 1.45; }
.tbl.plan tr.inner.solo > td { padding-left: 0; background: none; }

/* plan */
.planlink { color: var(--accent); text-transform: none; letter-spacing: 0; }
.planlink:hover { text-decoration: underline; }
.tbl td.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.clip.narrow { max-width: 240px; }
.stages { margin: -6px 0 16px; }
.stages button em { font-style: normal; color: var(--dim); font-size: 12px; margin-left: 4px; }
.plan-kv { margin-bottom: 14px; row-gap: 8px; }
.plan-kv dd { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.kvp { white-space: nowrap; max-width: 100%; }
.plan-kv dd { min-width: 0; }
@media (max-width: 980px) { .kvp { white-space: normal; overflow-wrap: anywhere; } }
.kvp i { font-style: normal; color: var(--dim); margin-right: 6px; }
.tbl.plan tr.grp td { border-top-color: var(--line-2); }
.tbl.plan tr.grp.open td { background: rgba(255, 255, 255, 0.03); }
.tbl.plan .chev { color: var(--accent); width: 20px; text-align: center; }
.tbl.plan .sd { color: var(--dim); font-size: 12px; }
.tbl.plan tr.inner > td { padding: 0 0 10px 18px; border-top: 0; background: rgba(255, 255, 255, 0.015); }
.tbl.plan tr.inner .tbl td { font-size: 13px; padding: 5px 12px 5px 0; }
.subh { margin: 22px 0 10px; font-size: 13px; color: var(--accent); font-weight: 400; }
.analysis { display: grid; gap: 14px; }
.an-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; border-top: 1px solid var(--line); padding-top: 12px; }
.an-text p { margin: 6px 0 0; color: var(--ink); white-space: pre-wrap; font-size: 13px; }
.an-img img { display: block; max-width: 420px; max-height: 260px; border: 1px solid var(--line); background: #000; cursor: pointer; }
#rail .raillabel { display: block; padding: 12px 0 2px 10px; font-size: 12px; color: var(--faint); }
#rail .railnote { display: block; padding: 4px 0 4px 10px; font-size: 12px; color: var(--faint); }
#rail .finished a { color: var(--faint); }
#rail .finished a.on, #rail .finished a:hover { color: var(--ink); }

/* protocol */
.proto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.proto h3 { margin: 0 0 6px; font-size: 13px; color: var(--accent); font-weight: 400; }
.proto p { margin: 0 0 8px; color: var(--ink); white-space: pre-line; max-width: 64ch; font-size: 13px; line-height: 1.6; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--dim); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips span { border: 1px solid var(--line-2); padding: 1px 8px; font-size: 12px; color: var(--dim); }

/* run page */
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.art { border: 1px solid var(--line); padding: 8px; display: grid; gap: 6px; font-size: 12px; min-width: 0; }
.art img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; display: block; }
.art .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art .am { color: var(--dim); font-size: 12px; }
.runlive { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); gap: 22px; }

/* fleet */
.host-claim { color: var(--accent); }
.users { color: var(--dim); }

/* ---------------------------------------------------------------- feed */
#feed { grid-area: feed; display: flex; flex-direction: column; min-height: 0; margin-top: 18px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); }
#feedlist { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#feedlist:empty::after { content: "nothing reported yet"; display: block; padding: 8px 12px; color: var(--faint); font-size: 12px; }
#feedlist li { display: grid; grid-template-columns: 70px 62px minmax(0, 1fr); gap: 0 8px; padding: 6px 12px; font-size: 13px; line-height: 1.45; cursor: default; }
#feedlist li[data-run] { cursor: pointer; }
#feedlist li[data-run]:hover { background: rgba(255, 255, 255, 0.03); }
#feedlist li.new { animation: enter 260ms var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
#feedlist .t { color: var(--faint); }
#feedlist .k { font-size: 12px; padding-top: 1px; color: var(--dim); }
#feedlist .b { min-width: 0; }
#feedlist .b1 { overflow-wrap: anywhere; }
#feedlist .b2 { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#feedlist .k-start { color: var(--run); }
#feedlist .k-done { color: var(--ink); }
#feedlist .k-fail { color: var(--fail); }
#feedlist .k-plan, #feedlist .k-claim, #feedlist .k-release { color: var(--accent); }
#feedlist .k-artifact { color: var(--faint); }
#feedlist .v { color: var(--bone); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1280px) {
  :root { --feedw: 290px; --rail: 180px; }
  .live { grid-template-columns: 1fr; }
  .stage { max-width: 440px; }
  .sweep { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  #app { height: auto; min-height: 100vh; grid-template: auto auto auto auto / minmax(0, 1fr); grid-template-areas: "bar" "rail" "view" "feed"; padding: 10px 16px 24px; }
  #hud { display: none; }
  #bar { flex-wrap: wrap; padding: 6px 0 10px; gap: 10px 16px; }
  #bar .grow { display: none; }
  #bar .inst { white-space: normal; }
  #totals .sep { margin: 0 6px; }
  #rail { flex-direction: row; flex-wrap: wrap; padding: 10px 0 0; gap: 4px; }
  #rail .sub, #rail .foot, #rail .rblock { display: none; }
  #rail .rnav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
  #rail .rcodes { display: flex; padding: 0 6px; }
  #view { overflow: visible; padding-top: 12px; }
  #feed { height: 60vh; }
  .title h1 { font-size: 26px; }
  .feat .big { font-size: 60px; }
  .runlive { grid-template-columns: 1fr; }
  .an-row { grid-template-columns: 1fr; }
  .an-img img { max-width: 100%; }
  .live { grid-template-columns: minmax(0, 1fr); }
  .stage { max-width: none; }
  .sec-b { padding: 12px; }
  .nums { gap: 8px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Catalogue: keep identity, execution state and ownership visible at every width. */
.skip-link { position: fixed; left: 18px; top: -80px; z-index: 20; background: var(--void); padding: 10px 16px; border: 1px solid var(--accent); }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.control-button { padding: 7px 11px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 12px; white-space: nowrap; }
.control-button:hover { background: var(--band); border-color: var(--accent-dim); }
#app.feed-hidden { grid-template-columns: var(--rail) minmax(0,1fr); grid-template-areas: "bar bar" "rail view"; }
#app.feed-hidden #feed { display: none; }
.catalogue-title { margin-bottom: 22px; }
.catalogue-title .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.catalogue-title h1 { font-size: 42px; }
.catalogue-title p { margin: 5px 0 0; }
.catalogue-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); margin-bottom: 20px; }
.catalogue-summary > div { display: grid; gap: 5px; padding: 16px 20px; background: #100c17; }
.catalogue-summary b { font-size: 27px; font-weight: 400; }
.catalogue-summary span { font-size: 11px; color: var(--dim); }
.catalogue-summary > div:nth-child(2) b { color: var(--run); }
.catalogue-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.catalogue-controls label { display: grid; gap: 6px; font-size: 11px; color: var(--dim); flex: 1 1 155px; min-width: 0; }
.catalogue-controls .catalogue-search { flex: 2 1 250px; }
.catalogue-controls input, .catalogue-controls select { font: 12px/1.4 var(--mono); color: var(--ink); background: #100d15; border: 1px solid var(--line-2); border-radius: 5px; padding: 10px; width: 100%; min-height: 40px; min-width: 0; }
.catalogue-controls .control-button { min-height: 40px; }
.catalogue-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 15px 0 8px; font-size: 11px; color: var(--dim); }
.catalogue-caption > span:first-child { color: var(--ink); }
.catalogue-help { margin-bottom: 24px; color: var(--dim); font-size: 12px; max-width: 90ch; }
.catalogue-help summary { cursor: pointer; color: var(--accent); }
.catalogue-help p { line-height: 1.8; }
.experiment-group { margin: 0 0 22px; }
.experiment-group > summary { cursor: pointer; padding: 10px 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; font-weight: 700; font-size: 14px; }
.group-count { font-weight: 400; font-size: 11px; color: var(--dim); margin-left: 10px; padding: 2px 7px; background: var(--band); border-radius: 12px; }
.experiment-group.depth-1 { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 16px; }
.experiment-group.depth-1 > summary { font-weight: 400; color: var(--dim); font-size: 13px; border: 0; }
.experiment-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,340px),1fr)); gap: 14px; }
.experiment-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: linear-gradient(135deg,rgba(170,115,255,.045),transparent 65%),var(--panel); transition: border-color 150ms; }
.experiment-card:hover, .experiment-card:focus-within { border-color: var(--accent-dim); }
.card-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 11px; }
.experiment-status { border-radius: 4px; background: var(--band); padding: 3px 7px; color: var(--dim); }
.status-running { color: var(--run); background: rgba(71,199,245,.09); }
.status-queued { color: var(--amber); background: rgba(255,190,60,.07); }
.status-attention { color: #ff8999; background: rgba(248,79,101,.09); }
.status-completed { color: var(--bone); }
.card-age { color: var(--dim); }
.experiment-card h3 { margin: 16px 0 5px; font: 500 19px/1.4 system-ui,sans-serif; overflow-wrap: anywhere; }
.experiment-card h3 a { display: inline-block; }
.experiment-card h3 a:hover { color: var(--accent); }
.experiment-card h3 span { font-size: 15px; color: var(--accent); }
.experiment-id { font-size: 11px; color: var(--faint); overflow-wrap: anywhere; margin: 0 0 16px; }
.card-owner { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12px; flex-wrap: wrap; }
.card-counts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 18px 0 14px; gap: 10px; }
.card-counts div { display: flex; flex-direction: column-reverse; gap: 4px; }
.card-counts dt { font-size: 10px; color: var(--dim); }
.card-counts dd { margin: 0; font-size: 20px; }
.card-counts div:first-child dd { color: var(--run); }
.completion-track { height: 3px; background: var(--line); overflow: hidden; border-radius: 2px; }
.completion-track span { display: block; height: 100%; background: var(--bone); }
.card-foot { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: 10px; color: var(--dim); }
.failure-note { color: #ff8999; }
.catalogue-empty { padding: 40px 20px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; }
.catalogue-empty h2 { font-size: 17px; }.catalogue-empty p { color: var(--dim); }
@media (min-width:981px) { body[data-view="exps"] #view { padding-right: 10px; } }
@media (max-width:980px) {
  #app.feed-hidden { grid-template: auto auto auto / minmax(0,1fr); grid-template-areas: "bar" "rail" "view"; }
  .catalogue-title h1 { font-size: 34px; }
  #clock { display: none; }
  #rail a { min-height: 40px; }
}
@media (max-width:520px) {
  .catalogue-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .catalogue-summary > div { padding: 12px 15px; }
  .catalogue-controls { padding: 12px; }
  .catalogue-controls label { flex-basis: 100%; }
  .experiment-group.depth-1 { margin-left: 5px; padding-left: 9px; }
  .experiment-card { padding: 15px; }
  #hostcount { display: none; }
}
.catalogue-filter-panel > summary { padding: 12px 0; cursor: pointer; color: var(--accent); font-size: 12px; }
@media (max-width:680px) { .catalogue-summary { margin-bottom: 8px; }.catalogue-title { margin-bottom: 14px; } }

/* Connection states stay readable even before the first successful API response. */
.connection-empty { padding: clamp(24px, 6vw, 72px); max-width: 760px; }
.connection-empty h1 { font-size: 22px; color: var(--accent); }
.connection-empty p { color: var(--dim); }
#connection-notice { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(700px, calc(100% - 32px)); z-index: 20; padding: 16px 20px; border: 1px solid var(--amber); background: var(--void); color: var(--amber); }
.replayctl { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.replayctl .btns { display: flex; gap: 8px; }
.replayctl button { font: inherit; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); padding: 6px 12px; cursor: pointer; }
.replayctl button:hover { border-color: var(--accent-dim); }
.replayctl input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------------------------------------------------------------- program (home): the lab */

.lab-hero { position: relative; height: clamp(460px, 70vh, 780px); margin: -8px 0 14px; isolation: isolate; }
.lab-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 46% 40% at 50% 54%, hsla(var(--hue), 85%, 45%, 0.2), transparent 70%), radial-gradient(ellipse 22% 16% at 50% 52%, rgba(71, 199, 245, 0.07), transparent 70%);
  animation: field 9s ease-in-out infinite; }
.lab-orbit { width: 100%; height: 100%; display: block; }
.lab-core { position: absolute; left: 50%; top: 50%; transform: translate(-50%, calc(-100% - 96px)); text-align: center; pointer-events: none; display: grid; }
.lab-core b { font: 900 76px/1 var(--display); color: var(--ink); text-shadow: 0 0 14px hsla(var(--hue), 90%, 72%, 0.55), 0 0 2px #fff; }
.lab-core b small { font: 700 26px/1 var(--mono); color: var(--dim); margin-left: 2px; text-shadow: none; }
.lab-core b.bump { animation: corebump 700ms var(--ease); }
.lab-core span, .lab-read span { font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); }
.lab-read { position: absolute; left: 0; top: 6px; display: flex; gap: 34px; pointer-events: none; }
.lab-read div { display: grid; gap: 3px; }
.lab-read b { font: 700 30px/1 var(--display); color: var(--ink); }
.lab-read .run b { color: var(--run); text-shadow: 0 0 10px rgba(71, 199, 245, 0.6); }
.lab-read .bad b { color: var(--fail); }
.lab-tip { position: absolute; z-index: 2; pointer-events: none; padding: 4px 12px 5px; font-size: 11px; letter-spacing: 0.12em; white-space: nowrap; color: #fff;
  background: linear-gradient(90deg, hsla(var(--hue), 90%, 60%, 0.22), transparent); border-left: 1px solid var(--accent);
  box-shadow: -6px 0 14px -6px var(--accent); text-shadow: 0 0 8px hsla(var(--hue), 90%, 75%, 0.9); text-transform: uppercase; }
.lab-tip b { font-family: var(--display); color: var(--accent); margin-right: 4px; }

.lab-progs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ptile { position: relative; display: grid; gap: 6px; padding: 14px 14px 12px; overflow: hidden;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01)); backdrop-filter: blur(8px);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
.ptile::before, .ptile::after { content: ""; position: absolute; width: 9px; height: 9px; border: 0 solid var(--accent-dim); }
.ptile::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.ptile::after { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.ptile:hover, .ptile:focus-visible { transform: translateY(-3px); border-color: var(--accent-dim); box-shadow: 0 14px 34px -14px hsla(var(--hue), 90%, 60%, 0.55); }
.ptile .pc { font: 900 32px/1 var(--display); color: var(--accent); text-shadow: 0 0 10px hsla(var(--hue), 90%, 70%, 0.45); }
.ptile .pn { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptile .pv { display: flex; align-items: center; gap: 7px; }
.ptile .pv b { font-size: 18px; font-weight: 400; }
.ptile .pv em { font-style: normal; font-size: 12px; color: var(--run); }
.ptile .pb { display: flex; height: 2px; background: rgba(255, 255, 255, 0.07); }
.ptile .pb i, .pm-bar i { display: block; height: 100%; }
.q-done { background: var(--bone); } .q-running { background: var(--run); box-shadow: 0 0 6px var(--run); } .q-failed { background: var(--fail); }
.ptile.is-live { border-top-color: rgba(71, 199, 245, 0.55); }
.ptile.is-live::before { width: 40%; height: 1px; border: 0; top: 0; left: -40%; background: linear-gradient(90deg, transparent, var(--run), transparent); animation: scan 3.2s linear infinite; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--run); box-shadow: 0 0 8px var(--run); animation: breathe 2.4s ease-in-out infinite; }

.lab-time { margin-top: 26px; }
.tl { display: block; overflow: visible; }
.tl text { font-family: var(--mono); font-size: 9px; fill: var(--faint); }
.tl .tl-code { font-family: var(--display); font-weight: 900; font-size: 13px; fill: var(--accent); }
.tl .tl-hr { text-anchor: middle; }
.tl-grid { stroke: rgba(255, 255, 255, 0.05); }
.tl-now { stroke: var(--run); stroke-dasharray: 2 3; opacity: 0.6; }
.tl-lane { stroke: rgba(255, 255, 255, 0.06); }
.tl-done { fill: var(--bone); opacity: 0.55; }
.tl-running { fill: var(--run); }
.tl-failed { fill: var(--fail); opacity: 0.7; }
.tl-queued, .tl-registered, .tl-cancelled { fill: var(--faint); opacity: 0.4; }
.tl a:hover .tl-seg { opacity: 1; fill: #fff; }
.tl-head { fill: var(--run); filter: drop-shadow(0 0 4px var(--run)); transform-box: fill-box; transform-origin: center; animation: beacon 2.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- one program */
.pd-head { display: flex; align-items: baseline; gap: 20px; margin: 10px 0 6px; }
.pd-code { font: 900 76px/0.9 var(--display); color: var(--accent); text-shadow: 0 0 18px hsla(var(--hue), 90%, 70%, 0.5); }
.pd-head h1 { margin: 0; font: 900 28px/1 var(--display); color: var(--ink); }
.pd-nav { font-size: 11px; color: var(--faint); letter-spacing: 0.1em; transition: color 150ms var(--ease); }
.pd-navs { margin-left: auto; display: flex; gap: 18px; }
.pd-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(580px, 1fr)); gap: 0 40px; }
.pd-nav:hover { color: var(--accent); }
.pd-read { position: static; margin: 14px 0 34px; }
.pl { margin-bottom: 26px; }
.pl-name { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.pl.is-live .pl-name { color: var(--run); }
.pl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; }
.pl-arrow { width: 22px; height: 1px; background: var(--line-2); position: relative; }
.pl-arrow::after { content: ""; position: absolute; right: 0; top: -2px; border: 2.5px solid transparent; border-left-color: var(--line-2); border-right: 0; }
.vc { display: grid; gap: 7px; width: 170px; padding: 11px 12px 10px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)); backdrop-filter: blur(8px);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
.vc:hover, .vc:focus-visible { transform: translateY(-3px); border-color: var(--accent-dim); box-shadow: 0 14px 30px -14px hsla(var(--hue), 90%, 60%, 0.55); }
.vc .vt { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px var(--faint); }
.vc .vn b { font: 900 30px/1 var(--display); color: var(--ink); }
.vc .vn span { font-size: 12px; color: var(--faint); margin-left: 3px; }
.vc .va { font-size: 10px; color: var(--faint); letter-spacing: 0.08em; }
.vc.s-running { border-color: rgba(71, 199, 245, 0.55); box-shadow: 0 0 22px -8px rgba(71, 199, 245, 0.55); }
.vc.s-running .dot { background: var(--run); box-shadow: 0 0 6px var(--run); animation: breathe 2.4s ease-in-out infinite; animation-delay: inherit; }
.vc.s-running .vt { color: var(--run); }
.vc.s-done .dot { background: var(--bone); box-shadow: none; }
.vc.s-done .vn b { color: var(--bone); }
.vc.s-failed { border-color: rgba(248, 79, 101, 0.4); }
.vc.s-failed .dot { background: var(--fail); box-shadow: none; }
.vc.s-failed .vn b { color: var(--fail); }
.vc.bump .vn b { animation: corebump 700ms var(--ease); }

.xs { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.xs-running { color: var(--run); } .xs-done { color: var(--bone); } .xs-failed { color: var(--fail); }
.crumb-code { font-family: var(--display); font-weight: 900; color: var(--accent); }

/* rail: nav, program chips, running cards, recent rows */
#rail { gap: 0; padding-top: 14px; padding-right: 4px; }
#rail .rnav { display: flex; flex-direction: column; gap: 1px; }
#rail a.rn { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; font-size: 13px; color: var(--dim); border: 0; border-left: 1px solid transparent; letter-spacing: 0.04em; position: relative; transition: color 160ms var(--ease), background 160ms var(--ease); }
#rail a.rn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.025); }
#rail a.rn.on { color: #fff; border-left-color: var(--accent); background: linear-gradient(90deg, hsla(var(--hue), 90%, 70%, 0.12), transparent 80%); }
#rail a.rn.on::before { content: ""; position: absolute; left: -1px; top: 20%; bottom: 20%; width: 1px; box-shadow: 0 0 10px 1px var(--accent); }
#rail a.rn em { font-style: normal; font-size: 11px; color: var(--fail); }
#rail .rcodes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 4px 10px 12px; }
#rail a.rcode { position: relative; display: grid; grid-template-columns: 1fr; place-items: center; text-align: center; padding: 7px 0 6px; font: 900 13px/1 var(--display); color: var(--accent); letter-spacing: 0.06em;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)); transition: all 160ms var(--ease); }
#rail a.rcode:hover, #rail a.rcode.on { color: #fff; border-color: var(--accent-dim); text-shadow: 0 0 8px var(--accent); box-shadow: 0 0 16px -6px hsla(var(--hue), 90%, 65%, 0.7); }
#rail a.rcode.live::after { content: ""; position: absolute; top: 4px; right: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--run); box-shadow: 0 0 6px var(--run); }
#rail .rblock { margin-top: 16px; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
#rail .rblock header { display: flex; align-items: baseline; gap: 8px; padding: 0 12px 4px; font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); }
#rail .rblock header b { font: 900 14px/1 var(--display); color: var(--run); letter-spacing: 0; text-shadow: 0 0 8px rgba(71, 199, 245, 0.6); }
#rail a.rcard { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 9px 10px; margin: 0 2px; overflow: hidden;
  border: 1px solid rgba(71, 199, 245, 0.22); background: linear-gradient(120deg, rgba(71, 199, 245, 0.08), rgba(255, 255, 255, 0.015) 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); transition: transform 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
#rail a.rcard::before { content: ""; position: absolute; top: 0; left: -45%; width: 45%; height: 100%; background: linear-gradient(90deg, transparent, rgba(71, 199, 245, 0.09), transparent); animation: sheen 3.2s var(--ease) infinite; animation-delay: inherit; pointer-events: none; }
#rail a.rcard:hover, #rail a.rcard.on { transform: translateX(2px); border-color: rgba(71, 199, 245, 0.6); box-shadow: 0 0 22px -8px rgba(71, 199, 245, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
#rail .rc-t { display: grid; gap: 3px; min-width: 0; }
#rail .rc-1 { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; color: var(--ink); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rail .rc-1 b { font: 900 11px/1 var(--display); color: var(--accent); flex: none; }
#rail .rc-2 { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--faint); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; }
#rail .rc-2 i { font-style: normal; color: var(--run); flex: none; }
.rring { display: block; transform: rotate(-90deg); overflow: visible; }
.rring circle { fill: none; stroke-width: 2.4; }
.rring .rr-bg { stroke: rgba(255, 255, 255, 0.08); }
.rring .rr-done { stroke: var(--bone); }
.rring .rr-fail { stroke: var(--fail); }
.rring .rr-run { stroke: var(--run); filter: drop-shadow(0 0 3px var(--run)); animation: breathe 2.4s ease-in-out infinite; }
.rring text { transform: rotate(90deg); transform-origin: center; text-anchor: middle; dominant-baseline: middle; font: 700 9px var(--mono); fill: var(--ink); }
#rail a.rrow { display: grid; grid-template-columns: 6px 30px 1fr auto; gap: 8px; align-items: center; padding: 5px 12px; font-size: 12px; color: var(--dim); transition: background 150ms var(--ease), color 150ms var(--ease); }
#rail a.rrow:hover { background: rgba(255, 255, 255, 0.03); color: var(--ink); }
#rail a.rrow i { width: 5px; height: 5px; border-radius: 50%; background: var(--bone); }
#rail a.rrow.s-failed i { background: var(--fail); }
#rail a.rrow b { font: 900 11px/1 var(--display); color: hsla(var(--hue), 80%, 72%, 0.75); }
#rail a.rrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rail a.rrow em { font-style: normal; font-size: 10px; color: var(--faint); }
#rail .rall { display: block; padding: 8px 12px 0; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); transition: color 150ms var(--ease); }
#rail .rall:hover { color: var(--accent); }
@keyframes sheen { 0% { left: -45%; } 60%, 100% { left: 110%; } }

/* home: key, hypothesis matrix, blocks */
.lab-key { position: absolute; right: 0; bottom: 6px; display: flex; gap: 16px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); pointer-events: none; }
.lab-key i { display: inline-block; width: 5px; height: 5px; margin-right: 6px; vertical-align: 1px; }
.key-done { background: var(--bone); } .key-run { background: var(--run); box-shadow: 0 0 6px var(--run); border-radius: 50%; } .key-fail { background: var(--fail); } .key-hyp { width: 1px !important; height: 9px !important; background: var(--bone); vertical-align: -1px !important; }
.lab-block { margin-top: 30px; }
.lab-block > header { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.lab-block h2 { margin: 0; font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--dim); font-weight: 400; }
.lab-block header span { font-size: 11px; color: var(--faint); margin-left: auto; }
.hmx { display: grid; gap: 7px; }
.hrow { display: grid; grid-template-columns: 170px 1fr 28px; align-items: center; gap: 12px; }
.ha { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hn { font: 900 13px/1 var(--display); color: var(--bone); text-align: right; }
.hcells { display: flex; flex-wrap: wrap; gap: 3px; }
.hc { width: 11px; height: 11px; border: 1px solid hsla(var(--hue), 70%, 70%, 0.22); background: hsla(var(--hue), 70%, 60%, 0.05); transition: transform 140ms var(--ease), background 140ms var(--ease); }
.hc:hover { transform: scale(1.5); background: hsla(var(--hue), 80%, 70%, 0.4); position: relative; z-index: 1; }
.hc.on { background: var(--bone); border-color: var(--bone); box-shadow: 0 0 8px rgba(221, 201, 166, 0.75); cursor: pointer; }
.ptile .pv small { font-size: 10px; color: var(--faint); margin: 0 6px 0 -3px; letter-spacing: 0.06em; }
.ptile .pv .ph { color: var(--bone); }
.lab-core span { letter-spacing: 0.24em; }

.pg-enter .ptile, .pg-enter .lab-read div, .pg-enter .pl { animation: enter 360ms var(--ease) both; }
.pg-enter .ptile:nth-child(2), .pg-enter .pl:nth-child(2) { animation-delay: 50ms; }
.pg-enter .ptile:nth-child(3), .pg-enter .pl:nth-child(3) { animation-delay: 100ms; }
.pg-enter .ptile:nth-child(4), .pg-enter .pl:nth-child(4) { animation-delay: 150ms; }
.pg-enter .ptile:nth-child(5), .pg-enter .pl:nth-child(5) { animation-delay: 200ms; }
.pg-enter .ptile:nth-child(n+6), .pg-enter .pl:nth-child(n+6) { animation-delay: 250ms; }
.pg-enter .lab-orbit { animation: orbitin 900ms var(--ease) both; }

@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes beacon { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.8); opacity: 0.4; } }
@keyframes scan { from { left: -40%; } to { left: 100%; } }
@keyframes field { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes orbitin { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes corebump { 0% { color: #fff; text-shadow: 0 0 18px var(--bone), 0 0 4px #fff; } 100% { } }

@media (max-width: 1280px) { .lab-progs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .lab-hero { height: 380px; }
  .lab-core b { font-size: 44px; }
  .lab-read { gap: 20px; }
  .lab-read b { font-size: 22px; }
  .lab-progs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hrow { grid-template-columns: 1fr; gap: 4px; }
  .lab-key { display: none; }
  .pd-code { font-size: 54px; }
  .vc { width: 100%; }
  .pd-lines { grid-template-columns: 1fr; }
  .pl-arrow { display: none; }
  .pl-row { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #rail a.rcard::before, .rring .rr-run, .pulse, .vc .dot, .tl-head, .ptile.is-live::before, .lab-hero::before, .pg-enter *, .bump, .bump * { animation: none !important; }
}

/* live: running experiments + fleet */
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.lv { display: grid; gap: 10px; padding: 14px 15px; border: 1px solid rgba(71, 199, 245, 0.45); position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(71, 199, 245, 0.07), rgba(255, 255, 255, 0.01) 55%); box-shadow: 0 0 30px -14px rgba(71, 199, 245, 0.6);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease); }
.lv::before { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 1px; background: linear-gradient(90deg, transparent, var(--run), transparent); animation: scan 3.2s linear infinite; }
.lv:hover { transform: translateY(-2px); box-shadow: 0 10px 34px -12px rgba(71, 199, 245, 0.7); }
.lv-h { display: flex; align-items: baseline; gap: 9px; }
.lv-h b { font: 900 22px/1 var(--display); color: var(--accent); }
.lv-h .ln { font-size: 14px; color: var(--ink); }
.lv-h .tg { font-size: 12px; color: var(--faint); }
.lv-h .ow { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faint); }
.lv-n { display: flex; align-items: baseline; gap: 8px; }
.lv-n b { font: 900 40px/1 var(--display); color: var(--run); text-shadow: 0 0 12px rgba(71, 199, 245, 0.55); }
.lv-n span { font-size: 12px; color: var(--faint); }
.lv-runs { display: grid; gap: 6px; }
.lv-r { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 10px; align-items: center; font-size: 12px; color: var(--dim); }
.lv-r .rid { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-r .bar { width: 100% !important; }
.lv-r .host { color: var(--faint); font-size: 11px; }
.lv-empty { color: var(--faint); font-size: 13px; padding: 20px 0; }

/* fly-in: the focused program's header over the map */
body[data-view="prog"] #hostcount { display: none; }
.lab-focus { position: absolute; left: 0; bottom: 8px; display: flex; align-items: baseline; gap: 16px; z-index: 2; animation: enter 500ms var(--ease) both; animation-delay: 300ms; }
.lf-back { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); padding: 6px 12px; border: 1px solid var(--line-2); background: rgba(10, 6, 18, 0.6); backdrop-filter: blur(8px); transition: color 150ms var(--ease), border-color 150ms var(--ease); align-self: center; }
.lf-back:hover { color: #fff; border-color: var(--accent-dim); }
.lf-code { font: 900 64px/0.9 var(--display); color: var(--accent); text-shadow: 0 0 18px hsla(var(--hue), 90%, 70%, 0.55); }
.lf-name { font: 900 24px/1 var(--display); color: var(--ink); }
.lf-nav { display: flex; gap: 14px; margin-left: 10px; font-size: 11px; letter-spacing: 0.1em; }
.lf-nav a { color: var(--faint); } .lf-nav a:hover { color: var(--accent); }
.lab .pd { margin-top: 6px; }
@media (max-width: 980px) { .lf-code { font-size: 40px; } .lf-name { font-size: 16px; } .lf-nav { display: none; } }

/* GitHub mark on experiments */
.gh { display: inline-grid; place-items: center; margin-left: auto; padding: 3px; color: var(--faint); cursor: pointer; border-radius: 50%; transition: color 150ms var(--ease), filter 150ms var(--ease), transform 150ms var(--ease); vertical-align: middle; }
.gh svg { fill: currentColor; display: block; }
.gh:hover, .gh:focus-visible { color: #fff; filter: drop-shadow(0 0 6px hsla(var(--hue), 90%, 70%, 0.9)); transform: scale(1.12); outline: none; }
.vc .vt .gh { margin-left: auto; }
#rail .rc-2 i { display: inline-flex; align-items: center; gap: 6px; }
#rail .rc-2 .gh { padding: 0; margin: 0; }
.lv-h .gh { margin-left: 0; }
.title h1 .gh { margin-left: 6px; vertical-align: 2px; }

/* phone: the swarm as a header visual, then lists */
.lab-mlive { display: none; }
.mlive { display: grid; gap: 8px; }
.mlive .rcard { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 10px 12px; overflow: hidden;
  border: 1px solid rgba(71, 199, 245, 0.25); background: linear-gradient(120deg, rgba(71, 199, 245, 0.09), rgba(255, 255, 255, 0.015) 60%); }
.mlive .rcard::before { content: ""; position: absolute; top: 0; left: -45%; width: 45%; height: 100%; background: linear-gradient(90deg, transparent, rgba(71, 199, 245, 0.09), transparent); animation: sheen 3.2s var(--ease) infinite; animation-delay: inherit; pointer-events: none; }
.mlive .rc-t { display: grid; gap: 3px; min-width: 0; }
.mlive .rc-1 { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlive .rc-1 b { font: 900 12px/1 var(--display); color: var(--accent); }
.mlive .rc-2 { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }
.mlive .rc-2 i { font-style: normal; color: var(--run); display: inline-flex; align-items: center; gap: 6px; }
.mlive .rc-2 .gh { padding: 0; margin: 0; }
@media (max-width: 760px) {
  #app { padding: 8px 12px 24px; }
  #bar { flex-wrap: wrap; gap: 6px 14px; padding-bottom: 8px; height: auto; }
  #bar .grow, #hostcount, #feed-toggle { display: none; }
  #totals { order: 3; width: 100%; font-size: 10px; }
  #totals b { font-size: 13px; }
  #totals .sep { margin: 0 6px; }
  #rail .rnav a.rn { padding: 6px 8px; font-size: 12px; }
  #rail .rcodes { width: 100%; padding: 4px 0; display: grid; grid-template-columns: repeat(6, 1fr); }
  .lab-hero { height: 300px; margin: 0 -12px 10px; }
  .lab-key { display: none; }
  .lab-mlive { display: block; margin-top: 4px; margin-bottom: 18px; }
  .lab-progs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ptile { padding: 11px; }
  .ptile .pc { font-size: 24px; }
  .ptile .pv b { font-size: 15px; }
  .lab-block:last-child { display: none; }
  .hcells { gap: 2px; }
  .hc { width: 9px; height: 9px; }
  .lab-focus { left: 12px; bottom: 6px; gap: 10px; flex-wrap: wrap; }
  .lf-back { padding: 4px 8px; font-size: 10px; }
  .pd-lines { grid-template-columns: 1fr; }
  .pl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .vc { width: auto; min-width: 0; padding: 9px 10px; }
  .vc .vn b { font-size: 24px; }
  .vc .vb .qbar { width: 100% !important; }
  .pl-arrow { display: none; }
  .lv-grid { grid-template-columns: 1fr; }
  .lv-r { grid-template-columns: 80px 1fr auto; }
  .lv-r .host { display: none; }
}
@media (max-width: 980px) {
  #rail { padding-top: 6px; }
  #rail .rblock, #rail .foot { display: none; }
  #rail .rnav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; width: 100%; }
  #rail .rnav a.rn { padding: 6px 10px; }
  #rail .rnav a.rn.on::before { display: none; }
  #rail .rcodes { order: 9; width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); padding: 6px 0 2px; }
}

/* who runs what: avatar in the progress ring, the ring and card lit in the person's hue */
.rwho { position: relative; width: 34px; height: 34px; display: grid; place-items: center; }
.rwho .rring { position: absolute; inset: 0; }
.rwho .av { position: relative; box-shadow: 0 0 0 1px var(--pc, var(--run)), 0 0 10px -1px var(--pc, var(--run)); }
.rring .rr-run { stroke: var(--pc, var(--run)); filter: drop-shadow(0 0 3px var(--pc, var(--run))); }
#rail a.rcard, .mlive .rcard { border-color: color-mix(in srgb, var(--pc, var(--run)) 35%, transparent); background: linear-gradient(120deg, color-mix(in srgb, var(--pc, var(--run)) 13%, transparent), rgba(255, 255, 255, 0.015) 60%); }
#rail a.rcard:hover, #rail a.rcard.on { border-color: var(--pc, var(--run)); box-shadow: 0 0 22px -8px var(--pc, var(--run)); }
#rail .rc-2 i, .mlive .rc-2 i { color: var(--pc, var(--run)); }
#rail a.rcard::before, .mlive .rcard::before { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--pc, var(--run)) 14%, transparent), transparent); }
#rail a.rrow { grid-template-columns: 14px 30px 1fr auto; }
#rail a.rrow .av { box-shadow: 0 0 0 1px var(--pc), 0 0 6px -1px var(--pc); }
#rail .rc-2 > span, .mlive .rc-2 > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.evidence-notice{background:#121c28;border-left:3px solid #f2b661;padding:16px 20px;margin:18px 0;color:#ececf0;font:14px/1.6 monospace}.evidence-notice strong{color:#f2b661}.evidence-notice p{margin:8px 0}.evidence-notice a{color:#7de0d2}.evidence-notice small{color:#afb8c8}
