/* kernspace · the studio. The proofing desk: the sheet is the hero, framed by crop marks and rulers in real
   pixels; the chrome is black and white so the four inks carry all the color, and every sheet lies on a neutral grey
   tile, never on the page. The blue pencil marks everything that is annotation: selection, focus, guides, explanations.
   DESIGN.md explains the tokens and the components. No inline styles anywhere: the CSP allows only this file. */

@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader/Newsreader-Variable.ttf") format("truetype"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader/Newsreader-Italic-Variable.ttf") format("truetype"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono/JetBrainsMono-Variable.ttf") format("truetype"); font-weight: 100 800; font-display: swap; }
/* the families the sheets name, for the live proof in the word editor (fonts from here reach its shadow root) */
@font-face { font-family: "KNunito"; src: url("../fonts/nunito/Nunito-Variable.ttf") format("truetype"); font-weight: 200 1000; font-display: block; }
@font-face { font-family: "KMono"; src: url("../fonts/jetbrains-mono/JetBrainsMono-Variable.ttf") format("truetype"); font-weight: 100 800; font-display: block; }

:root {
  /* dark first: black, with the near-black tile every sheet lies on */
  --desk: #000000;          /* page ground */
  --well: #1D1D1F;          /* the tile a sheet lies on: neutral grey, never the page */
  --raised: #1D1D1F;        /* controls, keycaps, slips */
  --hair: #424245;          /* hairlines */
  --control: #6E6E73;       /* input and track edges, 3:1 */
  --ink: #F5F5F7;           /* text, primary button */
  --ink-2: #A1A1A6;
  --ink-3: #86868B;
  --on-ink: #000000;
  --pencil: #2997FF;        /* the blue pencil: annotation only */
  --pencil-wash: rgba(41, 151, 255, .16);
  --pencil-sheet: #8FD6E4;  /* drawn over sheets, same in both themes */
  --rubric: #FF453A;        /* the red pencil: errors */
  --tape: rgba(245, 245, 247, .08);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 40px 80px -40px rgba(0, 0, 0, .85), 0 12px 24px -16px rgba(0, 0, 0, .6);
  --thumb-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .05);

  --voice: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-12: 12px; --t-13: 13px; --t-15: 15px; --t-17: 17px; --t-21: 21px; --t-28: 28px; --t-40: 40px; --t-56: 56px;
  --gutter: 32px;
  --pad-l: max(var(--gutter), env(safe-area-inset-left, 0px)); --pad-r: max(var(--gutter), env(safe-area-inset-right, 0px));   /* notches in landscape */
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --desk: #FFFFFF; --well: #F5F5F7; --raised: #FFFFFF; --hair: #D2D2D7; --control: #86868B;
    --ink: #1D1D1F; --ink-2: #424245; --ink-3: #6E6E73; --on-ink: #FFFFFF;
    --pencil: #0066CC; --pencil-wash: rgba(0, 102, 204, .10); --rubric: #E30000; --tape: rgba(29, 29, 31, .06);
    --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 34px 60px -34px rgba(0, 0, 0, .28), 0 10px 20px -14px rgba(0, 0, 0, .18);
    --thumb-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .06);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --desk: #FFFFFF; --well: #F5F5F7; --raised: #FFFFFF; --hair: #D2D2D7; --control: #86868B;
  --ink: #1D1D1F; --ink-2: #424245; --ink-3: #6E6E73; --on-ink: #FFFFFF;
  --pencil: #0066CC; --pencil-wash: rgba(0, 102, 204, .10); --rubric: #E30000; --tape: rgba(29, 29, 31, .06);
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 34px 60px -34px rgba(0, 0, 0, .28), 0 10px 20px -14px rgba(0, 0, 0, .18);
  --thumb-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px)); }
@media (min-width: 861px) { html { scroll-padding-bottom: 44px; } }   /* a focused bottom-row control keeps room for its tip below (8px gap, 26px tip) */
body {
  margin: 0; overflow-x: clip;   /* safety net: a hidden tip must never widen the page (clip keeps sticky working) */
  background: var(--desk);
  color: var(--ink);
  font: 400 var(--t-17)/1.5 var(--voice);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration-color: var(--control); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--pencil); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; border-radius: 4px; }
.mono { font-family: var(--data); font-variant-ligatures: none; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--ink); color: var(--on-ink); border-radius: 8px; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: var(--pad-l) var(--pad-r); }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--desk) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hair);
}
.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 24px; height: 24px; flex: none; }
.brand .mark-tb { stroke: var(--pencil); fill: none; }
.word { font: 560 var(--t-21)/1 var(--voice); letter-spacing: -.012em; }
.nav { display: flex; gap: 4px; margin-left: 20px; }
.nav a { padding: 8px 12px; border-radius: 8px; font-size: var(--t-15); color: var(--ink-2); text-decoration: none; transition: color .15s, background-color .15s; }
@media (hover: hover) { .nav a:hover { color: var(--ink); background: var(--tape); } }
.top-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: color .15s, background-color .15s;
}
@media (hover: hover) { .icon-btn:hover { color: var(--ink); background: var(--tape); } }
.icon-btn:disabled { opacity: .35; cursor: default; color: var(--ink-2); background: transparent; }
.icon-btn svg { width: 19px; height: 19px; }
/* the one tooltip: data-tip on the control (or its label), shown on a fine pointer's hover, on keyboard focus and on a touch/pen long-press (~500ms, without firing the control); a plain tap never shows it. Below by default; end/start/up keep it inside the viewport */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); content: attr(data-tip) / ""; position: absolute; z-index: 60; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 6px 10px; border-radius: 7px; background: var(--ink); color: var(--on-ink);
  font: 500 var(--t-12)/1.2 var(--voice); letter-spacing: 0; text-align: left; white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
[data-tip]:focus-visible::after, [data-tip]:has(input:focus-visible)::after { opacity: 1; visibility: visible; }
[data-tip].tip-on::after { opacity: 1; visibility: visible; }   /* a touch long-press (main.js) */
@media (pointer: coarse) { [data-tip] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } }   /* no callout or selection loupe on the hold */
@media (hover: hover) and (pointer: fine) { [data-tip]:hover::after { opacity: 1; visibility: visible; transition-delay: .35s; } }
.top-tools [data-tip]::after, .stage-tools .btn[data-tip]::after, .edit-tools .btn[data-tip]::after, #dl-pack::after, .edit-bar .btn::after { left: auto; right: 0; transform: none; }
.series-switch label:first-child::after, .stage-tools .switch::after, .ep-bad::after, .ep-tools .icon-btn:first-child::after, #dl-png::after { left: 0; right: auto; transform: none; }
.use-series::after { left: 0; right: auto; transform: none; }
.vol-nav .icon-btn:last-child::after, #whole::after, .ep-hist .icon-btn:last-child::after { left: auto; right: 0; transform: none; }
#eb-prev::after { left: 0; right: auto; transform: none; }
.acts [data-tip]::after { top: auto; bottom: calc(100% + 8px); }
@media (min-width: 861px) { .acts [data-tip]::after { top: calc(100% + 8px); bottom: auto; } }
.theme-moon { display: none; }
:root[data-theme="light"] .theme-sun { display: none; }
:root[data-theme="light"] .theme-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-moon { display: block; }
}

/* tape: the finding chips of the sheet, reused as tags */
.tape {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--tape); color: var(--ink-2);
  font: 500 11.5px/1.1 var(--data); letter-spacing: .01em; white-space: nowrap;
}
[data-version]:empty { visibility: hidden; }   /* until version.json arrives */
.tape-pencil { background: transparent; color: var(--pencil); box-shadow: inset 0 0 0 1px var(--pencil); }
.tape i { width: 14px; height: 5px; border-radius: 3px; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 1px rgba(130, 130, 130, .28); flex: none; }

/* ---------- intro */
.intro .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 46ch); align-items: end; gap: 16px 48px; padding-block: 44px 28px; }
.intro h1 { font-size: var(--t-56); line-height: 1.02; letter-spacing: -.022em; }
.intro p { color: var(--ink-2); font-size: var(--t-17); }
.intro .aside { display: block; margin-top: 8px; color: var(--ink-3); font-style: italic; }

/* ---------- studio */
.studio .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) 344px;
  grid-template-areas: "stage insp" "stage acts"; grid-template-rows: auto 1fr;
  gap: 0 44px; padding-bottom: 40px;
}
.stage-col { grid-area: stage; display: flex; flex-direction: column; min-width: 0; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.series-now { display: flex; align-items: center; gap: 6px 16px; min-width: 0; font-size: var(--t-15); color: var(--ink-2); }
.series-meta { display: flex; align-items: baseline; gap: 10px; }
/* the series switch: a segmented group without the well. JS sets --n, one option per series, each with its own glyph */
.seg.series-switch { --n: 4; display: inline-grid; padding: 0; background: none; box-shadow: none; }
.seg.series-switch::before { top: 0; bottom: 0; left: 0; width: calc(100% / var(--n)); }
.seg.series-switch .opt { flex-direction: row; gap: 8px; padding: 5px 14px; line-height: 1.3; }
.series-switch svg { width: 16px; height: 16px; flex: none; }

.stage {
  position: relative; display: grid; place-items: center;
  height: var(--stage-h, 560px);
  padding: 66px 36px 32px 88px;
  background: var(--well); border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--hair);
  overflow: hidden;
}
.sheet {
  --w: 800px; --h: 450px;
  position: relative; width: var(--w); height: var(--h); max-width: 100%;
  container-type: inline-size;
  transition: width .42s var(--ease), height .42s var(--ease), border-radius .42s var(--ease);
}
.sheet > img, .read-fig img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  box-shadow: var(--shadow); background: var(--raised);
  transition: opacity .2s ease, filter .25s ease;
}
.sheet > img.is-swapping { opacity: .55; }
/* crop marks: the trim, drawn just outside each corner */
.crop { position: absolute; width: 0; height: 0; pointer-events: none; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--ink-3); animation: draw .5s var(--ease) both; animation-delay: var(--d, 0s); }
.crop::before { width: 14px; height: 1px; top: -.5px; }
.crop::after { width: 1px; height: 14px; left: -.5px; }
.crop.tl { left: 0; top: 0; } .crop.tl::before { right: 8px; transform-origin: 100% 0; } .crop.tl::after { bottom: 8px; transform-origin: 0 100%; }
.crop.tr { right: 0; top: 0; --d: .08s; } .crop.tr::before { left: 8px; transform-origin: 0 0; } .crop.tr::after { bottom: 8px; transform-origin: 0 100%; }
.crop.bl { left: 0; bottom: 0; --d: .16s; } .crop.bl::before { right: 8px; transform-origin: 100% 0; } .crop.bl::after { top: 8px; transform-origin: 0 0; }
.crop.br { right: 0; bottom: 0; --d: .24s; } .crop.br::before { left: 8px; transform-origin: 0 0; } .crop.br::after { top: 8px; transform-origin: 0 0; }
@keyframes draw { from { transform: scale(0); } }
/* rulers in real output pixels */
.ruler { position: absolute; pointer-events: none; color: var(--ink-3); font: 400 10px/1 var(--data); font-variant-numeric: tabular-nums; animation: rise .6s .2s var(--ease) both; }
.ruler-x { left: 0; right: 0; top: -40px; height: 8px; border-bottom: 1px solid var(--hair);
  background: linear-gradient(90deg, var(--control) 1px, transparent 1px) 0 100% / calc(100% / 40) 4px repeat-x; }
.ruler-y { top: 0; bottom: 0; left: -42px; width: 8px; border-right: 1px solid var(--hair);
  background: linear-gradient(var(--control) 1px, transparent 1px) 100% 0 / 4px calc(100% / 20) repeat-y; }
.ruler span { position: absolute; }
.ruler-x span { bottom: 12px; transform: translateX(-50%); }
.ruler-x span:first-child { transform: none; } .ruler-x span:last-child { transform: translateX(-100%); }
.ruler-y span { right: 12px; transform: translateY(-50%); }
.ruler-y span:first-child { transform: none; } .ruler-y span:last-child { transform: translateY(-100%); }
@keyframes rise { from { opacity: 0; } }

/* on-screen context: a generic menu bar, dock and desktop icons, or a lock screen with a notification */
.ctx { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s ease; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.stage[data-view="screen"] .ctx { opacity: 1; }
.stage[data-view="screen"] .crop { opacity: 0; }
.ctx-desk, .ctx-phone { position: absolute; inset: 0; display: none; }
.sheet[data-format="desktop"] .ctx-desk, .sheet[data-format="wide"] .ctx-desk { display: block; }
.sheet[data-format="phone"] .ctx-phone { display: block; }
.menubar {
  position: absolute; left: 0; right: 0; top: 0; height: 2.6%;
  display: flex; align-items: center; gap: .9cqw; padding-inline: 1.2cqw;
  background: rgba(18, 18, 18, .38); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 1.05cqw; font-weight: 500;
}
.menubar i { display: block; height: .55cqw; border-radius: 1cqw; background: currentColor; opacity: .8; }
.menubar i:nth-child(1) { width: 1.1cqw; } .menubar i:nth-child(2) { width: 3.4cqw; } .menubar i:nth-child(3) { width: 2.2cqw; }
.menubar i:nth-child(4) { width: 2.6cqw; } .menubar i:nth-child(5) { width: 2.9cqw; }
.menubar .clock { margin-left: auto; letter-spacing: .01em; }
.dock {
  position: absolute; left: 50%; bottom: 1.1%; transform: translateX(-50%);
  display: flex; gap: .7cqw; padding: .7cqw; border-radius: 1.8cqw;
  background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.dock i { width: 3.6cqw; aspect-ratio: 1; border-radius: .95cqw; background: rgba(255, 255, 255, .28); }
.dock i:nth-child(3n) { background: rgba(255, 255, 255, .42); }
.dock i:nth-child(4n+1) { background: rgba(255, 255, 255, .2); }
/* approximate positions, in sheet px, to refine from a device screenshot: the macOS icon column at 2x scaling (x 3600-3800, first tile at y 150, pitch 232);
   the iOS collapsed notification stack (card x 48-1242, y 2215-2435, two peeks to y 2470) */
.icons { position: absolute; top: 3.906cqw; right: 1.042cqw; width: 5.208cqw; display: flex; flex-direction: column; align-items: center; gap: 1.875cqw; }
.icons span { display: flex; flex-direction: column; align-items: center; gap: .365cqw; }
.icons i { width: 3.333cqw; aspect-ratio: 1; border-radius: .87cqw; background: rgba(255, 255, 255, .28); }
.icons span:nth-child(3n) i { background: rgba(255, 255, 255, .42); }
.icons span:nth-child(4n+1) i { background: rgba(255, 255, 255, .2); }
.icons b { width: 3.906cqw; height: .469cqw; border-radius: 1cqw; background: currentColor; opacity: .8; }
.icons span:nth-child(even) b { width: 3.1cqw; }
.ctx-phone { color: var(--lock, #fff); text-align: center; }
.island { position: absolute; left: 50%; top: 1.3%; width: 29%; height: 3.2%; transform: translateX(-50%); border-radius: 99px; background: #000; }
.lock-date { position: absolute; left: 0; right: 0; top: 11.5%; font-size: 4.6cqw; font-weight: 600; opacity: .9; }
.lock-time { position: absolute; left: 0; right: 0; top: 13.4%; font-size: 23cqw; font-weight: 650; letter-spacing: -.02em; line-height: 1; }
.notif, .peek { position: absolute; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.notif { left: 3.721cqw; width: 92.558cqw; top: 171.705cqw; height: 17.054cqw; border-radius: 4.651cqw; padding-inline: 5cqw; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1.5cqw; }
.notif i { display: block; height: 1.2cqw; border-radius: 1cqw; background: currentColor; opacity: .8; }
.notif i:nth-child(1) { width: 24cqw; } .notif i:nth-child(2) { width: 62cqw; opacity: .6; } .notif i:nth-child(3) { width: 44cqw; opacity: .6; }
.peek { height: 1.86cqw; border-radius: 0 0 1.5cqw 1.5cqw; }
.peek.p1 { left: 6.822cqw; width: 86.357cqw; top: 188.217cqw; }
.peek.p2 { left: 9.922cqw; width: 80.155cqw; top: 189.612cqw; }
.lock-btn { position: absolute; bottom: 3.6%; width: 12.5cqw; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: rgba(19, 19, 19, .38); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; }
.lock-btn svg { width: 45%; height: 45%; }
.lock-btn.l { left: 10%; } .lock-btn.r { right: 10%; }
.stage[data-view="screen"] .sheet[data-format="phone"] { border-radius: calc(var(--w) * .13); }
.stage[data-view="screen"] .sheet[data-format="phone"] > img { border-radius: inherit; box-shadow: 0 0 0 5px #0B0B0B, 0 0 0 6px var(--control), var(--shadow); }
.stage[data-view="screen"] .sheet[data-format="phone"] .ruler { opacity: 0; }

.slug-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-top: 12px; }
.slug { min-width: 0; font: 400 var(--t-12)/1.5 var(--data); color: var(--ink-2); overflow-wrap: anywhere; font-variant-ligatures: none; }
.slug .dim { color: var(--ink-3); }
.hint-keys { display: flex; align-items: center; gap: 6px; font-size: var(--t-13); color: var(--ink-3); white-space: nowrap; }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  font: 500 11px/1 var(--data); color: var(--ink-2);
  background: var(--raised); border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--hair), 0 1px 0 var(--hair);
}

/* filmstrip of volumes */
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 14px;
  margin: 18px -6px 0; padding: 8px 54px 10px 6px;   /* end padding clears the 48px fade */
  overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scroll-padding-inline: 6px 48px;
  scrollbar-width: thin; scrollbar-color: var(--hair) transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  border: 0; min-width: 0;
}
.pick { position: relative; display: block; cursor: pointer; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.frame { scroll-snap-align: start; }
.frame .face { position: relative; display: block; }
.frame img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 2px; box-shadow: var(--thumb-shadow); background: var(--raised); transition: transform .2s var(--ease); }
@media (hover: hover) { .frame:hover img { transform: translateY(-2px); } }
.frame .cap { display: flex; align-items: baseline; gap: 7px; margin-top: 8px; font-size: var(--t-15); color: var(--ink-2); line-height: 1.2; }
.frame .cap .mono { font-size: 11px; color: var(--ink-3); }
.frame input:checked ~ .cap { color: var(--ink); }
.frame input:focus-visible ~ .face { outline: 2px solid var(--pencil); outline-offset: 5px; border-radius: 3px; }

/* registration brackets: the one selection mark, in pencil. Choices among peers (.seg) move one bracket to the next option;
   a card or a swatch draws its own. The ghost on .opt::after is the hover preview. */
.bracket::after, .seg::before, .seg .opt::after {
  --b: 1.5px; --l: 10px; --c: var(--pencil);
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--b), linear-gradient(var(--c), var(--c)) top left / var(--b) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--b), linear-gradient(var(--c), var(--c)) top right / var(--b) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--b), linear-gradient(var(--c), var(--c)) bottom left / var(--b) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--b), linear-gradient(var(--c), var(--c)) bottom right / var(--b) var(--l);
  background-repeat: no-repeat;
}
.bracket::after { content: ""; position: absolute; inset: var(--bi, -6px); pointer-events: none; opacity: 0; transform: scale(1.08); transition: opacity .16s ease, transform .22s var(--ease); }
input:checked ~ .bracket::after, input:checked + .bracket::after { opacity: 1; transform: none; }

/* ---------- inspector */
.insp { grid-area: insp; display: flex; flex-direction: column; gap: 26px; min-width: 0; padding-top: 4px; }
.vol-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vol-no { font-size: var(--t-15); color: var(--ink-3); }
.vol-no .mono { font-size: var(--t-13); color: var(--ink-2); }
.vol-nav { display: flex; gap: 4px; }
.vol-nav .icon-btn { width: 36px; height: 36px; box-shadow: inset 0 0 0 1px var(--hair); }
.vol-name { margin-top: 6px; font-size: var(--t-56); line-height: 1; letter-spacing: -.025em; }
.vol-line { margin-top: 12px; color: var(--ink-2); font-size: var(--t-17); }
.vol-line em { color: var(--ink); }
.findings { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }

.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 0; font-size: var(--t-15); font-weight: 560; }
.field-head .val { font-weight: 400; color: var(--ink-2); }

/* drawdown: every ink against every ground, one click picks both */
.drawdown { display: grid; grid-template-columns: 44px repeat(4, minmax(0, 1fr)); gap: 6px 8px; align-items: center; }
.dd-ink { font-size: var(--t-13); color: var(--ink-3); text-align: center; padding-bottom: 2px; }
.dd-ink.on { color: var(--ink); }
.dd-row { font-size: var(--t-13); color: var(--ink-3); line-height: 1.1; }
.dd-row small { display: block; font: 400 10px/1.3 var(--data); color: var(--pencil); }
.cell { display: block; }
.cell .chip {
  position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 3px;
  background:
    linear-gradient(to bottom right, transparent calc(50% - .8px), var(--fg) calc(50% - .8px), var(--fg) calc(50% + .8px), transparent calc(50% + .8px)),
    repeating-linear-gradient(90deg, var(--tb) 0 4px, transparent 4px 7px) 0 38% / 100% 1px no-repeat,
    var(--bg);
  box-shadow: inset 0 0 0 1px rgba(130, 130, 130, .22);
  transition: transform .15s var(--ease);
}
.cell .chip::before { content: ""; position: absolute; right: 14%; top: 16%; width: 30%; height: 4px; border-radius: 2px; background: var(--c1); }
@media (hover: hover) { .cell:hover .chip { transform: translateY(-1px); } }
.cell input:focus-visible + .chip { outline: 2px solid var(--pencil); outline-offset: 4px; }
.picked { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.picked b { font-size: var(--t-21); font-weight: 500; letter-spacing: -.01em; }
.picked .mono { font-size: var(--t-12); color: var(--ink-3); }
.picked p { grid-column: 1 / -1; color: var(--ink-2); font-size: var(--t-15); line-height: 1.45; }

/* segmented controls with a sliding thumb */
.seg {
  --n: 3; --i: 0;
  position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  padding: 3px; border-radius: 11px; background: var(--well); box-shadow: inset 0 0 0 1px var(--hair);
}
.seg::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); pointer-events: none;
  transform: translateX(calc(var(--i) * 100%)); transition: transform .3s var(--ease);
}
.seg:has(> label:nth-child(2) input:checked) { --i: 1; }
.seg:has(> label:nth-child(3) input:checked) { --i: 2; }
.seg:has(> label:nth-child(4) input:checked) { --i: 3; }
.seg > label { position: relative; z-index: 1; display: flex; cursor: pointer; }
.seg > label:is(:hover, :has(input:focus-visible)) { z-index: 7; }   /* its tip clears the sticky stage in the narrow editor */
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg .opt { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 9px; border-radius: 2px; color: var(--ink-2); text-align: center; transition: color .2s; }
.seg .opt::after { content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .15s; }
@media (hover: hover) { .seg label:hover input:not(:checked) + .opt::after { opacity: .4; } .seg label:hover .opt { color: var(--ink); } }
.seg input:checked + .opt { color: var(--ink); }
.seg input:focus-visible + .opt { outline: 2px solid var(--pencil); outline-offset: 1px; }
.seg .opt small { font: 400 10.5px/1 var(--data); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg .opt .name { font-size: var(--t-15); line-height: 1.1; }
.fmt { display: block; height: 18px; border: 1.5px solid currentColor; border-radius: 3px; margin-bottom: 4px; }
.fmt.d { width: 32px; } .fmt.w { width: 29px; } .fmt.p { width: 10px; border-radius: 2.5px; }

/* a plain switch, no visible label ("On screen" is its name and tooltip): the sheet slides along a ruler. Off shows the sheet alone; on shows it on a screen. Pencil marks the on state, as on the pressed icon buttons */
.switch { display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .track {
  position: relative; flex: none; width: 46px; height: 26px; border-radius: 4px; background-color: var(--well); box-shadow: inset 0 0 0 1px var(--control);
  background-image: linear-gradient(90deg, var(--control) 1px, transparent 1px); background-size: 6px 4px; background-position: 3px 100%; background-repeat: repeat-x;
  transition: background-color .2s, box-shadow .2s;
}
.switch .track i { position: absolute; top: 4px; left: 4px; width: 20px; height: 14px; border-radius: 2px; background: var(--ink-3); transition: transform .3s var(--ease), background-color .2s; }
.switch input:checked + .track { background-color: var(--pencil-wash); box-shadow: inset 0 0 0 1px var(--pencil); }
.switch input:checked + .track i { transform: translateX(18px); background: var(--pencil); }
.switch input:focus-visible + .track { outline: 2px solid var(--pencil); outline-offset: 3px; }
/* the finish picker, the last row of Ink and ground on the drawdown's grid: Finish in its 44px name column, None or a
   family, then that family's stocks in a bare group, so the family keeps the well, one bracket sliding in each; the note;
   then, while a finish is on, the sheet at full size */
.finish { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 16px; }
.finish-name { font-size: var(--t-13); color: var(--ink-3); line-height: 1.1; }
.finish .seg { grid-column: 2; }
.finish .opt { min-width: 0; padding-inline: 0; }
.finish .opt .name { white-space: nowrap; }   /* each stock keeps one line */
/* the bare group keeps the family's 3px sides and its bracket's left and width, so both rows share column edges */
.seg.stock { padding-block: 0; background: none; box-shadow: none; }
.seg.stock::before { top: 0; bottom: 0; }
.seg.stock .opt { padding-block: 7px 6px; }
.seg.stock.fresh::before { transition: none; }   /* a new family's stocks: the bracket lands, it doesn't slide over the new names */
/* the note, over every finish's note stacked unseen in the same cell (main.js): as tall as the longest at any width */
.finish-say, .loupe { grid-column: 1 / -1; }
.finish-say { display: grid; }
.finish-say > *, .finish-size > * { grid-area: 1 / 1; }
.finish-size { display: grid; visibility: hidden; }
.finish .note { margin-top: 0; }
.finish .note span { display: block; }
/* one canvas pixel to each screen pixel: main.js sizes the canvas from this box and the pixel ratio. It dims while it shows
   an older sheet than the stage, after a beat, so a quick redraw doesn't flicker */
.loupe { margin: 2px 0 0; }
.loupe canvas { display: block; width: 100%; height: 112px; border-radius: 2px; background: var(--well); box-shadow: var(--thumb-shadow); image-rendering: pixelated; transition: opacity .2s ease; }
.loupe[aria-busy="true"] canvas { opacity: .55; transition-delay: .5s; }
.loupe figcaption { margin-top: 6px; font-size: var(--t-12); color: var(--ink-3); }

/* whoami: the handle and the whoami line, laid out as the sheet's box draws them */
.who {
  padding: 11px 14px 12px; background: var(--raised); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--control);
  font-family: var(--data); font-variant-ligatures: none; transition: box-shadow .15s;
}
.who:focus-within { box-shadow: inset 0 0 0 1px var(--pencil), 0 0 0 3px var(--pencil-wash); }
.who.bad { box-shadow: inset 0 0 0 1px var(--rubric); }
.who-prompt { display: block; font-size: var(--t-13); color: var(--ink-3); }
.who-row { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.who input {
  min-width: 0; height: 34px; padding: 0; border: 0; border-bottom: 1px dashed var(--control); border-radius: 0;
  background: transparent; color: var(--ink); font: 400 16px/1 var(--data); outline: none;
}
.who input::placeholder { color: var(--ink-3); opacity: 1; }
.who input:focus-visible { border-bottom: 1px solid var(--pencil); }
.who input[aria-invalid="true"] { border-bottom-color: var(--rubric); }
.who .h { flex: 0 1 11ch; field-sizing: content; min-width: 6ch; max-width: 21ch; }
.who .m { flex: 1 1 auto; }
.who-dot { color: var(--ink-3); }
.note { margin-top: 8px; font-size: var(--t-13); color: var(--ink-3); line-height: 1.4; }
.note.err { color: var(--rubric); }
.need { grid-column: 1 / -1; font-size: var(--t-13); color: var(--ink-2); }

/* actions */
.acts { grid-area: acts; align-self: start; display: grid; grid-template-columns: 1fr auto auto; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 50px; padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer;
  font: 600 var(--t-17)/1 var(--voice); letter-spacing: -.005em;
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--control);
  transition: transform .12s var(--ease), background-color .15s, box-shadow .15s, opacity .15s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
@media (hover: hover) { .btn:hover { box-shadow: inset 0 0 0 1px var(--ink-2); } }
.btn:active { transform: scale(.98); }
.btn-ink { background: var(--ink); color: var(--on-ink); box-shadow: none; }
@media (hover: hover) { .btn-ink:hover { box-shadow: none; background: color-mix(in srgb, var(--ink) 88%, var(--pencil)); } }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: .7; }   /* the cue that survives reduced motion */
.btn[aria-busy="true"] .dl { animation: nudge .9s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateY(2px); } }
.fine { grid-column: 1 / -1; font-size: var(--t-13); color: var(--ink-3); }

/* ---------- sections */
.sec { border-top: 1px solid var(--hair); }
.sec > .wrap { padding-block: 88px; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 52ch); gap: 12px 48px; align-items: end; margin-bottom: 44px; }
.sec-head h2 { font-size: var(--t-40); line-height: 1.05; letter-spacing: -.02em; }
.sec-head p { color: var(--ink-2); }

/* read the mat */
.read-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 48px; align-items: start; }
.read-fig { position: sticky; top: 92px; margin: 0; aspect-ratio: 16 / 9; max-width: 100%; container-type: inline-size; }
.read-fig img { box-shadow: 0 0 0 10px var(--well), var(--shadow); }   /* the tile as a spread, so the key's marks stay on the sheet */
.read-fig img.dim { filter: brightness(.48) saturate(.6); }
.read-fig svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mk { fill: rgba(143, 214, 228, .16); stroke: var(--pencil-sheet); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.mk-line { fill: none; stroke: var(--pencil-sheet); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.mk-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pencil .5s var(--ease) forwards; }
@keyframes pencil { to { stroke-dashoffset: 0; } }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  background: #0B0B0B; color: var(--pencil-sheet); box-shadow: inset 0 0 0 1px var(--pencil-sheet);
  font: 500 1.05cqw/1 var(--data); font-size: max(11px, 1.05cqw);
  animation: rise .25s ease both;
}
.legend { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--hair); }
.legend-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; padding: 0 12px 10px; font-size: var(--t-13); color: var(--ink-3); }
.legend button {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start;
  width: 100%; padding: 12px; border: 0; border-bottom: 1px solid var(--hair); background: transparent; text-align: left; cursor: pointer;
  transition: background-color .15s;
}
@media (hover: hover) { .legend button:hover { background: var(--tape); } }
.legend button[aria-current="true"] { background: var(--pencil-wash); }
.legend svg { width: 22px; height: 22px; color: var(--ink-3); margin-top: 1px; }
.legend button[aria-current="true"] svg { color: var(--pencil); }
.legend .term { font-weight: 560; font-size: var(--t-15); line-height: 1.35; }
.legend .mean { color: var(--ink-2); font-size: var(--t-15); line-height: 1.35; }

/* inks */
.ink-rows { display: grid; gap: 0; border-top: 1px solid var(--hair); }
.ink-row { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 32px 48px; padding: 32px 0; border-bottom: 1px solid var(--hair); }
.ink-row h3 { font-size: var(--t-28); letter-spacing: -.015em; line-height: 1.1; }
.ink-row p { margin-top: 8px; color: var(--ink-2); font-size: var(--t-15); max-width: 34ch; }
.grounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.gcard { display: flex; flex-direction: column; gap: 10px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.gcard .face { position: relative; display: block; }
.gcard img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 2px; box-shadow: var(--thumb-shadow); background: var(--raised); transition: transform .2s var(--ease); }
@media (hover: hover) { .gcard:hover img { transform: translateY(-2px); } }
.colorbar { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); height: 10px; border-radius: 1px; overflow: hidden; box-shadow: 0 0 0 1px rgba(130, 130, 130, .2); }
.gmeta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gmeta b { font-size: var(--t-17); font-weight: 560; }
.gmeta .mono { font-size: 11px; color: var(--ink-3); }
.gcard .gnote { font-size: var(--t-13); color: var(--ink-3); line-height: 1.4; }
.gcard .face.bracket { --bi: -7px; }
.gcard[aria-pressed="true"] .face.bracket::after { opacity: 1; transform: none; }

/* series */
.series-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.sheetlet { display: flex; flex-direction: column; gap: 12px; }
.sheetlet .art { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; border-radius: 3px; }
.sheetlet .art img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; box-shadow: var(--thumb-shadow); }
.sheetlet h3 { font-size: var(--t-21); letter-spacing: -.01em; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sheetlet p { color: var(--ink-2); font-size: var(--t-15); line-height: 1.45; }
.sheetlet .origin { color: var(--ink-3); font-style: italic; }
.sheetlet .use-series { align-self: flex-start; margin-top: 4px; }
.sheetlet .art.bracket { --bi: -7px; }
.sheetlet[data-current] .art.bracket::after { opacity: 1; transform: none; }
/* every sheet lies on the tile, never on the page: the strip, the inks and the series take the stage's grey as a mat */
.frame .face, .gcard .face, .sheetlet .art { background: var(--well); padding: clamp(5px, 3%, 10px); border-radius: 6px; }

/* colophon + sign-off */
.colophon .wrap { padding-block: 72px 40px; }
.colo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 220px); gap: 32px 48px; }
.colo-grid h2 { font-size: var(--t-21); font-weight: 560; margin-bottom: 10px; }
.colo-grid p { color: var(--ink-2); font-size: var(--t-15); }
.colo-grid p + p { margin-top: 10px; }
.colo-grid .colo-aside { color: var(--ink-3); font-style: italic; }
.colo-links { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: var(--t-15); }
.signoff { position: relative; margin-top: 96px; padding-top: 44px; font-size: clamp(44px, 9vw, 136px); line-height: .98; letter-spacing: -.035em; font-weight: 380; }
.signoff .line { display: block; }
.signoff .line + .line { color: var(--ink-3); }
.signoff .k { position: relative; }
.signoff .k.n { margin-right: -.06em; }
.signoff .k.m { margin-right: -.045em; }
.kern-mark {
  position: absolute; right: -.035em; top: -.32em; height: 1.36em; width: 0;
  border-left: 1px solid var(--pencil); pointer-events: none;
}
.kern-mark span { position: absolute; top: -18px; left: 0; transform: translateX(-50%); font: 500 11px/1 var(--data); letter-spacing: 0; color: var(--pencil); white-space: nowrap; }
.foot-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--hair); font-size: var(--t-13); color: var(--ink-3); }

/* export slip */
.slip {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 12px;
  background: var(--raised); box-shadow: 0 0 0 1px var(--hair), 0 18px 40px -16px rgba(0, 0, 0, .55);
  transform: translate(-50%, 140%); opacity: 0; transition: transform .35s var(--ease), opacity .2s;
}
.slip.show { transform: translate(-50%, 0); opacity: 1; }
.slip b { font-weight: 560; font-size: var(--t-15); }
.slip .mono { font-size: var(--t-12); color: var(--ink-2); overflow-wrap: anywhere; }
.slip svg { width: 18px; height: 18px; color: var(--pencil); flex: none; }
.noscript { max-width: 60ch; margin: 24px auto; padding-inline: 16px; color: var(--ink-2); }
.slip { width: max-content; }
.slip:not(.show) { visibility: hidden; transition: transform .35s var(--ease), opacity .2s, visibility 0s .35s; }
.ep-keys { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 12px; font-size: var(--t-13); color: var(--ink-3); }
.ep-keys span + kbd { margin-left: 6px; }
.hint-touch { display: none; font-size: var(--t-13); color: var(--ink-3); }
@media (pointer: coarse), (max-width: 860px) { .ep-keys { display: none; } .hint-touch { display: block; } }
@media (pointer: coarse) { .hint-keys { display: none; } }
.hint-touch[hidden] { display: none; }


/* ---------- word editor: the sheet becomes the proof, the inspector becomes the copy desk */
.stage-tools, .edit-tools { display: flex; align-items: center; gap: 8px; }
.btn-sm { height: 36px; padding: 0 14px; border-radius: 10px; font-size: var(--t-15); gap: 8px; white-space: nowrap; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-icon { padding: 0; width: 50px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-sm.btn-icon { width: 36px; }
.btn-sm.btn-icon svg { width: 17px; height: 17px; }
.btn-ink svg { width: 20px; height: 20px; }
.use-series[aria-current="true"] { color: var(--pencil); background: var(--pencil-wash); box-shadow: inset 0 0 0 1px var(--pencil); }
.crumb { display: none; align-items: baseline; gap: 8px; min-width: 0; font-size: var(--t-15); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { font-weight: 560; color: var(--ink); }
.crumb [aria-hidden] { color: var(--ink-3); }
.edit-tools, .rail, .ep, .edit-bar, .live { display: none; }
.seg-fmt { --n: 3; width: 138px; }
.seg-fmt .opt { padding: 8px 4px; }
.seg-fmt .fmt { margin: 0; }
.icon-line { box-shadow: inset 0 0 0 1px var(--hair); width: 36px; height: 36px; }
.icon-line[aria-pressed="true"] { color: var(--pencil); background: var(--pencil-wash); box-shadow: inset 0 0 0 1px var(--pencil); }

body[data-editing] .series-now, body[data-editing] .stage-tools, body[data-editing] .slug-row, body[data-editing] .strip,
body[data-editing] .insp, body[data-editing] .acts, body[data-editing] #sheet-img, body[data-editing] .crop, body[data-editing] .ctx { display: none; }
body[data-editing] .crumb, body[data-editing] .edit-tools { display: flex; }
body[data-editing] .rail { display: flex; }
body[data-editing] .ep { display: flex; }
body[data-editing] .live { display: block; }
body[data-editing] .sheet { transition: none; }
body[data-editing] .ruler { background: none; animation: none; }
body[data-editing] .ruler-x span { transform: translateX(-50%); }
body[data-editing] .ruler-y span { transform: translateY(-50%); }
body[data-editing] .ruler-x span::after { content: ""; position: absolute; left: 50%; top: 100%; height: 8px; margin-top: 2px; border-left: 1px solid var(--control); }
body[data-editing] .ruler-y span::after { content: ""; position: absolute; top: 50%; left: 100%; width: 8px; margin-left: 2px; border-top: 1px solid var(--control); }

/* the live proof: inline SVG in a shadow root, zoomed through its viewBox */
.live { position: absolute; inset: 0; overflow: hidden; border-radius: 6px; background: var(--well); outline: 1px solid var(--hair); }
.ov { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.ov .br { fill: none; stroke: var(--pencil-sheet); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linecap: square; }
.ov .br.dash { stroke-dasharray: 5 4; }
.ov .br.fixed { stroke: #A4A4A4; stroke-dasharray: 2 4; }
.ov .ghost { fill: rgba(143, 214, 228, .06); stroke: var(--pencil-sheet); stroke-opacity: .6; stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.ov .obst { fill: rgba(242, 147, 156, .16); stroke: #F2939C; stroke-width: 2; vector-effect: non-scaling-stroke; }
.ov .clock { fill: rgba(242, 147, 156, .12); stroke: #F2939C; stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
/* light grounds (ditto, greenbar, redline, whiteprint): the same marks in darker pencil and rubric, 4.5:1 or more */
.sheet[data-ground="light"] .ov .br, .sheet[data-ground="light"] .ov .ghost { stroke: #1F6E82; stroke-opacity: 1; }
.sheet[data-ground="light"] .ov .br.fixed { stroke: #666666; }
.sheet[data-ground="light"] .ov .obst, .sheet[data-ground="light"] .ov .clock { stroke: #B42A2A; }
.sheet.can-edit { cursor: pointer; }
.sheet-pin { z-index: 3; pointer-events: none; transform: translate(-50%, -100%); }
.sheet-pin.fixed { color: #C7C7C7; box-shadow: inset 0 0 0 1px #696969; }

/* slot rail: the sheet's words, in reading order, as tape */
.rail { gap: 8px; margin: 14px -6px 0; padding: 8px 6px 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.rchip {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px;
  border: 0; border-radius: 999px; background: var(--tape); color: var(--ink-2); cursor: pointer; scroll-snap-align: center;
  font: 500 12.5px/1 var(--data); font-variant-ligatures: none; white-space: nowrap; transition: color .15s, background-color .15s;
}
@media (hover: hover) { .rchip:hover { color: var(--ink); } }
.rchip[aria-selected="true"] { color: var(--ink); background: var(--pencil-wash); }
.rchip[aria-selected="true"]::after { opacity: 1; transform: none; }
.rchip.edited::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pencil); flex: none; }
.rchip .sw { flex: none; background: var(--c); box-shadow: 0 0 0 1px rgba(130, 130, 130, .3); }
.rchip .sw.h { width: 14px; height: 5px; border-radius: 3px; }
.rchip .sw.v { width: 5px; height: 14px; border-radius: 3px; }
.rchip .sw.q { width: 8px; height: 8px; }

/* the copy desk: one slot's options */
.ep { grid-area: insp; flex-direction: column; min-width: 0; position: sticky; top: 76px; max-height: calc(100vh - 92px); }
.ep-head { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.ep-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ep-title { font-size: var(--t-28); line-height: 1.05; letter-spacing: -.015em; }
.ep-hist { display: flex; gap: 4px; }
.ep-hist .icon-btn { width: 34px; height: 34px; }
.ep-hist .icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.ep-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-size: var(--t-13); color: var(--ink-3); }
.ep-meta .mono { font-size: 11.5px; }
.ep-search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; margin-top: 14px; background: var(--raised); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--control); }
.ep-search:focus-within { box-shadow: inset 0 0 0 1px var(--pencil), 0 0 0 3px var(--pencil-wash); }
.ep-search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.ep-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink); font: 400 16px/1 var(--voice); outline: none; }
.ep-search input::placeholder { color: var(--ink-3); }
.ep-count { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.ep-list { flex: 1 1 auto; min-height: 140px; overflow-y: auto; margin-top: 6px; padding: 0 2px 6px; scroll-padding: 44px 0 8px; outline: none; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.ep-list:focus-visible { box-shadow: inset 0 0 0 2px var(--pencil); border-radius: 8px; }
.og-h { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; padding: 14px 10px 6px; background: var(--desk); font-size: var(--t-13); font-weight: 560; color: var(--ink-2); }
.og-h .mono { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.orow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 3px 12px; min-height: 52px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
@media (hover: hover) { .orow:hover { background: var(--tape); } }
.orow.is-active { box-shadow: inset 0 0 0 2px var(--pencil); }
.orow[aria-selected="true"] { background: var(--pencil-wash); }
.orow[aria-selected="true"]::after { content: "In use"; position: absolute; right: 10px; bottom: 9px; font: 500 10.5px/1 var(--data); color: var(--pencil); }
.orow[aria-disabled="true"] { cursor: default; }
@media (hover: hover) { .orow[aria-disabled="true"]:hover { background: transparent; } }
.ot { font: 400 14px/1.35 var(--data); color: var(--ink); overflow-wrap: anywhere; font-variant-ligatures: none; }
.ot .lk { color: var(--ink-3); }
.ot.ph { font: 300 18px/1.2 KNunito, var(--voice); }
.orow[aria-disabled="true"] .ot { color: var(--ink-3); }
.orow .on { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.orow .on .tape { padding: 2px 7px; font-size: 10.5px; }
.om { grid-column: 1 / -1; padding-right: 48px; font-size: var(--t-13); line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.om .why { color: var(--rubric); }
.fmts { display: inline-flex; align-items: flex-end; gap: 3px; }
.fmts i { display: block; border: 1.2px solid currentColor; border-radius: 1.5px; color: var(--ink-3); }
.fmts i.d { width: 13px; height: 8px; } .fmts i.w { width: 12px; height: 8px; } .fmts i.p { width: 5px; height: 10px; }
.fmts i.bad { color: var(--rubric); }
.ep-bad { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; margin-top: 8px; padding: 10px; border: 0; border-top: 1px solid var(--hair); background: none; color: var(--ink-2); font-size: var(--t-13); text-align: left; cursor: pointer; }
@media (hover: hover) { .ep-bad:hover { color: var(--ink); } }
.ep-bad svg { width: 17px; height: 17px; flex: none; }
.ep-bad .n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--tape); color: var(--ink-2); font: 500 var(--t-12)/1 var(--data); }
.ep-bad[aria-expanded="true"] { color: var(--ink); }
.ep-empty { padding: 18px 10px; color: var(--ink-2); font-size: var(--t-15); }
.ep-linked { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--tape); color: var(--ink-2); font-size: var(--t-13); line-height: 1.45; }
.ep-who { margin-top: 16px; }
.ep-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: var(--t-13); }
.ep-saved { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.linkbtn { padding: 4px 0; border: 0; background: none; color: var(--ink-2); font: inherit; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: .2em; cursor: pointer; }
@media (hover: hover) { .linkbtn:hover { color: var(--ink); text-decoration-color: var(--pencil); } }
.linkbtn:disabled { opacity: .45; cursor: default; text-decoration: none; }
.ep-tools { display: flex; gap: 4px; margin-left: -8px; }
.ep-tools .icon-btn { width: 34px; height: 34px; }
.fixed-list summary { cursor: pointer; color: var(--ink-3); list-style: none; }
.fixed-list summary::-webkit-details-marker { display: none; }
.fixed-list summary::after { content: " +"; }
.fixed-list[open] summary::after { content: " \2212"; }
.fixed-list ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--ink-2); max-width: 30ch; }
.fixed-list li b { font-weight: 560; color: var(--ink); }
.edit-bar { align-items: center; gap: 8px; }
.edit-bar .eb-label { flex: 1; min-width: 0; text-align: center; font-size: var(--t-15); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-bar .eb-label .mono { font-size: 11.5px; color: var(--ink-3); }
.edit-bar .icon-btn { box-shadow: inset 0 0 0 1px var(--hair); width: 44px; height: 44px; }
.edit-bar .btn { height: 44px; }
.edit-bar .btn-icon { width: 44px; }
.frame.edited .face::before { content: ""; position: absolute; z-index: 1; right: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--pencil); box-shadow: 0 0 0 2px var(--desk); }

/* ---------- responsive */
@media (max-width: 860px) {
  .slip { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  body:not([data-editing]):has(#need:not([hidden])) .slip { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }   /* the bar is taller while the need line shows */
  body[data-editing][data-unpinned] .stage, body[data-editing][data-unpinned] .rail { position: static; }
  body[data-editing]:not([data-unpinned]) .ep :is(input, .orow, button, summary) { scroll-margin: calc(132px + var(--stage-h)) 0 84px; }
  .icon-line, .ep-hist .icon-btn, .ep-tools .icon-btn { width: 44px; height: 44px; }
  .seg-fmt .opt { padding: 13px 4px; }
  .finish .opt { min-height: 44px; justify-content: center; }
  .ep-foot .linkbtn, #slip-undo { min-height: 44px; min-width: 44px; }
  .ep-foot .linkbtn { display: inline-flex; align-items: center; }   /* min-height does nothing on an inline link */
  .colo-links { gap: 0; }
  .colo-links a { display: inline-block; padding-block: 12px; }
  .fixed-list summary { line-height: 44px; }
  .ep-bad { min-height: 44px; }
  body[data-unpinned] #ep-search { scroll-margin-top: calc(-4px + env(safe-area-inset-top, 0px)); }   /* results stay above the keyboard */
}
@media (max-width: 1180px) {
  .studio .wrap { grid-template-columns: minmax(0, 1fr) 312px; gap: 0 32px; }
  .read-grid { grid-template-columns: minmax(0, 1fr); }
  .read-fig { position: relative; top: auto; }
  .series-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vol-name { font-size: 48px; }
}
@media (max-width: 860px) and (max-aspect-ratio: 4/5) {   /* tall enough that the sheet is under ~45% of the screen: it stays put while the key scrolls under it */
  .read-fig { position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--desk); padding-bottom: 8px; box-sizing: content-box; }
  .legend button { scroll-margin-top: calc(60px + env(safe-area-inset-top, 0px) + (100vw - 32px) * .5625 + 16px); }
}
@media (max-width: 860px) {
  :root { --gutter: 16px; scroll-padding-top: 64px; scroll-padding-bottom: 96px; }   /* clear of the pinned download bar */
  .top .icon-btn, .vol-nav .icon-btn { width: 44px; height: 44px; }
  .brand { min-height: 44px; }
  .btn-sm, .who input { height: 44px; }
  .btn-sm.btn-icon { width: 44px; }
  .stage-bar { flex-wrap: wrap; }
  .seg.series-switch .opt { padding-block: 11px; }
  .switch { min-height: 44px; }
  .gcard .face.bracket::after, .sheetlet .art.bracket::after { transform: none; }   /* the settle scale would push the last card past the screen */
  .nav { display: none; }
  .intro .wrap, .sec-head { grid-template-columns: minmax(0, 1fr); }
  .intro .wrap { padding-block: 28px 20px; }
  .intro h1 { font-size: 44px; }
  .studio .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "insp" "acts"; grid-template-rows: auto; }
  .stage { padding: 56px 24px 26px; }
  .ruler-y { display: none; }
  .insp { padding-top: 28px; }
  .acts {
    position: sticky; bottom: 0; z-index: 10; margin: 26px calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l));
    padding: 12px var(--pad-r) calc(12px + env(safe-area-inset-bottom, 0px)) var(--pad-l);
    background: color-mix(in srgb, var(--desk) 88%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--hair);
  }
  .fine { display: none; }
  body[data-editing] .stage-col { display: contents; }
  body[data-editing] .studio .wrap { grid-template-areas: "bar" "stage" "rail" "insp" "acts"; }
  body[data-editing] .stage-bar { grid-area: bar; margin-bottom: 10px; }
  body[data-editing] .stage { grid-area: stage; position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 6; margin-inline: calc(-1 * var(--pad-l)) calc(-1 * var(--pad-r)); padding: 8px max(8px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px)); border-radius: 0; box-shadow: inset 0 -1px 0 var(--hair); }
  body[data-editing] .ruler { display: none; }
  body[data-editing] .rail { grid-area: rail; position: sticky; top: calc(60px + env(safe-area-inset-top, 0px) + var(--stage-h)); z-index: 6; margin: 0 calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l)); padding: 10px var(--pad-r) 10px var(--pad-l); background: var(--desk); box-shadow: inset 0 -1px 0 var(--hair); }
  body[data-editing] .rchip { height: 44px; }
  body[data-editing] .acts { display: grid; grid-template-columns: minmax(0, 1fr); }
  body[data-editing] .acts > :not(.edit-bar) { display: none; }
  body[data-editing] .edit-bar { display: flex; }
  .ep { position: static; max-height: none; padding-top: 18px; }
  .ep-list { overflow: visible; }
  .og-h { position: static; }
  .orow { min-height: 56px; }
  .seg-fmt { width: calc(3 * 44px + 6px); }   /* 3 x 44 plus the 3px padding */
  .crumb span:first-child, .crumb [aria-hidden] { display: none; }
  #edit-done { display: none; }
  body[data-unpinned] #edit-done { display: inline-flex; }   /* the edit bar is far down the list when unpinned */
  .sec > .wrap { padding-block: 60px; }
  .ink-row { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .grounds { gap: 12px; }
  .gcard .gnote { display: none; }
  .colo-grid { grid-template-columns: minmax(0, 1fr); }
  .legend-head { display: none; }
  .legend button { grid-template-columns: 28px minmax(0, 1fr); row-gap: 4px; }
  .legend .mean { grid-column: 2; }
}
@media (max-width: 560px) {
  .series-grid { grid-template-columns: minmax(0, 1fr); }
  .intro h1 { font-size: 38px; }
  .vol-name { font-size: 44px; }
  .strip { grid-auto-columns: 112px; }
  .hint-keys { display: none; }
  .top .wrap { gap: 8px; }
  .series-now { width: 100%; }
  .stage-tools { width: 100%; justify-content: space-between; }
  .gmeta .mono { display: none; }
}
@media (max-width: 1200px) { .series-meta { display: none; } }   /* the bar is too short for the count until the inspector's column has room */
@media (max-width: 690px), (min-width: 861px) and (max-width: 1060px) {   /* four names need 550px of bar plus the tools: where it is shorter the glyphs stay and the names go */
  .seg-lite .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .seg-lite .opt { min-width: 44px; min-height: 44px; justify-content: center; padding-inline: 12px; }
}
@media (max-width: 400px) {
  .top .tape { display: none; }   /* the version is in the footer too */
  .finish { grid-template-columns: minmax(0, 1fr); }   /* Finish goes above its picker, so 35 mm fast keeps one line at 15px */
  .finish .seg { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mk-draw { stroke-dashoffset: 0; }
  /* the crop still dims only after its beat, as a step and not a fade, so a quick redraw doesn't flash */
  .loupe[aria-busy="true"] canvas { transition: opacity 0s linear .5s !important; }
}
@media (forced-colors: active) {
  .bracket::after { background: none; outline: 2px solid Highlight; }
  .seg::before { background: none; }
  .seg .opt::after { display: none; }
  [data-tip]::after { outline: 1px solid CanvasText; }
  .switch .track { outline: 1px solid CanvasText; }
  .switch input:checked + .track { outline: 2px solid Highlight; }
  .switch .track i { forced-color-adjust: none; background: CanvasText; }
  .switch input:checked + .track i { background: Highlight; }
  .ep-list:focus-visible, .orow.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
  .orow[aria-selected="true"] { outline: 1px solid Highlight; outline-offset: -1px; }
  .ep-search, .who, .seg, .icon-line { outline: 1px solid CanvasText; outline-offset: -1px; }
  .ep-search:focus-within, .who:focus-within, .icon-line[aria-pressed="true"], .seg::before { outline: 2px solid Highlight; }
}
