/* ============================================================
   OHM TAPE — archive terminal
   ============================================================
   The page is a records terminal: a masthead, a dossier on the
   subject, and a deck of index controls along the bottom. It is
   laid out like a printed archive slip — hairline rules, wide
   tracked micro-labels, one very large numeral per block — and it
   is wired to the 3D scene, not decoration over it. Every control
   here maps to a "file" you can select and read.

   Two ideas hold the whole sheet together:

   1. THE RECORD IS A SHEET, THE SCENE IS NOT. Everything the page
      says in words is printed on one translucent plate that hangs
      over the right third. Before it, the type sat straight on the
      lit background: legible only because the tape happened to
      stay on the left, and grey-on-grey wherever the floor was
      bright. The plate gives the record its own value, so contrast
      no longer depends on where the camera is — and the tape can
      pass behind it, which is what a document over a photograph
      has always done.

   2. ONE STATE LATTICE, EVERYWHERE. rest → hover → press → focus →
      on. Hover is always the accent; press is always a 1px sink;
      focus is always the same accent hairline, offset, never
      colour alone. Nothing on this page is decoration.
   ============================================================ */

/* ============================ tokens =================================== */
:root {
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei UI", "PingFang SC", sans-serif;
  /* an optical display cut for the few things set large. Segoe UI Variable
     Display is a real optical size; where it is absent the stack falls back to
     the text face, which at these weights still reads as a display. */
  --disp: "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei UI", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Microsoft YaHei UI", "PingFang SC", ui-monospace, monospace;

  /* type scale — one step per job, nothing ad-hoc */
  --fs-micro: 0.59375rem;        /* kbd chips, table slugs */
  --fs-label: 0.65625rem;       /* tracked micro-labels */
  --fs-ui: 0.71875rem;          /* buttons, hud */
  --fs-body: 0.78125rem;        /* record prose, list rows */
  --fs-cn: clamp(0.9375rem, 1.12vw, 1.125rem);
  --fs-h: clamp(1.1875rem, 1.72vw, 1.875rem);   /* the file number */
  --fs-num: clamp(1.875rem, 3.7vw, 3.5rem);  /* ARCHIVE / SELECT */

  /* tracking — wide for small caps, negative for display. Optical, not fixed */
  --tr-micro: .22em;
  --tr-label: .18em;
  --tr-ui: .16em;
  --tr-body: .04em;

  /* motion — four speeds and three curves is the whole vocabulary */
  --t-press: .12s;
  --t-fast: .22s;
  --t-swift: .34s;
  --t-med: .5s;
  --t-slow: .68s;
  --e-out: cubic-bezier(.16, 1, .3, 1);
  --e-inout: cubic-bezier(.4, 0, .2, 1);
  --e-spring: cubic-bezier(.22, 1.25, .36, 1);

  /* geometry */
  --pad: clamp(1.375rem, 3vw, 2.75rem);
  --sheet-pad-x: 1.5rem;
  --sheet-pad-t: 1.375rem;
  --sheet-pad-b: 1.375rem;
  --blur: 1.125rem;
  --r: 0.125rem;
  /* the widest the record plate is ever allowed to get. Past this it stops
     growing and the room between the subject and the plate does the widening
     instead — a 1100px-wide slip of paper reads as an empty slab, not a record
     (it is a rem length, so the cap itself grows with the root size). */
  --plate-max: 47rem;

  /* the plate's own line and edge highlight, overridden per theme */
  --sheet-tint: #eef0f3;
  --sheet-a: 78%;
  --sheet-line: rgba(20, 22, 26, .13);
  --sheet-hi: rgba(255, 255, 255, .55);
  --sh-sheet: 0 1.625rem 4rem -2.375rem var(--shadow), 0 0.1875rem 0.875rem -0.5rem var(--shadow);
}

/* ---------- the lamps, and how they go out ----------
   A theme is eighteen custom properties, and CSS cannot transition an
   unregistered custom property — so before this, swapping `data-theme` changed
   every token in a single frame. The body cross-faded over 0.9s while the plate,
   the console, the two overlays and every hairline they carry snapped to the new
   room. Registering each one gives it a type and an initial value, which makes it
   animatable, so the transition can live on the root and *everything* that reads
   a token follows — including values that cannot be interpolated any other way:
   gradient stops, color-mix() results, box-shadows, backdrop tints, the inset
   highlight on the paper. One declaration instead of a per-element list that
   would have to be kept in sync with every rule added later. */
@property --paper { syntax: '<color>'; inherits: true; initial-value: #e6e9ed; }
@property --ink { syntax: '<color>'; inherits: true; initial-value: #14161a; }
@property --ink-dim { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .72); }
@property --ink-faint { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .62); }
@property --ink-ghost { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .32); }
@property --hair { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .19); }
@property --hair-soft { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .1); }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #8d4712; }
@property --accent-soft { syntax: '<color>'; inherits: true; initial-value: rgba(141, 71, 18, .11); }
@property --accent-line { syntax: '<color>'; inherits: true; initial-value: rgba(141, 71, 18, .5); }
@property --chip-bg { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .93); }
@property --chip-ink { syntax: '<color>'; inherits: true; initial-value: #f1f2f4; }
@property --chip-hair { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, .16); }
@property --shadow { syntax: '<color>'; inherits: true; initial-value: rgba(36, 40, 48, .3); }
@property --sheet-tint { syntax: '<color>'; inherits: true; initial-value: #eef0f3; }
@property --sheet-line { syntax: '<color>'; inherits: true; initial-value: rgba(20, 22, 26, .13); }
@property --sheet-hi { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, .55); }
@property --sheet-a { syntax: '<percentage>'; inherits: true; initial-value: 78%; }

/* ---------- the lamps-off variant ---------- */
[data-theme="noir"] {
  --paper: #08090b;
  --ink: #f2efe9;
  --ink-dim: rgba(242, 239, 233, .74);
  --ink-faint: rgba(242, 239, 233, .62);
  --ink-ghost: rgba(242, 239, 233, .30);
  --hair: rgba(242, 239, 233, .17);
  --hair-soft: rgba(242, 239, 233, .085);
  --accent: #dd9152;
  --accent-soft: rgba(221, 145, 82, .15);
  --accent-line: rgba(221, 145, 82, .55);
  --chip-bg: rgba(242, 239, 233, .95);
  --chip-ink: #131110;
  --chip-hair: rgba(0, 0, 0, .16);
  --shadow: rgba(0, 0, 0, .55);

  --sheet-tint: #101217;
  --sheet-a: 74%;
  --sheet-line: rgba(242, 239, 233, .11);
  --sheet-hi: rgba(255, 255, 255, .07);
}
[data-theme="studio"] {
  --paper: #e6e9ed;
  --ink: #14161a;
  --ink-dim: rgba(20, 22, 26, .72);
  --ink-faint: rgba(20, 22, 26, .62);
  --ink-ghost: rgba(20, 22, 26, .32);
  --hair: rgba(20, 22, 26, .19);
  --hair-soft: rgba(20, 22, 26, .095);
  --accent: #8d4712;
  --accent-soft: rgba(141, 71, 18, .11);
  --accent-line: rgba(141, 71, 18, .5);
  --chip-bg: rgba(20, 22, 26, .93);
  --chip-ink: #f1f2f4;
  --chip-hair: rgba(255, 255, 255, .16);
  --shadow: rgba(36, 40, 48, .3);

  --sheet-tint: #eef0f3;
  --sheet-a: 78%;
  --sheet-line: rgba(20, 22, 26, .13);
  --sheet-hi: rgba(255, 255, 255, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* THE ONE DIAL. Every length in this sheet is a multiple of the root size
   (see tools/_px2rem.mjs), so the whole interface keeps its proportions instead
   of being stretched over more canvas: at 1440 the root is 16px and nothing
   differs from a hand-written px sheet, at 2560 it is 21px and the plate, the
   type, the console and the hairlines all come up together. The clamp is
   anchored at 1440 (1.1111vw = 16px exactly) and caps at 21px — 1.31× — which
   is where a 1440-class composition reads at the same weight on a 2560 display.
   Borders and outlines stay in px on purpose: a hairline is one device pixel at
   every scale. */
html {
  font-size: clamp(16px, 1.1111vw, 21px);
  /* the room changes on the tokens themselves (see @property above), on the same
     0.9s clock the body already used, and on the same curve */
  transition:
    --paper .9s cubic-bezier(.16, 1, .3, 1), --ink .9s cubic-bezier(.16, 1, .3, 1),
    --ink-dim .9s cubic-bezier(.16, 1, .3, 1), --ink-faint .9s cubic-bezier(.16, 1, .3, 1),
    --ink-ghost .9s cubic-bezier(.16, 1, .3, 1),
    --hair .9s cubic-bezier(.16, 1, .3, 1), --hair-soft .9s cubic-bezier(.16, 1, .3, 1),
    --accent .9s cubic-bezier(.16, 1, .3, 1), --accent-soft .9s cubic-bezier(.16, 1, .3, 1),
    --accent-line .9s cubic-bezier(.16, 1, .3, 1),
    --chip-bg .9s cubic-bezier(.16, 1, .3, 1), --chip-ink .9s cubic-bezier(.16, 1, .3, 1),
    --chip-hair .9s cubic-bezier(.16, 1, .3, 1), --shadow .9s cubic-bezier(.16, 1, .3, 1),
    --sheet-tint .9s cubic-bezier(.16, 1, .3, 1), --sheet-line .9s cubic-bezier(.16, 1, .3, 1),
    --sheet-hi .9s cubic-bezier(.16, 1, .3, 1), --sheet-a .9s cubic-bezier(.16, 1, .3, 1);
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  /* deliberately NOT a font-size: several measures on this page are in `ch`
     (the now-chip's cap, the record's note), and those resolve against the
     inherited size. Setting it here silently reshortened both of them. */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* the body's own colours are tokens, so the root's token transition is what
     carries them; a second easing here would only make the room change mushy */
}
canvas#gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
body.dragging canvas#gl { cursor: grabbing; }

/* every numeral on this page is a read-out: it must not jitter sideways when
   it goes 01 → 02 */
b, .counter, .col-id, .sel-num, input[type="range"] { font-variant-numeric: tabular-nums; }

.ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.ui > * { pointer-events: none; }
.ui button, .ui .row, .ui input, .ui input[type="range"] { pointer-events: auto; }
.micro { font-family: var(--mono); }

/* one focus language for the whole terminal — a hairline, never a glow. The
   offset is what keeps it legible over both the scene and the plate. */
:where(.ui) :is(button, input, [tabindex]):focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r);
}
:where(.ui) :is(button, input, [tabindex]):focus:not(:focus-visible) { outline: none; }
/* the plate's own controls sit on a surface, so they get the tighter ring */
.sheet :is(button):focus-visible { outline-offset: 2px; }

/* ---------- hairline frame with registration marks ---------- */
.frame {
  position: absolute; inset: 1.125rem;
  border: 1px solid var(--hair-soft);
  /* `--hair-soft` is a token; it animates with the rest of the room */
}
.frame i { position: absolute; width: 0.5625rem; height: 0.5625rem; border: 1px solid var(--ink-faint); }
.frame i:nth-child(1) { top: -0.0625rem; left: -0.0625rem; border-right: 0; border-bottom: 0; }
.frame i:nth-child(2) { top: -0.0625rem; right: -0.0625rem; border-left: 0; border-bottom: 0; }
.frame i:nth-child(3) { bottom: -0.0625rem; left: -0.0625rem; border-right: 0; border-top: 0; }
.frame i:nth-child(4) { bottom: -0.0625rem; right: -0.0625rem; border-left: 0; border-top: 0; }

/* ============================ masthead ================================= */
.mast {
  position: absolute; top: 2.5rem; left: var(--pad); right: var(--pad);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1.875rem;
}
.brand { text-transform: uppercase; }
/* the logotype is three weights stacked: two heavy lines pinning a light one,
   tight enough that they read as a single block rather than three paragraphs */
.brand h1 {
  font-family: var(--disp);
  font-size: clamp(1.625rem, 3.05vw, 3.125rem); font-weight: 700;
  letter-spacing: -.032em; line-height: .94;
}
.brand-mid {
  font-size: clamp(0.625rem, .8vw, 0.84375rem); font-weight: 400;
  letter-spacing: .014em; line-height: 1.2; margin-top: 0.25rem; color: var(--ink-dim);
}
.brand-end {
  font-family: var(--disp);
  font-size: clamp(1.3125rem, 2.4vw, 2.5rem); font-weight: 700;
  letter-spacing: -.024em; line-height: 1; margin-top: 0.0625rem;
}
.mast-nav { display: flex; align-items: center; gap: 0.875rem; padding-top: 0.5rem; }
.vr { width: 0.0625rem; height: 0.9375rem; background: var(--hair); flex: none; }

/* the masthead buttons draw their rule in on hover — the same gesture as
   「读取」and the reference rows, so the whole terminal hovers one way */
.tb {
  appearance: none; border: 0; background: none; color: var(--ink); cursor: pointer;
  font: inherit; font-size: var(--fs-ui); font-weight: 500;
  letter-spacing: var(--tr-ui); text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap;
  position: relative; padding: 0.125rem 0;
  transition: color var(--t-swift) var(--e-out), transform var(--t-press) var(--e-out);
}
.tb::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -0.1875rem; height: 0.0625rem;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-med) var(--e-out);
}
.tb:hover { color: var(--accent); }
.tb:hover::after { transform: scaleX(1); }
.tb:active { transform: translateY(0.0625rem); }
.tb svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }
/* the gear turns a quarter and swells. Linear on purpose: it is eight-toothed,
   so nothing about it says "ease" — it says a shaft being engaged, and the page
   already spins the 巡览 arrow on the same `linear`. It stays turned while the
   panel is up, so the button reads as open rather than as hovered. */
#btn-settings svg { transition: transform .55s linear; }
#btn-settings:hover svg,
#btn-settings.open svg { transform: rotate(90deg) scale(1.15); }
#btn-settings.open { color: var(--accent); }
#btn-settings.open::after { transform: scaleX(1); }

/* the lights. Solid ink on the live one — at this size a border tint is not
   enough to read across a bright room */
.seg { display: flex; border: 1px solid var(--hair); border-radius: var(--r); }
.seg button {
  appearance: none; border: 0; background: none; color: var(--ink-dim); cursor: pointer;
  font: inherit; font-size: 0.6875rem; letter-spacing: .14em; padding: 0.375rem 0.8125rem; white-space: nowrap;
  transition: color var(--t-swift) var(--e-out), background var(--t-med) var(--e-out);
}
.seg button + button { border-left: 1px solid var(--hair); }
.seg button:hover { color: var(--ink); background: var(--accent-soft); }
.seg button:active { transform: translateY(0.0625rem); }
.seg button.on { color: var(--paper); background: var(--ink); }
.seg button.on:hover { background: var(--ink); }

/* ============================ dossier ================================== */
/* The subject sits in the left half and the record in the right; the two must
   not overlap, because every value in this column is dark text and the tape is
   not a pale enough thing to read it over — which is exactly what the plate
   under the record is for. */
/* The panel hangs from a line rather than from its own middle. It is centred on
   `--panel-half` — half its height, measured once and on resize — instead of on
   itself, because its length changes for reasons that have nothing to do with
   where it sits: the wheel shortens it, and every record has a different sheet
   (a spec row more or less, a note a line longer). Centred on itself, the file
   number and everything above the sheet rose a little every time a shorter
   record was picked up. Anchored at the top, a longer sheet just grows downward. */
.dossier {
  position: absolute; left: auto; right: var(--pad);
  width: min(calc(45% - var(--pad)), var(--plate-max));
  top: calc(50% - var(--panel-half, 13.125rem));
  /* How much of its own length the panel is not using. It rests 20% short, and
     the loop adds --give on top of that as the wheel brings the lens in (see
     syncPanelGive in main.js) — a length rather than a position, which is why
     the crumb and the body both read it, and why folding can still beat it
     further down. */
  --retract: calc(20% + var(--give, 0) * 1%);
}

/* the plate. It carries the margin, not the text: one element moves, so the
   sheet, its rule and everything printed on it can never drift apart — which
   is what a percentage margin on two children of different containing blocks
   would have done. */
.sheet {
  position: relative;
  margin-left: var(--retract);
  padding: var(--sheet-pad-t) var(--sheet-pad-x) var(--sheet-pad-b);
  background: color-mix(in srgb, var(--sheet-tint) var(--sheet-a), transparent);
  backdrop-filter: blur(var(--blur)) saturate(1.06);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.06);
  border: 1px solid var(--sheet-line);
  border-radius: var(--r);
  box-shadow: inset 0 0.0625rem 0 var(--sheet-hi), var(--sh-sheet);
  transition:
    margin-left .58s var(--e-spring) 0s;
}
/* the sheet's registration tick: a 0.0625rem accent rule at the top-left corner,
   the way a drawing is cornered before it is filed */
.sheet::before {
  content: ''; position: absolute; top: -0.0625rem; left: -0.0625rem;
  width: 1.375rem; height: 0.125rem; background: var(--accent); opacity: .85;
}

/* The crumb never wraps. Retracting the plate squeezes this line, and a wrap is a
   height change in the middle of a move that is otherwise one gesture: the sheet
   grew a line for the length of the fold and the breadcrumb jumped down with it.
   So the parts give in order instead — the archive prefix retracts to nothing, on
   the plate's own second-beat clock so it travels with the edge, and the record's
   name ellipsizes if it still cannot fit. Nothing here changes the line's height,
   so the top of the sheet holds still while the bottom walks. */
.crumb {
  font-size: 0.6875rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); display: flex; align-items: center; gap: 0.625rem;
  flex-wrap: nowrap; overflow: hidden;
}
.crumb i { font-style: normal; opacity: .55; }
.crumb-pre {
  display: inline-flex; align-items: center; gap: 0.625rem; white-space: nowrap;
  overflow: hidden; max-width: 22rem; opacity: 1;
  transition: max-width .42s var(--e-out), opacity .28s var(--e-out);
}
/* folding waits for the plate's second beat (see .dossier.folded .sheet);
   unfolding goes at once, which is the rule the body collapse already follows */
.dossier.folded .crumb-pre { max-width: 0; opacity: 0; transition-delay: .36s, .36s; }
.crumb-id {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-dim);
}
/* the fold sits on the crumb line so it costs no vertical space of its own */
.fold {
  appearance: none; border: 0; background: none; cursor: pointer; margin-left: auto;
  flex: none;   /* the affordance to unfold may never be the part that gives way */
  font: inherit; font-size: 0.65625rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0.1875rem 0 0.1875rem 0.75rem;
  transition: color var(--t-swift) var(--e-out), transform var(--t-press) var(--e-out);
}
/* a drawn triangle rather than ▾ / ▸ : `content` cannot be transitioned, so the
   two glyphs used to swap in a single frame. This one turns, and since the
   button is saying which way the sheet is about to move, the turn *is* the
   information. */
.fold::before {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 0.3125rem solid currentColor;
  border-top: 0.25rem solid transparent; border-bottom: 0.25rem solid transparent;
  margin-right: 0.5em; vertical-align: 0.0625em;
  transform: rotate(90deg);
  transition: transform var(--t-med) var(--e-out);
}
.dossier.folded .fold::before { transform: rotate(0deg); }
.fold:hover { color: var(--accent); }
.fold:active { transform: translateY(0.0625rem); }

/* The record's own sheet swaps — its name, its note and its specs — so changing
   record reads as a change rather than as text being overwritten in place. This
   used to be on the whole body, which took the file number, the breadcrumb and
   the reference list along with it: the list you had just clicked was pulsing
   under the pointer, and the number is a cursor being written (see setFileNo in
   main.js) rather than a block being replaced. Only the part being read swaps. */
@keyframes dswap { from { opacity: 0; transform: translateY(0.4375rem); } to { opacity: 1; transform: none; } }
.doc.swap { animation: dswap .44s var(--e-out) both; }
@media (prefers-reduced-motion: reduce) { .doc.swap { animation: none; } }
/* A record's sheet is 4 spec rows or 5, a note one line longer or shorter — the
   box is held to the height it had and walked to the height it needs on the same
   clock as that fade, so the growth is one motion rather than the button under it
   being shoved down in a frame (see swapIn in main.js) */
.doc.grow { overflow: hidden; transition: height .44s var(--e-out); }
@media (prefers-reduced-motion: reduce) { .doc.grow { transition: none; } }

/* Folding runs in two beats. The body collapses first; then the plate's left
   edge retracts to the right. Unfolding plays the same two beats backwards.

   The delays live on the *target* state, which is how a CSS transition says
   "on the way in, wait; on the way out, go now". */
.foldwrap {
  max-height: 56.25rem; overflow: hidden;
  transition: max-height .50s var(--e-out) .34s, opacity .38s var(--e-out) .34s;
}
.dossier.folded .foldwrap {
  max-height: 0; opacity: 0;
  transition: max-height .42s var(--e-out) 0s, opacity .30s var(--e-out) 0s;
}

/* The retract is one motion, not two. The plate's left edge is the line
   everything in the panel sits against, so the whole body travels with it:
   growing the left margin both draws the edge in and brings the text along,
   staying put against the line's left end. */
/* the macro vantage puts the lens in close enough that the tape reaches into
   this column on its own. That vantage folds the panel outright (the fold is
   what it wants, and it is declared below so it wins); this is the state the
   panel falls back into when that fold is undone by hand — narrowed rather than
   shortened, with the spec table still on screen. */
.dossier.tight .sheet { margin-left: max(34%, var(--retract)); }
/* a narrower panel means less room for two columns, so the left one gives up
   its width rather than squeezing the reference list out of shape. The floor
   on the second track is what makes the first one actually yield. */
.dossier.tight .dossier-grid {
  grid-template-columns: minmax(0, 14.5rem) minmax(8.75rem, 1fr);
}
.dossier.folded .sheet {
  margin-left: 60%;   /* folded, the plate keeps 40% of its open length */
  transition: margin-left .64s var(--e-spring) .40s;
}

.fileno {
  font-family: var(--disp);
  font-size: var(--fs-h); font-weight: 700; letter-spacing: -.014em;
  margin-top: 1rem; padding-bottom: 1.375rem;
  display: flex; align-items: baseline; gap: .5em; white-space: nowrap;
  position: relative;
}
/* The rule under the file number is drawn rather than bordered, so it can be
   drawn *again*: every record change re-rules the sheet from the left. It is the
   one gesture that says a fresh slip has been laid on the plate rather than the
   old one edited. The reference header's rule re-draws with it. */
.fileno::after, .ref-h::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--hair); transform-origin: 0 50%;
}
.ref-h::after { background: var(--hair-soft); }
@keyframes redraw { from { transform: scaleX(0); } }
.dossier.reprint .fileno::after,
.dossier.reprint .ref-h::after { animation: redraw .62s var(--e-out) both; }
.dossier.reprint .ref-h::after { animation-delay: .08s; }
.fileno b { font-weight: 700; }
/* The cursor does not blink. It is the pen that writes the file number (see
   setFileNo), and a pen is either moving or standing on the line — a pen that
   flickered would read as a decorative cursor instead of the thing doing the
   work. It is also three times its old width: at 0.125rem it was a cursor, at 0.375rem it
   is a nib, and it is what the mask's cut hides behind. */
.caret {
  display: inline-block; width: 0.375rem; height: .82em; background: var(--ink);
  transform: translateY(.06em);
}

/* 16.5rem for the record unless that would eat into the room the reference rows
   need — this panel is not always as long as it used to be, and the second track
   is not the one that should pay for it. 184 = the column gap plus the 140 the
   tight grid below settles on for those rows. */
.dossier-grid {
  display: grid;
  grid-template-columns: minmax(0, min(16.5rem, calc(100% - 11.5rem))) minmax(0, 1fr);
  gap: 1.375rem 2.5rem; margin-top: 1.375rem;
  /* the record's name and REFERENCE AREA are two headers on one line, so they
     sit on one baseline rather than on one top edge — which is what they did
     when the two columns were sized by their own type */
  align-items: baseline;
}
.doc-cn { font-size: var(--fs-cn); font-weight: 500; letter-spacing: .06em; text-wrap: balance; }
.doc-en {
  font-size: var(--fs-label); letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 0.5rem;
}
.doc-note {
  font-size: 0.75rem; line-height: 1.85; color: var(--ink-dim); margin-top: 1rem;
  max-width: 32ch; font-weight: 300; text-wrap: pretty;
}
/* the spec rows are the actual content of a record — the reason it is filed.
   The dotted leader between a key and its value is the oldest archive
   convention there is, and it does a real job here: at this size the eye
   otherwise falls off the row between the label and its number. */
.spec { list-style: none; margin-top: 1.125rem; border-top: 1px solid var(--hair-soft); }
.spec li {
  display: flex; align-items: baseline;
  padding: 0.40625rem 0; border-bottom: 1px solid var(--hair-soft);
  transition: padding-left var(--t-med) var(--e-out), border-color var(--t-swift) var(--e-out);
}
.spec li span { order: 1; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .1em; color: var(--ink-faint); transition: color var(--t-swift) var(--e-out); }
/* the value never breaks: these are readings, and "12 µm" split across two
   lines is the one thing a spec table may not do. They are short enough that
   nowrap costs nothing. */
.spec li b { order: 3; font-weight: 400; font-family: var(--mono); font-size: 0.6875rem; color: var(--ink-dim); letter-spacing: .04em; white-space: nowrap; transition: color var(--t-swift) var(--e-out); }
.spec li::after {
  content: ''; order: 2; flex: 1 1 auto; min-width: 1rem; margin: 0 0.5rem;
  border-bottom: 1px dotted var(--hair); transform: translateY(-.28em);
}
.spec li:hover { padding-left: 0.375rem; }
.spec li:hover b { color: var(--ink); }
.spec li:hover span { color: var(--accent); }
/* The rows cascade. A record's spec table is rebuilt when you pick another one,
   and arriving in order — rather than as one block — is what says the sheet was
   re-printed rather than merely re-read. `--i` is the row's index, written when
   the rows are built (render / buildIndex). */
@keyframes cascadeIn { from { opacity: 0; transform: translateY(0.6rem); } }
.spec li { animation: cascadeIn .5s var(--e-out) both; animation-delay: calc(var(--i, 0) * 34ms); }

/* the primary action. It reads as a control first — a hairline box that fills,
   sinks and locks — because "read this record" is the one thing this page
   actually does, and it should not have to be found. */
.access {
  appearance: none; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; gap: 0.8125rem; margin-top: 1.25rem;
  font: inherit; font-size: 0.71875rem; font-weight: 500;
  letter-spacing: var(--tr-label); text-transform: uppercase;
  padding: 0.5625rem 0.9375rem; border: 1px solid var(--hair); background: transparent;
  border-radius: var(--r); position: relative; overflow: hidden;
  transition: color var(--t-swift) var(--e-out), border-color var(--t-swift) var(--e-out),
              transform var(--t-press) var(--e-out);
}
.access::before {
  content: ''; position: absolute; inset: 0; background: var(--accent-soft);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-med) var(--e-out);
}
.access > * { position: relative; }
.access svg {
  width: 1.5rem; height: 0.8125rem; fill: none; stroke: currentColor;
  stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--t-med) var(--e-out);
}
.access:hover { color: var(--accent); border-color: var(--accent-line); }
.access:hover::before { transform: scaleX(1); }
.access:hover svg { transform: translateX(0.4375rem); }
.access:active { transform: translateY(0.0625rem); }
.access[disabled] { color: var(--ink-faint); cursor: default; border-color: var(--hair-soft); }
.access[disabled] svg { opacity: .4; }
.access[disabled]::before { transform: scaleX(0); }
.access[disabled]:hover { transform: none; }
.access[disabled]:hover svg { transform: none; }

/* the record already on screen. The rule stays drawn and the label takes the
   accent, so "which one am I looking at" is answerable without pressing it. */
.access.done { color: var(--accent); border-color: var(--accent-line); }
.access.done::before { transform: scaleX(1); }
.access.done svg { transform: translateX(0.25rem); }

/* the other files in this column — the reference area is the pick list */
.ref { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.ref-h {
  font-size: var(--fs-label); letter-spacing: var(--tr-micro); text-transform: uppercase;
  color: var(--ink-faint); padding-bottom: 0.75rem; width: 100%;
  position: relative; text-align: right;
}
/* `stretch`, not `flex-end`: a non-stretch align on this column collapses each
   row to its own content width, so the rows are drawn right-aligned one by one
   and the markers land wherever each name happens to end. The rows fill the
   track and align their own contents instead — the right edge still comes from
   the column's last track, so the block still hangs off the plate's right rule. */
.ref-list { list-style: none; margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.125rem; align-items: stretch; width: 100%; }
/* A reference row is a three-column table, not a right-aligned sentence: the
   markers line up in one rail, the names start on one axis, the numbers end on
   one axis. Right-aligned, the markers floated — a short name pushed its dot
   inward, and the column of dots turned into a scatter, which is the one thing
   an index is not allowed to be. */
.row {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--ink-dim);
  font: inherit;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; column-gap: 0.75rem;
  width: 100%; padding: 0.375rem 0.5rem 0.375rem 0; position: relative;
  transition: color var(--t-swift) var(--e-out), padding var(--t-med) var(--e-out),
              transform var(--t-press) var(--e-out);
}
/* All three cells are pinned to row 1. The markup is number, name, marker — so
   left to the auto-placement algorithm the number takes column 3 of row 1, the
   name is behind the cursor and starts row 2, and the marker starts row 3: three
   stacked rows per record instead of one table row. */
.row .rn { grid-column: 3; grid-row: 1; text-align: right; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .1em; color: var(--ink-faint); }
/* the name is the one part of a reference row that can give: without this it
   keeps its min-content width, and a short track makes it paint leftward over
   the spec table instead of taking a second line */
.row .rt {
  grid-column: 2; grid-row: 1; text-align: left; min-width: 0;
  font-size: var(--fs-body); letter-spacing: var(--tr-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .rd {
  grid-column: 1; grid-row: 1; width: 0.3125rem; height: 0.3125rem; flex: none; border: 1px solid var(--ink-faint);
  transition: background var(--t-swift) var(--e-out), border-color var(--t-swift) var(--e-out),
              box-shadow var(--t-swift) var(--e-out);
}
.row:hover { color: var(--ink); padding-right: 0.875rem; }
.row:hover .rn { color: var(--ink-dim); }
.row:active { transform: translateX(0.0625rem); }
.row.sel { color: var(--ink); padding-right: 0.875rem; }
.row.sel .rd { border-color: var(--ink); border-radius: 50%; background: var(--ink); }
.row.done .rd { background: var(--accent); border-color: var(--accent); }
.row.sel.done .rd { background: var(--accent); box-shadow: 0 0 0 0.0625rem var(--sheet-tint), 0 0 0 0.125rem var(--accent); }
.row.sel:focus-visible .rd { box-shadow: 0 0 0 0.0625rem var(--sheet-tint), 0 0 0 0.125rem var(--accent); }

/* ============================ now playing ============================== */
.now {
  position: absolute; left: var(--pad); bottom: 9.375rem;
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.5625rem 1rem 0.625rem 0.8125rem; border-radius: 3px;
  background: var(--chip-bg); color: var(--chip-ink);
  box-shadow: 0 1rem 2.375rem -1.375rem var(--shadow);
  max-width: min(46ch, 40vw);
  /* the chip's own colours are tokens (see @property); the reveal needs a delay,
     so that is the only thing timed here */
  transition: opacity .9s var(--e-out), transform .9s var(--e-out);
}
/* a 0.125rem accent tab rather than a border, so the chip keeps one clean edge */
.now::before { content: ''; width: 0.125rem; align-self: stretch; background: #d0783a; flex: none; }
.now b { font-size: 0.75rem; font-weight: 500; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now em {
  font-style: normal; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .1em;
  opacity: .58; white-space: nowrap; padding-left: 0.75rem; border-left: 1px solid var(--chip-hair);
}
.eq { display: flex; align-items: flex-end; gap: 0.125rem; height: 0.6875rem; }
.eq i { width: 0.0625rem; height: 0.1875rem; background: currentColor; opacity: .45; transition: opacity var(--t-med) var(--e-out), height var(--t-med) var(--e-out); }
body.playing .eq i { opacity: 1; animation: eq .9s ease-in-out infinite; }
body.playing .eq i:nth-child(2) { animation-delay: .18s; }
body.playing .eq i:nth-child(3) { animation-delay: .36s; }
body.playing .eq i:nth-child(4) { animation-delay: .54s; }
@keyframes eq { 0%, 100% { height: 0.1875rem; } 50% { height: 0.6875rem; } }
/* the rewind's own colours arrive and leave rather than being switched on */
.now b, .now em { transition: opacity var(--t-med) var(--e-out), color var(--t-med) var(--e-out); }
body.rewinding .now b { opacity: .45; }
body.rewinding .counter b { color: var(--accent); }
body.rewinding .eq i { animation: none; height: 0.1875rem; }
body.no-audio .now { opacity: .72; }

/* ============================ deck ====================================
   Three tracks, and the two outer ones are equal: `1fr auto 1fr` is what puts
   the pager on the frame's own centre line. It used to be absolutely centred in
   the deck and had no idea the transport existed — at 1440 the vantage read-out
   was printed straight under the play button. In a grid it cannot happen, and
   equal outer tracks mean the middle lands on the middle however wide the
   transport gets. */
.deck {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 3.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end; gap: 1.375rem 2.5rem;
}
.sel { justify-self: start; }
.deck-right { justify-self: end; }
.sel-num { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.5rem; }
.sel-num b {
  font-family: var(--disp);
  font-size: var(--fs-num); font-weight: 300; letter-spacing: .01em; line-height: .88;
}
.sel-num i, .sel-num span { font-size: 0.9375rem; font-style: normal; color: var(--ink-faint); font-weight: 300; }
.micro { font-size: var(--fs-label); letter-spacing: var(--tr-micro); text-transform: uppercase; color: var(--ink-faint); }

/* two stacked groups, centred in the middle column: which record, then which
   vantage. Stacking is what gives the deck its rows instead of one very long
   line that had to fit between two blocks that never yielded. */
.pager { justify-self: center; display: flex; flex-direction: column; gap: 0.6875rem; align-items: center; }
.pager .grp { display: flex; align-items: center; gap: 0.75rem; }
.rail { width: 0.0625rem; height: 1.375rem; background: var(--hair); flex: none; }
.pk {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--ink);
  font: inherit; font-size: 1.1875rem; font-weight: 300; line-height: 1;
  padding: 0.25rem 0.3125rem;
  transition: transform var(--t-med) var(--e-out), color var(--t-swift) var(--e-out),
              opacity var(--t-swift) var(--e-out);
}
.pk:hover { color: var(--accent); }
.pk[data-act="prev-file"]:hover, .pk[data-act="prev-col"]:hover { transform: translateX(-0.1875rem); }
.pk[data-act="next-file"]:hover, .pk[data-act="next-col"]:hover { transform: translateX(0.1875rem); }
.pk:active { transform: translateY(0.0625rem) scale(.94); }
.pk.flash { color: var(--accent); }
.cols { display: flex; align-items: center; gap: 0.1875rem; }
.tick {
  position: relative; width: 0.5625rem; height: 1.5rem; border: 0; background: none; padding: 0; cursor: pointer;
}
.tick::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 0.0625rem; height: 0.5625rem;
  background: var(--ink-faint); transform: translate(-50%, -50%);
  transition: height var(--t-med) var(--e-out), width var(--t-med) var(--e-out),
              background var(--t-swift) var(--e-out);
}
.tick:hover::before { background: var(--ink-dim); }
.tick:active::before { height: 1.3125rem; }
.tick.on::before { width: 0.125rem; height: 1.0625rem; background: var(--ink); }
.tick.done::before { background: var(--accent); }
.col-id {
  font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint); white-space: nowrap;
}
.col-id b { color: var(--ink-dim); font-weight: 500; }
.col-id i { font-style: normal; }
.col-name { display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; margin-left: 0.375rem; min-width: 0; }
.col-name b { font-size: var(--fs-body); font-weight: 500; letter-spacing: var(--tr-body); white-space: nowrap; }
.col-name em {
  font-style: normal; font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-faint);
}

.deck-right { display: flex; align-items: flex-end; min-width: 0; }
/* the console. Two rows: what is doing, and where in the tape. The rail gets a
   whole row to itself — a scrubber squeezed between two buttons is a slider,
   and this is the one control that answers "how much is left". */
.transport {
  display: grid; align-items: center;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-areas: "play counter icons" "track track track";
  gap: 0.625rem 0.875rem;
  border: 1px solid var(--hair-soft); border-radius: var(--r);
  padding: 0.5625rem 0.8125rem 0.75rem;
  background: color-mix(in srgb, var(--sheet-tint) calc(var(--sheet-a) * .55), transparent);
  /* no backdrop blur here on purpose: the plate above carries one, and a second
     always-visible blur is a per-frame compositor pass over the whole canvas for
     a difference the console's flat tint already makes. */
  /* no colour transition here: the plate's tint, line, highlight and shadow are
     all tokens, and the tokens themselves are what animates (see @property) —
     reading the same change twice would just double the easing */
}
#btn-play { grid-area: play; }
.transport .counter { grid-area: counter; }
.tc-set { grid-area: icons; justify-self: end; display: flex; align-items: center; gap: 0.625rem; }
.track { grid-area: track; position: relative; display: flex; align-items: center; }

/* The fill is its own element rather than a gradient stop on the native track:
   a gradient cannot be interpolated, so clicking the rail — or pressing Home /
   End — teleported the ink to its new length in a single frame. A transform can,
   and it composites. The tick scale stays behind it (a ::before is the first
   child in paint order), so the measure still reads through the fill. */
.rail-fill {
  position: absolute; left: 0; right: 0; top: 50%; height: 0.0625rem;
  transform: translateY(-50%) scaleX(var(--p, 0));
  transform-origin: 0 50%;
  background: var(--ink); pointer-events: none;
  transition: transform var(--t-fast) var(--e-out), background var(--t-swift) var(--e-out);
}

.tc-btn {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.9375rem; color: var(--chip-ink); background: var(--chip-bg); border-radius: var(--r);
  font: inherit; font-size: var(--fs-label); font-weight: 500;
  letter-spacing: var(--tr-label); text-transform: uppercase;
  transition: transform var(--t-press) var(--e-out), filter var(--t-swift) var(--e-out);
}
.tc-btn:hover { filter: brightness(1.16); }
.tc-btn:active { transform: scale(.98); }
.tc-btn svg { width: 0.6875rem; height: 0.6875rem; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
/* the two glyphs are drawn in the same 16×16 box, so the swap is a cross-fade
   rather than a display flip: the triangle shrinks and turns away while the bars
   rise into place. `display` can never be animated, and on the control that is
   pressed most often that one-frame swap was the most visible cut on the page. */
.tc-btn .ico-play { fill: currentColor; stroke: none; }
.tc-btn .ico-play, .tc-btn .ico-pause {
  transform-box: fill-box; transform-origin: 50% 50%;
  transition: opacity .24s var(--e-out), transform .34s var(--e-out);
}
.tc-btn .ico-pause { opacity: 0; transform: scale(.62) rotate(12deg); }
body.playing .tc-btn .ico-play { opacity: 0; transform: scale(.62) rotate(-12deg); }
body.playing .tc-btn .ico-pause { opacity: 1; transform: none; }
.counter { display: flex; align-items: baseline; gap: 0.3125rem; font-family: var(--mono); }
/* one character of a rolling read-out: the live glyph in flow and the leaving
   one absolutely over it, so the cell's width is the *new* digit's and a roll
   can never shove what is beside it. Tabular figures mean that width is the
   same before and after anyway. */
.od { position: relative; display: inline-block; }
.od > b { display: block; font-weight: inherit; font-variant-numeric: inherit; }
.od > b + b { position: absolute; inset: 0; opacity: 0; }

.counter b { font-size: 0.875rem; font-weight: 400; letter-spacing: .05em; transition: color .45s var(--e-out); }
.counter i, .counter span { font-size: 0.6875rem; font-style: normal; color: var(--ink-faint); transition: color .45s var(--e-out); }
.tc-ico {
  appearance: none; display: grid; place-items: center; width: 1.6875rem; height: 1.6875rem; padding: 0;
  border: 1px solid var(--hair); border-radius: 50%; background: transparent; color: var(--ink-dim);
  cursor: pointer; position: relative;
  transition: color var(--t-swift) var(--e-out), border-color var(--t-swift) var(--e-out),
              background var(--t-swift) var(--e-out), transform var(--t-press) var(--e-out);
}
.tc-ico:hover { color: var(--ink); border-color: var(--ink-faint); }
.tc-ico:active { transform: scale(.92); }
.tc-ico svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.tc-ico.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
/* spin the whole svg, not the arc path: the arc's own bbox centre is off the
   circle's centre, so rotating it orbits instead of turning in place */
#btn-auto.on svg { animation: spin 6.5s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #btn-auto.on svg { animation: none; } }
/* the speaker's arcs retreat and the cross arrives — the same gesture as the
   transport's play/pause, in the same 0.24s/0.34s */
.tc-ico .ico-wave, .tc-ico .ico-x {
  transform-box: fill-box; transform-origin: 50% 50%;
  transition: opacity .24s var(--e-out), transform .34s var(--e-out);
}
.tc-ico .ico-x { opacity: 0; transform: scale(.6) rotate(-14deg); }
body.muted #btn-mute .ico-wave { opacity: 0; transform: scale(.6) rotate(14deg); }
body.muted #btn-mute .ico-x { opacity: 1; transform: none; }
/* only the speaker greys out. `body.muted .tc-ico` was more specific than
   `.tc-ico.on`, so muting also drained the accent out of the 拆解 / 翻面 /
   巡览 icons while they were switched on. */
body.muted #btn-mute { color: var(--ink-faint); }

/* ---- the seek rail ---------------------------------------------------------
   A real <input type="range">, not a div with a pointer handler: the range owns
   the drag, the click-to-jump, the arrow keys and the slider role for free, and
   the page already styles one in the settings sheet, so the rail under the
   counter and the dial in the sheet are visibly the same part. `--p` is written
   by the transport (main.js) as a percentage; the track's gradient is the fill. */
.track::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 0.4375rem;
  transform: translateY(-50%); pointer-events: none;
  background: repeating-linear-gradient(90deg,
    var(--hair) 0 0.0625rem, transparent 0.0625rem 12.5%);
  opacity: .85;
}
.track input[type="range"] {
  appearance: none; -webkit-appearance: none; position: relative; z-index: 1;
  display: block; width: 100%; height: 1.375rem; margin: 0; padding: 0; border: 0;
  background: none; cursor: pointer;
}
.track input[type="range"]::-webkit-slider-runnable-track { height: 0.0625rem; background: var(--hair); }
.track input[type="range"]::-moz-range-track { height: 0.0625rem; background: var(--hair); }
.track input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 0.125rem; height: 0.875rem;
  margin-top: -0.40625rem; border: 0; border-radius: 0; background: var(--ink);
  transition: background var(--t-fast) var(--e-out), height var(--t-fast) var(--e-out),
              margin-top var(--t-fast) var(--e-out);
}
.track input[type="range"]::-moz-range-thumb {
  width: 0.125rem; height: 0.875rem; border: 0; border-radius: 0; background: var(--ink);
}
.track input[type="range"]:hover::-webkit-slider-thumb,
.track input[type="range"]:focus-visible::-webkit-slider-thumb {
  background: var(--accent); height: 1.125rem; margin-top: -0.53125rem;
}
.track input[type="range"]:hover::-moz-range-thumb,
.track input[type="range"]:focus-visible::-moz-range-thumb { background: var(--accent); }
.track input[type="range"]:focus-visible { outline: none; }
body.rewinding .track input[type="range"]::-webkit-slider-thumb { background: var(--accent); }
body.rewinding .track input[type="range"]::-moz-range-thumb { background: var(--accent); }
body.rewinding .rail-fill { background: var(--accent); }

/* ---- volume readout -------------------------------------------------------
   The speaker is a knob as well as a switch: the wheel over it sets the level,
   and this is the only place the number is shown. It sits above the icon, fades
   in on the first notch and fades out a moment after the last one, so nothing
   permanent is added to the console for a control that is used occasionally. */
.vol-read {
  position: absolute; left: 50%; bottom: calc(100% + 0.4375rem); transform: translate(-50%, 0.25rem);
  padding: 0.1875rem 0.4375rem; border: 1px solid var(--sheet-line); border-radius: var(--r);
  background: color-mix(in srgb, var(--sheet-tint) 94%, transparent);
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: .08em; color: var(--ink);
  white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-out);
}
#btn-mute.show-vol .vol-read { opacity: 1; transform: translate(-50%, 0); }
/* the same readout, hung off the one button in the masthead that has something
   to say back — what it is loading, or why it will not */
#btn-add { position: relative; }
#btn-add.show-vol .vol-read { opacity: 1; transform: translate(-50%, 0); }
/* the icon carries the level too: one arc below half, two above, so the state
   reads without the number */
/* the second arc is a level, not a state: above half it is there, below half it
   is not, and it fades across the line rather than blinking */
#btn-mute .ico-wave path { transition: opacity var(--t-med) var(--e-out); }
#btn-mute.vol-lo .ico-wave path:last-child { opacity: 0; }

/* ============================ hud ===================================== */
.hud {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 1.125rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
  font-size: var(--fs-ui); letter-spacing: var(--tr-ui); text-transform: uppercase; color: var(--ink-faint);
}
.hud-l { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.live { width: 0.3125rem; height: 0.3125rem; border-radius: 50%; background: var(--accent); animation: pulse 3.6s var(--e-inout) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.72); } }
body.playing .live { animation-duration: 1.6s; }

/* The key legend as a row of keycaps rather than a sentence of slashes. Each
   chip is a real key plus what it does; `data-p` grades them, and the narrow
   breakpoints drop the lower grades instead of letting the line wrap into the
   deck. The chip lights when its key is pressed (main.js writes .hit), so the
   legend doubles as a keyboard read-out. */
.hud-c {
  display: flex; align-items: center; justify-content: center;
  gap: 0.4375rem 0.9375rem; flex-wrap: wrap;
  /* the key-legend switch used to be `display: none`, which is a cut by
     definition. It closes instead — the row's own height above a cap — so the
     HUD settles as the chips are put away. */
  overflow: hidden; max-height: 6rem;
  transition: opacity .9s var(--e-out), max-height var(--t-slow) var(--e-out);
}
.kg { display: inline-flex; align-items: center; gap: 0.3125rem; }
.kg kbd {
  font-family: var(--mono); font-size: var(--fs-micro); font-weight: 500;
  letter-spacing: .06em; line-height: 1; text-transform: none;
  padding: 0.1875rem 0.3125rem 0.125rem; border: 1px solid var(--hair); border-radius: 2px;
  background: var(--hair-soft); color: var(--ink-dim);
  box-shadow: 0 0.0625rem 0 var(--hair-soft);
  transition: color var(--t-fast) var(--e-out), border-color var(--t-fast) var(--e-out),
              background var(--t-fast) var(--e-out), transform var(--t-press) var(--e-out);
}
.kg em {
  font-style: normal; font-size: var(--fs-micro); letter-spacing: var(--tr-label);
  text-transform: uppercase; color: var(--ink-faint);
}
.kg.hit kbd { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(0.0625rem); }
body.moved .hud-c { opacity: .45; }
body.moved .hud-c:hover,
body.moved .hud-c:focus-within { opacity: 1; }
body.keys-off .hud-c { max-height: 0; opacity: 0; pointer-events: none; }
.hud-r { white-space: nowrap; font-family: var(--mono); }
.hud-r i { font-style: normal; opacity: .5; margin: 0 0.375rem; }

/* ============================ index overlay ============================ */
/* 92% is deliberate: an archive index is a page, and at 82% the room behind it
   left every slug and spec value sitting in a haze. The scene still reads
   through it, which is what says the terminal is behind the sheet rather than
   gone. */
.index {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(1.375rem) saturate(1.1);
  -webkit-backdrop-filter: blur(1.375rem) saturate(1.1);
  display: grid; place-items: center; pointer-events: auto;
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-med) var(--e-out), visibility var(--t-med);
}
/* a hairline of the room left on either side, so the overlay reads as a sheet
   laid over the terminal rather than as the terminal disappearing */
.index::before, .index::after {
  content: ''; position: absolute; left: 0; right: 0; height: 0.0625rem;
  background: linear-gradient(90deg, transparent, var(--hair), transparent);
}
.index::before { top: 0; }
.index::after { bottom: 0; }
.index[hidden] { display: none; }
.index.open { opacity: 1; visibility: visible; }
.index-in {
  width: min(73.75rem, calc(100vw - 5.5rem)); max-height: 76vh; overflow: auto;
  padding: 0.25rem 0 0.5rem;
  transform: translateY(0.875rem); opacity: 0;
  transition: transform var(--t-slow) var(--e-out) .04s, opacity var(--t-med) var(--e-out) .04s;
  scrollbar-width: thin; scrollbar-color: var(--hair) transparent;
}
.index.open .index-in { transform: none; opacity: 1; }
.index-in::-webkit-scrollbar { width: 0.375rem; }
.index-in::-webkit-scrollbar-thumb { background: var(--hair); }
.index-in::-webkit-scrollbar-track { background: transparent; }
/* the settings sheet is the same overlay with five rows in it, so it gets its
   own measure rather than a card rack's */
#settings .index-in { width: min(38.75rem, calc(100vw - 5.5rem)); }

.index-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1.25rem;
  border-bottom: 1px solid var(--hair); padding-bottom: 0.875rem;
}
.index-h { font-size: 0.6875rem; letter-spacing: .24em; text-transform: uppercase; display: flex; gap: 0.625rem; align-items: baseline; }
.index-h span { color: var(--ink-faint); }
#index-close, #settings-close {
  border: 1px solid var(--hair); border-radius: var(--r); padding: 0.4375rem 0.75rem;
  letter-spacing: .18em;
}
#index-close:hover, #settings-close:hover { border-color: var(--accent-line); }
#index-close::after, #settings-close::after { display: none; }

/* rows: the name over its English slug and one line of what it does, with the
   switch at the right — the theme switcher's segmented control, on its own row */
.set-list { list-style: none; margin: 0.25rem 0 0; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1rem 0.125rem; border-bottom: 1px solid var(--hair-soft);
  transition: padding-left var(--t-med) var(--e-out), border-color var(--t-swift) var(--e-out);
  /* the rows cascade like the spec rows and the index cards; `--i` is the row's
     index, written when they are built */
  animation: cascadeIn .5s var(--e-out) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.set-row:hover { padding-left: 0.5rem; border-color: var(--hair); }
.set-t { display: flex; flex-direction: column; gap: 0.1875rem; min-width: 0; }
.set-t b { font-size: 0.8125rem; font-weight: 500; letter-spacing: .06em; color: var(--ink); }
.set-t i {
  font-style: normal; font-family: var(--mono); font-size: var(--fs-micro);
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
}
.set-t em { font-style: normal; font-size: var(--fs-ui); line-height: 1.55; color: var(--ink-dim); }
.set-row .seg { flex: none; }
/* the sheet's one dial. Same rail language as the segmented control — a hairline
   with ink for what is set — but continuous: the ink length is `--fill`, written
   by the row's own painter, and the handle is a tick on the rail rather than a
   knob, because nothing else on this page has a round thumb either. The number
   beside it is the deck's own mono read-out. */
.set-dial { flex: none; display: flex; align-items: center; gap: 0.875rem; }
.set-val {
  min-width: 2.125rem; text-align: right; font-family: var(--mono);
  font-size: var(--fs-label); letter-spacing: .08em;
  color: var(--ink);
}
/* the same rail as the transport's, out of the same parts: a hairline track, an
   ink fill that scales, a tick for a thumb */
.dial-track { position: relative; flex: none; display: flex; align-items: center; width: 8.25rem; }
.set-dial input[type="range"] {
  appearance: none; -webkit-appearance: none; display: block;
  width: 100%; height: 1.625rem; margin: 0; padding: 0; border: 0; background: none;
  cursor: pointer; pointer-events: auto;
}
.set-dial input[type="range"]::-webkit-slider-runnable-track { height: 0.0625rem; background: var(--hair); }
.set-dial input[type="range"]::-moz-range-track { height: 0.0625rem; background: var(--hair); }
.set-dial input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 0.1875rem; height: 0.8125rem;
  margin-top: -0.375rem; border: 0; border-radius: 0; background: var(--ink);
}
.set-dial input[type="range"]::-moz-range-thumb {
  width: 0.1875rem; height: 0.8125rem; border: 0; border-radius: 0; background: var(--ink);
}
.set-dial input[type="range"]:hover::-webkit-slider-thumb,
.set-dial input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--accent); }
.set-dial input[type="range"]:hover::-moz-range-thumb,
.set-dial input[type="range"]:focus-visible::-moz-range-thumb { background: var(--accent); }
.set-dial input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.index-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.375rem 2.625rem; margin-top: 1.75rem; }
.icol {
  display: flex; flex-direction: column;
  animation: cascadeIn .55s var(--e-out) both; animation-delay: calc(var(--i, 0) * 45ms);
}
/* the header of a card is the control: the whole record is one clickable
   block, and the specs underneath are what it is filed under */
.icol-h {
  appearance: none; border: 0; background: none; cursor: pointer; font: inherit; text-align: left;
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.625rem;
  padding: 0 0 0.625rem; border-bottom: 1px solid var(--hair); color: var(--ink);
  transition: color var(--t-swift) var(--e-out), padding-left var(--t-med) var(--e-out),
              transform var(--t-press) var(--e-out);
}
.icol-h span { font-size: var(--fs-body); letter-spacing: .05em; }
.icol-h em {
  font-style: normal; font-family: var(--mono); font-size: 0.625rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); transition: color var(--t-swift) var(--e-out);
}
.icol-h:hover { color: var(--accent); padding-left: 0.375rem; }
.icol-h:hover em { color: var(--accent); }
.icol-h:active { transform: translateY(0.0625rem); }
.icol.on .icol-h { color: var(--accent); }
.icol.on .icol-h em { color: var(--accent); }
.icol.on .icol-h { border-bottom-color: var(--accent-line); }
.icol .spec { margin-top: 0.25rem; border-top: 0; }

/* ---------- exploded annotations ---------- */
.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .6s var(--e-out); }
.lines line { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 3; }
.lines circle { fill: none; stroke: var(--accent); stroke-width: 1; }
/* opacity only — x1/y1/cx/cy are CSS properties in SVG2, so `all` would animate
   the leaders crawling to their anchors instead of just fading */
.lines line, .lines circle { transition: opacity .6s var(--e-out); }
.anno {
  position: absolute; opacity: 0; visibility: hidden;
  transition: opacity .6s var(--e-out), visibility .6s;
  white-space: nowrap; pointer-events: none;
}
.anno b { display: block; font-size: 0.75rem; font-weight: 400; letter-spacing: .14em; }
.anno i { font-style: normal; font-family: var(--mono); font-size: 0.625rem; letter-spacing: .14em; color: var(--ink-faint); }
.anno u { position: absolute; text-decoration: none; font-family: var(--mono); font-size: 0.625rem; color: var(--accent); letter-spacing: .1em; }
.anno[data-side="right"] { text-align: right; }
.anno[data-side="right"] u { right: 0; top: -1rem; }
.anno[data-side="left"] { text-align: left; }
.anno[data-side="left"] u { left: 0; top: -1rem; }
body.exploded .anno { opacity: 1; visibility: visible; }
/* while one part is being read, its leader line is the only one drawn */
body.exploded .anno.mute { opacity: 0; visibility: hidden; }

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 20; background: var(--paper);
  display: grid; place-items: center;
  transition: opacity .9s var(--e-out), visibility .9s;
}
body.ready .loader { opacity: 0; visibility: hidden; }
.loader-box { animation: lin .8s var(--e-out) both; }
@keyframes lin { from { opacity: 0; transform: translateY(0.5625rem); } to { opacity: 1; transform: none; } }
.loader-mark {
  font-family: var(--disp);
  font-size: 0.8125rem; letter-spacing: .5em; color: var(--ink-faint); margin-bottom: 1.375rem; text-align: center;
}
.loader-mark b { font-weight: 700; color: var(--ink); }
.loader-bar { position: relative; width: 15rem; height: 0.0625rem; background: var(--hair); margin: 0 auto; }
.loader-bar i { display: block; height: 100%; width: 0%; background: var(--ink); transition: width .4s var(--e-out); }
/* the leading edge of the bar carries the accent, so the one moving thing on
   this screen is the thing that is doing the work */
.loader-bar i::after {
  content: ''; position: absolute; top: -0.125rem; height: 0.3125rem; width: 0.3125rem;
  background: var(--accent); transform: translateX(-0.3125rem);
}
.loader-lbl {
  display: flex; justify-content: space-between; width: 15rem; margin: 0.8125rem auto 0;
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: .18em; color: var(--ink-faint);
}
@media (prefers-reduced-motion: reduce) { .loader-box { animation: none; } }

/* ---------- reveal ---------- */
.mast, .dossier, .deck, .hud, .now { opacity: 0; transform: translateY(0.875rem); }
.dossier { transform: translateY(0.875rem); }
body.ready .mast, body.ready .deck, body.ready .hud, body.ready .now { opacity: 1; transform: translateY(0); }
body.ready .dossier { opacity: 1; transform: none; }
.mast { transition: opacity 1.1s var(--e-out) .1s, transform 1.1s var(--e-out) .1s; }
.dossier { transition: opacity 1.2s var(--e-out) .24s, transform 1.2s var(--e-out) .24s, left .7s var(--e-out); }
.now { transition: opacity .9s var(--e-out) .5s, transform .9s var(--e-out) .5s; }
.deck { transition: opacity 1s var(--e-out) .58s, transform 1s var(--e-out) .58s; }
.hud { transition: opacity 1s var(--e-out) .72s, transform 1s var(--e-out) .72s; }

/* ============================ responsive ==============================
   The deck breaks first: two equal outer tracks have to hold the transport and
   the pager side by side, which needs about 65rem. Below that the pager takes
   a row of its own, then the whole band stacks. */
@media (max-width: 1240px) {
  .dossier { width: min(calc(50% - var(--pad)), var(--plate-max)); }
  .col-name { display: none; }
  .deck { gap: 1.125rem 1.75rem; }
}
@media (max-width: 1080px) {
  .deck {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    grid-template-areas: "sel right" "pager pager";
  }
  .sel { grid-area: sel; }
  .deck-right { grid-area: right; }
  .pager { grid-area: pager; justify-self: center; margin-top: 0.125rem; }
  /* the deck has just grown a second row, so the now-chip has to clear it */
  .now { bottom: 12.5rem; }
}
@media (max-width: 900px) {
  :root { --pad: 1.5rem; --sheet-pad-x: 1.25rem; --sheet-pad-t: 1.125rem; --sheet-pad-b: 1.25rem; }
  .frame { inset: 0.6875rem; }
  .mast { top: 1.625rem; flex-direction: column; gap: 0.875rem; }
  .mast-nav { padding-top: 0; flex-wrap: wrap; }
  /* the record becomes a bottom sheet; the scene keeps the top of the frame.
     The three offsets are measured off the stacked console below: deck 2.625rem
     tall 14rem, the now-chip under the plate, and the plate capped so it cannot
     reach back up into the masthead. */
  .dossier { left: var(--pad); right: var(--pad); top: auto; bottom: 20rem; transform: none; width: auto; max-width: none; }
  body.ready .dossier { transform: none; }
  .dossier, .sheet { max-height: calc(100vh - 36.5rem); }
  /* the bottom sheet is already the whole column: the retract has nothing to
     give way to down here, and folding would push it off the left edge */
  .sheet, .dossier.tight .sheet, .dossier.folded .sheet { margin-left: 0; }
  .sheet { overflow: auto; scrollbar-width: thin; }
  .doc-note, .vr { display: none; }
  .dossier-grid { grid-template-columns: minmax(0, 1fr); gap: 1.125rem; }
  .ref { align-items: flex-start; text-align: left; }
  .ref-h { text-align: left; }
  .ref-list { align-items: stretch; }
  .row { padding-right: 0; padding-left: 0; }
  .row:hover, .row.sel { padding-right: 0; padding-left: 0.5rem; }
  .now { bottom: 17.5rem; max-width: calc(100vw - var(--pad) * 2); }
  .deck { bottom: 2.625rem; grid-template-columns: minmax(0, 1fr); grid-template-areas: "sel" "right" "pager"; gap: 0.875rem; }
  .deck-right { justify-content: space-between; width: 100%; }
  .transport { flex: 1 1 auto; }
  .sel-num b { font-size: 2.125rem; }
  /* the legend loses its lower grades rather than wrapping into the deck */
  .kg[data-p="3"] { display: none; }
  .hud { justify-content: center; }
  .hud-l, .hud-r { display: none; }
}
@media (max-width: 620px) {
  .brand-mid, .doc-note { display: none; }
  .counter span, .counter i { display: none; }
  .col-id { display: none; }
  .kg[data-p="2"] { display: none; }
  .hud { font-size: 0.625rem; }
  .set-t em { display: none; }
  .dial-track { width: 5.75rem; }
  .index-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- the panel measured against itself ----------
   Deep in the zoom the body is a third of its usual width and two columns
   cannot be had in it: the left track is squeezed to nothing and the spec
   values end up painted over the reference list. So the grid drops to one
   column down there, and the reference area gives way first — it is the same
   six records the deck's ticks and the archive index already carry, and at
   that reading distance the tape is the thing on screen.

   The body is what the margin narrows, so the body is what has to be the query
   container; a viewport query cannot see this, because on a wide window the
   panel is narrow and the window is not. 282 = 330 less the plate's own two
   margins, so the one-column switch happens at the same panel width it always
   did. */
.dbody { container-type: inline-size; }
@container (max-width: 282px) {
  /* both selectors: `.tight` states its own columns, and a container query adds
     no weight to the selectors inside it */
  .dossier-grid, .dossier.tight .dossier-grid { grid-template-columns: minmax(0, 1fr); }
  .ref { display: none; }
}

/* ---------- more contrast, on request ---------- */
@media (prefers-contrast: more) {
  :root, [data-theme="studio"] {
    --ink-faint: rgba(20, 22, 26, .82);
    --hair: rgba(20, 22, 26, .38);
    --hair-soft: rgba(20, 22, 26, .2);
    --sheet-a: 94%;
  }
  [data-theme="noir"] {
    --ink-faint: rgba(242, 239, 233, .82);
    --hair: rgba(242, 239, 233, .4);
    --hair-soft: rgba(242, 239, 233, .22);
    --sheet-a: 94%;
  }
  .frame { border-color: var(--hair); }
}

/* ============================ reduced motion ============================
   The JS half of this lives in main.js (`reduce`): no intro, no idle drift, no
   camera travel, no material cross-fades, and the two text helpers land their
   value instead of animating it. These are the same decisions on the CSS side.

   `*` rather than a list of selectors. When the whole point of a page is that
   nothing changes in one frame, a hand-kept list of exceptions is a list that
   goes stale the moment another detail is animated — and this pass added a dozen
   of them. Longhands, because the rules being overridden set the `transition` and
   `animation` shorthands, and a delay left in place is still motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01s !important;
    transition-delay: 0s !important;
    animation-duration: .01s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}
