/* ==========================================================================
   Flobotics base: reset, type, layout, shared components
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--yellow); color: var(--on-yellow); }

/* Links: highlighter sweep */
a { color: inherit; text-decoration: none; }
.link, .prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  background-image: linear-gradient(var(--yellow), var(--yellow));
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.link:hover, .prose a:hover { background-size: 100% 100%; color: var(--on-yellow); }

/* ---- Layout ---- */
.container { max-width: calc(var(--maxw) + var(--pad-x) * 2); margin: 0 auto; padding-inline: var(--pad-x); }
.section { padding-block: var(--sec-y); }
.section.tight { padding-block: calc(var(--sec-y) * .6); }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Type ---- */
.mono { font-family: var(--f-mono); font-stretch: 87.5%; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--f-mono); font-stretch: 87.5%;
  font-size: 11.5px; font-weight: 500; line-height: 1.3;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.meta { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.h-hero, .h1, .h2 {
  font-family: var(--f-head); font-stretch: var(--head-stretch);
  font-weight: var(--head-weight); letter-spacing: var(--head-track);
}
.h-hero { font-size: clamp(40px, 6.2vw, 80px); line-height: 1.0; }
.h1 { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04; }
.h2 { font-size: clamp(27px, 3.3vw, 40px); line-height: 1.1; letter-spacing: calc(var(--head-track) * .7); }
.h3 { font-family: var(--f-display); font-stretch: 100%; font-weight: 620; font-size: 21px; line-height: 1.3; letter-spacing: -.005em; }
.h4 { font-family: var(--f-display); font-stretch: 106%; font-weight: 650; font-size: 17px; line-height: 1.35; }
.lead { font-size: clamp(18px, 1.6vw, 20px); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.body-s { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.prose { max-width: 66ch; color: var(--ink-2); }
.prose > * + * { margin-top: 1em; }
.prose strong { color: var(--ink); font-weight: 620; }
/* Highlighter: the same slanted vector marker stroke as the homepage .mark (v0.82). Evidence only. */
.hl { background-color: transparent; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 18 C28 17 69 13 100 9 L100 88 C70 90 30 94 0 97 Z' fill='%23F2C230'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 100% 100%; color: var(--on-yellow); padding: 0 .15em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.muted { color: var(--muted); }

/* Section head: 2px rule + mono label, like a manual chapter */
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; border-top: 2px solid var(--ink); padding-top: 16px; margin-bottom: 48px; }
.sec-head .row-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.sec-head .h2 { max-width: 22ch; }
.sec-head .lead { margin-top: 4px; }
.sec-head.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; column-gap: 48px; }
.sec-head.split .row-top { grid-column: 1 / -1; }
@media (max-width: 860px) { .sec-head.split { grid-template-columns: minmax(0, 1fr); } }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-display); font-stretch: 106%; font-weight: 600; font-size: 15px; letter-spacing: .01em; line-height: 1;
  padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn .arr { transition: transform var(--t-fast) var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn.sm { padding: 10px 13px; font-size: 14px; }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-text { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 15px; border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.btn-text .arr { transition: transform var(--t-fast) var(--ease); }
.btn-text:hover .arr { transform: translateX(3px); }

/* ---- Global navigation ---- */
.gnav { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.gnav-in { height: var(--nav-h); display: flex; align-items: center; gap: 28px; }
.wordmark { font-family: var(--f-display); font-stretch: 125%; font-weight: 760; font-size: 21px; letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wordmark i { width: 9px; height: 9px; background: var(--yellow); display: inline-block; transform: translateY(-5px); }
.gnav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.gnav-links a { font-size: 15px; font-weight: 500; letter-spacing: .005em; padding: 8px 10px; border-radius: var(--radius); display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.gnav-links a:hover { background: var(--surface-2); color: var(--ink); }
.gnav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.lab-count { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 500; letter-spacing: .04em; background: var(--yellow); color: var(--on-yellow); padding: 3px 6px; display: inline-flex; align-items: center; gap: 5px; }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; display: inline-block; }
.gnav-actions { display: flex; align-items: center; gap: 10px; }
.theme-btn { width: 36px; height: 36px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--radius); cursor: pointer; display: grid; place-items: center; }
.theme-btn:hover { border-color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 1.5; }
.menu-btn { display: none; }
@media (max-width: 1120px) {
  .gnav-links { display: none; }
  .gnav-in { justify-content: space-between; }
  .menu-btn { display: grid; }
  .gnav.open .gnav-links { display: grid; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px var(--pad-x) 20px; gap: 2px; }
  .gnav.open .gnav-links a { padding: 12px 4px; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
}
@media (max-width: 520px) { .gnav-actions .btn { display: none; } }

/* Sub-bar (register navigation under the global nav) */
.subbar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: var(--nav-h); z-index: 40; }
.subbar-in { display: flex; align-items: center; gap: 20px; min-height: 48px; overflow-x: auto; scrollbar-width: none; }
.subbar-in::-webkit-scrollbar { display: none; }
.subbar nav { display: flex; gap: 2px; }
.subbar nav a { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11.5px; letter-spacing: .04em; padding: 8px 10px; white-space: nowrap; color: var(--muted); transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.subbar nav a:hover { color: var(--ink); background: var(--surface-2); }
.subbar nav a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---- Lab lockup ---- */
.lab-lock { display: inline-flex; font-family: var(--f-mono); font-stretch: 100%; font-weight: 600; font-size: 12px; letter-spacing: .1em; border: 1.5px solid var(--ink); line-height: 1; white-space: nowrap; }
.lab-lock span { padding: 6px 9px; }
.lab-lock .lab { background: var(--yellow); color: var(--on-yellow); border-left: 1.5px solid var(--ink); }

/* ---- Specimen label ---- */
.spec { display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11.5px; background: var(--surface); }
.spec > div { padding: 8px 12px; border-right: 1px solid var(--line-strong); display: grid; gap: 2px; }
.spec > div:last-child { border-right: 0; }
.spec b { font-weight: 400; font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.spec.ink { border-color: var(--ink); }
.spec.ink > div { border-color: var(--ink); }

/* ---- Status chips ---- */
.chip { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; display: inline-flex; align-items: center; gap: 7px; line-height: 1; white-space: nowrap; border: 1px solid transparent; }
.chip.proposed { border: 1px dashed var(--ink); }
.chip.running { background: var(--yellow); color: #15181A; border-color: var(--yellow); }
.chip.running::before { content: ""; width: 6px; height: 6px; background: #15181A; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
.chip.replicating { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--yellow); }
.chip.concluded { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.inconclusive { border-color: var(--muted); color: var(--muted); }
.chip.failed { border-color: var(--fail); color: var(--fail); }
.chip.retracted { border-color: var(--muted); color: var(--muted); text-decoration: line-through; }
.chip.pass { border-color: var(--pass); color: var(--pass); }
.chip.op { border-color: var(--line-strong); color: var(--ink-2); }
.chip.op::before { content: ""; width: 6px; height: 6px; background: var(--pass); border-radius: 50%; }

/* Tags (topics) */
.tag { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border: 1px solid var(--line-strong); color: var(--ink-2); display: inline-block; line-height: 1.4; white-space: nowrap; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; align-content: start; position: relative; transition: border-color var(--t-fast) var(--ease); }
a.card:hover, .card.hover:hover { border-color: var(--ink); }
.card.result::before { content: ""; position: absolute; top: -1px; left: -1px; width: 14px; height: 14px; background: var(--yellow); }
.card.dashed { border-style: dashed; border-color: var(--line-strong); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
.t th, .t td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.t td.m, .t .m { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.t td.r, .t th.r { text-align: right; }
.t tr:last-child td { border-bottom: 0; }
.t td.best { background: var(--yellow); color: #15181A; font-weight: 600; }
.t tbody tr { transition: background var(--t-fast) var(--ease); }
.t tbody tr:hover { background: var(--surface-2); }

/* ---- Instrument console (dark in both themes) ---- */
.console { background: var(--panel); color: var(--panel-ink); border: 1px solid var(--panel-line); --ch-ink: var(--panel-ink); --ch-muted: var(--panel-muted); --ch-line: var(--panel-line); }
.console-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--panel-line); flex-wrap: wrap; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; color: var(--panel-muted); }
.console-bar strong { color: var(--panel-ink); font-weight: 500; }
.console .meta, .console .eyebrow { color: var(--panel-muted); }
.btn-console { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; background: var(--yellow); color: #15181A; border: 0; padding: 7px 11px; cursor: pointer; border-radius: 0; }
.btn-console:active { transform: translateY(1px); }
.btn-console.ghost { background: transparent; color: var(--panel-ink); border: 1px solid var(--panel-line); }
.btn-console.ghost:hover { border-color: var(--panel-ink); }

/* ---- Code ---- */
.code { background: var(--panel); color: var(--panel-ink); border: 1px solid var(--panel-line); font-family: var(--f-mono); font-stretch: 87.5%; }
.code-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px 8px 14px; border-bottom: 1px solid var(--panel-line); font-size: 11px; color: var(--panel-muted); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: inherit; font-size: 13px; line-height: 1.65; tab-size: 4; }
.code .k { color: #9DB0FF; } .code .s { color: #F2C230; } .code .c { color: #7C878A; font-style: normal; } .code .f { color: #E8ECEB; font-weight: 600; } .code .n { color: #B7E4CF; }
.code-out { border-top: 1px solid var(--panel-line); padding: 8px 14px; font-size: 11px; color: var(--panel-muted); display: flex; gap: 16px; flex-wrap: wrap; }
.code-out .ok { color: #7FD1A8; } .code-out .bad { color: #F0705C; }
.copy-btn { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; background: transparent; color: var(--panel-ink); border: 1px solid var(--panel-line); padding: 5px 8px; cursor: pointer; }
.copy-btn:hover { border-color: var(--panel-ink); }

/* ---- Photo treatment ---- */
.ph { position: relative; overflow: hidden; background: var(--ph-mid); aspect-ratio: var(--ar, 4 / 3); max-width: 100%; isolation: isolate; }
.ph > svg.ph-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ph figcaption, .ph .ph-cap { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; }
.ph .ph-cap span { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; line-height: 1.35; letter-spacing: .02em; background: rgba(15, 18, 19, .72); color: #E8ECEB; padding: 4px 7px; max-width: 80%; }
.ph .ph-cap .ph-tag { background: transparent; border: 1px solid rgba(232, 236, 235, .5); text-transform: uppercase; letter-spacing: .08em; font-size: 9px; white-space: nowrap; }
.crop { position: relative; }
.crop::before, .crop::after { content: ""; position: absolute; width: 10px; height: 10px; border-color: var(--ink); border-style: solid; pointer-events: none; }
.crop::before { top: -6px; left: -6px; border-width: 1px 0 0 1px; }
.crop::after { bottom: -6px; right: -6px; border-width: 0 1px 1px 0; }

/* ---- Tooltip ---- */
#tip { position: fixed; z-index: 100; pointer-events: none; background: var(--panel); color: var(--panel-ink); font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; line-height: 1.45; padding: 7px 9px; border: 1px solid var(--panel-line); box-shadow: 0 8px 24px rgba(21, 24, 26, .18); max-width: 260px; opacity: 0; transform: translateY(4px); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); white-space: pre-line; }
#tip.on { opacity: 1; transform: none; }

/* ---- Chart text ---- */
.chart { --ch-ink: var(--ink); --ch-muted: var(--muted); --ch-line: var(--line); overflow-x: auto; }
.console .chart { --ch-ink: var(--panel-ink); --ch-muted: var(--panel-muted); --ch-line: var(--panel-line); }
.chart svg { display: block; width: 100%; height: auto; }
.ch-t { font-family: var(--f-body); font-size: 12.5px; fill: var(--ch-ink); }
.ch-tb { font-family: var(--f-body); font-size: 13px; font-weight: 600; fill: var(--ch-ink); }
.ch-m { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; fill: var(--ch-muted); }
.ch-v { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; font-weight: 500; fill: var(--ch-ink); }
.ch-grid { stroke: var(--ch-line); stroke-width: 1; }
.ch-axis { stroke: var(--ch-muted); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; color: var(--muted); }
.console .legend { color: var(--panel-muted); }
.legend i { display: inline-block; width: 12px; height: 10px; margin-right: 6px; vertical-align: -1px; }
[data-tip] { cursor: default; }

/* ---- Diagram primitives (shared grammar) ---- */
.dg-line { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.dg-line.dash { stroke-dasharray: 4 3; }
.dg-box { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.dg-box.dash { stroke-dasharray: 4 3; }
.dg-auto { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.5; }
.dg-fail { fill: var(--surface); stroke: var(--fail); stroke-width: 1.5; }
.dg-person { fill: var(--surface); stroke: var(--forest); stroke-width: 1.5; }
.dg-t { font-family: var(--f-body); font-size: 12.5px; fill: var(--ink); }
.dg-ty { font-family: var(--f-body); font-size: 12.5px; fill: #15181A; }
.dg-m { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 9.5px; fill: var(--muted); letter-spacing: .06em; }
.dg-arrow { fill: var(--ink); }

/* ---- Footer ---- */
.gfoot { background: var(--panel); color: var(--panel-ink); margin-top: 0; }
.gfoot a { color: var(--panel-ink); }
.gfoot a:hover { color: var(--yellow); }
.gfoot-status { border-bottom: 1px solid var(--panel-line); }
.gfoot-status .container { display: flex; flex-wrap: wrap; gap: 8px 28px; padding-block: 14px; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; color: var(--panel-muted); }
.gfoot-status .ok::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #45BE85; margin-right: 8px; }
.gfoot-main { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; padding-block: 56px; }
.gfoot-main h4 { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--panel-muted); margin-bottom: 14px; }
.gfoot-main ul { list-style: none; display: grid; gap: 8px; font-size: 15px; }
.gfoot-brand p { font-size: 15px; line-height: 1.55; color: var(--panel-muted); max-width: 34ch; margin-top: 14px; }
.gfoot-latest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--panel-line); }
.gfoot-latest a { padding: 20px 24px 22px 0; display: grid; gap: 6px; border-right: 1px solid var(--panel-line); }
.gfoot-latest a + a { padding-left: 24px; }
.gfoot-latest a:last-child { border-right: 0; }
.gfoot-latest .meta { color: var(--panel-muted); }
.gfoot-latest strong { font-weight: 600; font-size: 15px; line-height: 1.35; }
.gfoot-base { border-top: 1px solid var(--panel-line); }
.gfoot-base .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-block: 18px; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; color: var(--panel-muted); }
@media (max-width: 900px) {
  .gfoot-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gfoot-latest { grid-template-columns: minmax(0, 1fr); }
  .gfoot-latest a, .gfoot-latest a + a { padding: 16px 0; border-right: 0; border-bottom: 1px solid var(--panel-line); }
}
@media (max-width: 520px) { .gfoot-main { grid-template-columns: minmax(0, 1fr); } }

/* ---- Prototype switcher (not part of the design) ---- */
.proto { position: fixed; left: 12px; bottom: 12px; z-index: 90; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; }
.proto summary { list-style: none; cursor: pointer; background: #15181A; color: #E8ECEB; padding: 8px 12px; border: 1px solid #F2C230; display: inline-flex; gap: 8px; align-items: center; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; }
.proto summary::-webkit-details-marker { display: none; }
.proto summary::before { content: ""; width: 7px; height: 7px; background: #F2C230; }
.proto nav { position: absolute; bottom: calc(100% + 6px); left: 0; background: #15181A; border: 1px solid #343D41; display: grid; min-width: 230px; }
.proto nav a { color: #E8ECEB; padding: 9px 12px; border-bottom: 1px solid #2A3134; display: flex; justify-content: space-between; gap: 12px; }
.proto nav a:last-child { border-bottom: 0; }
.proto nav a:hover { background: #22292C; }
.proto nav a em { font-style: normal; color: #8E999B; }
.proto nav a.cur { box-shadow: inset 3px 0 0 #F2C230; }

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

/* ---- Shared small components ---- */
.lab-lock.big { font-size: 15px; }
.lab-lock.big span { padding: 8px 12px; }
.lab-lock.inv .lab { background: var(--c-graphite); color: var(--c-yellow); }
.lab-lock.inv { border-color: var(--c-graphite); color: var(--c-graphite); }
.lab-lock.inv .lab { border-color: var(--c-graphite); }
.tag-blue { border-color: var(--blue); color: var(--blue); }
.tag-yellow { background: var(--yellow); border-color: var(--yellow); color: #15181A; }
.tag-fail { border-color: var(--fail); color: var(--fail); }

/* Run progress (running experiments) */
.runs { display: grid; gap: 6px; }
.runs-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line-strong); position: relative; overflow: hidden; }
.runs-bar span { position: absolute; inset: 0 auto 0 0; background: var(--ink); transition: width 600ms var(--ease); }
.runs-bar span::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--yellow); }

/* Threshold meter (failed experiments) */
.meter { display: grid; gap: 6px; }
.meter-bar { position: relative; height: 18px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.meter-bar span { position: absolute; top: 0; bottom: 0; left: 0; background: var(--fail); opacity: .85; }
.meter-bar em { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }

/* Forms */
label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 11px 12px;
  transition: border-color var(--t-fast) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
textarea { resize: vertical; }

/* Wide content (charts, code, tables) must never widen its grid track */
.chart, .post-fig, .code, .console, .table-wrap, .fig, .env, .flow, .fw, .fw-body, .loop, figure, pre { min-width: 0; }

/* ---- Digital rain (easter egg) ---- */
.rain-btn span { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.rain-btn.on { background: var(--yellow); border-color: var(--yellow); }
.rain-btn.on span { color: #15181A; }
canvas.rain { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 400ms var(--ease); }
canvas.rain.on { opacity: 1; }
canvas.rain-back { z-index: 0; }
canvas.rain-front { z-index: 95; }
html.raining main, html.raining .gfoot { position: relative; z-index: 1; }
.rain-hint { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8px); z-index: 121; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; letter-spacing: .02em; padding: 8px 12px; background: var(--c-graphite); color: #E8ECEB; border: 1px solid var(--c-yellow); opacity: 0; pointer-events: none; transition: opacity 400ms var(--ease), transform 400ms var(--ease); max-width: calc(100vw - 32px); text-align: center; cursor: pointer; }
.rain-hint.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rain-wet { animation: rainWet 1.2s ease-out; }
@keyframes rainWet {
  0% { text-shadow: none; }
  12% { text-shadow: 0 0 18px rgba(242, 194, 48, .95), 0 0 3px rgba(242, 194, 48, 1); }
  100% { text-shadow: 0 0 0 rgba(242, 194, 48, 0); }
}

/* ==========================================================================
   Switches panel (hardware control panel)
   ========================================================================== */
.gnav-actions { position: relative; }
.sw-btn { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--radius); cursor: pointer; font-family: var(--f-display); font-weight: 600; font-size: 13.5px; color: var(--ink); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.sw-btn:hover, .sw-btn.open { border-color: var(--ink); }
.sw-ico { display: grid; gap: 3px; }
.sw-ico i { width: 17px; height: 7px; border: 1.5px solid var(--ink); border-radius: 4px; position: relative; display: block; }
.sw-ico i::after { content: ""; position: absolute; top: -1.5px; left: -1.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.sw-ico i:last-child::after { left: auto; right: -1.5px; background: var(--yellow); box-shadow: 0 0 0 1.5px var(--ink); }
.sw-btn.active .sw-ico i:first-child::after { left: auto; right: -1.5px; background: var(--yellow); box-shadow: 0 0 0 1.5px var(--ink); }
.sw-count { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 700; background: var(--c-yellow); color: #15181A; padding: 1px 6px; border-radius: 999px; line-height: 1.5; }
@media (max-width: 760px) { .sw-lbl { display: none; } }

.swp { position: absolute; top: calc(100% + 12px); right: 0; width: 372px; z-index: 60; color: #E8ECEB; font-family: var(--f-body);
  background-color: #1A1F22; border: 1px solid #3A4448; box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
  background-image: radial-gradient(circle at 11px 11px, #56626A 2.4px, transparent 3px), radial-gradient(circle at calc(100% - 11px) 11px, #56626A 2.4px, transparent 3px), radial-gradient(circle at 11px calc(100% - 11px), #56626A 2.4px, transparent 3px), radial-gradient(circle at calc(100% - 11px) calc(100% - 11px), #56626A 2.4px, transparent 3px); }
.swp-head { display: flex; justify-content: space-between; gap: 10px; padding: 16px 26px 12px; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #F2C230; }
.swp-serial { color: #6E787A; letter-spacing: .06em; }
.swp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 13px 26px; border-top: 1px solid #2B3235; }
.swp-txt strong { display: block; font-weight: 650; font-size: 14.5px; color: #E8ECEB; }
.swp-txt span { display: block; font-size: 12px; line-height: 1.4; color: #8E999B; margin-top: 2px; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #3A4448; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6); transition: background var(--t-fast), box-shadow var(--t-fast); }
.swp-row:has(.tgl.on) .led { background: #F2C230; box-shadow: 0 0 8px 1px rgba(242, 194, 48, .9); }
.tgl { width: 50px; height: 28px; border-radius: 14px; background: #0B0E0F; border: 1px solid #3A4448; position: relative; cursor: pointer; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7); transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); padding: 0; }
.tgl i { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #D5DADA; background-image: linear-gradient(180deg, #F4F6F5, #AEB6B7); box-shadow: 0 2px 4px rgba(0, 0, 0, .55); transition: transform 180ms cubic-bezier(.2, .9, .3, 1.25); }
.tgl.on { background: #F2C230; border-color: #F2C230; box-shadow: inset 0 2px 5px rgba(120, 90, 0, .45); }
.tgl.on i { transform: translateX(22px); }
.tgl:focus-visible, .kill-cover:focus-visible, .kill-btn:focus-visible { outline: 2px solid #F2C230; outline-offset: 3px; }
.swp-kill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 26px; border-top: 1px solid #2B3235; background: rgba(200, 64, 44, .08); }
.swp-kill .swp-txt strong { color: #F0705C; }
.kill-unit { position: relative; width: 80px; height: 80px; background: #0B0E0F; border: 1px solid #3A4448; border-radius: 6px; display: grid; place-items: center; perspective: 420px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .7); }
.kill-btn { width: 56px; height: 56px; border-radius: 50%; border: 2px solid #5A1A12; cursor: pointer; color: #FFFFFF; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  background: radial-gradient(circle at 35% 30%, #F58B78, #C8402C 55%, #8E2A1C); box-shadow: 0 5px 0 #5A1A12, 0 8px 14px rgba(0, 0, 0, .55); transition: transform 90ms ease, box-shadow 90ms ease; }
.kill-btn:active, .kill-btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 #5A1A12, 0 3px 6px rgba(0, 0, 0, .5); }
.kill-btn.pressed { font-size: 8px; }
.kill-cover { position: absolute; inset: 5px; border-radius: 4px; border: 1px solid #15181A; cursor: pointer; display: grid; place-items: center; padding: 0; transform-origin: top center;
  background: repeating-linear-gradient(45deg, #F2C230 0 8px, #15181A 8px 16px); box-shadow: 0 6px 12px rgba(0, 0, 0, .5); transition: transform 420ms cubic-bezier(.2, .9, .3, 1.2); }
.kill-cover span { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 9px; font-weight: 800; letter-spacing: .12em; background: #15181A; color: #F2C230; padding: 3px 6px; }
.kill-cover.up { transform: rotateX(-116deg); }
.kill-cover.hint { animation: coverHint .55s ease-in-out 2; }
@keyframes coverHint { 50% { transform: rotateX(-28deg); } }
.swp-foot { display: flex; justify-content: space-between; gap: 10px; padding: 11px 26px 14px; border-top: 1px solid #2B3235; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; color: #6E787A; }
@media (max-width: 520px) { .swp { position: fixed; top: calc(var(--nav-h) + 6px); left: 8px; right: 8px; width: auto; } .swp-row, .swp-kill, .swp-head, .swp-foot { padding-inline: 18px; } }

/* ---- Fax mode ---- */
html.fax { overflow-x: hidden; }
html.fax body { padding-top: 24px; }
html.fax .gnav { top: 24px; }
html.fax .subbar { top: calc(var(--nav-h) + 24px); }
html.fax main, html.fax .gnav, html.fax .subbar, html.fax .gfoot { filter: grayscale(1) contrast(1.28) brightness(1.04); }
html.fax[data-theme="dark"] main, html.fax[data-theme="dark"] .gnav, html.fax[data-theme="dark"] .subbar, html.fax[data-theme="dark"] .gfoot { filter: grayscale(1) invert(1) contrast(1.2) brightness(1.03); }
html.fax main { transform: rotate(-.3deg); transform-origin: top center; }
.fx-head { position: fixed; top: 0; left: 0; right: 0; height: 24px; z-index: 60; background: #FFFFFF; color: #111; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; letter-spacing: .06em; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px dashed #9A9A9A; white-space: nowrap; overflow: hidden; }
@media (max-width: 640px) { .fx-head span:nth-child(3) { display: none; } }
.fx-noise { position: fixed; inset: 0; pointer-events: none; z-index: 97; mix-blend-mode: multiply; opacity: .6;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"); }
.fx-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 96; mix-blend-mode: multiply; }
.fx-layer i { position: absolute; display: block; width: 0; background: rgba(242, 194, 48, .95); border-radius: 1px; }
.fx-layer i.sweep { animation: fxSweep 380ms var(--ease) forwards; }
@keyframes fxSweep { from { width: 0; } to { width: var(--w); } }
.fx-scan { position: fixed; left: 0; right: 0; top: 0; height: 16vh; z-index: 98; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(242, 194, 48, .28) 80%, rgba(255, 255, 255, .95) 82%, transparent 86%); animation: fxScan 1.2s linear forwards; }
@keyframes fxScan { from { transform: translateY(-18vh); } to { transform: translateY(104vh); } }

/* ---- Agent view ---- */
.agv { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 110; background: #0B0E0F; color: #E8ECEB; border-left: 2px solid #F2C230; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; transform: translateX(104%); transition: transform 300ms var(--ease); font-family: var(--f-body); box-shadow: -24px 0 48px -24px rgba(0, 0, 0, .5); }
.agv.on { transform: none; }
.agv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #262C2F; }
.agv-head strong { display: block; font-weight: 700; font-size: 17px; line-height: 1.3; margin-top: 4px; }
.agv-k { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #F2C230; }
.agv-x { background: none; border: 1px solid #3A4448; color: #E8ECEB; width: 32px; height: 32px; font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.agv-x:hover { border-color: #F2C230; }
.agv-body { overflow-y: auto; padding: 4px 20px 20px; }
.agv-sec { padding: 16px 0; border-bottom: 1px solid #262C2F; display: grid; gap: 8px; }
.agv-sec p { font-size: 14.5px; line-height: 1.5; color: #C9CBC5; }
.agv-facts { list-style: none; display: grid; gap: 4px; }
.agv-facts button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; background: #13171A; border: 1px solid #262C2F; color: #E8ECEB; padding: 8px 10px; cursor: pointer; font-size: 13px; transition: border-color var(--t-fast) var(--ease); }
.agv-facts button:hover { border-color: #F2C230; }
.agv-facts button b { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; font-weight: 600; color: #15181A; background: #F2C230; padding: 2px 6px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agv pre { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11.5px; line-height: 1.6; color: #C9CBC5; white-space: pre-wrap; margin: 0; background: #050707; padding: 10px 12px; border: 1px solid #262C2F; }
.agv-foot { padding: 12px 20px; border-top: 1px solid #262C2F; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; color: #8E999B; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ln.stream { opacity: 0; animation: lnIn 260ms var(--ease) forwards; }
@keyframes lnIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.agent-hit { box-shadow: 0 0 0 3px #F2C230 !important; border-radius: 2px; }
.agent-ping { animation: agPing 1.2s var(--ease); }
@keyframes agPing { 0% { box-shadow: 0 0 0 3px #F2C230, 0 0 0 3px rgba(242, 194, 48, .8); } 100% { box-shadow: 0 0 0 3px #F2C230, 0 0 0 26px rgba(242, 194, 48, 0); } }
@media (min-width: 1240px) { html.agent body { padding-right: 460px; } html.agent .agv { width: 460px; } }

/* ---- Kill switch ---- */
html.killed *, html.killed *::before, html.killed *::after { animation-play-state: paused !important; }
html.killed main { filter: grayscale(.75); }
.kill-banner { position: fixed; left: 0; right: 0; top: var(--nav-h); z-index: 105; background: #C8402C; color: #FFFFFF; padding: 16px 0; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); animation: kbIn 380ms cubic-bezier(.2, .9, .3, 1.25); }
html.fax .kill-banner { top: calc(var(--nav-h) + 24px); }
.kb-in { display: flex; justify-content: space-between; gap: 16px 28px; align-items: center; flex-wrap: wrap; }
.kb-k { font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; display: block; opacity: .9; }
.kill-banner strong { display: block; font-weight: 600; font-size: 16px; line-height: 1.4; max-width: 68ch; margin-top: 4px; }
.kb-actions { display: flex; gap: 16px; align-items: center; }
.kb-resume { background: #FFFFFF; color: #15181A; border: 0; padding: 11px 18px; font-family: var(--f-display); font-weight: 650; font-size: 14px; cursor: pointer; }
.kb-resume:hover { background: #F2C230; }
.kb-actions a { color: #FFFFFF; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
@keyframes kbIn { from { transform: translateY(-110%); } to { transform: none; } }
#gfStatus.paused { color: #F0705C; }
#gfStatus.paused::before { background: #F0705C; }
.gf-kill { margin-left: auto; background: transparent; border: 1px solid #F0705C; color: #F0705C; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; cursor: pointer; }
.gf-kill:hover { background: #F0705C; color: #15181A; }

/* Fixes: fax on dark pages prints on white paper; banner animates even when everything else is frozen */
html.fax[data-theme="dark"], html.fax[data-theme="dark"] body { background-color: #EDEDE8 !important; background-image: none !important; }
html.fax[data-theme="dark"] body::before { display: none; }
html.killed .kill-banner, html.killed .kill-banner * { animation-play-state: running !important; }
.gnav-links a { white-space: nowrap; }
@media (max-width: 1440px) { .sw-lbl { display: none; } .gnav-links a { padding: 8px 8px; font-size: 14.5px; } .gnav-in { gap: 20px; } }

/* ---------------- Sound (v0.8) ---------------- */
.swp { max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.swp-txt .vol { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.swp-txt .vol span { margin: 0; font-family: var(--f-mono); font-stretch: 87.5%; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: #6E787A; }
#soundVol { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; max-width: 170px; height: 18px; background: transparent; cursor: pointer; opacity: .45; transition: opacity var(--t-fast); }
.swp-sound.sound-on #soundVol { opacity: 1; }
#soundVol::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #3A4448 0 1px, #242A2D 1px 10px); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6); }
#soundVol::-moz-range-track { height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #3A4448 0 1px, #242A2D 1px 10px); }
#soundVol::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 18px; margin-top: -7px; border-radius: 2px; background: linear-gradient(#FFD659, #D9A91C); border: 1px solid #0E1113; box-shadow: 0 2px 4px rgba(0, 0, 0, .5), inset 0 -4px 0 rgba(0, 0, 0, .12); }
#soundVol::-moz-range-thumb { width: 12px; height: 18px; border-radius: 2px; background: linear-gradient(#FFD659, #D9A91C); border: 1px solid #0E1113; }
#soundVol:focus-visible { outline: 2px solid #F2C230; outline-offset: 2px; }
.sound-pill { position: fixed; right: 18px; bottom: 18px; z-index: 97; display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 14px; cursor: pointer;
  background: #1A1F22; color: #E8ECEB; border: 1px solid #F2C230; border-radius: 999px; box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .6);
  font-family: var(--f-mono); font-stretch: 87.5%; font-size: 11px; letter-spacing: .04em; animation: pillIn .4s var(--ease, ease) both; }
.sound-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #F2C230; box-shadow: 0 0 8px 1px rgba(242, 194, 48, .9); animation: pillPulse 1.6s ease-in-out infinite; }
@keyframes pillIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes pillPulse { 50% { opacity: .35; } }
html.killed .sound-pill, html.killed .sound-pill::before { animation-play-state: running !important; }
@media (max-width: 520px) { .sound-pill { left: 12px; right: 12px; bottom: 12px; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .sound-pill, .sound-pill::before { animation: none; } }
