/* J-Space Probes — lab dashboard.
   Palette: dataviz reference instance (validated). Violet is the lab's
   identity color (UI only); categorical slots are reserved for data series. */

:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --lens: #4a3aa7;
  --lens-soft: rgba(74, 58, 167, 0.08);
  --raised: #ffffff;
  --well: #f1f0ea;
  --bezel: rgba(11, 11, 11, 0.13);
  --shadow: 0 1px 2px rgba(31, 27, 16, 0.05), 0 8px 24px rgba(31, 27, 16, 0.06);
  --well-shadow: inset 0 1px 5px rgba(31, 27, 16, 0.08);
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #008300;
  --s5: #9085e9; --s6: #e34948; --s7: #e87ba4; --s8: #eb6834;
  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
  --seq-550: #1c5cab; --seq-700: #0d366b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace,
          "SF Mono", Consolas, monospace;
}
:root[data-theme="light"] {
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e;
  --muted: #898781; --grid: #e1e0d9; --axis: #c3c2b7;
  --ring: rgba(11,11,11,0.10); --lens: #4a3aa7;
  --lens-soft: rgba(74,58,167,0.08);
  --raised: #ffffff;
  --well: #f1f0ea;
  --bezel: rgba(11, 11, 11, 0.13);
  --shadow: 0 1px 2px rgba(31, 27, 16, 0.05), 0 8px 24px rgba(31, 27, 16, 0.06);
  --well-shadow: inset 0 1px 5px rgba(31, 27, 16, 0.08);
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #008300;
  --s5: #9085e9; --s6: #e34948; --s7: #e87ba4; --s8: #eb6834;
  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
  --seq-550: #1c5cab; --seq-700: #0d366b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ecebe5;
    --ink-2: #c3c2b7;
    --muted: #96948d;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --lens: #9085e9;
    --lens-soft: rgba(144, 133, 233, 0.12);
  --raised: #1e1d1c;
  --well: #121211;
  --bezel: rgba(255, 255, 255, 0.09);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 30px rgba(0, 0, 0, 0.5);
  --well-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
    --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #008300;
    --s5: #9085e9; --s6: #e66767; --s7: #d55181; --s8: #d95926;
    --seq-100: #16233a; --seq-250: #1c5cab; --seq-400: #3987e5;
    --seq-550: #86b6ef; --seq-700: #cde2fb;
  }
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ecebe5; --ink-2: #c3c2b7;
  --muted: #96948d; --grid: #2c2c2a; --axis: #383835;
  --ring: rgba(255,255,255,0.10); --lens: #9085e9;
  --lens-soft: rgba(144,133,233,0.12);
  --raised: #1e1d1c;
  --well: #121211;
  --bezel: rgba(255, 255, 255, 0.09);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 30px rgba(0, 0, 0, 0.5);
  --well-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
  --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #008300;
  --s5: #9085e9; --s6: #e66767; --s7: #d55181; --s8: #d95926;
  --seq-100: #16233a; --seq-250: #1c5cab; --seq-400: #3987e5;
  --seq-550: #86b6ef; --seq-700: #cde2fb;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
}

/* ---- masthead: two quiet tiers — identity row, then nav row ---- */
.masthead { border-bottom: 1px solid var(--grid); padding: 16px 28px 0; }
.masthead-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
}
.masthead-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lens-mark {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--lens); position: relative; flex: none;
}
.lens-mark::after {
  content: ""; position: absolute; inset: 4.5px;
  border-radius: 50%; background: var(--lens);
}
.masthead h1 {
  font-family: var(--serif); font-size: 23px; font-weight: 600;
  letter-spacing: 0.01em; margin: 0; white-space: nowrap;
}
/* the signature: a live core-sample sparkline of the lab's first headline
   record — the answer surfacing through the stack. Drawn by drawSpark(). */
.mast-spark { display: inline-flex; align-items: center; margin-left: 6px; }
.mast-spark canvas { display: block; opacity: 0.9; }
.mast-spark:hover canvas { opacity: 1; }
.masthead-sub { margin: 0; color: var(--muted); font-size: 13px; }
.theme-toggle {
  margin-left: auto; flex: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--ring); background: var(--surface);
  color: var(--ink-2); font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--lens); color: var(--lens); }
.theme-toggle:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.masthead-bottom {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  margin-top: 8px;
}
.masthead-nav {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 0 0 0 -10px;
}
.masthead-nav::-webkit-scrollbar { display: none; }
.masthead-nav a {
  color: var(--ink-2); text-decoration: none; font-size: 13px;
  padding: 7px 10px 9px; white-space: nowrap; border-radius: 7px 7px 0 0;
  border-bottom: 2px solid transparent;
}
.masthead-nav a:hover { color: var(--lens); }
.masthead-nav a.active {
  color: var(--lens); font-weight: 600;
  border-bottom-color: var(--lens);
}
.masthead-bottom .stats { margin-left: auto; font-size: 12px; padding-bottom: 6px; }

/* ---- frame ---- */
.frame { display: flex; min-height: calc(100vh - 108px); }
.rail {
  flex: 0 0 320px; border-right: 1px solid var(--grid);
  padding: 18px 14px 40px; overflow-y: auto;
}
.detail { flex: 1 1 auto; min-width: 0; padding: 26px 34px 80px; }
.empty { color: var(--muted); font-style: italic; }

/* ---- mobile rail drawer ---- */
/* Toggle button + backdrop are inert on desktop (display:none), so wide
   layouts stay pixel-identical. On narrow viewports the rail becomes an
   off-canvas drawer opened by the toggle. */
.rail-toggle {
  display: none; align-items: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--lens); color: var(--lens);
  background: var(--lens-soft);
}
.rail-toggle:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.rail-toggle-bars {
  width: 15px; height: 10px; flex: none; position: relative;
}
.rail-toggle-bars, .rail-toggle-bars::before, .rail-toggle-bars::after {
  border-top: 2px solid currentColor;
}
.rail-toggle-bars::before, .rail-toggle-bars::after {
  content: ""; position: absolute; left: 0; right: 0;
}
.rail-toggle-bars::before { top: 3px; }
.rail-toggle-bars::after { top: 7px; }
.rail-backdrop { display: none; }

@media (max-width: 900px) {
  .frame { display: block; }
  .rail { border-right: none; border-bottom: 1px solid var(--grid); }
}

@media (max-width: 768px) {
  .rail-toggle { display: inline-flex; margin: 8px 0 0; }
  .rail-backdrop {
    position: fixed; inset: 0; z-index: 44;
    background: rgba(0, 0, 0, 0.45); border: 0;
  }
  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 46;
    width: min(320px, 86vw); max-width: 86vw;
    border-right: 1px solid var(--grid); border-bottom: none;
    background: var(--page); box-shadow: 2px 0 18px rgba(0, 0, 0, 0.28);
    transform: translateX(-100%); transition: transform 0.22s ease;
  }
  body.rail-open .rail { transform: translateX(0); }
  body.rail-open .rail-backdrop[hidden] { display: block; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .rail { transition: none; }
}

/* ---- rail controls (sticky) ---- */
.rail-controls {
  position: sticky; top: 0; z-index: 5; background: var(--page);
  padding: 2px 2px 10px; margin: -6px -2px 4px;
  border-bottom: 1px solid var(--grid);
}
#q {
  width: 100%; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: 8px; padding: 7px 10px;
}
#q:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.chip-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.fchip {
  font: inherit; font-size: 12px; padding: 2px 11px; cursor: pointer;
  border-radius: 99px; border: 1px solid var(--ring);
  background: none; color: var(--ink-2);
}
.fchip[aria-pressed="true"] {
  border-color: var(--lens); color: var(--lens); font-weight: 600;
  background: var(--lens-soft);
}
.fchip:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }

/* ---- rail ---- */
.unit-group { margin-bottom: 2px; }
.unit-head {
  display: flex; align-items: baseline; gap: 7px; width: 100%;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin: 8px 0 2px;
  background: none; border: none; cursor: pointer; padding: 5px 8px;
  border-radius: 7px; text-align: left; line-height: 1.35;
}
.unit-head:hover { background: var(--lens-soft); color: var(--ink); }
.unit-head:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.unit-head .tri { flex: none; width: 10px; color: var(--muted); }
.unit-head .uname { flex: 1 1 auto; }
.unit-head .count {
  flex: none; font-size: 11px; font-weight: 500; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.exp-link {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; border: 1px solid transparent;
  background: none; color: var(--ink); cursor: pointer;
  padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13.5px;
  text-decoration: none;
}
.exp-link.overview-link {
  color: var(--lens); font-size: 12.5px; font-weight: 500;
  gap: 8px; padding-top: 5px; padding-bottom: 5px;
}
.exp-link.overview-link .who { display: inline; margin-left: 6px; }
.exp-link:hover { background: var(--lens-soft); }
.exp-link:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.exp-link[aria-current="true"] {
  background: var(--lens-soft); border-color: var(--lens);
}
.exp-link .glyph { flex: none; }
.exp-link .who {
  display: block; color: var(--muted); font-size: 11.5px;
}

/* emergence glyph: the signature. A core sample of the layer stack —
   each band is one layer; depth of blue = closeness of the final answer
   (log rank). Reads top (embedding) to bottom (speech). */
.glyph { display: inline-flex; flex-direction: column; border-radius: 3px;
         overflow: hidden; border: 1px solid var(--ring); }
.glyph i { display: block; }

/* ---- record pager ---- */
.pager {
  display: flex; gap: 6px; justify-content: flex-end; margin: -8px 0 6px;
}
.pager a, .pager span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; font-size: 16px;
  border: 1px solid var(--ring); color: var(--ink-2);
  text-decoration: none; background: var(--surface);
}
.pager span { opacity: 0.35; }
.pager a:hover { border-color: var(--lens); color: var(--lens); }
.pager a:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }

/* ---- unit overview ---- */
.ov-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.ov-card {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  border: 1px solid var(--ring); background: var(--page);
  border-radius: 9px; padding: 10px 12px; color: var(--ink);
  text-decoration: none; font: inherit;
}
.ov-card:hover { border-color: var(--lens); background: var(--lens-soft); }
.ov-card:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.ov-card .glyph { flex: none; margin-top: 2px; }
.ov-body { min-width: 0; }
.ov-t { display: block; font-size: 13px; font-weight: 550; line-height: 1.3; }
.ov-m { display: block; color: var(--lens); font-size: 11.5px; margin-top: 2px;
        font-family: var(--mono); }
.ov-gen {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--muted); font-size: 12px; margin-top: 3px;
  font-style: italic;
}
table.mtx td { font-size: 13px; }
table.mtx td.lyr { width: auto; white-space: normal; min-width: 190px; }
.mtx-a { color: var(--ink); text-decoration: none; font-weight: 550;
         border-bottom: 1px dotted var(--axis); }
.mtx-a:hover { color: var(--lens); border-bottom-color: var(--lens); }
.bz-dot { cursor: default; }

/* ---- detail header ---- */
.exp-head { display: flex; gap: 22px; align-items: flex-start; }
.exp-head .glyph-lg { flex: none; margin-top: 6px; }
.exp-title h2 {
  font-family: var(--serif); font-size: 26px; font-weight: 600;
  margin: 0 0 6px; line-height: 1.25;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0; }
.chip {
  font-size: 12px; padding: 2px 10px; border-radius: 99px;
  border: 1px solid var(--ring); color: var(--ink-2);
  background: var(--surface);
}
.chip.model { border-color: var(--lens); color: var(--lens); font-weight: 600; }

/* ---- sections ---- */
/* the light table: prose floats on raised paper; data recesses into
   instrument wells (selected purely by payload via :has(), so renderers
   don't need markup changes) */
section.card {
  background: var(--raised); border: 1px solid var(--ring);
  border-radius: 14px; padding: 20px 24px; margin-top: 22px;
  box-shadow: var(--shadow);
}
section.card > h3 {
  margin: 0 0 14px; font-size: 11px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted);
  border-bottom: 1px solid var(--grid); padding-bottom: 8px;
}
section.card:has(.readout-scroll), section.card:has(.chart-wrap),
section.card:has(.params), section.card:has(.scan-cells),
section.card:has([data-f]), section.card:has(table.mtx) {
  background: var(--well); border-color: var(--bezel);
  border-radius: 8px; box-shadow: var(--well-shadow);
}
section.card:has(.readout-scroll) > h3, section.card:has(.chart-wrap) > h3,
section.card:has(.params) > h3, section.card:has(.scan-cells) > h3,
section.card:has([data-f]) > h3, section.card:has(table.mtx) > h3 {
  border-bottom-color: var(--bezel);
}
/* findings themes de-nest: the theme is a band with an etched header,
   only the cards themselves float */
section.card:has(.find-grid) {
  background: transparent; border-color: transparent; box-shadow: none;
  padding: 6px 2px 0; border-radius: 0;
}
section.card:has(.find-grid) > h3 {
  font-size: 12px; color: var(--ink-2);
}
/* comfortable reading measure for generated prose; data stays full-width */
.detail p, .detail li { max-width: 76ch; }
.turn .said { max-width: 76ch; }

/* conversation */
.turn { display: flex; gap: 10px; margin: 8px 0; }
.turn .role {
  flex: none; width: 74px; text-align: right; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  padding-top: 3px;
}
.turn.assistant .role { color: var(--lens); }
.turn .said { white-space: pre-wrap; }
.turn.assistant .said { font-weight: 500; }

/* params */
.params { display: grid; grid-template-columns: max-content 1fr;
          gap: 4px 18px; font-size: 13.5px; }
.params dt { color: var(--muted); }
.params dd { margin: 0; font-family: var(--mono); font-size: 12.5px;
             overflow-wrap: anywhere; }

/* chart */
.chart-wrap { overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px;
          font-size: 12.5px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; }
.viz-tip {
  position: fixed; pointer-events: none; z-index: 40;
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.14); display: none; min-width: 130px;
}
.viz-tip .tl { color: var(--muted); margin-bottom: 4px; }
.viz-tip .row { display: flex; justify-content: space-between; gap: 12px; }
.viz-tip .row b { font-family: var(--mono); font-weight: 500; }
svg text { font-family: var(--sans); }

/* readout table */
.pos-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.pos-tab {
  font: inherit; font-size: 12.5px; padding: 3px 12px; cursor: pointer;
  border-radius: 99px; border: 1px solid var(--ring);
  background: none; color: var(--ink-2);
}
.pos-tab[aria-selected="true"] {
  border-color: var(--lens); color: var(--lens); font-weight: 600;
}
.pos-tab:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.readout-scroll { overflow-x: auto; }
table.readout { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.readout th {
  text-align: left; color: var(--muted); font-weight: 500;
  padding: 3px 10px 3px 0; border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
table.readout td {
  padding: 2.5px 10px 2.5px 0; border-bottom: 1px solid var(--grid);
  vertical-align: top;
}
table.readout tbody tr:hover td { background: var(--lens-soft); }
table.readout td.lyr { color: var(--muted); font-variant-numeric: tabular-nums;
                       white-space: nowrap; width: 46px; }
table.readout tr.model-row td { border-top: 2px solid var(--axis);
                                background: var(--lens-soft); }
.tok {
  font-family: var(--mono); font-size: 11.5px; white-space: pre;
  background: var(--page); border: 1px solid var(--grid);
  border-radius: 5px; padding: 0.5px 5px; margin: 1px 3px 1px 0;
  display: inline-block; color: var(--ink-2);
}
.tok.hit { border-color: var(--lens); color: var(--lens); font-weight: 600; }

/* scan */
.scan-word { margin: 10px 0 2px; }
.scan-word h4 { margin: 0 0 4px; font-size: 13.5px;
                font-family: var(--mono); font-weight: 600; }
.scan-cells { display: flex; flex-wrap: wrap; gap: 5px; }
.cell {
  font-family: var(--mono); font-size: 11.5px;
  border: 1px solid var(--grid); border-radius: 5px; padding: 1px 7px;
  color: var(--ink-2); background: var(--page);
}
.cell b { color: var(--ink); font-weight: 600; }
.cell.strong { border-color: var(--s1); }
.scan-note { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* slice */
details.slice summary {
  cursor: pointer; color: var(--lens); font-weight: 500; font-size: 13.5px;
}
details.slice summary:focus-visible { outline: 2px solid var(--lens); }
details.slice iframe {
  width: 100%; height: 640px; border: 1px solid var(--ring);
  border-radius: 8px; margin-top: 12px; background: #fff;
}

/* Claude's thoughts */
section.thoughts {
  margin-top: 26px; padding: 20px 24px 16px;
  border-left: 3px solid var(--lens);
  background: var(--lens-soft); border-radius: 0 10px 10px 0;
}
section.thoughts > h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--lens);
}
.thoughts-body {
  font-family: var(--serif); font-size: 16px; line-height: 1.65;
  max-width: 62ch;
}
.thoughts-body p { margin: 0 0 12px; }
.thoughts-body code { font-family: var(--mono); font-size: 13px; }
.thoughts-missing { color: var(--muted); font-style: italic;
                    font-family: var(--serif); }

.unit-note {
  margin: 0; font-family: var(--serif); font-size: 15px;
  line-height: 1.55; color: var(--ink-2); max-width: 72ch;
}

/* interim-conclusions essay (#essay) */
article.essay {
  margin: 10px auto 60px; max-width: 68ch;
  padding: 28px 34px 22px;
  border-left: 3px solid var(--lens);
  background: var(--lens-soft); border-radius: 0 10px 10px 0;
}
article.essay .thoughts-body { max-width: none; font-size: 17px; }
article.essay h2 {
  font-family: var(--serif); font-size: 26px; font-weight: 600;
  margin: 0 0 18px;
}
article.essay h3 {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  margin: 26px 0 10px; color: var(--lens);
}

@media (prefers-reduced-motion: no-preference) {
  .exp-link, .pos-tab { transition: background 0.12s, border-color 0.12s; }
}

/* ---- the film (unit 12) ---- */
.film-note { font-size: 13px; color: var(--ink-2); margin: 4px 0 10px; }
.film-sub { font-size: 13px; color: var(--ink-2); margin: 18px 0 6px; font-weight: 600; }
.film-transcript {
  font-family: var(--mono); font-size: 12.5px; line-height: 2;
  margin: 8px 0; max-height: 128px; overflow-y: auto;
}
.ftok {
  display: inline-block; padding: 0 3px; margin: 0 1px; border: 0;
  border-radius: 3px; background: transparent; color: var(--ink);
  font: inherit; cursor: pointer; white-space: pre;
}
.ftok:hover { background: var(--lens-soft); }
.ftok.runway { color: var(--muted); }
.ftok.special { color: var(--muted); font-size: 10.5px; }
.ftok[aria-current] { background: var(--lens); color: var(--page); }
.film-controls { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.film-where { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.film-scroll { position: relative; overflow-x: auto; padding-bottom: 4px; }
.film-playhead {
  position: absolute; top: 0; pointer-events: none;
  outline: 2px solid var(--lens); outline-offset: 0; border-radius: 1px;
}
.film-ranks { font-family: var(--mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.mirror-x { margin: 10px 0; padding: 8px 12px; background: var(--lens-soft); border-radius: 8px; }
.mirror-x summary { cursor: pointer; font-size: 13.5px; }
.mirror-x .said { font-size: 13px; margin-top: 8px; }
.mirror-prompt { margin: 8px 0; }
.mirror-prompt summary { color: var(--muted); font-size: 12px; }
.mono-said { font-family: var(--mono); font-size: 11.5px !important; overflow-x: auto; }
.cast-vol td { background: var(--lens-soft); }
.film-ridge-words .pos-tab[aria-selected="true"] { outline: 2px solid var(--lens); }

/* ---- findings map ---- */
.theme-desc { color: var(--ink-2); font-size: 13.5px; margin: 4px 0 14px; }
.find-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.find-card { background: var(--raised); box-shadow: var(--shadow);
  border: 1px solid var(--ring); border-radius: 12px; padding: 14px 16px;
  background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.find-card h4 { margin: 0; font-size: 14.5px; line-height: 1.35; }
.find-card p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.find-card .chips { margin-top: 4px; }
.chip.rec { text-decoration: none; }
.chip.rec b { font-weight: 600; opacity: 0.65; margin-left: 3px; }
.chip.unitlink { text-decoration: none; color: var(--lens); border-color: var(--lens-soft); }

/* ---- sibling switcher on record pages ---- */
/* header stack rhythm: every row under the title gets the same 8px beat,
   and every chip — span, link, or button — sits on the same 24px line */
.exp-title .chips { margin-top: 8px; }
.exp-title .chips .chip { display: inline-flex; align-items: center; min-height: 24px; }
.sibs { margin-top: 0; align-items: center; }
.sibs-label { color: var(--muted); font-size: 12px; margin-right: 2px; line-height: 24px; }
.pin-row { align-items: center; }
.chip.pin, button.chip { min-height: 24px; padding-top: 0; padding-bottom: 0; }
.chip.sib { text-decoration: none; }
.chip.sib.cmp { color: var(--lens); }

/* ---- compare view ---- */
/* compare: subgrid row-aligns the paired sections across columns (head /
   conversation / thoughts / link / film), so matched cards top-align and
   stretch to equal height. Browsers without subgrid degrade to per-column
   stacking in the same order. */
.cmp-grid {
  display: grid; column-gap: 26px; align-items: start;
  grid-template-rows: repeat(5, auto); margin-top: 20px;
}
.cmp-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.cmp-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cmp-col { min-width: 0; display: grid; grid-template-rows: subgrid; grid-row: span 5; }
.cmp-col > .cmp-head { grid-row: 1; }
.cmp-col > section.card:not(.thoughts):not(.film-card) { grid-row: 2; }
.cmp-col > .thoughts { grid-row: 3; }
.cmp-col > .cmp-more { grid-row: 4; align-self: start; }
.cmp-col > .film-card { grid-row: 5; }
@media (max-width: 900px) {
  .cmp-grid.cols-2, .cmp-grid.cols-3 { grid-template-columns: 1fr; grid-template-rows: none; }
  .cmp-col { grid-template-rows: none; grid-row: auto; }
  .cmp-col > * { grid-row: auto !important; }
}
.cmp-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.cmp-head h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.3; }
.cmp-head h3 a { color: inherit; text-decoration: none; }
.cmp-head h3 a:hover { text-decoration: underline; }
.cmp-more { font-size: 13px; }

/* Unit 15 part D — hot-span panel */
.hot-tbl td.delta { font-weight: 600; text-align: center; }
.hot-tbl td.delta.pos { color: var(--good, #2ecc71); }
.hot-tbl td.delta.neg { color: var(--warn, #e67e22); }
.card p.caveat {
  font-size: 0.9em; opacity: 0.82;
  border-left: 2px solid var(--rule, #8884); padding-left: 0.8em;
  margin-top: 0.7em;
}

/* ---- atmosphere: full-page sediment field behind everything ---- */
#atmo { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; }

/* ---- view entry: content fades up on route change ---- */
@keyframes viewin { from { opacity: 0; transform: translateY(4px); } }
.detail > * { animation: viewin 0.22s ease both; }
@media (prefers-reduced-motion: reduce) { .detail > * { animation: none; } }

/* ---- interactive card lift ---- */
.find-card, .ov-card, section.card.board-arc {
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.find-card:hover {
  border-color: color-mix(in srgb, var(--lens) 45%, var(--ring));
  transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
  .find-card, .ov-card, section.card.board-arc { transition: none; }
  .find-card:hover { transform: none; }
}

/* ---- lab console (gear, bottom right) ---- */
.console-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--ring); background: var(--surface);
  color: var(--ink-2); font-size: 17px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
}
.console-fab:hover { color: var(--lens); border-color: var(--lens); }
.console-fab:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.console {
  position: fixed; right: 18px; bottom: 66px; z-index: 60;
  width: min(280px, calc(100vw - 36px));
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: 12px; padding: 14px 16px 16px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.26);
}
.console-head { display: flex; align-items: center; justify-content: space-between; }
.console-head h4 {
  margin: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
}
.console-x {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 13px; padding: 2px 4px; border-radius: 5px;
}
.console-x:hover { color: var(--ink); }
.console-sec { margin-top: 12px; }
.console-sec h5 {
  margin: 0 0 6px; font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2);
}
.con-note { margin: -2px 0 8px; font-size: 11.5px; color: var(--muted); max-width: none; }
.console-row { display: flex; gap: 6px; }
.console-row button {
  font: inherit; font-size: 12px; padding: 3px 12px; cursor: pointer;
  border-radius: 99px; border: 1px solid var(--ring);
  background: none; color: var(--ink-2);
}
.console-row button[aria-pressed="true"] {
  border-color: var(--lens); color: var(--lens); font-weight: 600;
  background: var(--lens-soft);
}
.console-row button:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.con-slider {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  font-size: 12px; color: var(--ink-2);
}
.con-slider input { flex: 1 1 auto; accent-color: var(--lens); }
.con-reroll {
  margin-top: 12px; font: inherit; font-size: 12px; cursor: pointer;
  padding: 4px 12px; border-radius: 99px; border: 1px solid var(--ring);
  background: none; color: var(--ink-2);
}
.con-reroll:hover { border-color: var(--lens); color: var(--lens); }

/* ---- findings hero + card core samples ---- */
.find-hero h2 { font-size: 34px; }
.find-lead {
  font-family: var(--serif); font-size: 18.5px; line-height: 1.5;
  color: var(--ink-2); margin: 6px 0 12px; max-width: 58ch;
}
.find-lead em { color: var(--lens); font-style: italic; }
.find-note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.fc-head { display: flex; gap: 12px; align-items: flex-start; }
.fc-head h4 { margin-top: 0 !important; }
.fc-glyph { flex: none; text-decoration: none; display: inline-flex; margin-top: 2px; }
.fc-glyph:hover .glyph { border-color: var(--lens); }
.fc-glyph:focus-visible { outline: 2px solid var(--lens); outline-offset: 2px; }

/* ---- params as chips ---- */
.pchips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip.pchip {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 8px;
  background: var(--page);
}
.pcode { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.params dd { display: flex; align-items: baseline; }
.params .pnone { color: var(--muted); }

/* ---- pin-to-compare ---- */
button.chip { cursor: pointer; font: inherit; font-size: 12px; }
button.chip:hover { border-color: var(--lens); color: var(--lens); }
button.chip:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.chip.pin.on { border-style: dashed; border-color: var(--lens); color: var(--lens); }

/* ---- masthead: narrow screens ---- */
@media (max-width: 768px) {
  .masthead { padding: 12px 16px 0; }
  .mast-spark { display: none; }
  .masthead-top .masthead-sub { flex: 1 1 100%; order: 3; }
  .theme-toggle { order: 2; }
  .masthead-bottom .stats { display: none; }
  .rail-toggle { margin: 0 0 6px auto; }
}

/* ---- board ---- */
.board-summary {
  color: var(--ink-2); font-size: 13px; margin: 10px 0 0;
  font-family: var(--mono);
}
.board-arc { display: flex; flex-direction: column; gap: 8px; }
.board-arc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.board-arc-head h3 { margin: 0; }
.board-status {
  font-size: 10.5px; padding: 1px 9px; border-radius: 99px;
  border: 1px solid var(--ring); color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.board-status-active { border-color: var(--s2); color: var(--s2); }
.board-status-parked { color: var(--muted); }
.board-status-closed { border-color: var(--axis); color: var(--axis); }
.board-question {
  font-family: var(--serif); font-style: italic; color: var(--muted);
  font-size: 13.5px; line-height: 1.5; margin: -2px 0 6px; max-width: 68ch;
}
.board-items { display: flex; flex-direction: column; }
.board-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px;
  padding: 9px 0; border-top: 1px solid var(--grid);
}
.board-item:first-child { border-top: none; padding-top: 3px; }
.board-item-title {
  margin: 0; font-size: 13.5px; font-weight: 550; color: var(--ink);
  flex: 1 1 220px; min-width: 0;
}
.board-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 10.5px; padding: 2px 9px; border-radius: 99px;
  border: 1px solid var(--ring); color: var(--ink-2);
}
.board-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--dot); }
.state-hunch     { --dot: var(--s5); }
.state-queued    { --dot: var(--s3); }
.state-hot       { --dot: var(--s6); }
.state-landed    { --dot: var(--s2); }
.state-dissolved { --dot: var(--s7); }
.state-parked    { --dot: var(--muted); }
.state-dropped   { --dot: var(--axis); }
.board-note {
  flex: 1 1 100%; margin: 0; font-size: 12.5px; color: var(--muted);
}
.board-note-date { font-family: var(--mono); margin-right: 8px; }
.board-links { flex: none; margin: 0; gap: 6px; }
.chip.board-link { text-decoration: none; }
.chip.board-link:hover { border-color: var(--lens); color: var(--lens); }
@media (max-width: 560px) {
  .board-item { flex-direction: column; align-items: flex-start; gap: 5px; }
  /* flex-basis is a main-axis size — in column mode that's height, so the
     220px width hint from the wide layout must be dropped here or every
     title balloons to 220px tall. */
  .board-item-title { flex: 1 1 auto; }
  .board-links { margin-top: 2px; }
}

/* ---- board novelty (vs published research): ★ novel · ◐ anticipated · ≡ covered ---- */
.nov-novel, .nov-anticipated, .nov-covered {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 10.5px; padding: 1px 8px; border-radius: 99px;
  border: 1px solid var(--ring); color: var(--ink-2);
  font-weight: 500; vertical-align: 2px; white-space: nowrap;
}
.nov-novel       { color: var(--s3); border-color: color-mix(in srgb, var(--s3) 45%, var(--ring)); }
.nov-anticipated { color: var(--ink-2); }
.nov-covered     { color: var(--muted); }
.board-nov { font-size: 12px; }
.board-nov-closest { color: var(--muted); opacity: 0.85; }
.find-card .nov-novel, .find-card .nov-anticipated, .find-card .nov-covered {
  font-size: 10px; vertical-align: 3px;
}

/* ---- base inline links: unstyled <a> in generated prose/tables otherwise
   falls back to browser blue (unreadable on the dark surface) ---- */
a { color: var(--lens); text-decoration-color: color-mix(in srgb, var(--lens) 45%, transparent); }
a:hover { text-decoration-color: var(--lens); }

/* ---- film v2 ---- */
/* ridge chips: smooth color/outline change on select/deselect (colors are
   assigned inline per-word by app.js, selection-order-based) */
.film-ridge-words .pos-tab { transition: border-color 0.12s, color 0.12s; }
/* compare view: sync-playheads toggle sits once above the per-column film
   players */
.film-sync-toggle {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 14px 0 0; font-size: 13px; color: var(--ink-2);
}
.film-sync-toggle input { accent-color: var(--lens); }
.film-sync-hint { color: var(--muted); font-size: 12px; }
/* the film player as a compare column: it should read as a natural
   continuation of that column, not a page-width section */
.cmp-col .film-card { margin-top: 14px; }

/* ---- explorer ---- */
.ex-stats { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }
.ex-controls { display: flex; flex-direction: column; gap: 10px; }
.ex-control-row {
  display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap;
}
.ex-unit-label {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: var(--muted);
}
.ex-unit-label select {
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--ring);
  border-radius: 8px; padding: 4px 8px;
}
.ex-unit-label select:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.ex-count { color: var(--muted); font-size: 12.5px; margin: 14px 0 8px; }

.ex-table .ex-id { font-family: var(--mono); font-size: 12px; }
.ex-table .ex-id a { text-decoration: none; }
.ex-table tbody tr { cursor: pointer; }
.ex-table .glyph { vertical-align: middle; }
.ex-sort-btn {
  font: inherit; font-size: inherit; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer; padding: 0;
  white-space: nowrap;
}
.ex-sort-btn:hover { color: var(--lens); }
.ex-sort-btn:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
th[aria-sort="ascending"] .ex-sort-btn,
th[aria-sort="descending"] .ex-sort-btn { color: var(--lens); font-weight: 600; }
.ex-badges { white-space: nowrap; }
.ex-badge { margin-right: 5px; color: var(--lens); }

.ex-matrix th, .ex-matrix td { vertical-align: top; }
.ex-mtx-unit { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; padding-right: 14px; }
.ex-mtx-cell { min-width: 160px; }
.ex-mtx-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.ex-mtx-glyph { display: inline-flex; text-decoration: none; }
.ex-mtx-glyph:hover .glyph { border-color: var(--lens); }
.ex-mtx-empty { color: var(--muted); text-align: center; }

/* ---- tour + funnel ---- */

/* landing funnel: three quiet doors between the lead paragraph and the
   headline-count chips on the findings map — deliberately understated,
   not another call-to-action row */
.door-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 2px;
}
.door {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 99px; border: 1px solid var(--grid);
  color: var(--ink-2); font-size: 13px; text-decoration: none;
  background: var(--surface);
}
.door:hover, .door:focus-visible {
  border-color: var(--lens); color: var(--lens);
  text-decoration-color: transparent;
}
.door:focus-visible { outline: 2px solid var(--lens); outline-offset: 2px; }
.door-arrow { color: var(--muted); }
.door:hover .door-arrow, .door:focus-visible .door-arrow { color: var(--lens); }

/* guided tour: a small floating card, bottom-center, that never blocks the
   page underneath (no backdrop/modal — see maybeTour() in app.js) */
.tour-card {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 61; width: min(380px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--grid); border-radius: 12px;
  padding: 14px 16px 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.tour-card:focus { outline: none; }
.tour-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.tour-body { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.tour-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
}
.tour-dots { display: flex; gap: 5px; }
.tour-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--grid);
}
.tour-dot.on { background: var(--lens); }
.tour-n { font-size: 11px; color: var(--muted); margin-right: auto; }
.tour-btns { display: flex; gap: 8px; }
.tour-btns button {
  font: inherit; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--grid); background: transparent; color: var(--ink-2);
  border-radius: 7px; padding: 5px 10px;
}
.tour-btns button:hover { border-color: var(--lens); color: var(--lens); }
.tour-btns button:focus-visible { outline: 2px solid var(--lens); outline-offset: 1px; }
.tour-btns .tour-primary {
  background: var(--lens); border-color: var(--lens); color: var(--surface);
  font-weight: 600;
}
.tour-btns .tour-primary:hover { opacity: 0.9; color: var(--surface); }

/* the highlighted target during an active tour step */
.tour-highlight {
  outline: 2px solid var(--lens); outline-offset: 3px; border-radius: 6px;
  animation: tour-pulse 1.6s ease-in-out infinite;
}
@keyframes tour-pulse {
  0%, 100% { outline-color: var(--lens); }
  50% { outline-color: color-mix(in srgb, var(--lens) 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .tour-highlight { animation: none; }
}

/* ---- explorer results sit in an instrument well (integration polish) ---- */
#ex-results {
  background: var(--well); border: 1px solid var(--bezel);
  border-radius: 8px; box-shadow: var(--well-shadow);
  padding: 6px 14px 10px; margin-top: 6px;
}

/* screenshot mode (?theme=): entry animations off for deterministic captures */
.no-anim .detail > * { animation: none; }

/* ---- the actual headliners: novelty-★ cards wear a gold spine ---- */
.find-card.novel { box-shadow: inset 3px 0 0 var(--s3), var(--shadow); }
