/* ==========================================================================================================
   nir.nodirodilov.uz — NIR Lab · Adversarial ML — design system v4 «Scientific Editorial × Research Workbench»
   (2026-11-08)
   ----------------------------------------------------------------------------------------------------------
   Composition primitives instead of a card grid: an editorial page head (kicker, title, one-sentence dek,
   source tags), numbered section heads that state the question a section answers, numbered figures with
   captions and sources, large typeset numbers with context, hairline rules and whitespace for grouping,
   drawers and tabs for depth. Surfaces are reserved for things you operate (the workbench, interactive
   figures). Shell: persistent left sidebar (252 px, 72 px rail, drawer below 1024 px) and a compact topbar.
   Themes: true black (#000 canvas) and true white (#FFF canvas). Semantic colour only — FGSM cyan, transfer
   blue, CKA violet, success emerald, warning amber, adversarial failure coral; primary actions in ink.
   Typography: Inter (self-hosted, CSP font-src 'self') with tabular figures for every number; monospace
   only for code, identifiers and formulas. Colour is never the only carrier of meaning.
   ========================================================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fonts/inter-cyrillic-ext.woff2?v=5.1.0") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fonts/inter-cyrillic.woff2?v=5.1.0") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fonts/inter-latin-ext.woff2?v=5.1.0") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fonts/inter-latin.woff2?v=5.1.0") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Characters outside the Inter subsets (ε Δ ρ → ≤ ∈ ₁ ✓ …) fall through to the next family. Static "Segoe UI"
   comes before the variable "Segoe UI Variable": Chrome builds a separate instance of a variable system font for
   every weight × optical size, and those instances were most of the first layout (FGSM page, 4× CPU: 1599 ms
   layout, 649 ms of it creating 25 system-font instances; with this order the layout is about a third shorter).
   Symbols missing from Segoe UI are found in Segoe UI Symbol / Cambria Math without a system-wide search. */
:root {
  color-scheme: light dark;
  --font-sans: "Inter", "Segoe UI", "Segoe UI Symbol", "Cambria Math", "Segoe UI Variable Text", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Inter", "Segoe UI", "Segoe UI Symbol", "Cambria Math", "Segoe UI Variable Display", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;

  /* ---- type roles: display (home topic) 34–40, page 30–34, section 24, figure 17, lead 19, body 16 (reading 17), small 14, meta 13 ---- */
  --t-hero: clamp(1.625rem, 1rem + 1.15vw, 2.125rem);
  --t-page: clamp(1.75rem, 1.4rem + 0.8vw, 2.125rem);
  --t-section: clamp(1.375rem, 1.25rem + 0.35vw, 1.625rem);
  --t-fig: 1.0625rem;
  --t-lead: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --t-card: 1.0625rem;
  --t-body: 1rem;
  --t-read: 1.0625rem;
  --t-nav: 0.9375rem;
  --t-small: 0.875rem;
  --t-table: 0.875rem;
  --t-meta: 0.8125rem;
  --t-metric: clamp(2.125rem, 1.55rem + 1.15vw, 2.875rem);

  /* ---- spacing (4 px system) and radii ---- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --radius: 14px;        /* figures, instruments */
  --radius-sm: 10px;     /* wells, inputs */
  --radius-lg: 18px;     /* the workbench */
  --radius-btn: 10px;

  /* ---- light surfaces: white canvas, soft neutral wells ---- */
  --bg: #ffffff;
  --sidebar-bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-3: #eef1f5;
  --ink: #0f141c;
  --ink-2: #1f2937;
  --muted: #4a5567;
  --faint: #667085;
  --line: #e3e7ee;
  --line-strong: #c9d1dc;

  /* ---- hues: text-safe / vivid / soft (text-safe tones ≥ 4.5 : 1 on the canvas) ---- */
  --azure: #2563eb;   --azure-vivid: #3b82f6;   --azure-soft: #eaf2ff;  --azure-ink: #1d4ed8;
  --cyan: #0e7490;    --cyan-vivid: #06b6d4;    --cyan-soft: #e3f7fa;
  --violet: #6d28d9;  --violet-vivid: #8b5cf6;  --violet-soft: #f1ecff;
  --indigo: #4338ca;  --indigo-vivid: #6366f1;  --indigo-soft: #eceeff;
  --amber: #b45309;   --amber-vivid: #f59e0b;   --amber-soft: #fdf3df;
  --coral: #be123c;   --coral-vivid: #f43f5e;   --coral-soft: #ffe7eb;
  --emerald: #047857; --emerald-vivid: #10b981; --emerald-soft: #e1f6ed;
  --slate-soft: #f1f4f8;
  --panel: #f7f8fa;
  /* UI-indicator tones (≥ 3 : 1 on --surface, WCAG 1.4.11): slider, selected rings, category marks, control borders */
  --amber-ui: #cc6f05; --cyan-ui: #0891b2; --emerald-ui: #059669; --control-border: #7c8a9e;

  /* ---- semantic roles (the brief's accent map) ---- */
  --c-fgsm: var(--cyan); --c-fgsm-vivid: var(--cyan-vivid); --c-fgsm-ui: var(--cyan-ui); --c-fgsm-soft: var(--cyan-soft);
  --c-tr: var(--azure); --c-tr-vivid: var(--azure-vivid); --c-tr-ui: var(--azure-vivid); --c-tr-soft: var(--azure-soft);
  --c-cka: var(--violet); --c-cka-vivid: var(--violet-vivid); --c-cka-ui: var(--violet-vivid); --c-cka-soft: var(--violet-soft);
  --mod: var(--ink); --mod-vivid: var(--ink-2); --mod-ui: var(--ink-2); --mod-soft: var(--surface-2);

  /* ---- component aliases ---- */
  --accent: var(--azure); --accent-vivid: var(--azure-vivid); --accent-soft: var(--azure-soft); --accent-ink: #ffffff;
  --btn-primary: var(--ink); --btn-primary-ink: var(--bg); --btn-primary-hover: #273142;
  --ok: var(--emerald); --ok-soft: var(--emerald-soft);
  --warn: var(--amber); --warn-soft: var(--amber-soft);
  --bad: var(--coral); --bad-soft: var(--coral-soft);
  --purple: var(--violet); --purple-soft: var(--violet-soft);
  --neutral-soft: var(--slate-soft);
  --focus: #0f141c;
  --delta-pos: #e11d48;   /* +Δ: pixel value increased (lighter) */
  --delta-neg: #2563eb;   /* −Δ: pixel value decreased (darker) */
  --delta-zero: #e2e8f0;
  --shadow-1: 0 1px 2px rgba(15, 20, 28, 0.04);
  --shadow-2: 0 12px 32px rgba(15, 20, 28, 0.12), 0 1px 3px rgba(15, 20, 28, 0.06);
  --sidebar-w: 252px;
  --rail-w: 72px;
  --topbar-h: 62px;
  --page-max: 1600px;
  --wide-max: 1320px;
  --read-max: 1240px;
  --measure: 72ch;
  --maxw: var(--page-max);
  --header-h: var(--topbar-h);
}

/* ---- dark theme (system preference without explicit choice, or explicit choice): true black canvas ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --sidebar-bg: #08090b; --surface: #0d0f12; --surface-2: #15181e; --surface-3: #1c2027;
    --ink: #f7f8fa; --ink-2: #e5e7eb; --muted: #a7afbe; --faint: #858e9d; --line: #23272f; --line-strong: #3b4350;
    --azure: #7cb2ff; --azure-soft: #0f1d33; --azure-ink: #a9ccff;
    --cyan: #38d6ec; --cyan-soft: #0a242c;
    --violet: #b49cff; --violet-soft: #1c1530;
    --indigo: #a2a8ff; --indigo-soft: #181a36;
    --amber: #fbbf24; --amber-soft: #261c09;
    --coral: #fb8a9c; --coral-soft: #2f1017;
    --emerald: #46d39a; --emerald-soft: #0a251b;
    --slate-soft: #1c2027;
    --panel: #0d0f12;
    --amber-ui: #fbbf24; --cyan-ui: #22d3ee; --emerald-ui: #34d399; --control-border: #616b7b;
    --btn-primary: #f7f8fa; --btn-primary-ink: #000000; --btn-primary-hover: #d5dae2;
    --focus: #f7f8fa;
    --delta-pos: #fb7185; --delta-neg: #60a5fa; --delta-zero: #1c2027;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.6); --shadow-2: 0 14px 36px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --sidebar-bg: #08090b; --surface: #0d0f12; --surface-2: #15181e; --surface-3: #1c2027;
  --ink: #f7f8fa; --ink-2: #e5e7eb; --muted: #a7afbe; --faint: #858e9d; --line: #23272f; --line-strong: #3b4350;
  --azure: #7cb2ff; --azure-soft: #0f1d33; --azure-ink: #a9ccff;
  --cyan: #38d6ec; --cyan-soft: #0a242c;
  --violet: #b49cff; --violet-soft: #1c1530;
  --indigo: #a2a8ff; --indigo-soft: #181a36;
  --amber: #fbbf24; --amber-soft: #261c09;
  --coral: #fb8a9c; --coral-soft: #2f1017;
  --emerald: #46d39a; --emerald-soft: #0a251b;
  --slate-soft: #1c2027;
  --panel: #0d0f12;
  --amber-ui: #fbbf24; --cyan-ui: #22d3ee; --emerald-ui: #34d399; --control-border: #616b7b;
  --btn-primary: #f7f8fa; --btn-primary-ink: #000000; --btn-primary-hover: #d5dae2;
  --focus: #f7f8fa;
  --delta-pos: #fb7185; --delta-neg: #60a5fa; --delta-zero: #1c2027;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.6); --shadow-2: 0 14px 36px rgba(0, 0, 0, 0.7);
}

/* module accent of a page or a block: data-mod="fgsm|transfer|cka" */
[data-mod="fgsm"] { --mod: var(--c-fgsm); --mod-vivid: var(--c-fgsm-vivid); --mod-ui: var(--c-fgsm-ui); --mod-soft: var(--c-fgsm-soft); }
[data-mod="transfer"] { --mod: var(--c-tr); --mod-vivid: var(--c-tr-vivid); --mod-ui: var(--c-tr-ui); --mod-soft: var(--c-tr-soft); }
[data-mod="cka"] { --mod: var(--c-cka); --mod-vivid: var(--c-cka-vivid); --mod-ui: var(--c-cka-ui); --mod-soft: var(--c-cka-soft); }

@media (prefers-contrast: more) { :root { --line: var(--line-strong); --muted: var(--ink); --faint: var(--ink-2); } }
:root[data-contrast="high"] { --line: var(--line-strong); --muted: var(--ink); --faint: var(--ink-2); }
:root[data-contrast="high"] .fig, :root[data-contrast="high"] .workbench, :root[data-contrast="high"] .pred-card, :root[data-contrast="high"] .badge, :root[data-contrast="high"] .tag { border-width: 2px; }

/* ==========================================================================================================
   base
   ========================================================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 20px); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: var(--t-body); line-height: 1.55; overflow-x: hidden; -webkit-font-smoothing: antialiased; font-optical-sizing: auto; }
img, canvas, svg { max-width: 100%; }
a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
p a, li a, dd a, td a, .fig-cap a, .dek a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 0.45em; text-wrap: balance; letter-spacing: -0.012em; font-weight: 650; }
h1 { font-size: var(--t-page); font-weight: 700; letter-spacing: -0.024em; line-height: 1.12; }
h2 { font-size: var(--t-section); letter-spacing: -0.018em; margin-top: 1.6rem; }
h3 { font-size: var(--t-card); margin-top: 1.1rem; }
h4 { font-size: 1rem; margin-top: 0.9rem; }
p, li, dd { max-width: var(--measure); }
p { margin: 0 0 0.9em; }
small, .small { font-size: var(--t-meta); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--surface-3); padding: 0.06em 0.34em; border-radius: 4px; overflow-wrap: anywhere; }
p, li, dd, dt, td, th, summary, .dek, .small, .muted { overflow-wrap: break-word; }
.prose, .doc-body, dl.rows dd, .fig-cap, .bib-role, .synth p { hyphens: auto; -webkit-hyphens: auto; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem 1rem; overflow: auto; font-size: 0.8125rem; line-height: 1.5; min-width: 0; max-width: 100%; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }
abbr[title] { text-decoration: underline dotted; cursor: help; }
var { font-style: italic; }
sup, sub { line-height: 0; }
figure { margin: 0; }
figcaption { color: var(--muted); font-size: var(--t-meta); max-width: var(--measure); }
ul, ol { padding-left: 1.25rem; }
li { margin: 0.22rem 0; }
li::marker { color: var(--faint); }
dl.kv { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0.6rem 0; }
dl.kv dt { color: var(--muted); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .m-hide { display: none; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
details > summary { cursor: pointer; }
.btn, .tb-btn, .nav-item, .util-link, .seg label, .eps-preset, .sample-btn, .heatmap .cell, .icon-btn, .sidebar-toggle, .tb-menu, .outcome-counts button, .toc a, .tab, .drawer > summary { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }

/* ==========================================================================================================
   app shell: sidebar + topbar + canvas
   ========================================================================================================== */
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--btn-primary); color: var(--btn-primary-ink); padding: 0.5rem 0.8rem; border-radius: 6px; z-index: 100; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--sidebar-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 60; transition: width 0.18s ease, transform 0.22s ease; }
.app-main { flex: 1 1 auto; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.18s ease; }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 13px 12px 9px 16px; min-height: var(--topbar-h); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); min-width: 0; flex: 1 1 auto; }
.sidebar-brand .mark { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 9px; background: var(--ink); color: var(--bg); }
.sidebar-brand .mark .ic { width: 21px; height: 21px; stroke-width: 2.1; }
.sidebar-brand .brand-text { display: grid; line-height: 1.15; min-width: 0; }
.sidebar-brand .brand-title { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; white-space: nowrap; }
.sidebar-brand .brand-sub { font-size: 0.75rem; color: var(--muted); font-weight: 500; white-space: nowrap; letter-spacing: 0.02em; }
.sidebar-toggle { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; }
.sidebar-toggle:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.sidebar-toggle .ic { width: 18px; height: 18px; }
.sidebar-toggle .ic-expand { display: none; }
.site-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 12px; scrollbar-width: thin; }
.nav-group { padding: 10px 0 2px; }
.nav-group + .nav-group { margin-top: 2px; }
.nav-group-label { display: block; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 4px 12px 7px; white-space: nowrap; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.site-nav li { margin: 0; }
.nav-item, .util-link { position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 10px 0 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--t-nav); border: 1px solid transparent; white-space: nowrap; }
.nav-item:hover, .util-link:hover { background: var(--surface-3); color: var(--ink); }
.nav-item .nav-icon, .util-link .nav-icon { width: 20px; height: 20px; flex: 0 0 20px; color: var(--faint); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item[data-hue] .nav-icon { color: var(--nav-hue); }
.nav-item[data-hue="cyan"] { --nav-hue: var(--cyan); --nav-hue-vivid: var(--cyan-vivid); --nav-hue-soft: var(--cyan-soft); }
.nav-item[data-hue="azure"] { --nav-hue: var(--azure); --nav-hue-vivid: var(--azure-vivid); --nav-hue-soft: var(--azure-soft); }
.nav-item[data-hue="violet"] { --nav-hue: var(--violet); --nav-hue-vivid: var(--violet-vivid); --nav-hue-soft: var(--violet-soft); }
.nav-item:hover .nav-icon, .util-link:hover .nav-icon { color: var(--ink-2); }
.nav-item[data-hue]:hover .nav-icon { color: var(--nav-hue); }
.nav-item .nav-label, .util-link .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-kbd { margin-left: auto; font-size: 0.68rem; color: var(--faint); font-family: var(--font-mono); }
.nav-item[aria-current="page"], .util-link[aria-current="page"] { background: var(--surface-3); color: var(--ink); font-weight: 650; }
.nav-item[aria-current="page"] .nav-icon, .util-link[aria-current="page"] .nav-icon { color: var(--ink); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 2px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--ink); }
.nav-item[data-hue][aria-current="page"] { background: var(--nav-hue-soft); color: var(--nav-hue); }
.nav-item[data-hue][aria-current="page"] .nav-icon { color: var(--nav-hue); }
.nav-item[data-hue][aria-current="page"]::before { background: var(--nav-hue-vivid); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px 10px 12px; display: grid; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.util-link { min-height: 36px; font-size: 0.875rem; color: var(--muted); }
.sidebar-foot .status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 10px; background: transparent; border: 1px solid color-mix(in srgb, var(--amber-vivid) 45%, var(--line)); color: var(--amber); font-weight: 600; font-size: 0.72rem; line-height: 1.25; margin: 2px 2px 0; white-space: nowrap; max-width: 100%; }
.sidebar-foot .status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber-vivid); flex: 0 0 7px; }
.sidebar-close { display: none; }
.rail-tip { position: fixed; z-index: 90; background: var(--ink); color: var(--bg); padding: 5px 9px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-2); }
.rail-tip[hidden] { display: none; }

/* collapsed rail (desktop only) */
@media (min-width: 1024px) {
  :root[data-sidebar="collapsed"] .sidebar { width: var(--rail-w); }
  :root[data-sidebar="collapsed"] .app-main { margin-left: var(--rail-w); }
  :root[data-sidebar="collapsed"] .sidebar-head { flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 6px; }
  :root[data-sidebar="collapsed"] .brand-text, :root[data-sidebar="collapsed"] .nav-group-label, :root[data-sidebar="collapsed"] .nav-label, :root[data-sidebar="collapsed"] .nav-kbd, :root[data-sidebar="collapsed"] .status-pill .pill-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  :root[data-sidebar="collapsed"] .site-nav { padding: 4px 8px 10px; }
  :root[data-sidebar="collapsed"] .nav-group { padding-top: 6px; }
  :root[data-sidebar="collapsed"] .nav-group + .nav-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
  :root[data-sidebar="collapsed"] .nav-item, :root[data-sidebar="collapsed"] .util-link { justify-content: center; padding: 0; width: 44px; height: 40px; margin: 0 auto; }
  :root[data-sidebar="collapsed"] .nav-item[aria-current="page"]::before { left: -6px; }
  :root[data-sidebar="collapsed"] .sidebar-toggle .ic-collapse { display: none; }
  :root[data-sidebar="collapsed"] .sidebar-toggle .ic-expand { display: block; }
  :root[data-sidebar="collapsed"] .sidebar-foot { padding: 10px 6px; justify-items: center; }
  :root[data-sidebar="collapsed"] .status-pill { padding: 6px; margin: 0; }
}

/* drawer (tablet portrait and phones) */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 55; }
.sidebar-backdrop[hidden] { display: none !important; }
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-104%); width: min(300px, 86vw); box-shadow: none; }
  .app-main { margin-left: 0; }
  :root[data-drawer="open"] .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .sidebar-toggle { display: none; }
  .sidebar-close { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
  body.drawer-lock { overflow: hidden; }
}
@media (min-width: 1024px) { .sidebar-backdrop { display: none !important; } }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 40; min-height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 14px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .topbar { padding: 0 24px; gap: 10px; } }
@media (min-width: 1280px) { .topbar { padding: 0 32px; } }
.tb-menu { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; flex: 0 0 38px; }
.tb-menu:hover { background: var(--surface-2); }
@media (min-width: 1024px) { .tb-menu { display: none; } }
.tb-crumbs { min-width: 0; flex: 1 1 auto; }
.tb-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 7px; font-size: 0.9rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tb-crumbs li { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-crumbs li + li::before { content: "/"; margin-right: 7px; color: var(--line-strong); }
.tb-crumbs a { color: var(--muted); text-decoration: none; }
.tb-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.tb-crumbs [aria-current="page"] { color: var(--ink); font-weight: 650; font-size: 0.95rem; }
@media (max-width: 599px) { .tb-crumbs li:not(:last-child) { display: none; } .tb-crumbs li + li::before { content: none; } }
.tb-brand { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
@media (max-width: 1279px) { .tb-brand { display: none; } }
.tb-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.tb-btn { height: 36px; min-width: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.875rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tb-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.tb-btn .ic { width: 17px; height: 17px; }
.tb-btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }
.tb-btn.present { color: var(--ink); }
.tb-btn[data-copied="1"] { background: var(--emerald-soft); border-color: var(--emerald-ui); color: var(--emerald); }
.tb-btn .ic-sun { display: none; }
.tb-btn[data-current="dark"] .ic-sun { display: block; }
.tb-btn[data-current="dark"] .ic-moon { display: none; }
@media (max-width: 899px) { .tb-btn .lbl { display: none; } .tb-btn { padding: 0 8px; } }
.tb-btn.uz { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.02em; }
.tb-btn.uz[aria-pressed="true"] { background: var(--emerald-soft); border-color: var(--emerald-ui); color: var(--emerald); }

/* page canvas */
.page { flex: 1 1 auto; width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 18px 16px 64px; min-width: 0; }
@media (min-width: 768px) { .page { padding: 22px 24px 72px; } }
@media (min-width: 1280px) { .page { padding: 26px 32px 88px; } }
@media (min-width: 1600px) { .page { padding: 30px 40px 96px; } }
.page.reading { max-width: var(--read-max); }
.page.reading-wide { max-width: var(--wide-max); }
.container { width: 100%; max-width: var(--page-max); margin: 0 auto; }
main { min-width: 0; }

/* ==========================================================================================================
   editorial primitives: page head, kicker, source tags, section heads, figures, numbers, notes, rows
   ========================================================================================================== */
/* page head: kicker · title · one-sentence dek · source tags. Never boxed. */
.masthead { display: grid; gap: 10px; margin: 0 0 26px; max-width: 1180px; }
.masthead h1 { margin: 0; }
.masthead .dek { margin: 0; font-size: var(--t-lead); line-height: 1.5; color: var(--ink-2); max-width: 70ch; }
.masthead .src-tags { margin-top: 4px; }
/* compact head for instrument pages: title and tags on one line, dek below */
.masthead.compact { gap: 6px; margin-bottom: 18px; max-width: none; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .masthead.compact { grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: end; } .masthead.compact .kicker, .masthead.compact h1, .masthead.compact .dek { grid-column: 1; } .masthead.compact .src-tags { grid-column: 2; grid-row: 2 / span 2; align-self: end; justify-content: flex-end; margin: 0; } }
.masthead.compact h1 { font-size: clamp(1.625rem, 1.35rem + 0.55vw, 1.875rem); }
.masthead.compact .dek { font-size: 1rem; color: var(--muted); max-width: 86ch; }
.kicker { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.875rem; font-weight: 600; color: var(--muted); letter-spacing: 0.005em; }
.kicker .mod { display: inline-flex; align-items: center; gap: 7px; color: var(--mod); font-weight: 650; }
.kicker .mod::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--mod-vivid); flex: 0 0 8px; }
.kicker .sep { color: var(--line-strong); }
@media (max-width: 600px) { .kicker .sep { display: none; } .kicker > span:last-child { flex-basis: 100%; } }
.src-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.src-tags li { margin: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 7px; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: transparent; white-space: nowrap; line-height: 1.5; }
.tag.real { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald-vivid) 50%, var(--line)); }
.tag.csv { color: var(--azure); border-color: color-mix(in srgb, var(--azure-vivid) 45%, var(--line)); }
.tag.illus { color: var(--muted); border-style: dashed; }
.tag.plain { text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: 0.75rem; }

/* sections: a hairline, a number, the question the section answers */
.sec { margin: 0; padding: 34px 0 6px; border-top: 1px solid var(--line); }
.sec.flush { border-top: 0; padding-top: 6px; }
.sec + .sec { margin-top: 18px; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 20px; margin: 0 0 18px; align-items: baseline; }
@media (min-width: 900px) { .sec-head { grid-template-columns: 56px minmax(0, 1fr) auto; } }
.sec-num { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600; color: var(--faint); letter-spacing: 0.04em; padding-top: 0.35em; }
.sec-head h2 { margin: 0; }
.sec-q { margin: 6px 0 0; color: var(--muted); font-size: 1rem; max-width: 72ch; }
.sec-aside { margin: 0; color: var(--faint); font-size: var(--t-meta); align-self: end; justify-self: end; text-align: right; max-width: 42ch; }
@media (max-width: 899px) { .sec-aside { justify-self: start; text-align: left; } }
.sec-body { min-width: 0; }
@media (min-width: 900px) { .sec-body.indent { padding-left: 76px; } }

/* figures: numbered, titled, captioned; the visual dominates */
.fig { min-width: 0; margin: 0; display: grid; gap: 12px; align-content: start; }
.fig.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px; }
@media (min-width: 1280px) { .fig.panel { padding: 20px 24px 18px; } }
.fig-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.fig-no { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--mod, var(--faint)); letter-spacing: 0.04em; white-space: nowrap; }
.fig-title { margin: 0; font-size: var(--t-fig); font-weight: 650; letter-spacing: -0.01em; flex: 1 1 320px; min-width: 0; }
.fig-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.fig-cap { margin: 0; color: var(--muted); font-size: var(--t-meta); line-height: 1.5; max-width: 96ch; }
.fig-cap b { color: var(--ink-2); font-weight: 600; }
.fig-src { display: block; margin-top: 4px; color: var(--faint); font-size: 0.75rem; }
.fig-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .fig-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fig-grid.wide-narrow { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); } }

/* numbers: value · what · against what · source */
.stat-row { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
@media (min-width: 640px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat-row.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { min-width: 0; padding: 16px 20px 14px 0; border-bottom: 1px solid var(--line); --stat-hue: var(--ink); }
@media (min-width: 640px) { .stat-row > .stat { padding-left: 20px; border-left: 1px solid var(--line); } }
@media (min-width: 640px) and (max-width: 1099px) { .stat-row > .stat:nth-child(2n+1) { padding-left: 0; border-left: 0; } }
@media (min-width: 1100px) { .stat-row > .stat:nth-child(3n+1) { padding-left: 0; border-left: 0; } .stat-row.c4 > .stat:nth-child(3n+1) { padding-left: 20px; border-left: 1px solid var(--line); } .stat-row.c4 > .stat:nth-child(4n+1) { padding-left: 0; border-left: 0; } }
.stat.hue-azure, .stat.hue-transfer { --stat-hue: var(--azure); } .stat.hue-cyan, .stat.hue-fgsm { --stat-hue: var(--cyan); } .stat.hue-violet, .stat.hue-cka { --stat-hue: var(--violet); } .stat.hue-indigo { --stat-hue: var(--indigo); } .stat.hue-amber { --stat-hue: var(--amber); } .stat.hue-coral { --stat-hue: var(--coral); } .stat.hue-emerald { --stat-hue: var(--emerald); } .stat.hue-slate { --stat-hue: var(--muted); }
.stat .v { font-size: var(--t-metric); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.02; letter-spacing: -0.03em; font-family: var(--font-display); color: var(--stat-hue); white-space: nowrap; }
.stat .v .u { font-size: 0.55em; font-weight: 600; letter-spacing: 0; margin-left: 0.08em; color: var(--muted); }
.stat .k { font-size: 0.9375rem; color: var(--ink-2); margin-top: 8px; line-height: 1.4; font-weight: 500; }
.stat .frac { font-size: var(--t-meta); color: var(--muted); margin-top: 6px; line-height: 1.45; }
.stat .frac.mono, .stat .src { font-family: var(--font-mono); font-size: 0.75rem; color: var(--faint); }

/* notes (callouts) — only where scientifically useful */
.note { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 16px; margin: 14px 0; color: var(--ink-2); max-width: 80ch; }
.note > :last-child { margin-bottom: 0; }
.note .label, .callout .label { display: block; font-weight: 650; font-size: 0.8125rem; letter-spacing: 0.01em; margin-bottom: 4px; color: var(--muted); }
.note.caveat { border-color: var(--amber-vivid); } .note.caveat .label { color: var(--amber); }
.note.key { border-color: var(--mod-vivid, var(--azure-vivid)); } .note.key .label { color: var(--mod, var(--azure)); }
.note.ok { border-color: var(--emerald-vivid); } .note.ok .label { color: var(--emerald); }
.note.bad { border-color: var(--coral-vivid); } .note.bad .label { color: var(--coral); }
.callout { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 16px; margin: 12px 0; max-width: 80ch; }
.callout > :last-child { margin-bottom: 0; }
.callout.warn { border-color: var(--amber-vivid); } .callout.warn .label { color: var(--amber); }
.callout.honest { border-color: var(--violet-vivid); } .callout.honest .label { color: var(--violet); }
.callout.ok { border-color: var(--emerald-vivid); } .callout.ok .label { color: var(--emerald); }
.callout.bad { border-color: var(--coral-vivid); } .callout.bad .label { color: var(--coral); }
.callout.compact { font-size: 0.9rem; margin: 8px 0; }

/* definition rows: label column + content column separated by hairlines */
dl.rows { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; border-top: 1px solid var(--line); }
dl.rows > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 24px; padding: 12px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) { dl.rows > div { grid-template-columns: minmax(150px, 0.32fr) minmax(0, 1fr); } }
dl.rows dt { color: var(--muted); font-weight: 600; font-size: 0.9375rem; }
dl.rows dd { margin: 0; max-width: 80ch; }
dl.rows.compact > div { padding: 8px 0; }
dl.rows.compact dt { font-size: var(--t-small); }

/* prose blocks */
.prose { font-size: var(--t-read); line-height: 1.65; max-width: 72ch; }
.prose p, .prose li { max-width: 72ch; }
.prose h3 { font-size: 1.125rem; margin: 1.4rem 0 0.4rem; }
.lede, .dek { font-size: var(--t-lead); color: var(--ink-2); line-height: 1.5; }
.split-2 { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .split-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; } .split-2.wide-narrow { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } .split-2.narrow-wide { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); } }
.split-3 { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .split-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .split-3 > * + * { border-left: 1px solid var(--line); } .split-3 > * { padding: 0 24px; } .split-3 > :first-child { padding-left: 0; } .split-3 > :last-child { padding-right: 0; } }
@media (max-width: 979px) { .split-3 > * + * { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; } }
.list-check { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.list-check li { position: relative; padding-left: 26px; margin: 0; }
.list-check li::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--faint); }
.list-check.yes li::before { border-color: var(--emerald-vivid); background: var(--emerald-vivid); }
.list-check.no li::before { border-color: var(--coral-vivid); background: transparent; }
.list-check.plan li::before { border-color: var(--faint); border-style: dashed; }
.list-check.caveat li::before { border-color: var(--amber-vivid); border-radius: 2px; transform: rotate(45deg); }

/* chain: a sequence of steps with numbers and arrows (no boxes) */
.chain { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); counter-reset: chain; }
@media (min-width: 980px) { .chain { grid-template-columns: repeat(var(--chain-cols, 3), minmax(0, 1fr)); } }
.chain > li { margin: 0; position: relative; padding: 18px 26px 18px 0; min-width: 0; max-width: none; }
@media (min-width: 980px) { .chain > li + li { padding-left: 26px; border-left: 1px solid var(--line); } .chain > li:not(:last-child)::after { content: ""; position: absolute; right: -7px; top: 30px; width: 12px; height: 12px; border-top: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong); transform: rotate(45deg); background: var(--bg); } }
@media (max-width: 979px) { .chain > li + li { border-top: 1px solid var(--line); } }
.chain .chain-n { display: block; font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600; color: var(--mod, var(--faint)); margin-bottom: 8px; }
.chain h3 { margin: 0 0 6px; font-size: 1.125rem; }
.chain p { margin: 0 0 10px; color: var(--ink-2); }
.chain .q { color: var(--muted); font-size: 0.9375rem; }
.chain .go { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: var(--mod, var(--ink)); }
.chain .go:hover { text-decoration: underline; }
.chain .go .ic { width: 16px; height: 16px; }

/* drawers: progressive disclosure for depth (tables, derivations, raw data) */
.drawer { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0; }
.drawer + .drawer { border-top: 0; }
.drawer > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 13px 4px; cursor: pointer; min-height: 48px; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.drawer > summary .drawer-t { font-weight: 650; font-size: 1rem; }
.drawer > summary .drawer-s { color: var(--muted); font-size: var(--t-small); flex: 1 1 auto; min-width: 0; }
.drawer > summary .chev { width: 18px; height: 18px; color: var(--faint); margin-left: auto; flex: 0 0 18px; transition: transform 0.18s ease; }
.drawer[open] > summary .chev { transform: rotate(180deg); }
.drawer-body { padding: 4px 4px 20px; min-width: 0; }
.drawer-body > :first-child { margin-top: 0; }
.drawers { display: grid; }
.fig .drawer { border-bottom: 0; margin-top: 2px; }
.fig .drawer > summary { padding: 11px 0; min-height: 44px; }
.fig .drawer > summary .drawer-t { font-size: 0.9375rem; }
.fig .drawer-body { padding: 2px 0 6px; }

/* tabs (enhanced by site.js; without JS every panel is shown in order) */
.tabs { min-width: 0; }
.tablist { display: none; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; margin: 0 0 22px; }
.tabs.is-ready .tablist { display: flex; }
.tab { appearance: none; border: 0; background: transparent; padding: 11px 14px 12px; font-weight: 600; font-size: 0.9375rem; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--mod-vivid, var(--ink)); }
.tab .tab-n { font-family: var(--font-mono); font-size: 0.75rem; color: var(--faint); font-weight: 500; }
.tab:focus-visible { outline-offset: -3px; }
.tabpanel { min-width: 0; }
.tabs:not(.is-ready) .tabpanel + .tabpanel { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.tabpanel > h2:first-child, .tabpanel > .panel-h:first-child { margin-top: 0; }
.panel-h { font-size: 1.25rem; margin: 0 0 6px; }
.panel-q { margin: 0 0 18px; color: var(--muted); max-width: 80ch; }

/* toolbar: horizontal parameter controls above a figure */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; padding: 0 0 16px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tool { display: grid; gap: 6px; min-width: 0; }
.tool-l { font-size: var(--t-meta); font-weight: 600; color: var(--muted); }
.tool .hint { max-width: 34ch; }
.toolbar .tool.grow { flex: 1 1 260px; }
.toolbar select { min-width: 220px; }

/* ==========================================================================================================
   buttons, badges, forms
   ========================================================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 40px; padding: 0.5rem 1rem; border-radius: var(--radius-btn); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; font-size: 0.9375rem; line-height: 1.2; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-2); }
.btn.primary { background: var(--btn-primary); color: var(--btn-primary-ink); border-color: var(--btn-primary); }
.btn.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn.big { min-height: 46px; padding: 0.6rem 1.25rem; font-size: 1rem; }
.btn.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet-vivid) 50%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.link { border-color: transparent; padding-left: 4px; padding-right: 4px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.btn.link:hover { background: transparent; text-decoration-color: currentColor; }
.btn.small { min-height: 34px; padding: 0.3rem 0.7rem; font-size: 0.875rem; }
.btn.icon { padding: 0.25rem 0.55rem; }
.btn .ic { width: 17px; height: 17px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--ink-2); color: var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.icon-btn { min-width: 36px; min-height: 36px; padding: 0.3rem 0.6rem; border-radius: 9px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--line-strong); }
.badge { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.14rem 0.62rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.005em; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; line-height: 1.4; }
.badge.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--emerald-vivid) 50%, transparent); color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--amber-vivid) 55%, transparent); color: var(--warn); }
.badge.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--coral-vivid) 50%, transparent); color: var(--bad); }
.badge.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--azure-vivid) 50%, transparent); color: var(--azure); }
.badge.purple, .badge.violet { background: var(--purple-soft); border-color: color-mix(in srgb, var(--violet-vivid) 50%, transparent); color: var(--purple); }
.badge.indigo { background: var(--indigo-soft); border-color: color-mix(in srgb, var(--indigo-vivid) 50%, transparent); color: var(--indigo); }
.badge.cyan { background: var(--cyan-soft); border-color: color-mix(in srgb, var(--cyan-vivid) 50%, transparent); color: var(--cyan); }
.badge.mode { font-family: var(--font-mono); text-transform: uppercase; font-size: 0.6875rem; letter-spacing: 0.04em; background: transparent; border-radius: 6px; }
.badge.wrap, .badge.status { white-space: normal; text-align: left; }
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.status-chips li { margin: 0; }
.status-chips .badge { background: transparent; font-weight: 500; color: var(--muted); }
.status-chips .badge.warn { color: var(--amber); }
@media (max-width: 600px) { .badge { white-space: normal; text-align: left; } }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0; }
.chips li { border: 1px solid var(--line); border-radius: 8px; padding: 0.28rem 0.55rem; font-size: 0.875rem; background: transparent; margin: 0; white-space: normal; line-height: 1.35; }
.chips li b { font-weight: 650; }
.note-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--t-meta); color: var(--muted); align-items: center; }
.cluster { display: flex; flex-wrap: wrap; gap: 0.5rem 0.65rem; align-items: center; min-width: 0; }
.cluster > * { max-width: 100%; }
.split { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 1.2rem; align-items: baseline; }
.flow > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid > * { min-width: 0; }

/* forms */
.controls { display: grid; gap: 0.8rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; font-size: var(--t-meta); color: var(--muted); }
label { font-weight: 500; }
.field { display: grid; gap: 0.4rem; margin-bottom: 0.7rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .field-label { font-size: var(--t-meta); color: var(--muted); font-weight: 600; }
.field .hint, .hint { font-size: var(--t-meta); color: var(--muted); margin: 0.25rem 0 0; line-height: 1.45; }
select, input[type="number"], input[type="text"] { min-height: 38px; border: 1px solid var(--control-border); border-radius: 9px; padding: 0.3rem 0.6rem; background: var(--surface); color: var(--ink); width: 100%; max-width: 100%; font-size: 0.9375rem; }
select:disabled, input:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }
.radio-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.radio-row label { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line); border-radius: 9px; padding: 0.35rem 0.65rem; min-height: 36px; cursor: pointer; background: transparent; font-size: 0.875rem; }
.radio-row label:has(input:checked) { border-color: var(--ink-2); background: var(--surface-3); font-weight: 620; }
.radio-row label:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.radio-row input { margin: 0; width: 1rem; height: 1rem; }
/* segmented control: radios hidden, labels become the control (keyboard arrows still move the native radio) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: transparent; min-width: 0; }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
.seg label { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; padding: 0 10px; cursor: pointer; font-size: 0.875rem; font-weight: 600; position: relative; color: var(--muted); border-left: 1px solid var(--line); text-align: center; line-height: 1.15; white-space: nowrap; }
.seg label:hover { color: var(--ink); background: var(--surface-2); }
.seg label:first-child { border-left: 0; }
.seg.wrap label:nth-child(2n+1) { border-left: 0; }
.seg.wrap label:nth-child(n+3) { border-top: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--bg); z-index: 1; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -4px; z-index: 2; }
.seg label:has(input:checked):has(input:focus-visible) { outline-color: var(--bg); }
.seg label:has(input:disabled) { opacity: 0.38; cursor: not-allowed; }
.seg .sub { display: block; font-size: 0.7rem; font-weight: 500; opacity: 0.75; }
.seg label:has(input:checked) .sub { opacity: 0.8; }
.pair-arrow { display: grid; place-items: center; color: var(--faint); font-size: 1.1rem; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; }
.range-row input[type="number"] { width: 5.6rem; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; --fill: 33%; --range-hue: var(--mod-ui, var(--cyan-ui)); }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--range-hue) var(--fill), var(--line-strong) var(--fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--range-hue); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--range-hue); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); margin-top: -8px; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--range-hue); cursor: pointer; }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.ticks { position: relative; display: block; height: 1.15rem; margin: -6px 10px 0; font-size: 0.75rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ticks span:nth-child(1) { left: 0; } .ticks span:nth-child(2) { left: 33.333%; } .ticks span:nth-child(3) { left: 66.667%; } .ticks span:nth-child(4) { left: 100%; }
.status-line { font-size: var(--t-meta); color: var(--muted); min-height: 1.3em; margin: 0; }
.status-line.busy::before { content: "⋯ "; }
.status-line.ok::before { content: "✓ "; color: var(--emerald); }
.status-line.error { color: var(--bad); }
.toggle { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 32px; cursor: pointer; font-size: 0.875rem; color: var(--ink-2); }
.toggle input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--ink); }
.pos-stepper { display: inline-grid; grid-template-columns: auto 1fr auto; gap: 4px; align-items: center; }
.pos-stepper input[type="number"] { text-align: center; min-width: 5.2rem; font-variant-numeric: tabular-nums; }

/* ==========================================================================================================
   the FGSM workbench: one instrument — controls rail | specimen stage (verdict · images · readout · predictions)
   ========================================================================================================== */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; --mod: var(--c-fgsm); --mod-vivid: var(--c-fgsm-vivid); --mod-ui: var(--c-fgsm-ui); --mod-soft: var(--c-fgsm-soft); }
@media (min-width: 1024px) { .workbench { grid-template-columns: 272px minmax(0, 1fr); } }
@media (min-width: 1440px) { .workbench { grid-template-columns: 296px minmax(0, 1fr); } }
.wb-controls { padding: 16px 18px 14px; display: grid; gap: 0; align-content: start; min-width: 0; border-bottom: 1px solid var(--line); }
@media (min-width: 1024px) { .wb-controls { border-bottom: 0; border-right: 1px solid var(--line); } }
.wb-results { padding: 16px 18px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1280px) { .wb-results { padding: 18px 24px 20px; } }
/* the controls rail stays in view while the stage and the analysis tabs below it scroll */
@media (min-width: 1024px) { .wb-controls { position: sticky; top: calc(var(--topbar-h) + 8px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 16px); overflow-y: auto; scrollbar-width: thin; border-right: 0; } .wb-results { border-left: 1px solid var(--line); } #lab[data-mode="compact"] .wb-controls { position: static; max-height: none; overflow: visible; } }
.wb-results > *, .wb-controls > * { min-width: 0; }
.ctl { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; min-width: 0; }
.ctl:first-of-type { border-top: 0; padding-top: 2px; }
.ctl-h { margin: 0; font-size: 0.875rem; font-weight: 650; color: var(--ink); letter-spacing: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ctl-h .aside { font-size: 0.75rem; font-weight: 500; color: var(--faint); }
.ctl .field-label, .ctl .sub-l { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
.ctl .hint { font-size: 0.78rem; }
.ctl .cluster { gap: 6px; }
.ctl-more { border-top: 1px solid var(--line); }
.ctl-more > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 0.875rem; font-weight: 650; }
.ctl-more > summary::-webkit-details-marker { display: none; }
.ctl-more > summary .aside { font-weight: 500; color: var(--faint); font-size: 0.75rem; }
.ctl-more > summary .chev { width: 16px; height: 16px; color: var(--faint); margin-left: auto; transition: transform 0.18s ease; }
.ctl-more[open] > summary .chev { transform: rotate(180deg); }
.ctl-more > .ctl { border-top: 0; padding-top: 0; }
.ctl-foot { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.wb-controls .btn.small { min-height: 32px; }
.wb-controls .seg label { min-height: 34px; padding: 0 6px; font-size: 0.8125rem; }
@media (min-width: 1440px) { .wb-controls .seg.wrap { grid-auto-flow: column; grid-template-columns: none; } .wb-controls .seg.wrap label { border-top: 0; border-left: 1px solid var(--line); } .wb-controls .seg.wrap label:first-child { border-left: 0; } }
/* phones/tablets: one column in reading order of the experiment — verdict, images, the ε slider, predictions, the rest */
@media (max-width: 1023px) {
  .workbench { display: flex; flex-direction: column; gap: 14px; padding: 14px 14px 16px; }
  .wb-controls, .wb-results { display: contents; }
  .workbench .verdict { order: 1; } .workbench .trio { order: 2; } .workbench .ctl-eps { order: 3; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .workbench .pred-grid { order: 4; } .workbench .wb-readout { order: 5; } .workbench .ctl-pair { order: 6; } .workbench .ctl-sample { order: 7; }
  .workbench .ctl-more { order: 8; } .workbench .ctl-foot { order: 9; } .workbench .drawer { order: 10; } .workbench .lang-uz { order: 11; } .workbench #url-warning { order: 0; }
  .workbench .ctl { border-top: 1px solid var(--line); }
}

/* ε control */
.eps-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 6px; align-items: center; }
.eps-control > * { grid-column: 1 / -1; min-width: 0; }
.eps-control > .field-label { grid-row: 1; padding-right: 5.4rem; line-height: 1.35; }
.eps-row { display: contents; }
.eps-row > input[type="number"] { grid-row: 1; grid-column: 1 / -1; justify-self: end; align-self: center; }
.eps-row > .btn.icon:first-child { grid-row: 2; grid-column: 1; }
.eps-row > input[type="range"] { grid-row: 2; grid-column: 2; }
.eps-row > .btn.icon:nth-of-type(2) { grid-row: 2; grid-column: 3; }
.eps-control > .ticks { grid-row: 3; grid-column: 2; }
.eps-row .btn.icon { min-height: 32px; min-width: 32px; padding: 0; border-radius: 8px; }
.eps-row input[type="number"] { width: 4.6rem; min-height: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; }
.eps-readout { font-size: 1.25rem; font-weight: 700; color: var(--mod); font-variant-numeric: tabular-nums; }
.eps-presets { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.eps-presets .lbl { font-size: 0.75rem; color: var(--faint); margin-right: 2px; }
.eps-preset { font-variant-numeric: tabular-nums; font-size: 0.8125rem; padding: 0 9px; min-height: 28px; border-radius: 7px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.eps-preset:hover { border-color: var(--mod-ui); }
.eps-preset[aria-pressed="true"] { background: var(--mod); border-color: var(--mod); color: var(--bg); font-weight: 650; }
.eps-preset[aria-pressed="true"][data-csv="1"]::after { color: inherit; border-color: currentColor; }
.eps-preset[data-csv="1"]::after { content: "CSV"; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em; color: var(--emerald); border: 1px solid color-mix(in srgb, var(--emerald-vivid) 45%, transparent); border-radius: 3px; padding: 0 2px; line-height: 1.3; }
.curated { display: flex; flex-wrap: wrap; gap: 4px; }
.curated .btn.small { min-height: 28px; padding: 0 8px; font-variant-numeric: tabular-nums; font-size: 0.8125rem; font-weight: 500; border-radius: 7px; }
.curated .btn[aria-pressed="true"] { background: var(--mod); border-color: var(--mod); color: var(--bg); font-weight: 650; }
.curated p { flex-basis: 100%; }

/* verdict line: the outcome of the current specimen, stated first */
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.verdict .outcome-text { flex: 1 1 340px; margin: 0; font-size: 1.0625rem; line-height: 1.45; color: var(--ink); max-width: 80ch; }
.true-label { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line-strong); padding: 0.22rem 0.6rem; border-radius: 8px; font-size: 0.875rem; color: var(--muted); white-space: normal; }
.true-label b { font-size: 1.125rem; font-family: var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.outcome { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 8px; padding: 0.26rem 0.7rem; font-weight: 650; font-size: 0.875rem; border: 1px solid var(--line); line-height: 1.3; white-space: normal; }
.outcome.both { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--coral-vivid) 50%, transparent); }
.outcome.source { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--amber-vivid) 50%, transparent); }
.outcome.target { background: var(--purple-soft); color: var(--purple); border-color: color-mix(in srgb, var(--violet-vivid) 50%, transparent); }
.outcome.neither { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--emerald-vivid) 50%, transparent); }
.outcome.notj { background: var(--neutral-soft); color: var(--muted); }

/* specimen trio: large pixel-exact images on a neutral ground */
.trio { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
@media (min-width: 1280px) { .trio { gap: 18px; } }
@media (max-width: 420px) { .trio { gap: 8px; } }
.pixel-panel { margin: 0; display: grid; gap: 7px; justify-items: start; align-content: start; min-width: 0; background: transparent; border: 0; padding: 0; }
.pixel-panel h3, .pixel-panel h4 { margin: 0; font-size: 0.875rem; font-weight: 650; display: flex; align-items: center; gap: 7px; color: var(--ink); line-height: 1.25; }
.pixel-panel h3::before, .pixel-panel h4::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--line-strong); flex: 0 0 9px; }
.pixel-panel.clean h4::before, .pixel-panel.clean h3::before { background: var(--ink-2); }
.pixel-panel.adv h4::before, .pixel-panel.adv h3::before { background: var(--coral-vivid); }
.pixel-panel.delta h4::before, .pixel-panel.delta h3::before { background: var(--c-fgsm-vivid); }
.pixel-panel.noise h4::before, .pixel-panel.noise h3::before { background: var(--line-strong); }
.pixel-panel.manual h4::before, .pixel-panel.manual h3::before { background: var(--violet-vivid); }
.pixel-panel canvas { display: block; width: min(100%, 25vh); min-width: min(100%, 132px); max-width: 320px; aspect-ratio: 1; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; border: 1px solid var(--line-strong); border-radius: 8px; background: #000; touch-action: pinch-zoom; cursor: crosshair; }
.pixel-panel .caption { font-size: 0.8125rem; color: var(--muted); max-width: 100%; line-height: 1.35; margin: 0; }
.pixel-panel .pill { font-size: 0.72rem; }
.gray-legend { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.gray-legend .ramp { width: 84px; height: 7px; border: 1px solid var(--line-strong); background: linear-gradient(90deg, #000, #fff); border-radius: 2px; }
.colorbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.45rem; width: 100%; max-width: 220px; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.colorbar .ramp { height: 8px; border-radius: 2px; border: 1px solid var(--line-strong); background: linear-gradient(90deg, var(--delta-neg), var(--delta-zero) 50%, var(--delta-pos)); }
.delta-legend { font-size: 0.8125rem; color: var(--muted); display: grid; gap: 0.15rem; }
.swatch { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 3px; border: 1px solid var(--line-strong); vertical-align: -0.1em; margin-right: 0.25em; }
.swatch.pos { background: var(--delta-pos); } .swatch.neg { background: var(--delta-neg); } .swatch.zero { background: var(--delta-zero); }
.wb-readout { display: grid; gap: 8px; }
.delta-stats { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.45; max-width: none; }
.hover-row { display: flex; gap: 8px; align-items: center; }
.hover-row .pix-hover { flex: 1 1 auto; min-width: 0; }
.pix-hover { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-height: 2.2em; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 0; max-width: none; }
.pix-hover .k { color: var(--faint); }
.pix-hover .pos { color: var(--delta-pos); font-weight: 700; } .pix-hover .neg { color: var(--delta-neg); font-weight: 700; }

/* predictions: source (where the gradient is taken) and target (which only sees the finished image) */
.pred-grid { display: grid; gap: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
@media (max-width: 520px) { .pred-grid { grid-template-columns: minmax(0, 1fr); } .pred-card + .pred-card { border-top: 1px solid var(--line); } }
.pred-card { padding: 12px 18px 2px 0; display: grid; gap: 4px; min-width: 0; margin: 0; background: transparent; border: 0; }
@media (min-width: 521px) { .pred-card + .pred-card { padding-left: 20px; border-left: 1px solid var(--line); } }
.pred-card header { display: flex; justify-content: flex-start; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.pred-card h3, .pred-card h4 { margin: 0; font-size: 1.0625rem; font-weight: 650; }
.pred-card .role { font-size: 0.8125rem; font-weight: 650; color: var(--muted); }
.pred-card.source .role { color: var(--c-fgsm); } .pred-card.target .role { color: var(--c-tr); }
.pred-card .small.muted { font-size: 0.78rem; }
.pred-pair { display: grid; grid-template-columns: auto auto auto; justify-content: start; align-items: end; gap: 0.3rem 1.1rem; }
.pred-value { text-align: left; min-width: 3.6rem; }
.pred-value .lab { font-size: 0.75rem; color: var(--faint); font-weight: 600; }
.pred-value .digit { font-size: clamp(2.25rem, 1.9rem + 0.9vw, 3rem); font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; font-family: var(--font-display); letter-spacing: -0.03em; }
.pred-value .digit[data-state="fooled"] { color: var(--coral); }
.pred-value .digit[data-state="held"] { color: var(--emerald); }
.pred-value .digit[data-state="wrong-clean"] { color: var(--amber); }
.pred-value .score { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 3px; }
.pred-arrow { font-size: 1.3rem; color: var(--faint); padding-bottom: 1.2rem; }
.pred-card .cluster { gap: 0.3rem 0.6rem; }
.pred-card .mono { font-size: 0.72rem; color: var(--faint); }

/* home: compact instrument — controls | images | predictions */
#lab[data-mode="compact"] .wb-controls .ctl { padding: 12px 0; }
@media (min-width: 1280px) {
  #lab[data-mode="compact"] .wb-results { grid-template-columns: minmax(0, 1fr) 232px; grid-template-areas: "verdict verdict" "trio preds" "readout preds"; column-gap: 22px; row-gap: 14px; }
  #lab[data-mode="compact"] .verdict { grid-area: verdict; }
  #lab[data-mode="compact"] .trio { grid-area: trio; }
  #lab[data-mode="compact"] .wb-readout { grid-area: readout; }
  #lab[data-mode="compact"] .pred-grid { grid-area: preds; grid-template-columns: minmax(0, 1fr); border-top: 0; border-left: 1px solid var(--line); padding-left: 20px; align-content: start; }
  #lab[data-mode="compact"] .pred-card { padding: 0 0 14px; }
  #lab[data-mode="compact"] .pred-card + .pred-card { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  #lab[data-mode="compact"] .wb-results > .full { grid-column: 1 / -1; }
}
/* full lab on very wide screens: predictions beside the images */
@media (min-width: 1700px) {
  #lab[data-mode="full"] .wb-results { grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "verdict verdict" "trio preds" "readout preds"; column-gap: 28px; }
  #lab[data-mode="full"] .verdict { grid-area: verdict; }
  #lab[data-mode="full"] .trio { grid-area: trio; }
  #lab[data-mode="full"] .wb-readout { grid-area: readout; }
  #lab[data-mode="full"] .pred-grid { grid-area: preds; grid-template-columns: minmax(0, 1fr); border-top: 0; border-left: 1px solid var(--line); padding-left: 24px; align-content: start; }
  #lab[data-mode="full"] .pred-card { padding: 0 0 16px; }
  #lab[data-mode="full"] .pred-card + .pred-card { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  #lab[data-mode="full"] .wb-results > .full { grid-column: 1 / -1; }
}

/* below the workbench: deeper analysis in tabs */
.advanced { margin-top: 34px; }
.advanced .sec-head { margin-bottom: 8px; }
.pop-grid { display: grid; gap: 24px 40px; grid-template-columns: minmax(0, 1fr); align-items: start; margin-top: 22px; }
@media (min-width: 1100px) { .pop-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); } }
.two-col { display: grid; gap: 24px 40px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.two-col.narrow-wide { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .two-col.narrow-wide { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }
.digit-inline { font-weight: 650; font-size: 1.25rem; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.json-box { max-height: 440px; }
.sample-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: var(--surface); }
.sample-btn { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); padding: 3px; display: grid; gap: 2px; justify-items: center; cursor: pointer; min-height: 44px; }
.sample-btn canvas { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 3px; }
.sample-btn .meta { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sample-btn[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
.sample-btn.curated { border-color: var(--c-fgsm-ui); }
.sample-btn.cat-both { box-shadow: inset 0 -3px 0 var(--coral-vivid); } .sample-btn.cat-source { box-shadow: inset 0 -3px 0 var(--amber-ui); } .sample-btn.cat-target { box-shadow: inset 0 -3px 0 var(--violet-vivid); } .sample-btn.cat-neither { box-shadow: inset 0 -3px 0 var(--emerald-ui); }
.outcome-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.outcome-counts button { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: transparent; padding: 0.55rem 0.75rem; cursor: pointer; min-height: 48px; --oc-hue: var(--ink); }
.outcome-counts button:hover { background: var(--surface-2); }
.outcome-counts button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
.outcome-counts button.both { --oc-hue: var(--coral); } .outcome-counts button.source { --oc-hue: var(--amber); } .outcome-counts button.target { --oc-hue: var(--violet); } .outcome-counts button.neither { --oc-hue: var(--emerald); }
.outcome-counts .c { font-weight: 650; font-size: 1.5rem; font-variant-numeric: tabular-nums; font-family: var(--font-display); color: var(--oc-hue); }
.outcome-counts .n { font-size: 0.8125rem; color: var(--muted); display: block; line-height: 1.3; }
.outcome-counts p { grid-column: 1 / -1; margin: 0; }
.pixel-table { font-family: var(--font-mono); font-size: 0.74rem; border-collapse: collapse; }
.pixel-table td { border: 1px solid var(--line); min-width: 2.3em; text-align: center; padding: 0.15rem; }
.pixel-table td.sel { outline: 2px solid var(--focus); }
.pix-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-width: 340px; }
.pix-grid button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2); cursor: pointer; padding: 0; font-size: 0.72rem; font-family: var(--font-mono); min-height: 32px; }
.pix-grid button[aria-pressed="true"] { outline: 2px solid var(--focus); outline-offset: -2px; }
.pix.manual-pos { outline: 3px solid var(--delta-pos); outline-offset: -3px; }
.pix.manual-neg { outline: 3px solid var(--delta-neg); outline-offset: -3px; }
#manual-badge { white-space: normal; text-align: left; line-height: 1.35; display: inline-block; max-width: 100%; }
.formula { font-family: var(--font-display); font-size: 1.125rem; background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 1rem; overflow-x: auto; margin: 0.7rem 0; line-height: 1.7; }
.formula .op { padding: 0 0.15em; }
.symbol-list dt { font-family: var(--font-display); font-style: italic; }

/* ==========================================================================================================
   matrices, charts, tables
   ========================================================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; font-size: var(--t-table); }
table.data th, table.data td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
table.data th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; font-size: 0.8125rem; color: var(--muted); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num { font-feature-settings: "tnum"; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.data caption { text-align: left; padding: 0.6rem 0.75rem; color: var(--muted); font-size: var(--t-meta); caption-side: top; }
table.tech { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
table.tech th, table.tech td { padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tech th { font-size: 0.8125rem; color: var(--muted); font-weight: 600; border-bottom-color: var(--line-strong); }
table.tech td.num { text-align: right; font-variant-numeric: tabular-nums; }
.na { color: var(--muted); font-style: italic; }
.heatmap { display: grid; gap: 6px; grid-template-columns: auto repeat(4, minmax(72px, 1fr)); align-items: stretch; max-width: 720px; overflow-x: auto; padding: 2px 2px 4px; }
.heatmap .corner { font-size: 0.75rem; color: var(--muted); align-self: end; padding: 0.2rem 0.4rem 0.4rem 0; line-height: 1.25; }
.heatmap .hlabel { font-size: 0.875rem; font-weight: 650; display: grid; place-items: end center; text-align: center; padding: 0.3rem 0.1rem 0.45rem; color: var(--ink-2); white-space: nowrap; }
.heatmap .vlabel { font-size: 0.875rem; font-weight: 650; display: grid; align-items: center; padding: 0.3rem 0.7rem 0.3rem 0; text-align: right; color: var(--ink-2); white-space: nowrap; }
.heatmap .cell { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; align-content: center; gap: 0.1rem; cursor: pointer; padding: 0.35rem 0.2rem; font-variant-numeric: tabular-nums; }
.heatmap .cell:hover { border-color: var(--ink-2); }
.heatmap .cell .v { font-weight: 650; font-size: 1.125rem; font-family: var(--font-display); white-space: nowrap; letter-spacing: -0.01em; }
.heatmap .cell .frac { font-size: 0.75rem; opacity: 0.92; }
.heatmap .cell .frac .s { display: none; }
.heatmap .cell.diag { background: repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-2) 6px, var(--surface-2) 12px); color: var(--muted); cursor: default; }
.heatmap .cell[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; position: relative; z-index: 1; }
.heatmap .cell.dark { color: #fff; }
.heatmap .cell.mirror { outline: 2px dashed var(--ink-2); outline-offset: 1px; }
@media (min-width: 1280px) { .heatmap { grid-template-columns: auto repeat(4, minmax(88px, 1fr)); } .heatmap .cell { min-height: 82px; } .heatmap .cell .v { font-size: 1.3rem; } }
.heatmap.big { display: block; max-width: 980px; }
.heatmap.big .hrow { display: grid; grid-template-columns: 112px repeat(4, minmax(72px, 1fr)); gap: 6px; margin-bottom: 6px; }
.heatmap.big .cell { cursor: default; min-height: 80px; }
.heatmap.big .cell .v { font-size: 1.4rem; }
.heatmap.big .cell .frac { font-size: 0.8125rem; }
.heatmap.big .hlabel, .heatmap.big .vlabel { font-size: 0.9375rem; }
@media (max-width: 600px) { .heatmap.big .hrow { grid-template-columns: 74px repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; } .heatmap.big .corner { font-size: 0.6875rem; } .heatmap.big .cell { min-height: 60px; } .heatmap.big .cell .v { font-size: 1.02rem; } }
.axis-note { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--t-meta); color: var(--muted); margin: 0 0 6px; }
.axis-note b { color: var(--ink-2); font-weight: 650; }
.heat-scale { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; max-width: 320px; font-size: 0.75rem; margin-top: 0.4rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.heat-scale .ramp { position: relative; height: 8px; border: 1px solid var(--line-strong); border-radius: 2px; background: linear-gradient(90deg, #eff6ff, #a9cbfb, #5a8ce8); }
.heat-scale .ramp .range { position: absolute; top: -5px; bottom: -5px; border: 2px solid var(--ink); border-radius: 3px; min-width: 4px; box-sizing: border-box; }
.heat-scale .range-note { grid-column: 1 / -1; color: var(--muted); }
.heat-scale.cka .ramp { background: linear-gradient(90deg, #f5f3ff, #c4b5fd, #5b21b6); }
:root[data-theme="dark"] .heat-scale .ramp { background: linear-gradient(90deg, #15181e, #1e3a8a, #2563eb); }
:root[data-theme="dark"] .heat-scale.cka .ramp { background: linear-gradient(90deg, #15181e, #4c1d95, #7c3aed); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .heat-scale .ramp { background: linear-gradient(90deg, #15181e, #1e3a8a, #2563eb); } :root:not([data-theme="light"]) .heat-scale.cka .ramp { background: linear-gradient(90deg, #15181e, #4c1d95, #7c3aed); } }
.matrix-layout { display: grid; gap: 24px 32px; grid-template-columns: minmax(0, 1fr); align-items: start; }
/* CKA: the matrix with the selected pair below it, the scatter beside both */
@media (min-width: 1180px) { .matrix-layout.cka { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); } }
.fig .cell-detail { border-left: 0; padding-left: 0; position: static; border-top: 1px solid var(--line); padding-top: 14px; }
.matrix-layout.cka .heatmap .cell { min-height: 66px; }
.fig-toolbar { margin: 0; padding: 0 0 8px; border-bottom: 0; gap: 10px 16px; }
.lab-page .sec { margin-top: 44px; }
.lab-page .sec + .sec { margin-top: 18px; }
@media (min-width: 1180px) { .matrix-layout { grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr); } }
.cell-detail { margin: 0; min-width: 0; padding: 0 0 0 0; }
@media (min-width: 1180px) { .cell-detail { border-left: 1px solid var(--line); padding-left: 28px; position: sticky; top: calc(var(--topbar-h) + 20px); } }
.cell-detail h3 { margin-top: 0; font-size: 1.125rem; }
.cell-detail .kv { font-size: 0.8125rem; grid-template-columns: fit-content(40%) minmax(0, 1fr); gap: 6px 14px; line-height: 1.45; }
.cell-detail .kv dt { font-size: 0.8125rem; }
.chart { width: 100%; height: auto; display: block; background: transparent; border: 0; border-radius: 0; overflow: visible; }
/* charts are drawn at their on-page width (charts.js), so these sizes are the sizes on screen */
.chart text { font-family: var(--font-sans); fill: var(--ink); font-size: 13px; }
.chart .ttl { font-weight: 650; }
.chart .lbl { font-size: 12px; fill: var(--muted); }
.chart .lbl.val { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .axis line, .chart .axis path { stroke: var(--control-border); }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .seg-line { stroke: var(--muted); stroke-width: 1.5; }
.chart .pt { cursor: pointer; }
.chart .pt:focus { outline: none; }
.chart .pt:focus > rect, .chart .pt:hover > rect, .chart .pt:focus > circle:not(.hit):not(.mark), .chart .pt:hover > circle:not(.hit):not(.mark) { stroke: var(--focus); stroke-width: 3; }
/* scatter marks: shape and fill carry the category (same family — filled ink circle, different families — hollow
   diamond); the pair selected in the matrix gets a violet ring; hover and keyboard focus ring the 24 px hit area */
.chart .pt > .hit { fill: transparent; stroke: none; }
.chart .pt:hover > .hit { stroke: var(--line-strong); stroke-width: 1.5; }
.chart .pt:focus-visible > .hit { stroke: var(--focus); stroke-width: 2; }
.chart .pt > .mark { fill: var(--ink-2); stroke: var(--bg); stroke-width: 1; }
.chart .pt.same > .mark { fill: var(--ink); stroke: var(--ink); }
.chart .pt.cross > .mark { fill: var(--bg); stroke: var(--ink-2); stroke-width: 2; }
.chart .pt.sel > .mark { stroke: var(--c-cka-vivid); stroke-width: 3.5; }
.chart .pt text { stroke: none; }
.chart .pt text.mk { fill: var(--ink); font-weight: 700; } .chart .pt.same text.mk { fill: var(--bg); }
/* point labels: a halo in the canvas colour keeps them legible over grid lines and neighbouring marks */
.chart .pt text.lbl { fill: var(--ink-2); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
/* series: colour plus line style (solid / dashed / dotted), never colour alone */
.chart .ser-tr { fill: var(--c-tr-vivid); } .chart path.ser-tr { stroke: var(--c-tr-vivid); fill: none; } .chart text.ser-tr { fill: var(--c-tr); }
.chart .ser-pgd { fill: var(--indigo-vivid); } .chart path.ser-pgd { stroke: var(--indigo-vivid); fill: none; } .chart text.ser-pgd { fill: var(--indigo); }
.chart .wb { fill: var(--c-fgsm-vivid); } .chart path.wb { stroke: var(--c-fgsm-vivid); fill: none; } .chart text.wb { fill: var(--c-fgsm); }
.chart .rand { fill: var(--muted); } .chart path.rand { stroke: var(--muted); fill: none; } .chart text.rand { fill: var(--muted); }
/* bars: FGSM solid blue, PGD-10 outlined indigo, random control grey (≥ 3 : 1 on the canvas in both themes) */
.chart .bar-fgsm { fill: var(--c-tr-vivid); }
.chart .bar-pgd { fill: color-mix(in srgb, var(--indigo-vivid) 22%, var(--bg)); stroke: var(--indigo-vivid); stroke-width: 2; }
.chart .bar-rand { fill: var(--muted); }
.chart .bar-wb { fill: var(--c-fgsm-vivid); }
.chart .bar-ab { fill: var(--c-tr-vivid); }
.chart .bar-ba { fill: var(--muted); }
.chart-tip { font-size: 0.875rem; min-height: 2.4em; color: var(--muted); margin: 0.2rem 0 0; }
.chart-card { min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--t-meta); color: var(--muted); margin: 0; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw.indigo { background: var(--indigo-vivid); } .sw.violet { background: var(--violet-vivid); } .sw.amber { background: var(--amber-vivid); } .sw.coral { background: var(--coral-vivid); } .sw.slate { background: var(--muted); } .sw.azure { background: var(--azure-vivid); } .sw.cyan { background: var(--cyan-vivid); }
.sw.same { background: var(--ink); border-radius: 50%; } .sw.cross { background: transparent; border: 2px solid var(--ink-2); transform: rotate(45deg) scale(0.9); border-radius: 1px; }
.legend .sw.ab, .sw.ab { background: var(--c-tr-vivid); } .legend .sw.ba, .sw.ba { background: var(--muted); }
.legend .sw.pgd { background: color-mix(in srgb, var(--indigo-vivid) 22%, var(--bg)); border: 2px solid var(--indigo-vivid); } .legend .sw.rand { background: var(--muted); } .legend .sw.fgsm { background: var(--c-tr-vivid); }
.chart-legend { margin: 6px 0 2px; }
.legend .sw.ring { background: transparent; border: 2.5px solid var(--c-cka-vivid); border-radius: 50%; }
.legend .sw.ln { width: 22px; height: 0; border-radius: 0; border-top: 2px solid var(--c-tr-vivid); background: none; vertical-align: 4px; }
.legend .sw.ln.pgd { border: 0; border-top: 2px dashed var(--indigo-vivid); background: none; } .legend .sw.ln.wb { border-top: 2.5px dotted var(--c-fgsm-vivid); } .legend .sw.ln.rand { border-top: 2.5px dotted var(--muted); background: none; }
.diagram { width: 100%; height: auto; background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.diagram text { font-family: var(--font-sans); font-size: 12px; fill: var(--ink); }
.diagram .box { fill: var(--surface-2); stroke: var(--line-strong); }
.diagram .arrow { stroke: var(--ink); fill: none; marker-end: url(#arr); }
.diagram .accent { fill: var(--violet-soft); stroke: var(--violet-vivid); }
.diagram .faint { fill: var(--muted); }

/* ==========================================================================================================
   page compositions
   ========================================================================================================== */
/* home: the topic as the headline, the question, the live instrument, three numbers */
.hero { display: grid; gap: 14px; margin: 0 0 24px; }
.hero h1 { font-size: clamp(1.625rem, calc(2.675vw - 8.5px), 2.25rem); line-height: 1.14; letter-spacing: -0.03em; font-weight: 700; max-width: none; margin: 0; }
@media (max-width: 1023px) { .hero h1 { font-size: var(--t-hero); } }
.hero-row { display: grid; gap: 16px 40px; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 1100px) { .hero-row { grid-template-columns: minmax(0, 1fr) auto; } }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.hero .lead-in, .lead-in { color: var(--ink-2); }
.hero .question { margin: 0; font-size: 1.0625rem; line-height: 1.5; color: var(--ink-2); max-width: 66ch; }
.hero .question b { color: var(--ink); font-weight: 650; }
.hero .status-chips { margin-top: 2px; }
.live-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 0 0 10px; }
.live-head h2 { margin: 0; font-size: 1.125rem; }
.live-head .tag { align-self: center; }
.live-head .live-q { color: var(--muted); font-size: var(--t-small); margin: 0; }
.hero-row { align-items: start; }
@media (min-width: 1100px) { .hero-row { grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 20px 44px; } }
.hero-text { display: grid; gap: 16px; align-content: start; min-width: 0; }
.hero-key { min-width: 0; }
.hero-key-h { margin: 0 0 2px; font-size: 0.875rem; font-weight: 650; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; letter-spacing: 0; }
.stat-row.tight { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-row.tight > .stat { padding: 12px 14px 12px 16px; border-left: 1px solid var(--line); }
.stat-row.tight > .stat:first-child { padding-left: 0; border-left: 0; }
.stat-row.tight .v { font-size: clamp(1.5rem, 1.1rem + 0.8vw, 2.05rem); }
.stat-row.tight .k { font-size: 0.875rem; margin-top: 6px; }
.stat-row.tight .frac { font-size: 0.8125rem; margin-top: 4px; }
@media (max-width: 559px) { .stat-row.tight { grid-template-columns: minmax(0, 1fr); } .stat-row.tight > .stat { padding-left: 0; border-left: 0; } }
.live { margin: 34px 0 6px; }
.live .live-head { margin-bottom: 12px; align-items: center; }
#lab[data-mode="compact"] .verdict .outcome-text { flex: 1 1 240px; font-size: 1rem; }
#lab[data-mode="compact"] .verdict { padding-bottom: 10px; }
.more-link { margin: 0; }
.more-link a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.home .sec { margin-top: 44px; }
.home .sec + .sec { margin-top: 18px; }

/* lab overview: three modules as an index, the outcome quadrant */
.quad { display: grid; gap: 6px; grid-template-columns: auto repeat(2, minmax(0, 1fr)); max-width: 820px; align-items: stretch; }
.quad .qh { font-size: var(--t-meta); font-weight: 650; color: var(--muted); display: grid; place-items: end center; text-align: center; padding: 4px; }
.quad .qv { font-size: var(--t-meta); font-weight: 650; color: var(--muted); display: grid; align-items: center; text-align: right; padding: 4px 10px 4px 0; }
.quad .q { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.quad .q b { display: block; font-size: 1rem; margin-bottom: 4px; }
.quad .q p { margin: 0; font-size: var(--t-small); color: var(--ink-2); }
.quad .q.both { background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral-vivid) 40%, transparent); } .quad .q.both b { color: var(--coral); }
.quad .q.source { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber-vivid) 40%, transparent); } .quad .q.source b { color: var(--amber); }
.quad .q.target { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet-vivid) 40%, transparent); } .quad .q.target b { color: var(--violet); }
.quad .q.neither { background: var(--emerald-soft); border-color: color-mix(in srgb, var(--emerald-vivid) 40%, transparent); } .quad .q.neither b { color: var(--emerald); }
.mode-legend { display: grid; gap: 8px; font-size: 0.9375rem; list-style: none; padding: 0; margin: 0; }
.mode-legend li { display: flex; gap: 10px; align-items: baseline; max-width: none; margin: 0; }
.mode-legend .tag, .mode-legend .badge { flex: 0 0 auto; }

/* results: an editorial report — findings with numbers, limitations beside them */
.report-top { display: grid; gap: 28px 44px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1200px) { .report-top { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); } }
.findings { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.finding { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 16px; padding: 18px 0 16px; border-bottom: 1px solid var(--line); margin: 0; max-width: none; }
@media (min-width: 760px) { .finding { grid-template-columns: 40px minmax(0, 1fr) minmax(150px, auto); } }
.finding .n { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--faint); padding-top: 0.3em; }
.finding h3 { margin: 0; font-size: 1.1875rem; line-height: 1.3; }
.finding p { margin: 6px 0 0; color: var(--muted); font-size: 0.9375rem; }
.finding .fv { grid-column: 2; font-size: clamp(1.875rem, 1.5rem + 0.9vw, 2.5rem); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; color: var(--ink); }
@media (min-width: 760px) { .finding .fv { grid-column: 3; grid-row: 1 / span 2; text-align: right; align-self: start; } }
.finding .fv small { display: block; font-size: 0.8125rem; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-top: 6px; white-space: normal; }
.limits { border-left: 3px solid var(--amber-vivid); padding: 2px 0 2px 22px; }
.limits h2 { font-size: 1.125rem; margin: 0 0 10px; color: var(--amber); }
.limits .list-check { gap: 9px; font-size: 0.9375rem; }
.limits p { font-size: 0.9375rem; color: var(--muted); }

/* documentation layout: content column + reading-position contents */
.doc { display: grid; gap: 36px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1200px) { .doc { grid-template-columns: minmax(0, 1fr) 236px; gap: 56px; } .doc-toc { position: sticky; top: calc(var(--topbar-h) + 26px); order: 2; max-height: calc(100vh - var(--topbar-h) - 52px); overflow-y: auto; scrollbar-width: thin; } }
.doc-body { min-width: 0; max-width: 820px; }
.doc-body > section { padding: 30px 0 6px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.doc-body > section:first-child { border-top: 0; padding-top: 4px; }
.doc-body h2 { font-size: 1.5rem; display: flex; gap: 14px; align-items: baseline; margin: 0 0 14px; }
.doc-body h2 .n { font-family: var(--font-mono); font-size: 0.875rem; color: var(--faint); font-weight: 500; flex: 0 0 auto; }
.doc-body h3 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; }
.doc-body p, .doc-body li { font-size: var(--t-read); line-height: 1.65; }
.doc-body dl.rows dd, .doc-body dl.rows dt { font-size: 0.9375rem; line-height: 1.55; }
.doc-body .table-wrap { margin: 12px 0; }
.toc { font-size: 0.875rem; border: 0; padding: 0; background: transparent; }
.toc strong, .toc .toc-h { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 650; margin: 0 0 10px; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); counter-reset: toc; columns: 1; }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }
@media (max-width: 1199px) { .doc-toc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; } .toc ol { columns: 2; column-gap: 24px; border-left: 0; } .toc a { padding-left: 0; border-left: 0; } }
@media (max-width: 600px) { .toc ol { columns: 1; } }

/* literature: landscape lanes, synthesis, compact bibliography */
.lanes { display: grid; gap: 0; border-top: 1px solid var(--line); }
.lane { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 980px) { .lane { grid-template-columns: 200px minmax(0, 1fr); } }
.lane-h { margin: 0; font-size: 1rem; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.lane-h::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--mod-vivid); flex: 0 0 9px; }
.lane-track { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.lane-track li { margin: 0; padding: 10px 0 0; border-top: 2px solid var(--mod-vivid); max-width: none; }
.lanes .years { display: none; }
.lane-track .yr { display: block; font-size: 0.8125rem; font-weight: 650; color: var(--mod); font-variant-numeric: tabular-nums; }
.lane-track .who { display: block; font-weight: 600; font-size: 0.9375rem; }
.lane-track .what { display: block; color: var(--muted); font-size: 0.875rem; line-height: 1.4; margin-top: 2px; }
.lane-track li.pilot { border-top-style: dashed; border-top-color: var(--ink); }
.lane-track li.pilot .yr { color: var(--ink); }
.synth { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
@media (min-width: 900px) { .synth { grid-template-columns: repeat(2, minmax(0, 1fr)); } .synth > div:nth-child(2n) { border-left: 1px solid var(--line); padding-left: 26px; } .synth > div:nth-child(2n+1) { padding-right: 26px; } }
.synth > div { padding-top: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.synth h3 { margin: 0 0 6px; font-size: 1.0625rem; }
.synth p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.6; }
.bib-filter { margin: 0 0 14px; }
.bib { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.bib-entry { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); margin: 0; max-width: none; }
@media (min-width: 900px) { .bib-entry { grid-template-columns: 44px minmax(0, 1fr) 200px; } }
.bib-n { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--faint); padding-top: 0.2em; }
.bib-main { min-width: 0; }
.bib-meta { margin: 0 0 3px; font-size: 0.875rem; color: var(--muted); }
.bib-meta b { color: var(--ink-2); font-weight: 600; }
.bib-title { margin: 0; font-size: 1.0625rem; line-height: 1.35; font-weight: 650; }
.bib-title a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.bib-role { margin: 6px 0 0; font-size: 0.9375rem; color: var(--ink-2); max-width: 78ch; }
.bib-links { margin: 6px 0 0; font-size: 0.8125rem; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.bib-side { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; align-content: start; }
@media (min-width: 900px) { .bib-side { grid-column: 3; grid-row: 1 / span 2; justify-content: flex-end; } }
.bib-entry[data-strand="transfer"] { --mod: var(--c-tr); --mod-vivid: var(--c-tr-vivid); }
.bib-entry[data-strand="similarity"] { --mod: var(--c-cka); --mod-vivid: var(--c-cka-vivid); }
.bib-entry .strand { font-size: 0.75rem; font-weight: 650; color: var(--mod); display: inline-flex; align-items: center; gap: 6px; }
.bib-entry .strand::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--mod-vivid, var(--faint)); }

/* ==========================================================================================================
   evidence footer, page footer, health rows, UZ notes, misc
   ========================================================================================================== */
.evidence-footer { position: static; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(8px); font-size: 0.78rem; }
.evidence-footer .container { padding: 0 14px; }
@media (min-width: 768px) { .evidence-footer { position: sticky; bottom: 0; } .evidence-footer .container { padding: 0 24px; } html { scroll-padding-bottom: 64px; } }
@media (min-width: 1280px) { .evidence-footer .container { padding: 0 32px; } }
.evidence-footer .bar { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; padding: 0.3rem 0; font-family: var(--font-mono); }
.evidence-footer .bar .k { color: var(--muted); }
.evidence-footer details { width: 100%; }
.evidence-footer summary { cursor: pointer; font-family: var(--font-sans); font-weight: 500; display: block; padding: 0.38rem 0; line-height: 1.45; min-width: 0; max-width: 100%; overflow-wrap: anywhere; color: var(--muted); }
.evidence-footer summary .mono { overflow-wrap: anywhere; color: var(--ink-2); }
.evidence-footer .detail { padding: 0.3rem 0 0.5rem; font-family: var(--font-sans); }
.site-footer { border-top: 1px solid var(--line); padding: 1.3rem 0 1.9rem; color: var(--muted); font-size: 0.84rem; margin-top: auto; }
.site-footer .container { padding: 0 16px; }
@media (min-width: 768px) { .site-footer .container { padding: 0 24px; } }
@media (min-width: 1280px) { .site-footer .container { padding: 0 32px; } }
.site-footer p { max-width: none; margin: 0 0 0.4rem; }
.site-footer nav ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: 0.4rem 0; }
.site-footer li { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.noscript-box { border: 1px solid var(--amber-vivid); border-left-width: 3px; padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin: 0.8rem 0; }
.kbd-hint { font-size: 0.8rem; color: var(--muted); }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; background: var(--surface); font-size: 0.78em; }
.health-row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) minmax(0, auto); gap: 0.6rem; align-items: start; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.health-row .rs { min-width: 0; max-width: 100%; overflow-wrap: anywhere; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .health-row { grid-template-columns: 4.2rem minmax(0, 1fr); } .health-row .rs { grid-column: 2; text-align: left; } }
.health-row:last-child { border-bottom: 0; }
.health-row .ic { font-weight: 700; font-family: var(--font-mono); font-size: 0.76rem; width: auto; height: auto; display: inline-block; border-radius: 6px; padding: 2px 6px; text-align: center; stroke: none; }
.health-row.ok .ic { color: var(--ok); background: var(--ok-soft); }
.health-row.bad .ic { color: var(--bad); background: var(--bad-soft); }
.health-row.warn .ic { color: var(--warn); background: var(--warn-soft); }
.health-row.pending .ic { color: var(--muted); background: var(--neutral-soft); }
.health-list { border-top: 1px solid var(--line); }
.lang-uz { display: none; }
:root[data-uz="on"] .lang-uz { display: block; border-left: 3px solid var(--emerald-vivid); padding: 0.45rem 0.8rem; color: var(--ink); background: var(--ok-soft); border-radius: 0 8px 8px 0; font-size: 0.92em; margin: 0.45rem 0; max-width: 80ch; }
:root[data-uz="on"] .lang-uz::before { content: "UZ · izoh"; display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: var(--emerald); margin-bottom: 0.15rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line-strong); padding: 0.2rem 0 0.8rem 1rem; margin: 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 0.5rem; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.repro-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.repro-links .btn { font-size: 0.875rem; min-height: 36px; }

/* ==========================================================================================================
   motion, forced colours, print
   ========================================================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { transition: none !important; animation: none !important; }
:root[data-motion="reduce"] { scroll-behavior: auto; }
@media (forced-colors: active) {
  .badge, .tag, .btn, .fig.panel, .workbench, .pred-card, .outcome, .heatmap .cell, .sample-btn, .tb-btn, .sidebar, .quad .q { border: 1px solid CanvasText; forced-color-adjust: none; background: Canvas; color: CanvasText; }
  .nav-item[aria-current="page"], .tab[aria-selected="true"], .seg label:has(input:checked) { outline: 2px solid Highlight; }
  input[type="range"]::-webkit-slider-thumb { background: Highlight; }
}
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f4f4f4; --ink: #000; --muted: #333; --line: #999; }
  .sidebar, .sidebar-backdrop, .topbar, .skip-link, .evidence-footer, .no-print, .site-footer nav, .rail-tip, .tablist { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .page { padding: 0; max-width: none; }
  a { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #333; }
  .fig, .workbench, .pred-card, .pixel-panel, .finding { box-shadow: none; break-inside: avoid; }
  details { display: block; }
  details > *:not(summary) { display: block; }
  .tabpanel[hidden] { display: block !important; }
  @page { margin: 16mm; }
}
.formula.display { font-size: 1.25rem; padding: 1rem 1.2rem; text-align: center; }
.formula-h { font-size: 1.125rem; margin: 1.4rem 0 0.2rem; }
.doc-steps .chain > li { padding-top: 8px; }

/* results report: findings, limitations, key numbers, raw data with filters */
.report .masthead { max-width: 1240px; }
.report-note { margin: 0; color: var(--muted); font-size: var(--t-small); max-width: 110ch; }
.report-h { font-size: 1.125rem; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.finding h3 a { color: inherit; text-decoration: none; }
.finding h3 a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); }
.limits .lim-list li { font-size: 0.9375rem; line-height: 1.5; }
.limits .lim-list b { color: var(--ink); }
.key-block { margin: 40px 0 0; }
.report .sec { margin-top: 44px; }
.report .sec + .sec { margin-top: 18px; }
.report .sec-body > p { max-width: 90ch; }
.report .sec-body .two-col h3 { font-size: 1rem; }
.raw-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 0 0 8px; }
.raw-filters select { min-width: 150px; width: auto; }
.raw-count { margin: 0 0 8px; }
.drawer.raw table.data td, .drawer.raw table.data th { white-space: nowrap; }

/* documentation pages: tables and callouts read as part of the text */
.doc-page .masthead { max-width: 1110px; }
.doc-body .table-wrap { border: 0; border-radius: 0; background: transparent; }
.doc-body table.data th { background: transparent; border-bottom: 1px solid var(--line-strong); padding-left: 0; }
.doc-body table.data td { padding-left: 0; }
.doc-body table.data tbody tr:hover td { background: transparent; }
.doc-body .formula { margin: 1rem 0; }
.doc-body .callout, .doc-body .note { margin: 1.1rem 0; }
.filter-field { max-width: 420px; margin: 4px 0 12px; }
.drawer.gloss { margin-top: 6px; }

/* literature */
.bib-entry[data-strand="bridge"] { --mod: var(--ink); --mod-vivid: var(--ink-2); }
.bib-entry[data-strand="data"] { --mod: var(--muted); --mod-vivid: var(--faint); }
.land-text { margin-top: 28px; }
.lit .masthead .cta-row { margin: 2px 0 0; }
.lit .bib-links a { color: var(--muted); }

/* lab overview */
.lab-index .mode-legend { margin: 0 0 8px; }
.chain.modules > li { padding-top: 22px; padding-bottom: 22px; }
.chain .chain-t { font-size: 1.5rem; margin: 0 0 8px; }
.chain.modules .chain-n { font-size: 0.875rem; }
.quad .q .outcome { margin-bottom: 8px; }

/* diagnostics: status | check | evidence; evidence wraps under the check on narrow screens */
.health-summary { margin: 0 0 18px; }
.health-row { grid-template-columns: 4.6rem minmax(200px, 1fr) minmax(0, 1.25fr); gap: 0.4rem 1rem; }
.health-row .lb { font-weight: 600; min-width: 0; }
.health-row .rs { text-align: left; font-size: 0.8125rem; color: var(--muted); }
@media (max-width: 900px) { .health-row { grid-template-columns: 4.6rem minmax(0, 1fr); } .health-row .rs { grid-column: 2; } }
.notfound { margin-top: 8vh; }
@media (min-width: 980px) {
  .lanes .years { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); list-style: none; margin: 0 0 0 224px; padding: 12px 0 8px; font-size: 0.75rem; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
  .lanes .years li { grid-column: span 2; margin: 0; padding-left: 5px; border-left: 1px solid var(--line-strong); max-width: none; }
  .lane-track { grid-template-columns: repeat(15, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 12px 0; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(200% / 15)); }
  .lane-track li { border-top: 0; border-left: 2px solid var(--mod-vivid); padding: 2px 14px 4px 9px; background: var(--bg); }
  .lane-track li.pilot { border-left: 2px dashed var(--ink); }
  .lane { align-items: start; } .lane-h { padding-top: 2px; }
  .lane-track li[data-y="2014"] { grid-column: 1 / span 3; } .lane-track li[data-y="2015"] { grid-column: 2 / span 3; } .lane-track li[data-y="2016"] { grid-column: 3 / span 3; }
  .lane-track li[data-y="2018"] { grid-column: 5 / span 3; } .lane-track li[data-y="2019"] { grid-column: 6 / span 3; } .lane-track li[data-y="2022"] { grid-column: 9 / span 3; }
  .lane-track li[data-y="2024"] { grid-column: 11 / span 3; } .lane-track li[data-y="2026"] { grid-column: 13 / span 3; }
}

/* FGSM: population metrics for the current settings, inside the stage */
.pop-strip { border-top: 1px solid var(--line); padding-top: 12px; }
.pop-h { margin: 0 0 4px; font-size: 0.875rem; font-weight: 650; color: var(--muted); }
.pop-strip .stat-row { border-top: 0; }
.pop-strip .stat .v { font-size: clamp(1.375rem, 1.1rem + 0.5vw, 1.75rem); }
.pop-strip #pop-csv { margin: 6px 0 0; }
/* short laptop screens: the instrument comes first, the one-line explanation stays available to screen readers */
@media (min-width: 1024px) and (max-height: 820px) {
  .lab-page .masthead.compact .dek { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .lab-page .masthead.compact { margin-bottom: 12px; }
  .page { padding-top: 16px; }
}
/* home instrument: the predictions column keeps only what is read at a glance (hashes are in the full lab) */
#lab[data-mode="compact"] .pred-card .mono, #lab[data-mode="compact"] .pred-card header .small { display: none; }
#lab[data-mode="compact"] .pred-card { gap: 2px; }
/* phones: matrices and toolbars fit the width */
.masthead, .masthead > * { min-width: 0; }
.dek, .report-note, .fig-cap, .hint, .sec-q { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .heatmap { grid-template-columns: fit-content(78px) repeat(4, minmax(0, 1fr)); gap: 4px; }
  .heatmap .vlabel { padding-right: 0.4rem; }
  .heatmap .cell .frac .l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .heatmap .cell .frac .s { display: inline; }
  .heatmap .cell { min-height: 58px; padding: 0.25rem 0.1rem; }
  .heatmap .cell .v { font-size: 0.95rem; }
  .heatmap .cell .frac { font-size: 0.68rem; }
  .heatmap .hlabel, .heatmap .vlabel { font-size: 0.75rem; }
  .toolbar .tool { flex: 1 1 100%; }
  .toolbar .seg label { white-space: normal; padding: 4px 6px; }
}
/* phones: the matrix first, its parameters directly under it */
@media (max-width: 760px) {
  #transfer-lab, #cka-lab { display: flex; flex-direction: column; }
  #transfer-lab > .toolbar, #cka-lab > .toolbar { order: 2; border-top: 1px solid var(--line); border-bottom: 0; padding: 16px 0 0; margin: 12px 0 0; }
}

.wb-results > .advanced { margin-top: 10px; }
@media (max-width: 1023px) { .workbench .advanced { order: 20; } }
@media (min-width: 1024px) and (max-width: 1279px) {
  .pixel-panel .caption { font-size: 0.75rem; line-height: 1.3; }
  .pixel-panel .gray-legend { display: none; }
  .pred-card .mono { display: none; }
  .verdict .outcome-text { font-size: 0.9375rem; }
}
/* image headings are one line of text with a colour key, not a flex row of fragments */
.pixel-panel h3, .pixel-panel h4 { display: block; }
.pixel-panel h3::before, .pixel-panel h4::before { display: inline-block; margin-right: 7px; vertical-align: 0; }
.stat-row.tight.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 759px) { .stat-row.tight.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-row.tight.c4 > .stat:nth-child(3) { padding-left: 0; border-left: 0; } }
/* phones: the full reading order of the instrument, including the population strip */
@media (max-width: 1023px) {
  .workbench #url-warning { order: 0; } .workbench .verdict { order: 1; } .workbench .trio { order: 2; } .workbench .ctl-eps { order: 3; }
  .workbench .pred-grid { order: 4; } .workbench .pop-strip { order: 5; } .workbench .wb-readout { order: 6; } .workbench .ctl-pair { order: 7; }
  .workbench .ctl-sample { order: 8; } .workbench .ctl-more { order: 9; } .workbench .ctl-foot { order: 10; } .workbench .drawer { order: 11; }
  .workbench .lang-uz { order: 12; } .workbench .advanced { order: 20; }
}
@media (max-width: 480px) { .mode-legend li { flex-direction: column; align-items: flex-start; gap: 4px; } }
@media (max-width: 520px) { .quad { grid-template-columns: minmax(0, 1fr); } .quad .qh, .quad .qv { display: none; } }

/* ==========================================================================================================
   independent review of v4 (2026-11-08): components adjusted after the second screenshot review
   ========================================================================================================== */
/* literature: the comparison as a table; the pilot column marked; a dash is "not compared here" */
table.compare { min-width: 680px; }
table.compare th[scope="row"] { width: 9.5rem; color: var(--muted); font-weight: 600; font-size: 0.875rem; }
table.compare thead th { font-size: 0.875rem; color: var(--ink); }
table.compare .pilot { background: color-mix(in srgb, var(--ink) 4%, transparent); }
table.compare td.none { color: var(--faint); }
.synth-note { margin: 12px 0 0; color: var(--muted); max-width: 72ch; }
.bib-prov { margin: 0 0 14px; max-width: 80ch; }
/* formulas: one per line; the CKA formula as MathML with a real fraction */
.formula.stack > span { display: block; }
.formula.stack > span + span { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px dashed var(--line); }
.formula.math { text-align: center; }
.formula.math math { font-size: 1.3em; }
/* lab overview: the three "open" links on one line */
.chain.modules > li { display: flex; flex-direction: column; }
.chain.modules > li > .go { margin-top: auto; padding-top: 4px; }
/* commands: wrap long lines; a wrapped line is indented under its command */
pre.cmds { white-space: pre-wrap; }
pre.cmds code > span { display: block; padding-left: 2.5ch; text-indent: -2.5ch; overflow-wrap: anywhere; }
pre.cmds code > span + span { margin-top: 0.25rem; }
.nw { white-space: nowrap; }
/* tables: the last row has no rule in every cell, including the row header */
table.data tbody tr:last-child > th, table.data tbody tr:last-child > td { border-bottom: 0; }
/* the three images share rows, so a heading that wraps does not lower its image */
.trio > .pixel-panel { grid-row: span 5; display: grid; grid-template-rows: subgrid; row-gap: 7px; }
.trio { row-gap: 0; }
/* fixed rows: heading, image, caption, colour key, badge — captions line up and the trio is no taller than its tallest panel */
.trio > .pixel-panel > h3, .trio > .pixel-panel > h4 { grid-row: 1; } .trio > .pixel-panel > canvas { grid-row: 2; }
.trio > .pixel-panel > .caption { grid-row: 3; } .trio > .pixel-panel > .gray-legend, .trio > .pixel-panel > .colorbar { grid-row: 4; }
.trio > .pixel-panel > .badge { grid-row: 5; }
/* home: the picked examples sit under the result they change, so the controls column ends near the stage */
.curated-strip { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.curated-strip .field-label { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.curated-strip .field-label .aside { font-weight: 500; color: var(--faint); margin-left: 6px; }
.curated-strip .curated .hint { margin: 2px 0 0; font-size: 0.78rem; }
@media (max-width: 1023px) { .workbench .curated-strip { order: 8; } }

/* ==========================================================================================================
   multimodal extension (2026-11-19): «Модальности» navigation group, modality hues (image cyan, text indigo,
   audio teal, tabular orange), compact sub-items for the image modules. Old routes and labels unchanged.
   ========================================================================================================== */
:root {
  --teal: #0f766e;   --teal-vivid: #14b8a6;   --teal-soft: #e0f5f2;   --teal-ui: #0d9488;
  --orange: #c2410c; --orange-vivid: #f97316; --orange-soft: #fff0e5; --orange-ui: #ea580c;
  --indigo-ui: #4f46e5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --teal: #2dd4bf; --teal-soft: #062824; --teal-ui: #2dd4bf; --orange: #fb923c; --orange-soft: #2a1608; --orange-ui: #fb923c; --indigo-ui: #818cf8; }
}
:root[data-theme="dark"] { --teal: #2dd4bf; --teal-soft: #062824; --teal-ui: #2dd4bf; --orange: #fb923c; --orange-soft: #2a1608; --orange-ui: #fb923c; --indigo-ui: #818cf8; }
[data-mod="text"] { --mod: var(--indigo); --mod-vivid: var(--indigo-vivid); --mod-ui: var(--indigo-ui); --mod-soft: var(--indigo-soft); }
[data-mod="audio"] { --mod: var(--teal); --mod-vivid: var(--teal-vivid); --mod-ui: var(--teal-ui); --mod-soft: var(--teal-soft); }
[data-mod="tabular"] { --mod: var(--orange); --mod-vivid: var(--orange-vivid); --mod-ui: var(--orange-ui); --mod-soft: var(--orange-soft); }
[data-mod="image"] { --mod: var(--c-fgsm); --mod-vivid: var(--c-fgsm-vivid); --mod-ui: var(--c-fgsm-ui); --mod-soft: var(--c-fgsm-soft); }
.nav-item[data-hue="indigo"] { --nav-hue: var(--indigo); --nav-hue-vivid: var(--indigo-vivid); --nav-hue-soft: var(--indigo-soft); }
.nav-item[data-hue="teal"] { --nav-hue: var(--teal); --nav-hue-vivid: var(--teal-vivid); --nav-hue-soft: var(--teal-soft); }
.nav-item[data-hue="orange"] { --nav-hue: var(--orange); --nav-hue-vivid: var(--orange-vivid); --nav-hue-soft: var(--orange-soft); }
/* fifteen routes: slightly tighter rows; the image modules hang under «Изображения» as a tree */
.nav-item { min-height: 38px; }
.nav-group { padding-top: 8px; }
.nav-group-label { padding-bottom: 6px; }
.site-nav .nav-sub { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 1px; position: relative; }
.site-nav .nav-sub::before { content: ""; position: absolute; left: 21px; top: 2px; bottom: 8px; width: 1px; background: var(--line-strong); }
.nav-item.nav-sub-item { min-height: 32px; padding-left: 36px; gap: 9px; font-size: 0.875rem; }
.nav-item.nav-sub-item .nav-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.nav-item.nav-sub-item[aria-current="page"]::before { left: 20px; top: 7px; bottom: 7px; }
.nav-item.is-section { color: var(--ink); font-weight: 600; }
.nav-item.is-section .nav-icon { color: var(--nav-hue, var(--ink)); }
@media (min-width: 1024px) {
  :root[data-sidebar="collapsed"] .site-nav .nav-sub::before { display: none; }
  :root[data-sidebar="collapsed"] .nav-item.nav-sub-item { width: 40px; height: 34px; min-height: 34px; padding: 0; }
  :root[data-sidebar="collapsed"] .nav-item.nav-sub-item[aria-current="page"]::before { left: -8px; }
}
/* short laptop screens: the status pill (also stated on every page) yields its height to the routes */
@media (min-width: 1024px) and (max-height: 820px) {
  .sidebar-foot .status-pill { display: none; }
  .nav-item { min-height: 34px; }
  .nav-item.nav-sub-item { min-height: 29px; }
  .nav-group { padding-top: 3px; }
  .nav-group-label { padding-top: 2px; padding-bottom: 4px; }
  .sidebar-head { min-height: 52px; padding-top: 8px; padding-bottom: 4px; }
}
.site-nav { padding-bottom: 8px; }
