/* Built by kit/build.mjs from kit/src/core.css and kit/parts/*.css — edit those, not this. */
/*
 * Tactile UI Kit — Tactile Modernism.
 *
 * Interface parts made the way Braun made radios: bead-blasted aluminium and
 * soft-touch black, printing instead of decoration, and no brand colour at
 * all. Colour only means something — a lamp that is on, a display that is
 * lit. Everything is lit by one lamp, high and to the left.
 *
 * Two finishes: aluminium (light, the default) and graphite (dark). Put
 * data-finish="graphite" on any element to switch everything inside it.
 * They are the Machined family; other families of finishes (porcelain and
 * black, ...) are their own stylesheets in kit/themes/, listed in
 * kit/finishes.mjs. Each finish has a tone, data-tone="light" or "dark".
 * Two volumes: Tactile (the default) and Quiet, the same parts with the depth
 * nearly off. Put data-volume="quiet" on any element (see "depth" below).
 * Every class starts with tui-. No dependencies; kit.mjs adds behaviour to the
 * few parts that need it (knob, tabs, toasts, meters).
 */

@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* Medium and semibold (Fontsource 5.3.0, OFL-1.1), Latin and Latin Extended: labels and keys at 500–600, not bold. */
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-Medium-Ext.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Instrument Sans'; src: url('./fonts/InstrumentSans-SemiBold-Ext.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; src: url('./fonts/GeistMono-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('./fonts/GeistMono-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ------------------------------------------------------------------ tokens */

:root, [data-finish="aluminium"] {
  --tui-red-ink: oklch(from var(--tui-red) 0.4824 calc(c * 0.8410) calc(h + 0.65));      /* red as text (danger, errors): the lamp red is too light to read on aluminium */
  color-scheme: light;
  --tui-desk: var(--tn-desk, #d8d7d2); --tn-desk: color-mix(in oklab, #d8d7d2, oklch(from #d8d7d2 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));        /* what the device stands on: the page */
  --tui-face: var(--tn-face, #e6e6e2); --tn-face: color-mix(in oklab, #e6e6e2, oklch(from #e6e6e2 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));        /* bead-blasted aluminium: panels */
  --tui-face-hi: var(--tn-face-hi, #f2f2ef); --tn-face-hi: color-mix(in oklab, #f2f2ef, oklch(from #f2f2ef l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));     /* raised parts: caps, knobs, thumbs */
  --tui-face-lo: var(--tn-face-lo, #cbccc8); --tn-face-lo: color-mix(in oklab, #cbccc8, oklch(from #cbccc8 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));     /* slots, chamfers */
  --tui-tactile-well: var(--tn-tactile-well, #d3d4d0); --tn-tactile-well: color-mix(in oklab, #d3d4d0, oklch(from #d3d4d0 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); /* recessed: fields, tracks (read --tui-well: the volume picks it) */
  --tui-skirt: var(--tn-skirt, #646561); --tn-skirt: color-mix(in oklab, #646561, oklch(from #646561 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));       /* the side of a key, seen below its top: dark enough to show the key at 3:1 */
  --tui-ink: var(--tn-ink, #1b1c1e); --tn-ink: color-mix(in oklab, #1b1c1e, oklch(from #1b1c1e l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));         /* printing */
  --tui-ink-2: var(--tn-ink-2, #45474b); --tn-ink-2: color-mix(in oklab, #45474b, oklch(from #45474b l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));       /* secondary printing, 6:1 on the face, 4.5:1 in a recess */
  --tui-ink-3: var(--tn-ink-3, #6c6e72); --tn-ink-3: color-mix(in oklab, #6c6e72, oklch(from #6c6e72 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));       /* tertiary: scales and hints, 3.6:1 — never body text */
  --tui-rule: var(--tn-rule, rgb(27 28 30 / 0.16)); --tn-rule: color-mix(in oklab, rgb(27 28 30 / 0.16), oklch(from rgb(27 28 30 / 0.16) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-cap: #1e1f21;         /* the contrast key: the one action that matters */
  --tui-cap-hi: #2d2e31;
  --tui-cap-skirt: #070708;
  --tui-cap-ink: #efede8;
  --tui-hl: rgb(255 255 255 / 0.9);   /* the catch light on a top edge */
  --tui-sh: 24 25 28;                  /* shadow colour, as channels */
  --tui-sh-a: 0.24;
  --tui-tactile-grain: 0.5;
  --tui-focus: var(--tb-edge, #1b1c1e);
  /* Metal and plastic that differ by finish: parts read these, never the
     finish of an ancestor, so a finish nested in another is exact. */
  --tui-cap-hl: rgb(255 255 255 / 0.14);
  --tui-rocker-hi: #f4f4f1; --tui-rocker-mid: #dedfdb; --tui-rocker-lo: #c4c5c1; --tui-rocker-sunk: #b1b2ae; --tui-rocker-wall: #8a8b87;
  --tui-rocker-mark: #2a2b2d; --tui-rocker-bezel: linear-gradient(#0c0d0e, #1d1e20);
  --tui-knob-hi: #fafaf8; --tui-knob-mid: #d9dad6; --tui-knob-lo: #a9aaa6;
  --tui-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.6), inset 0 -1px 2px rgb(0 0 0 / 0.3), 0 1px 2px rgb(0 0 0 / 0.35);
  --tui-cloth: #2a2b2d;
  --tui-backdrop: rgb(14 15 16 / 0.45);
  /* The floor of a recess darkens toward its upper wall. */
  --tui-tactile-well-fill: linear-gradient(to bottom, color-mix(in oklab, var(--tui-tactile-well) 86%, rgb(var(--tui-sh))), var(--tui-tactile-well) 55%);
  /* The Quiet volume in this finish: hairlines in ink, flat caps and wells. */
  --tui-quiet-well: var(--tn-quiet-well, #dcddd9); --tn-quiet-well: color-mix(in oklab, #dcddd9, oklch(from #dcddd9 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-key: var(--tn-quiet-key, #f3f3f0); --tn-quiet-key: color-mix(in oklab, #f3f3f0, oklch(from #f3f3f0 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-hover: var(--tn-quiet-key-hover, #f8f8f6); --tn-quiet-key-hover: color-mix(in oklab, #f8f8f6, oklch(from #f8f8f6 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-down: var(--tn-quiet-key-down, #e8e8e5); --tn-quiet-key-down: color-mix(in oklab, #e8e8e5, oklch(from #e8e8e5 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-line: var(--tn-quiet-line, rgb(27 28 30 / 0.13)); --tn-quiet-line: color-mix(in oklab, rgb(27 28 30 / 0.13), oklch(from rgb(27 28 30 / 0.13) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-line-2: var(--tn-quiet-line-2, rgb(27 28 30 / 0.22)); --tn-quiet-line-2: color-mix(in oklab, rgb(27 28 30 / 0.22), oklch(from rgb(27 28 30 / 0.22) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-edge: var(--tn-quiet-edge, rgb(27 28 30 / 0.5)); --tn-quiet-edge: color-mix(in oklab, rgb(27 28 30 / 0.5), oklch(from rgb(27 28 30 / 0.5) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));   /* the hairline round a control: keys, fields, trays (3:1 on the plate) */
  --tui-quiet-hl: rgb(255 255 255 / 0.8);
  --tui-quiet-whisper: 0 1px 2px rgb(24 25 28 / 0.07);
  --tui-quiet-shade: rgb(24 25 28 / 0.12);
  --tui-quiet-cap-hover: #303134; --tui-quiet-cap-down: #141516; --tui-quiet-cap-ring: rgb(0 0 0 / 0.55); --tui-quiet-cap-hl: rgb(255 255 255 / 0.12);
  /* An object drawn in this finish (its plate, the material in shadow, mid tone, lit, hotspot, the room in it, frame, edge; shadow alpha; 1 for matte; its markings, and how much they and its edges glow): bead-blasted aluminium. */
  --tui-obj-plate: #c9cac5; --tui-obj-dark: #6f747b; --tui-obj-body: #aeb4bb; --tui-obj-lite: #ffffff; --tui-obj-spec: #ffffff;
  --tui-obj-env: #dde4ec; --tui-obj-frame: #bfc0bb; --tui-obj-edge: #f6f7f8; --tui-obj-shadow: 0.34; --tui-obj-matte: 0;
  --tui-obj-mark: #1b1c1e; --tui-obj-glow: 0;
}

/* Set by graphite alone; every other finish draws them from its own light, so a finish nested in graphite does not inherit its values. */
[data-finish] { --tui-rocker-lip: initial; --tui-strip-floor: initial; --tui-strip-lip: initial; }
[data-finish="graphite"] {
  color-scheme: dark;
  --tui-red-ink: oklch(from var(--tui-red) 0.7088 calc(c * 0.9285) calc(h - 0.59));      /* red as text on graphite: lighter than the lamp so it reads at 4.5:1 */
  --tui-desk: var(--tn-desk, #0e0f10); --tn-desk: color-mix(in oklab, #0e0f10, oklch(from #0e0f10 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-face: var(--tn-face, #1b1c1e); --tn-face: color-mix(in oklab, #1b1c1e, oklch(from #1b1c1e l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));        /* soft-touch black */
  --tui-face-hi: var(--tn-face-hi, #28292c); --tn-face-hi: color-mix(in oklab, #28292c, oklch(from #28292c l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-face-lo: var(--tn-face-lo, #141516); --tn-face-lo: color-mix(in oklab, #141516, oklch(from #141516 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-tactile-well: var(--tn-tactile-well, #121315); --tn-tactile-well: color-mix(in oklab, #121315, oklch(from #121315 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-skirt: var(--tn-skirt, #09090a); --tn-skirt: color-mix(in oklab, #09090a, oklch(from #09090a l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink: var(--tn-ink, #e8e6e1); --tn-ink: color-mix(in oklab, #e8e6e1, oklch(from #e8e6e1 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink-2: var(--tn-ink-2, #a6a7a9); --tn-ink-2: color-mix(in oklab, #a6a7a9, oklch(from #a6a7a9 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink-3: var(--tn-ink-3, #7a7c7f); --tn-ink-3: color-mix(in oklab, #7a7c7f, oklch(from #7a7c7f l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-rule: var(--tn-rule, rgb(232 230 225 / 0.11)); --tn-rule: color-mix(in oklab, rgb(232 230 225 / 0.11), oklch(from rgb(232 230 225 / 0.11) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-cap: #e9e7e2;
  --tui-cap-hi: #f6f4ef;
  --tui-cap-skirt: #a8a7a3;
  --tui-cap-ink: #17181a;
  --tui-hl: rgb(255 255 255 / 0.11);
  /* Black plastic: the floor of a recess is darkest under its upper wall
     and picks up the lamp again near the lower one. */
  --tui-tactile-well-fill: linear-gradient(to bottom, #070808, var(--tui-tactile-well) 45%, #17181a);
  --tui-sh: 0 0 0;
  --tui-sh-a: 0.55;
  --tui-tactile-grain: 0.35;
  /* The slot a control slides in (switch, fader). Dark on dark it vanished, so on graphite it is a machined channel: its floor a step
     lighter than the plate, shadow under its upper wall, the room lamp caught on its lower lip (3:1 or more against the face). */
  --tui-slot-fill: linear-gradient(to bottom, #08090a, #1f2023 38%, #2e2f33);
  /* the switch is a wide pill: its floor lifted along its whole height, so the recess reads at thumbnail size as the track does */
  --tui-slot-fill-pill: linear-gradient(to bottom, #151618, #2d2e32 30%, #3a3b40);
  --tui-slot-depth: inset 0 2px 2px -1px rgb(0 0 0 / 0.85), inset 0 -1px 0 rgb(232 230 225 / 0.6), 0 1px 0 rgb(232 230 225 / 0.16);
  --tui-focus: var(--tb-edge, #e8e6e1);
  --tui-cap-hl: rgb(255 255 255 / 0.8);
  --tui-rocker-hi: #5b5c60; --tui-rocker-mid: #45464a; --tui-rocker-lo: #36373a; --tui-rocker-sunk: #2a2b2e; --tui-rocker-wall: #1a1b1d;
  --tui-rocker-mark: #e4e2dd; --tui-rocker-bezel: linear-gradient(#050506, #0d0e0f);
  /* The lamp rocker's lit lower lip and the channel strip's slot: dark on dark they vanished, so graphite lights the lower edge (about 4:1 on the face). */
  --tui-rocker-lip: rgb(232 230 225 / 0.5); --tui-strip-floor: linear-gradient(#141517, #26272b 40%, #2c2d31); --tui-strip-lip: rgb(232 230 225 / 0.06);
  --tui-knob-hi: #5a5b5f; --tui-knob-mid: #2c2d30; --tui-knob-lo: #141517;
  --tui-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.2), inset 0 -1px 2px rgb(0 0 0 / 0.5), 0 1px 2px rgb(0 0 0 / 0.6);
  --tui-cloth: #1f2022;
  --tui-backdrop: rgb(0 0 0 / 0.6);
  --tui-quiet-well: var(--tn-quiet-well, #151618); --tn-quiet-well: color-mix(in oklab, #151618, oklch(from #151618 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-key: var(--tn-quiet-key, #26272a); --tn-quiet-key: color-mix(in oklab, #26272a, oklch(from #26272a l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-hover: var(--tn-quiet-key-hover, #2a2b2e); --tn-quiet-key-hover: color-mix(in oklab, #2a2b2e, oklch(from #2a2b2e l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-down: var(--tn-quiet-key-down, #1e1f21); --tn-quiet-key-down: color-mix(in oklab, #1e1f21, oklch(from #1e1f21 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-line: var(--tn-quiet-line, rgb(232 230 225 / 0.1)); --tn-quiet-line: color-mix(in oklab, rgb(232 230 225 / 0.1), oklch(from rgb(232 230 225 / 0.1) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-line-2: var(--tn-quiet-line-2, rgb(232 230 225 / 0.17)); --tn-quiet-line-2: color-mix(in oklab, rgb(232 230 225 / 0.17), oklch(from rgb(232 230 225 / 0.17) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-edge: var(--tn-quiet-edge, rgb(232 230 225 / 0.5)); --tn-quiet-edge: color-mix(in oklab, rgb(232 230 225 / 0.5), oklch(from rgb(232 230 225 / 0.5) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-hl: rgb(255 255 255 / 0.06);
  --tui-quiet-whisper: 0 1px 2px rgb(0 0 0 / 0.35);
  --tui-quiet-shade: rgb(0 0 0 / 0.4);
  --tui-quiet-cap-hover: #f7f5f0; --tui-quiet-cap-down: #d9d7d2; --tui-quiet-cap-ring: rgb(0 0 0 / 0.6); --tui-quiet-cap-hl: rgb(255 255 255 / 0.7);
  /* An object drawn in this finish (its plate, the material in shadow, mid tone, lit, hotspot, the room in it, frame, edge; shadow alpha; 1 for matte; its markings, and how much they and its edges glow): graphite anodised, a step darker than steel, its edges diamond-cut bright. */
  --tui-obj-plate: #08090a; --tui-obj-dark: #0f1012; --tui-obj-body: #5f656d; --tui-obj-lite: #dfe5ec; --tui-obj-spec: #ffffff;
  --tui-obj-env: #8e9cad; --tui-obj-frame: #1c1d20; --tui-obj-edge: #e2e6ea; --tui-obj-shadow: 0.55; --tui-obj-matte: 0;
  --tui-obj-mark: #e8e6e1; --tui-obj-glow: 0;
}

/* Lamps: the only colour in the kit, and always a signal. Each status has one
   place, here. Set --tui-green, --tui-amber, --tui-red or --tui-blue on :root
   (after kit.css) or on a container and every lamp, meter, switch and legend
   inside follows; the red used as text (--tui-red-ink, in each finish) is
   derived from --tui-red, so it follows too. Blue is an indicator (linked, for
   information) and white is a cold LED: neither is an accent, they light only
   when they mean something. */
:root {
  --tui-green: #3fa34d;
  --tui-amber: #f29f05;
  --tui-red: #d93a2b;
  --tui-blue: #2f86eb;
}

/*
 * Tune it to your brand: three optional knobs, plain custom properties a buyer
 * sets once, on :root or on any element that carries a data-finish (the
 * tokens are worked out where a finish is set). Unset, each is invisible: the
 * tokens below are exactly what they were.
 *
 *   --tui-brand            a colour. The primary key, the focus ring, the mark
 *                          in a ticked box, a progress fill, a link's
 *                          underline, a chosen table row and the chosen day
 *                          of a calendar take it. Nothing else does, and no
 *                          text is ever coloured with it: printing on a brand
 *                          surface is black or white, whichever reads better.
 *   --tui-tone             a hue in degrees, and
 *   --tui-tone-strength    0 to 0.12 (default 0): how far the finish's
 *                          neutrals (desk, faces, wells, rules, the three
 *                          inks) lean toward that hue. Lightness is kept.
 *   --tui-green, -amber, -red, -blue   the status colours (above).
 *
 * Every neutral a finish sets reads `--tui-x: var(--tn-x, <its own value>)`
 * and works out `--tn-x` from the knobs. A knob that is unset makes --tn-x
 * invalid, so the var() falls back to the finish's own value, text and all.
 */
:root, [data-finish] {
  /* The tone: each neutral is mixed toward a colour of its own lightness and alpha, the knob's hue, and a
     chroma that grows with the square root of its lightness (so a dark desk is tinted less than a light one,
     and neither goes muddy). The share is strength / 0.12 of one half: at 0.12 it is half way. Mixed in
     OKLab, where a warm grey passes through neutral, not through green. */
  --tn-p: calc(var(--tui-tone-strength) / 0.12 * 50%);
  /* The brand, as a key: its colour, a darker side, a catch light, and the ink printed on it. The
     ink is white where the brand's relative luminance (the Y of CIE XYZ, which WCAG's contrast
     ratio is made of) is under 0.1791 and black above it, the point where both read at 4.58:1, so
     any brand reads at 4.5:1 or better. The face is flat so that holds across all of it. Hover and
     press move the face away from the ink, which can only add contrast. */
  --tb-cap: var(--tui-brand);
  --tb-ink: color(from var(--tui-brand) xyz-d65 calc(clamp(0, (0.1791 - y) * 1000000, 1) * 0.9505) clamp(0, (0.1791 - y) * 1000000, 1) calc(clamp(0, (0.1791 - y) * 1000000, 1) * 1.089));
  --tb-away: oklch(from var(--tb-ink) calc(1 - l) 0 0);
  --tb-hover: color-mix(in oklab, var(--tb-cap), var(--tb-away) 8%);
  --tb-down: color-mix(in oklab, var(--tb-cap), var(--tb-away) 16%);
  --tb-skirt: oklch(from var(--tui-brand) calc(l - 0.16) c h);
  --tb-hl: oklch(from var(--tui-brand) 1 0 0 / 0.25);
  /* The brand, drawn on the plate: the same hue, held dark enough on a light finish and light
     enough on a dark one to keep 3:1 against the plate (a ring, a mark, a fill, a rule). */
  --tb-edge: light-dark(oklch(from var(--tui-brand) min(l, 0.5) c h), oklch(from var(--tui-brand) max(l, 0.72) c h));
  /* The broad light on a cap. Unset, it is the catch light on the cap's edge
     (--tui-hl) and the two are one; a finish whose caps are satin under a
     bright cut edge sets it apart (black, kit/themes/materials.css). Reset on
     every finish, so a band never takes the sheen of the page around it. */
  --tui-sheen: initial;
  /* The edges a control is seen by, where a finish's own light is too soft to
     show it at 3:1 (WCAG 1.4.11): the catch light on a cap's top edge and on
     the plate's lip below a cut (--tui-edge-hl), the shade where the plate
     meets a pressed key (--tui-edge-sh), the line round a knob (--tui-knob-rim).
     Unset, each is the finish's own light; reset here so a band never takes
     its page's. */
  --tui-edge-hl: initial;
  --tui-edge-sh: initial;
  --tui-knob-rim: initial;
  --tui-knob-collar-lit: initial;
  --tui-knob-collar-shade: initial;
  /* Wood trims (kit/themes/wood.css): side cheeks, a header strip, the caps of a
     knob and a fader, end stops, a rail's end bars, an inset. Unset, a part draws
     itself as it always did; reset here so a band never takes its page's. */
  --tui-trim-w: initial;
  --tui-trim-stop-w: initial;
  --tui-trim-bar-w: initial;
  --tui-trim-cheek: initial;
  --tui-trim-strip: initial;
  --tui-trim-fader: initial;
  --tui-trim-fader-h: initial;
  --tui-trim-stop: initial;
  --tui-trim-bar: initial;
  --tui-trim-knob: initial;
  --tui-trim-grain: initial;
  --tui-trim-inset: initial;
  /* What a finish with dark paper (a screen, a phosphor tube) changes in parts
     drawn on paper, in either volume: the drawer index's board and the light
     lifting it, the lamp's sheen on thermal paper, an alert legend's glow. */
  --tui-board: initial;
  --tui-board-lift: initial;
  --tui-paper-sheen: initial;
  --tui-legend-glow: initial;
  --tui-legend-wash: initial;
  /* Lamps and displays: the only colour in the kit, and always a signal. The
     four status colours are on :root alone, above, so a buyer's value set on
     :root or on a container reaches every finish inside it. */
  /* A white (powered, standing by): a cold LED, not the warm filament of a bulb. */
  --tui-white: #e6eef7;
  --tui-lcd: #b8bea9;
  --tui-lcd-ink: #1d2318;
  --tui-vfd-bg: #080b0b;
  --tui-vfd: #c6f3ea;
  /* Paper is paper in either finish: a warm off-white slip and the thermal
     ink printed on it (13:1 and 6.3:1 on the paper). Only what lies around
     it, its shadow and the surface it lifts off, changes with the finish. */
  --tui-paper: #efece3;
  --tui-paper-hi: #f6f4ed;
  --tui-paper-ink: #24241f;
  --tui-paper-ink-2: #56554d;

  --tui-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --tui-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Type: words people read are 14px at least; labels are 13px in sentence case.
     Only numerals on a scale inside an object go smaller. */
  --tui-t-label: 13px;
  --tui-t-small: 14px;
  --tui-t-body: 14px;
  --tui-t-lead: 16px;
  --tui-t-h3: 20px;
  --tui-t-h2: 26px;
  --tui-t-h1: clamp(34px, 5vw, 56px);
  --tui-track: 0.09em;

  /* A 4px grid. */
  --tui-1: 4px; --tui-2: 8px; --tui-3: 12px; --tui-4: 16px; --tui-5: 20px; --tui-6: 24px; --tui-8: 32px; --tui-10: 40px; --tui-12: 48px;
  --tui-r-s: 4px; --tui-r-m: 7px; --tui-r-l: 12px;
  /* Corner-safe: words start and end where a side runs straight, never in the bend.
     Text within a radius of a box's top or bottom keeps at least that radius from
     each side: padding-inline: max(var(--tui-2), var(--tui-safe-m)). A pill (radius
     half its height or more) keeps its words half its height from each end. */
  --tui-safe-s: var(--tui-r-s); --tui-safe-m: var(--tui-r-m); --tui-safe-l: var(--tui-r-l);
  --tui-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* Light and a little under-damped: one rebound of about 5%, settled in 240ms (mass 1, stiffness 560, damping 33). Where linear() is unknown the plain curve above stands. */
  --tui-spring-latch: linear(0, 0.028, 0.101, 0.199, 0.312, 0.428, 0.54, 0.644, 0.735, 0.814, 0.879, 0.932, 0.972, 1.002, 1.023, 1.037, 1.044, 1.047, 1.046, 1.044, 1.039, 1.034, 1.029, 1.023, 1.018, 1.014, 1);

  /* A lit lamp's light, the same in every volume: the lamp gives it its colour through `color`. */
  --tui-glow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 6px 1px color-mix(in oklab, currentColor 70%, transparent), 0 0 14px 2px color-mix(in oklab, currentColor 30%, transparent);
  --tui-screw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3CradialGradient id='g' cx='.38' cy='.32' r='.75'%3E%3Cstop offset='0' stop-color='%23fbfbf9'/%3E%3Cstop offset='1' stop-color='%239d9e9a'/%3E%3C/radialGradient%3E%3Ccircle cx='5' cy='5' r='4.3' fill='url(%23g)' stroke='%23000' stroke-opacity='.35' stroke-width='.5'/%3E%3Cpath d='M2.4 6.3 7.6 3.7' stroke='%23000' stroke-opacity='.55' stroke-width='.9' stroke-linecap='round'/%3E%3C/svg%3E");
  --tui-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.28 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Machined's control edges (see --tui-edge-hl above). Not on :root itself,
   which every finish set on <html> also matches. */
:root:not([data-finish]), [data-finish="aluminium"] {
  --tui-edge-sh: rgb(24 25 28 / 0.68);
  --tui-knob-collar-lit: rgb(255 255 255 / 0.85);
  --tui-knob-collar-shade: rgb(24 25 28 / 0.62);
}
[data-finish="graphite"] {
  --tui-edge-hl: rgb(255 255 255 / 0.42);
  --tui-knob-collar-lit: rgb(255 255 255 / 0.56);
  --tui-knob-collar-shade: rgb(0 0 0 / 0.6);
}

/* ------------------------------------------------------------------ depth */

/*
 * Depth comes in two volumes. Tactile, the default, is the kit as it was
 * built: keys stand on skirts, recesses are dark under their upper wall,
 * plates cast a shadow. Quiet keeps every size, radius, word and lamp and
 * turns the depth nearly off: a hairline edge, one catch light, a whisper of
 * shadow, a 1px sink. Put data-volume="quiet" on <html> or on any element;
 * data-volume="tactile" inside it brings Tactile back. The finish is what a
 * part is made of, the volume is how much light is drawn on it, and the two
 * combine freely.
 *
 * The depth tokens are what a volume sets. Tactile leaves them unset, and
 * every shadow in the kit reads one with its own Tactile drawing as the
 * fallback, so it keeps its exact light (lit by its own variables: a key's
 * skirt, the contrast cap's catch light) and follows any other volume:
 *   box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 var(--skirt) 0 var(--tui-skirt), …);
 *
 *   --tui-depth-plate      a plate standing on the surface: panels, cases, thumbs
 *   --tui-depth-key        a key at rest, a cap on its skirt
 *   --tui-depth-key-hover  a key under the pointer
 *   --tui-depth-pressed    a key held or latched, below the plate
 *   --tui-depth-well       a recess: fields, tracks, trays, display windows
 *   --tui-depth-shade      shading drawn inside a recess, over what sits in it
 *   --tui-depth-float      a plate above the page: menus, popovers, toasts, dialogs
 *   --tui-depth-cap        the face of a raised cap (a background)
 *   --tui-depth-tone, --tui-depth-floor, --tui-depth-grain
 *                          the colour and floor of a recess (backgrounds), the panels' grain
 *
 * A lamp's light is not depth: --tui-glow is the same in every volume.
 */

/* The switch: empty in a quiet volume and unset everywhere else, so each
   `var(--tui-quiet) <value>` below is <value> in Quiet and unset in Tactile. */
[data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"] { --tui-quiet: ; }
[data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *) { --tui-quiet: initial; }

/* Declared wherever the finish or the volume can change, so they follow both. */
:root, [data-finish], [data-volume] {
  --tui-depth-plate: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-line), var(--tui-quiet-whisper);
  --tui-depth-key: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-edge), var(--tui-quiet-whisper);
  /* Hover and press draw the stronger line over the control's own, one step darker. */
  --tui-depth-key-hover: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-line-2), 0 0 0 1px var(--tui-quiet-edge), var(--tui-quiet-whisper);
  --tui-depth-pressed: var(--tui-quiet) 0 0 0 1px var(--tui-quiet-line-2), 0 0 0 1px var(--tui-quiet-edge), inset 0 1px 1px var(--tui-quiet-shade);
  --tui-depth-well: var(--tui-quiet) inset 0 0 0 1px var(--tui-quiet-edge), inset 0 1px 0 rgb(var(--tui-sh) / 0.05);
  --tui-depth-shade: var(--tui-quiet) none;
  --tui-depth-float: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-line), 0 10px 24px -14px rgb(var(--tui-sh) / 0.35);
  --tui-depth-cap: var(--tui-quiet) linear-gradient(var(--tui-quiet-key), var(--tui-quiet-key));
  --tui-depth-tone: var(--tui-quiet) var(--tui-quiet-well);
  --tui-depth-floor: var(--tui-quiet) none;
  --tui-depth-grain: var(--tui-quiet) 0.2;

  /* What the parts read: Tactile's shared drawings, each deferring to the volume. */
  --tui-well: var(--tui-depth-tone, var(--tui-tactile-well));
  --tui-well-fill: var(--tui-depth-floor, var(--tui-tactile-well-fill));
  --tui-grain: var(--tui-depth-grain, var(--tui-tactile-grain));
  /* Light, from the lamp above left. */
  --tui-raised: var(--tui-depth-plate,
    inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 5px 12px -5px rgb(var(--tui-sh) / var(--tui-sh-a)));
  /* The face of a raised cap: lit at the top, a shade darker at the foot. */
  --tui-raised-fill: var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  /* A recess, lit from above: the upper wall is in shadow, the lower wall
     catches the lamp, and so does the plate's lip below the cut. */
  --tui-inset: var(--tui-depth-well,
    inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6)),
    inset 0 9px 12px -9px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)),
    inset 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.45)),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 60%, transparent),
    0 1px 0 var(--tui-edge-hl, var(--tui-hl)),
    0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)));
  /* A pressed key sits below the plate, so the plate's edge shades its top. */
  --tui-pressed: var(--tui-depth-pressed,
    inset 0 5px 5px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 3)),
    inset 4px 0 4px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    inset -4px 0 4px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    0 -1px 0 var(--tui-edge-sh, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3))),
    0 1px 0 var(--tui-edge-hl, var(--tui-hl)));
}

/* ------------------------------------------------------------------- base */

.tui {
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-desk);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
.tui *, .tui *::before, .tui *::after { box-sizing: border-box; }
/* hidden always wins over a part's own display. */
.tui [hidden] { display: none !important; }

/* Labels: plain words in the second ink. The tracked capitals of a front panel are
   tui-label--caps, kept for one name a screen at most. */
.tui-label {
  font: 500 var(--tui-t-label)/1.25 var(--tui-sans);
  color: var(--tui-ink-2);
}
.tui-label--caps { font-size: 12px; letter-spacing: var(--tui-track); text-transform: uppercase; }
.tui-h1, .tui-h2, .tui-h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; color: var(--tui-ink); }
.tui-h1 { font-size: var(--tui-t-h1); letter-spacing: -0.035em; line-height: 0.98; }
.tui-h2 { font-size: var(--tui-t-h2); }
.tui-h3 { font-size: var(--tui-t-h3); letter-spacing: -0.01em; }
.tui-lead { font-size: var(--tui-t-lead); line-height: 1.5; color: var(--tui-ink-2); max-width: 58ch; }
.tui-muted { color: var(--tui-ink-2); }
.tui-num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ typography: the printed page
   Headings, text, a long read and the marks inside it, all printed in the one face. Every
   selector inside .tui-prose is :where(), so a class you set on an element there still wins. */
.tui-h4 { margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.005em; color: var(--tui-ink); }
.tui-text { margin: 0; font-size: var(--tui-t-body); line-height: 1.6; color: var(--tui-ink); max-width: 68ch; }
.tui-small { font-size: var(--tui-t-small); line-height: 1.5; color: var(--tui-ink-2); }

/* Quote: ruled off by a groove cut down its left edge, the source printed small beneath. */
.tui-quote, .tui-prose :where(blockquote) {
  margin: 0;
  padding: 2px 0 2px var(--tui-4);
  border-left: 2px solid var(--tui-rule);
  box-shadow: inset 1px 0 0 var(--tui-edge-hl, var(--tui-hl));
  max-width: 62ch;
}
.tui-quote blockquote { margin: 0; }
.tui-quote :where(blockquote, p), .tui-prose :where(blockquote > p) { margin: 0; font-size: var(--tui-t-lead); line-height: 1.5; color: var(--tui-ink); }
.tui-quote figcaption, .tui-prose :where(blockquote > footer) { margin-top: var(--tui-2); font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* Printed list: engraved markers in place of the browser's bullets. Keep role="list" on a ul
   (Safari drops list semantics when the bullets go). */
.tui-bullets, .tui-prose :where(ul, ol) { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--tui-2); max-width: 68ch; }
.tui-bullets > li, .tui-prose :where(ul, ol) > li { position: relative; padding-left: 22px; line-height: 1.55; }
:is(ul.tui-bullets, .tui-prose :where(ul)) > li::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tui-ink-3);
  box-shadow: 0 1px 0 var(--tui-edge-hl, var(--tui-hl));
}
:is(ol.tui-bullets, .tui-prose :where(ol)) { counter-reset: tui-li; }
:is(ol.tui-bullets, .tui-prose :where(ol)) > li { counter-increment: tui-li; padding-left: 30px; }
:is(ol.tui-bullets, .tui-prose :where(ol)) > li::before {
  content: counter(tui-li, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.28em;
  font: 600 var(--tui-t-label)/1.4 var(--tui-sans);
  letter-spacing: var(--tui-track);
  color: var(--tui-ink-2);
}

/* Inline code: a word of code in a small recessed plate, in the display face, wrapping in a sentence. */
.tui-code, .tui-prose :where(code) {
  padding: 0.12em 0.42em;
  border-radius: 4px;
  font: 500 0.9em/1 var(--tui-mono);
  color: var(--tui-ink);
  background: var(--tui-well);
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)), 0 1px 0 var(--tui-edge-hl, var(--tui-hl));
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* A block of code: the same well, a panel deep, scrolling sideways rather than wrapping. */
.tui-prose :where(pre) { padding: var(--tui-3) var(--tui-4); border-radius: var(--tui-r-s); background: var(--tui-well); box-shadow: var(--tui-inset); overflow-x: auto; font: 500 12px/1.6 var(--tui-mono); color: var(--tui-ink); }
.tui-prose :where(pre code) { padding: 0; background: none; box-shadow: none; font: inherit; }

/* Mark: a lit strip behind the words, the amber lamp turned low. */
.tui-mark, .tui-prose :where(mark) {
  color: inherit;
  padding: 0 0.15em;
  border-radius: 2px;
  background: linear-gradient(transparent 10%, color-mix(in oklab, var(--tui-amber) 34%, transparent) 10% 90%, transparent 90%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (forced-colors: active) { .tui-mark, .tui-prose :where(mark) { background: Mark; color: MarkText; } }

/* Caption: the legend under a figure, numbered like a plate in a manual. */
.tui-caption, .tui-prose :where(figcaption) { margin-top: var(--tui-2); font-size: var(--tui-t-small); line-height: 1.5; color: var(--tui-ink-2); max-width: 68ch; }
.tui-caption__n { margin-right: 0.7em; font: 600 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink); }

/* Prose: a long read styled without classes. Headings, lists, quotes, code, tables and figures. */
.tui-prose { font-size: var(--tui-t-body); line-height: 1.65; color: var(--tui-ink); max-width: 68ch; }
.tui-prose :where(h2, h3, h4, p, ul, ol, blockquote, figure, table, pre, hr) { margin: 0; }
.tui-prose > * + * { margin-top: 1em; }
.tui-prose :where(h2) { margin-top: 2em; font: 700 var(--tui-t-h3)/1.15 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-prose :where(h3) { margin-top: 1.6em; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); color: var(--tui-ink); }
.tui-prose :where(h4) { margin-top: 1.4em; font: 600 var(--tui-t-body)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-prose > :where(h2, h3, h4):first-child { margin-top: 0; }
.tui-prose > :where(h2, h3, h4) + * { margin-top: 0.6em; }
.tui-prose :where(strong, b) { font-weight: 600; color: var(--tui-ink); }
.tui-prose :where(a) { color: var(--tui-ink); text-decoration: underline 1px; text-decoration-color: var(--tb-edge, var(--tui-ink-3)); text-underline-offset: 0.2em; }
@media (hover: hover) and (pointer: fine) { .tui-prose :where(a:hover) { text-decoration-color: currentColor; } }
.tui-prose :where(hr) { height: 1px; border: 0; background: var(--tui-rule); margin-block: 2em; }
.tui-prose :where(img, video) { display: block; max-width: 100%; height: auto; border-radius: var(--tui-r-s); }
.tui-prose :where(table) { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tui-prose :where(th) { padding: 0 var(--tui-3) var(--tui-2) 0; text-align: left; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); color: var(--tui-ink-2); border-bottom: 1px solid var(--tui-rule); }
.tui-prose :where(td) { padding: var(--tui-2) var(--tui-3) var(--tui-2) 0; border-bottom: 1px solid var(--tui-rule); vertical-align: top; }

/* The default ring, at no specificity: a part that draws its own focus (the knob's body, a calendar day, a tree row) sets outline: none and wins, instead of wearing two rings. */
:where(.tui :focus-visible) { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* ------------------------------------------------------------------ panel */

/* A face plate. The grain is the bead-blast; the edge catches the lamp. */
.tui-panel {
  position: relative;
  isolation: isolate;
  /* A trim is its own piece, beside the plate, never under what sits on it:
     the cheeks are the panel's side borders, so padding, however a page sets
     it, starts at the plate, and a screw, a key or a pressed well can only
     ever land on the plate. Without a trim the border is nothing. */
  border-inline: var(--tui-trim-w, 0px) solid transparent;
  background: var(--tui-trim-cheek, none), var(--tui-face);
  border-radius: var(--tui-r-l);
  box-shadow: var(--tui-raised);
  padding: var(--tui-5);
}
.tui-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}
.tui-panel__head {
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  margin: calc(var(--tui-1) * -1) 0 var(--tui-4);
  padding-bottom: var(--tui-3);
  border-bottom: 1px solid var(--tui-rule);
}
.tui-panel__head > :first-child { flex: 1; }
/* Wood: one trim strip along the foot of the header. */
.tui-panel__head { background: var(--tui-trim-strip, none); }
/* One inset a page: a panel whose face is the trim (wood finishes only; elsewhere it is a panel). It is all one piece, so no cheeks. */
.tui-wood-inset { --tui-trim-w: 0px; background: var(--tui-trim-inset, var(--tui-face)); }
/* Four slotted screws, turned the way a fitter leaves them. */
.tui-panel--screws { padding: var(--tui-6); }
.tui-panel--screws::after {
  content: '';
  position: absolute;
  inset: 12px; /* well in from the edge and the 12px corner (Cipri, report #141) */
  pointer-events: none;
  --screw: var(--tui-screw);
  background: var(--screw) 0 0 / 9px 9px no-repeat, var(--screw) 100% 0 / 9px 9px no-repeat,
    var(--screw) 0 100% / 9px 9px no-repeat, var(--screw) 100% 100% / 9px 9px no-repeat;
  filter: drop-shadow(0 0.5px 0 var(--tui-hl));
}
/* A plain recessed tray that other parts sit in. */
.tui-tray {
  background: var(--tui-well-fill) var(--tui-well);
  border-radius: var(--tui-r-m);
  box-shadow: var(--tui-inset);
  padding: var(--tui-1);
}
/* A tray holding keys is concentric with them: the key's corner plus the gap. */
.tui-tray:has(> .tui-key) { border-radius: calc(var(--tui-r-m) + var(--tui-1)); }
.tui-tray:has(> .tui-key--sm) { border-radius: calc(6px + var(--tui-1)); }
.tui-tray:has(> .tui-key--lg) { border-radius: calc(9px + var(--tui-1)); }
.tui-rule { height: 1px; background: var(--tui-rule); border: 0; margin: var(--tui-4) 0; }

/* Perforated metal and speaker cloth: surfaces, not decoration. */
.tui-grille {
  border-radius: var(--tui-r-m);
  background: radial-gradient(circle, rgb(0 0 0 / 0.6) 1.1px, var(--tui-hl) 1.5px, transparent 1.9px) 0 0 / 7px 7px, var(--tui-face-lo);
  box-shadow: var(--tui-inset);
  min-height: 48px;
}
.tui-cloth {
  border-radius: var(--tui-r-m);
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.18) 0 1px, transparent 1px 3px),
    var(--tui-cloth);
  box-shadow: var(--tui-depth-well, inset 0 0 0 1px rgb(0 0 0 / 0.3), inset 0 8px 16px -8px rgb(0 0 0 / 0.5));
  min-height: 48px;
}

/* ------------------------------------------------------------------- keys */

/* A key: a cap on a skirt. Pressing it takes the skirt away. */
.tui-key {
  --h: 36px;
  --skirt: 2px;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tui-2);
  height: var(--h);
  padding: 0 var(--tui-4);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  letter-spacing: 0.01em;
  color: var(--tui-ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  background: var(--tui-depth-cap,
    radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key,
    inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)),
    0 var(--skirt) 0 var(--tui-skirt),
    0 calc(var(--skirt) + 1px) 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    0 calc(var(--skirt) + 6px) 12px -6px rgb(var(--tui-sh) / var(--tui-sh-a)));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
/* Hover is for a pointer that can: on a touch screen a lift would stay on after a tap. */
@media (hover: hover) and (pointer: fine) { .tui-key:hover { filter: brightness(1.03); } }
/* A key whose menu or popover is open stays down until it closes. */
.tui-key:active, .tui-key[aria-pressed="true"], .tui-key[aria-expanded="true"], .tui-key.is-down {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}
/* A key waiting on an answer dims and shows a waiting cursor. It keeps focus and still clicks, so the page guards the second press. Before the off rule, so a key both busy and aria-disabled reads as off. */
.tui-key[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.tui-key:disabled, .tui-key[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
/* A key that is off but still takes focus (aria-disabled) lifts while focused, so its ring shows at 3:1; it still reads as off. */
.tui-key[aria-disabled="true"]:focus-visible { opacity: 0.75; }
.tui-key svg { width: 16px; height: 16px; flex: none; }

/* The contrast key: the one action on a surface that matters most. */
.tui-key--primary {
  color: var(--tb-ink, var(--tui-cap-ink));
  background:
    radial-gradient(120% 90% at 50% 0%, rgb(255 255 255 / 0.1), transparent 60%),
    linear-gradient(var(--tb-cap, var(--tui-cap-hi)), var(--tb-cap, var(--tui-cap)));
  --tui-skirt: var(--tb-skirt, var(--tui-cap-skirt));
  --tui-hl: var(--tb-hl, var(--tui-cap-hl));
  --tui-edge-hl: initial;
}
/* Printed text that acts: no cap at all. */
.tui-key--flat {
  background: none;
  box-shadow: none;
  padding: 0 var(--tui-2);
  color: var(--tui-ink-2);
}
@media (hover: hover) and (pointer: fine) { .tui-key--flat:hover { color: var(--tui-ink); filter: none; } }
.tui-key--flat:active { transform: none; box-shadow: none; filter: none; color: var(--tui-ink); }
.tui-key--danger { color: var(--tui-red-ink, var(--tui-red)); }
.tui-key--sm { --h: 28px; --skirt: 1.5px; padding: 0 var(--tui-3); font-size: 13px; border-radius: 6px; }
.tui-key--lg { --h: 46px; --skirt: 3px; padding: 0 var(--tui-6); font-size: 14px; border-radius: 9px; }
/* The fingertip size: 44px, what a finger needs, for a key on a form people fill on a phone. In a combo too. */
.tui-key--tap { --h: 44px; }
/* Wide: the key takes its row and its words start at the left, after a leading logo or icon. For a short list of
   choices that each go somewhere: "Continue with GitHub", "Google". */
.tui-key--wide { display: flex; width: 100%; justify-content: flex-start; gap: var(--tui-3); }
.tui-key--icon { width: var(--h); padding: 0; }
.tui-key--round { border-radius: 999px; }
/* A round key with words is a pill: they stay out of its round ends. */
.tui-key--round:not(.tui-key--icon) { padding-inline: calc(var(--h) / 2); }
/* A leading icon sits nearer its edge than words do (a glyph's ink fills its box, words have side bearing), so the
   two sides read equal. Scales with the key, so it holds in groups, split keys and pills. */
.tui-key:not(.tui-key--icon, .tui-key--flat) > svg:first-child { margin-inline-start: calc(var(--h) * -0.1); }
/* A key with its own lamp, set in the cap. */
.tui-key .tui-lamp { margin-left: calc(var(--tui-1) * -1); }

/* ------------------------------------------------------------------ lamps */

.tui-lamp {
  --c: var(--tui-green);
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%), color-mix(in oklab, var(--c) var(--lamp-off, 22%), var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 1px 0 var(--tui-hl);
  vertical-align: middle;
}
.tui-lamp[data-lamp="amber"] { --c: var(--tui-amber); }
/* Red is the lamp that gets mistaken for lit: a pale rose lens reads as a dim lamp that is on. Unlit, it holds only a trace of red (a dead lens, no glow). */
.tui-lamp[data-lamp="red"] { --c: var(--tui-red); --lamp-off: 4%; }
.tui-lamp[data-lamp="blue"] { --c: var(--tui-blue); }
.tui-lamp[data-lamp="white"] { --c: var(--tui-white); }
.tui-lamp[data-on], .tui-lamp.is-on {
  color: var(--c);
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--c);
  box-shadow: var(--tui-glow);
}
/* A cold LED's halo is faintly blue, which is also what lets it show on aluminium. */
.tui-lamp[data-lamp="white"]:is([data-on], .is-on) { color: color-mix(in oklab, var(--c) 70%, var(--tui-blue)); }
.tui-lamp[data-blink] { animation: tui-blink 1.2s steps(1) infinite; }
@keyframes tui-blink { 50% { opacity: 0.25; } }
/* A lamp that comes on warms up in 140ms (a real one is quick to warm and slow to cool). :where keeps the rule weak, so a part that animates its own lamps (breathe, wink) still wins. */
.tui-lamp:where([data-on], .is-on):not([data-blink]) { animation: tui-lamp-warm 140ms var(--tui-ease); }
@keyframes tui-lamp-warm { from { filter: brightness(0.7) saturate(0.6); } }

/* A status line: lamp, then printed words. */
.tui-status { display: inline-flex; align-items: center; gap: var(--tui-2); font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* A tag: a small printed plate. */
.tui-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--tui-r-s);
  border: 1px solid var(--tui-rule);
  font: 600 13px/1 var(--tui-sans);
  color: var(--tui-ink-2);
  background: color-mix(in oklab, var(--tui-face) 60%, transparent);
}
.tui-tag--solid { border: 0; color: var(--tui-cap-ink); background: var(--tui-cap); }

/* --------------------------------------------------------------- switches */

/* A slide switch, the grip ridged like a thumbwheel. The slot it reveals
   is green only because the thing is on. */
.tui-switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 48px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  cursor: pointer;
  background: var(--tui-slot-fill-pill, var(--tui-well-fill)) var(--tui-well);
  box-shadow: var(--tui-slot-depth, var(--tui-inset));
  transition: background-color 180ms var(--tui-ease);
}
.tui-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 22px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, transparent 0 2px, rgb(var(--tui-sh) / 0.22) 2px 3px, var(--tui-hl) 3px 4px) center / 11px 8px no-repeat,
    var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 90%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-raised);
  transition: transform 180ms var(--tui-ease);
}
/* Held, the grip lengthens under the thumb; let go, it travels and meets its end stop with a small rebound. */
@supports (transition-timing-function: linear(0, 1)) {
  .tui-switch::after { transition: transform 240ms var(--tui-spring-latch), scale 90ms var(--tui-ease); }
}
.tui-switch:active::after { scale: 1.1 0.94; }
@media (prefers-reduced-motion: reduce) {
  .tui-switch::after { transition: none; }
  .tui-switch:active::after { scale: none; }
}
.tui-switch:checked { background: color-mix(in oklab, var(--tui-green) 75%, var(--tui-well)); box-shadow: inset 0 0 0 1px var(--tui-edge-sh, transparent), inset 0 1.5px 3px rgb(0 0 0 / 0.3), 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 0 10px -2px color-mix(in oklab, var(--tui-green) 60%, transparent); }
.tui-switch:checked::after { transform: translateX(16px); }
.tui-switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* A rocker, printed with the IEC marks: | is on, O is off. A black bezel
   and a cap that pivots in it: the pressed half sinks into the bezel's
   shadow, the other half rises toward the lamp and shows its end wall. */
.tui-rocker {
  --cap-hi: var(--tui-rocker-hi);
  --cap-mid: var(--tui-rocker-mid);
  --cap-lo: var(--tui-rocker-lo);
  --cap-sunk: var(--tui-rocker-sunk);
  --cap-wall: var(--tui-rocker-wall);
  --mark: var(--tui-rocker-mark);
  /* A mark on the sunk half is further away: smaller, nearer the pivot, dimmer. */
  --mark-sunk: color-mix(in oklab, var(--mark) 72%, var(--cap-sunk));
  appearance: none;
  position: relative;
  flex: none;
  width: 60px;
  height: 32px;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
  background: var(--tui-rocker-bezel);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(0 0 0 / 0.8), 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 -1px 0 rgb(var(--tui-sh) / 0.25), 0 0 0 1px rgb(0 0 0 / 0.35));
}
.tui-rocker::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  /* Off: the O half (right) is pressed; the | half (left) is raised. */
  background:
    linear-gradient(var(--mark), var(--mark)) calc(25% - 0.75px) 48.5% / 2px 9px no-repeat,
    radial-gradient(circle, transparent 2.7px, var(--mark-sunk) 2.9px 4px, transparent 4.2px) calc(75% - 0.75px) 51.5% / 11px 11px no-repeat,
    linear-gradient(to bottom, rgb(0 0 0 / 0.45), transparent 60%) 100% 0 / 50% 100% no-repeat,
    linear-gradient(to left, rgb(0 0 0 / 0.32), transparent 45%) 100% 0 / 50% 100% no-repeat,
    linear-gradient(rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.75)) 0 0 / 50% 1px no-repeat,
    linear-gradient(90deg, var(--cap-wall) 0 5%, var(--cap-hi) 5% 14%, var(--cap-mid) 32%, var(--cap-lo) 49.6%, rgb(0 0 0 / 0.4) 49.6% 50.4%, var(--cap-sunk) 50.4%);
  box-shadow: -2px 2px 3px -1px rgb(0 0 0 / 0.6);
}
.tui-rocker:checked::before {
  /* On: the | half (left) is pressed; the O half (right) is raised. */
  background:
    linear-gradient(var(--mark-sunk), var(--mark-sunk)) calc(25% + 0.75px) 51.5% / 2px 8px no-repeat,
    radial-gradient(circle, transparent 3px, var(--mark) 3.2px 4.4px, transparent 4.6px) calc(75% + 0.75px) 48.5% / 12px 12px no-repeat,
    linear-gradient(to bottom, rgb(0 0 0 / 0.45), transparent 60%) 0 0 / 50% 100% no-repeat,
    linear-gradient(to right, rgb(0 0 0 / 0.32), transparent 45%) 0 0 / 50% 100% no-repeat,
    linear-gradient(rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.75)) 100% 0 / 50% 1px no-repeat,
    linear-gradient(90deg, var(--cap-sunk) 0 49.6%, rgb(0 0 0 / 0.4) 49.6% 50.4%, var(--cap-lo) 50.4%, var(--cap-mid) 68%, var(--cap-hi) 86% 95%, var(--cap-wall) 95%);
  box-shadow: 2px 2px 3px -1px rgb(0 0 0 / 0.6);
}
.tui-rocker:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
/* The lamp rocker: the same rocker in a longer bezel with a lamp lens to the right of the cap, lit green when on.
   80 × 34. The lens is drawn in the bezel's own background, so ::after stays free for the 44px press area on touch. */
.tui-rocker--lamp {
  width: 80px;
  height: 34px;
  background:
    radial-gradient(circle at calc(100% - 11.5px) 50%, var(--lamp-lens) 0 4px, rgb(0 0 0 / 0.6) 4.5px, transparent 5px),
    var(--tui-rocker-bezel);
  --lamp-lens: color-mix(in oklab, var(--tui-green) 24%, #1a1b1d);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(0 0 0 / 0.8), 0 1px 0 var(--tui-rocker-lip, var(--tui-edge-hl, var(--tui-hl))), 0 -1px 0 rgb(var(--tui-sh) / 0.3));
}
.tui-rocker--lamp:checked {
  background:
    radial-gradient(circle at calc(100% - 12.8px) calc(50% - 1.3px), rgb(255 255 255 / 0.85), transparent 2px),
    radial-gradient(circle at calc(100% - 11.5px) 50%, var(--tui-green) 0 4.5px, color-mix(in oklab, var(--tui-green) 45%, transparent) 5px, color-mix(in oklab, var(--tui-green) 12%, transparent) 8px, transparent 10.5px),
    var(--tui-rocker-bezel);
}
.tui-rocker--lamp::before { inset: 3px 23px 3px 3px; }

/* A check key: a small square key; checked, a tick is printed on it. */
.tui-check, .tui-radio {
  appearance: none;
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  border-radius: 5px;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 1.5px 0 var(--tui-skirt), 0 2px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-radio { border-radius: 50%; }
.tui-check:checked, .tui-radio:checked {
  transform: translateY(1.5px);
  box-shadow: var(--tui-pressed);
}
.tui-check:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid var(--tb-edge, var(--tui-ink));
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.tui-radio:checked::after {
  content: '';
  position: absolute;
  inset: 5.5px;
  border-radius: 50%;
  background: var(--tb-edge, var(--tui-ink));
}
.tui-choice { display: inline-flex; align-items: center; gap: var(--tui-2); cursor: pointer; font-size: var(--tui-t-body); }

/* A row of latching keys, one down at a time: a band selector. */
.tui-seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-seg > label { position: relative; display: block; }
.tui-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tui-seg span {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 var(--tui-3);
  border-radius: 6px;
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink-2);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease), color 70ms;
}
.tui-seg span::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-amber) 20%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.35);
}
/* It goes down on the press, before the click latches it. */
.tui-seg label:active input:not(:checked) + span { transform: translateY(1px); }
.tui-seg input:checked + span {
  transform: translateY(1.5px);
  color: var(--tui-ink);
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}
.tui-seg input:checked + span::before {
  background: var(--tui-amber);
  box-shadow: 0 0 5px 1px color-mix(in oklab, var(--tui-amber) 60%, transparent);
}
.tui-seg input:focus-visible + span { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-seg--plain span::before { display: none; }

/* ------------------------------------------------------------------ fader */

/* A fader: a cap riding in a slot cut into the plate. */
.tui-fader {
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  cursor: pointer;
  background: transparent;
}
/* A slot's end stops are its end borders: the cap rides between them, never over them. */
.tui-fader::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  border-inline: var(--tui-trim-stop-w, 0px) solid transparent;
  background: var(--tui-trim-stop, none), var(--tui-slot-fill, var(--tui-well-fill)) var(--tui-well);
  box-shadow: var(--tui-slot-depth, var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl)));
}
.tui-fader::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  border-inline: var(--tui-trim-stop-w, 0px) solid transparent;
  background: var(--tui-trim-stop, none), var(--tui-slot-fill, var(--tui-well-fill)) var(--tui-well);
  box-shadow: var(--tui-slot-depth, var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl)));
}
.tui-fader::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 28px;
  margin-top: -11px;
  border-radius: 4px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 100% 1.5px no-repeat,
    var(--tui-trim-fader, var(--tui-depth-cap, linear-gradient(90deg, var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 4px 8px rgb(var(--tui-sh) / 0.35));
}
.tui-fader::-moz-range-thumb {
  width: 16px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 100% 1.5px no-repeat,
    var(--tui-trim-fader, var(--tui-depth-cap, linear-gradient(90deg, var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 4px 8px rgb(var(--tui-sh) / 0.35));
}
/* Held, the cap goes down a pixel and darkens a touch, as the range part's cap does (70ms, since it is moved many times a day). */
/* (Each engine's thumb in a rule of its own: a list with a pseudo-element the engine does not know is dropped whole.) */
.tui-fader::-webkit-slider-thumb { transition: transform 70ms var(--tui-ease), filter 70ms var(--tui-ease); }
.tui-fader::-moz-range-thumb { transition: transform 70ms var(--tui-ease), filter 70ms var(--tui-ease); }
.tui-fader:active::-webkit-slider-thumb { transform: translateY(1px); filter: brightness(0.97); }
.tui-fader:active::-moz-range-thumb { transform: translateY(1px); filter: brightness(0.97); }
.tui-fader:active { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .tui-fader::-webkit-slider-thumb { transition: none; } .tui-fader::-moz-range-thumb { transition: none; } }
.tui-fader:focus-visible { outline: none; }
.tui-fader:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-fader:focus-visible::-moz-range-thumb { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* The scale printed under a fader: ticks every 10%, a longer one at each end. */
.tui-scale {
  height: 8px;
  margin: 0 8px;
  background:
    linear-gradient(90deg, var(--tui-ink-3) 1px, transparent 1px) 0 0 / 10% 5px repeat-x,
    linear-gradient(90deg, var(--tui-ink-2) 1px, transparent 1px) 0 0 / calc(100% - 1px) 8px repeat-x;
}
.tui-fader--v { writing-mode: vertical-lr; direction: rtl; width: 32px; height: 140px; }
.tui-fader--v::-webkit-slider-runnable-track { width: 6px; height: auto; }
.tui-fader--v::-webkit-slider-thumb { width: 28px; height: 16px; margin-top: 0; margin-left: -11px; background: linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 100% no-repeat, var(--tui-trim-fader-h, var(--tui-depth-cap, linear-gradient(var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo)))); }
/* The channel strip: a slot plate with a narrow black channel down its middle, a steel cap you could pinch
   (24 × 44, grip grooves either side of a printed line) and a scale above and below. 64px tall; --v composes.
   The drawing is handed to each engine's track and thumb through custom properties (one rule per engine). */
.tui-fader--strip {
  /* the slit down the middle is a gap: darker than the floor it is cut in, never a lit line */
  --_slit: linear-gradient(rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.8));
  --_floor: var(--tui-strip-floor, var(--tui-well-fill));
  --_steel-hi: color-mix(in oklab, var(--tui-obj-lite) 86%, var(--tui-obj-body));
  --_steel-mid: color-mix(in oklab, var(--tui-obj-lite) 52%, var(--tui-obj-body));
  --_steel-lo: color-mix(in oklab, var(--tui-obj-body) 80%, var(--tui-obj-dark));
  --_grip: repeating-linear-gradient(transparent 0 4px, rgb(0 0 0 / 0.22) 4px 5px, rgb(255 255 255 / 0.55) 5px 6px);
  --_track:
    var(--_slit) 0 50% / 100% 6px no-repeat,
    var(--_floor) var(--tui-well);
  /* a recess with one bezel all round, in faces, never a line of one weight: the upper face in shadow, the sides between,
     the lower face a soft step lighter (on graphite barely; on aluminium a soft highlight) (Cipri, 17 Nov, on the mod) */
  --_track-sh: var(--tui-depth-well, inset 0 3px 4px -1px rgb(0 0 0 / 0.7), inset 3px 0 3px -2px rgb(0 0 0 / 0.35), inset -3px 0 3px -2px rgb(0 0 0 / 0.35), 0 2px 3px -1px var(--tui-strip-lip, rgb(255 255 255 / 0.55)));
  --_cap:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 100% 2px no-repeat,
    var(--_grip) 0 4px / 100% 14px no-repeat,
    var(--_grip) 0 26px / 100% 14px no-repeat,
    linear-gradient(90deg, var(--_steel-lo), var(--_steel-hi) 28%, var(--_steel-mid) 72%, var(--_steel-lo));
  --_cap-sh: inset 0 1px 0 rgb(255 255 255 / 0.7), inset 0 -2px 0 rgb(0 0 0 / 0.2), 0 2px 0 var(--tui-skirt), 0 5px 9px rgb(var(--tui-sh) / 0.45);
  height: 64px;
  background:
    linear-gradient(90deg, var(--tui-ink-2) 1px, transparent 1px) 12px 0 / calc((100% - 25px) / 4) 8px repeat-x,
    linear-gradient(90deg, var(--tui-ink-3) 1px, transparent 1px) 12px 3px / calc((100% - 25px) / 20) 5px repeat-x,
    linear-gradient(90deg, var(--tui-ink-2) 1px, transparent 1px) 12px 100% / calc((100% - 25px) / 4) 8px repeat-x,
    linear-gradient(90deg, var(--tui-ink-3) 1px, transparent 1px) 12px calc(100% - 3px) / calc((100% - 25px) / 20) 5px repeat-x;
}
.tui-fader--strip::-webkit-slider-runnable-track { height: 18px; border-radius: 5px; background: var(--_track); box-shadow: var(--_track-sh); }
.tui-fader--strip::-moz-range-track { height: 18px; border-radius: 5px; background: var(--_track); box-shadow: var(--_track-sh); }
.tui-fader--strip::-webkit-slider-thumb { width: 24px; height: 44px; margin-top: -13px; border-radius: 4px; background: var(--_cap); box-shadow: var(--_cap-sh); }
.tui-fader--strip::-moz-range-thumb { width: 24px; height: 44px; border-radius: 4px; background: var(--_cap); box-shadow: var(--_cap-sh); }
.tui-fader--strip.tui-fader--v {
  width: 64px;
  height: 180px;
  --_grip: repeating-linear-gradient(90deg, transparent 0 4px, rgb(0 0 0 / 0.22) 4px 5px, rgb(255 255 255 / 0.55) 5px 6px);
  --_track:
    linear-gradient(90deg, rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.8)) 50% 0 / 6px 100% no-repeat,
    var(--_floor) var(--tui-well);
  --_cap:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 2px 100% no-repeat,
    var(--_grip) 4px 0 / 14px 100% no-repeat,
    var(--_grip) 26px 0 / 14px 100% no-repeat,
    linear-gradient(var(--_steel-hi), var(--_steel-mid) 60%, var(--_steel-lo));
  background:
    linear-gradient(0deg, var(--tui-ink-2) 1px, transparent 1px) 0 12px / 8px calc((100% - 25px) / 4) repeat-y,
    linear-gradient(0deg, var(--tui-ink-3) 1px, transparent 1px) 3px 12px / 5px calc((100% - 25px) / 20) repeat-y,
    linear-gradient(0deg, var(--tui-ink-2) 1px, transparent 1px) 100% 12px / 8px calc((100% - 25px) / 4) repeat-y,
    linear-gradient(0deg, var(--tui-ink-3) 1px, transparent 1px) calc(100% - 3px) 12px / 5px calc((100% - 25px) / 20) repeat-y;
}
.tui-fader--strip.tui-fader--v::-webkit-slider-runnable-track { width: 18px; height: auto; }
.tui-fader--strip.tui-fader--v::-moz-range-track { width: 18px; height: auto; }
.tui-fader--strip.tui-fader--v::-webkit-slider-thumb { width: 44px; height: 24px; margin-top: 0; margin-left: -13px; }
.tui-fader--strip.tui-fader--v::-moz-range-thumb { width: 44px; height: 24px; }
/* A fader with its value in an LCD cell beside it. kit.mjs keeps the cell showing the value, set by hand or by code. */
.tui-fader-lcd { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.tui-fader-lcd > .tui-lcd { min-width: 3.4ch; justify-content: end; padding-block: 0.3em; }

/* ------------------------------------------------------------------- knob */

/* <tui-knob>: kit.mjs draws the ticks and turns it. The knurl and the
   pointer turn; the cap's sheen and every shadow stay still, because the
   lamp does not move. */
tui-knob {
  --size: 64px;
  --turn: 0deg;
  --k-hi: var(--tui-knob-hi);
  --k-mid: var(--tui-knob-mid);
  --k-lo: var(--tui-knob-lo);
  position: relative;
  display: inline-grid;
  place-items: center;
  width: calc(var(--size) * 1.45);
  height: calc(var(--size) * 1.45);
  touch-action: none;
  cursor: grab;
  user-select: none;
  outline: none;
}
/* A black knob on any finish. */
tui-knob[data-knob="black"] { --tui-trim-knob: initial; --k-hi: #5a5b5f; --k-mid: #2c2d30; --k-lo: #141517; --tui-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.2), inset 0 -1px 2px rgb(0 0 0 / 0.5), 0 1px 2px rgb(0 0 0 / 0.6); }
tui-knob:active { cursor: grabbing; }
tui-knob .tui-knob__ticks { position: absolute; inset: 0; color: var(--tui-ink-2); }
tui-knob .tui-knob__body {
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--k-mid);
  box-shadow: var(--tui-depth-plate, 0 0 0 1px var(--tui-knob-rim, transparent), 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 3px 7px 14px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
/* The collar the knob sits in (Machined), lit from the knurl's own lamp, upper left: the near arc catches it, the far arc
   falls into shade, graded between, never a ring of one weight (Fable, 17 Nov). The far arc keeps the 3:1 edge.
   A 2px ring outside the knob's box, so the box and everything measured off it stay put. Drawn only where the
   plate's own depth is, as the rim was: a finish or volume that sets --tui-depth-plate makes the background invalid. */
tui-knob .tui-knob__body::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  pointer-events: none;
  background: var(--tui-depth-plate, linear-gradient(150deg, var(--_lit), color-mix(in oklab, var(--_lit), var(--_shade)) 45%, var(--_shade) 80%));
  --_lit: var(--tui-knob-collar-lit, transparent);
  --_shade: var(--tui-knob-collar-shade, transparent);
  mask: radial-gradient(closest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
}
tui-knob .tui-knob__knurl, tui-knob .tui-knob__sheen, tui-knob .tui-knob__cap, tui-knob .tui-knob__mark { position: absolute; border-radius: 50%; }
/* Ridges, turning with the knob. */
tui-knob .tui-knob__knurl {
  inset: 0;
  transform: rotate(var(--turn));
  background: repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.3) 0 2.2deg, rgb(255 255 255 / 0.1) 2.2deg 3deg, transparent 3deg 6deg);
}
/* The ridges catch the lamp only on the side that faces it, and keep doing so
   as the knob turns: the mask is turned back by the knob's own turn, so it
   stays put on the screen while the ridges go round under it. */
tui-knob .tui-knob__knurl::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, transparent 0 2.2deg, rgb(255 255 255 / 0.5) 2.2deg 3deg, transparent 3deg 6deg);
  -webkit-mask: linear-gradient(calc(150deg - var(--turn)), black 15%, rgb(0 0 0 / 0.4) 45%, transparent 72%);
  mask: linear-gradient(calc(150deg - var(--turn)), black 15%, rgb(0 0 0 / 0.4) 45%, transparent 72%);
}
/* Light on the skirt, fixed: bright toward the lamp, dark away from it. */
tui-knob .tui-knob__sheen {
  inset: 0;
  background: linear-gradient(150deg, rgb(255 255 255 / 0.45), transparent 42%, transparent 58%, rgb(0 0 0 / 0.35));
}
/* The spun cap: a fixed bow-tie highlight across the machining, the way
   light sits on turned aluminium whatever angle the knob is at. */
tui-knob .tui-knob__cap {
  inset: 13%;
  background: var(--tui-trim-knob,
    repeating-radial-gradient(circle, rgb(255 255 255 / 0.06) 0 0.6px, rgb(0 0 0 / 0.035) 0.6px 1.5px),
    conic-gradient(from 0deg, var(--k-mid) 0deg, var(--k-lo) 40deg, var(--k-mid) 80deg, var(--k-hi) 135deg, var(--k-mid) 180deg, var(--k-lo) 220deg, var(--k-mid) 260deg, var(--k-hi) 315deg, var(--k-mid) 360deg));
  box-shadow: var(--tui-knob-cap-shadow);
}
/* The pointer, engraved into the cap, turning. A turned wooden cap carries its grain here, so the grain turns with it while the light on it stays put. */
tui-knob .tui-knob__mark { inset: 13%; transform: rotate(var(--turn)); background: var(--tui-trim-grain, none); }
tui-knob .tui-knob__mark::after {
  content: '';
  position: absolute;
  left: calc(50% - 1px);
  top: 5%;
  width: 2px;
  height: 30%;
  border-radius: 1px;
  background: var(--tui-ink);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
}
/* A reset settles the ridges and pointer back; a turn by hand stays instant. Reduced motion: it jumps. */
@media (prefers-reduced-motion: no-preference) {
  tui-knob.is-settling .tui-knob__knurl, tui-knob.is-settling .tui-knob__mark { transition: transform 240ms var(--tui-ease); }
}
tui-knob:focus-visible .tui-knob__body { outline: 2px solid var(--tui-focus); outline-offset: 4px; }
.tui-control { display: inline-grid; justify-items: center; gap: var(--tui-1); }
.tui-control > .tui-label { text-align: center; }
.tui-control output { font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }

/* ----------------------------------------------------------------- fields */

/* Packed at the top: in a row that stretches it (grid, flex), a field keeps its label and control together, so fields align by their inputs whatever hints their neighbours carry. */
.tui-field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.tui-field > .tui-label { padding-left: 2px; }
.tui-hint { font-size: var(--tui-t-small); color: var(--tui-ink-2); padding-left: 2px; }
.tui-field[data-error] .tui-hint { color: var(--tui-red-ink, var(--tui-red)); }
.tui-input, .tui-select, .tui-textarea {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-textarea { height: auto; min-height: 96px; padding: var(--tui-3); line-height: 1.5; resize: vertical; }
.tui-input::placeholder, .tui-textarea::placeholder { color: var(--tui-ink-3); }
.tui-input:focus-visible, .tui-select:focus-visible, .tui-textarea:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* An error is marked on the lip around the cut, so the upper wall's shadow cannot hide it. */
.tui-field[data-error] :is(.tui-input, .tui-select, .tui-textarea, .tui-combo) { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-select {
  padding-right: 34px;
  cursor: pointer;
  background:
    linear-gradient(45deg, transparent 50%, var(--tui-ink-2) 50%) calc(100% - 17px) 50% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--tui-ink-2) 50%) calc(100% - 12px) 50% / 5px 5px no-repeat,
    var(--tui-well);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%, 0 0;
}
/* An input with a key beside it, sharing one well. */
.tui-combo { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-combo .tui-input { box-shadow: none; background: transparent; height: 36px; }
/* Focus rings the whole well, not the field inside it. */
.tui-combo .tui-input:focus-visible, .tui-stepper input:focus-visible { outline: none; }
.tui-combo:has(.tui-input:focus-visible), .tui-stepper:has(input:focus-visible) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-combo .tui-key { --h: 36px; }
/* The fingertip size for a field: 44px, to match a --tap key beside it. In a combo too. */
.tui-input--tap, .tui-combo .tui-input--tap { height: 44px; }
.tui-combo .tui-key--tap { --h: 44px; }
/* A number with − and + keys. */
.tui-stepper { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border-radius: 9px; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-stepper input { width: 5ch; border: 0; background: transparent; text-align: center; font: 600 var(--tui-t-body)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); -moz-appearance: textfield; }
.tui-stepper input::-webkit-inner-spin-button { display: none; }
.tui-stepper .tui-key { --h: 28px; --skirt: 1.5px; width: 28px; padding: 0; }

/* --------------------------------------------------------------- displays */

/* A liquid-crystal window: grey-green glass, dark segments, a ghost of the
   unlit ones behind (data-ghost: the same width as the value, digits as 8,
   e.g. "88:88" behind "02:52"). */
.tui-lcd, .tui-vfd {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  padding: 0.35em max(0.6em, var(--tui-safe-s));
  border-radius: var(--tui-r-s);
  font: 500 28px/1 var(--tui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tui-lcd {
  color: var(--tui-lcd-ink);
  background:
    linear-gradient(170deg, rgb(255 255 255 / 0.18), transparent 40%),
    var(--tui-lcd);
  box-shadow: var(--tui-depth-well, inset 0 2px 4px rgb(0 0 0 / 0.28), inset 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 0 var(--tui-hl));
  text-shadow: 1px 1.5px 0 rgb(0 0 0 / 0.1);
}
.tui-vfd {
  color: var(--tui-vfd);
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.025) 0 1px, transparent 1px 3px),
    var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.8), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  text-shadow: 0 0 6px color-mix(in oklab, var(--tui-vfd) 55%, transparent), 0 0 18px color-mix(in oklab, var(--tui-vfd) 18%, transparent);
}
.tui-lcd[data-ghost]::before, .tui-vfd[data-ghost]::before {
  content: attr(data-ghost);
  position: absolute;
  left: 0.6em;
  top: 0.35em;
  opacity: 0.08;
  text-shadow: none;
}
.tui-lcd small, .tui-vfd small { font: 600 0.36em/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; opacity: 0.75; }
.tui-lcd--sm, .tui-vfd--sm { font-size: 16px; }
.tui-lcd--lg, .tui-vfd--lg { font-size: 44px; }

/* A readout: a printed label over a value, the way a panel names its dials. */
.tui-readout { display: grid; gap: 6px; }
.tui-readout__value { font: 600 var(--tui-t-h2)/1 var(--tui-sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tui-readout__value small { font-size: 0.5em; font-weight: 500; color: var(--tui-ink-2); letter-spacing: 0; margin-left: 2px; }
.tui-delta { font: 600 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); }
.tui-delta[data-dir="up"]::before { content: '▲ '; font-size: 0.7em; color: var(--tui-green); }
.tui-delta[data-dir="down"]::before { content: '▼ '; font-size: 0.7em; color: var(--tui-red-ink, var(--tui-red)); }

/* Stale: the last values after the feed has gone. Opt in with data-stale on a display, a readout or any region that
   holds them; nothing changes without it. The glass goes unlit (the glow off, the figures a third of their light, the
   ghost segments a little clearer) and a printed figure drops to the tertiary ink: still readable as the last value,
   no longer as a live one. Sizes are large text, so 3:1 is the floor. */
.tui-lcd:is([data-stale], [data-stale] *) { color: color-mix(in oklab, var(--tui-lcd-ink) 58%, var(--tui-lcd)); text-shadow: none; }
.tui-vfd:is([data-stale], [data-stale] *) { color: color-mix(in oklab, var(--tui-vfd) 46%, var(--tui-vfd-bg)); text-shadow: none; }
:is(.tui-lcd, .tui-vfd)[data-ghost]:is([data-stale], [data-stale] *)::before { opacity: 0.16; }
:is(.tui-lcd, .tui-vfd):is([data-stale], [data-stale] *) small { opacity: 1; }   /* the unit keeps the dimmed figure light, not a quarter less */
.tui-readout__value:is([data-stale], [data-stale] *) { color: var(--tui-ink-3); }

/* ----------------------------------------------------------------- meters */

/* An LED ladder: set --v from 0 to 1. Green, then amber, then red, the way
   a recording level has always been read. */
.tui-ladder {
  --v: 0.5;
  --n: 24;
  position: relative;
  height: 10px;
  border-radius: 2px;
  background: var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(0 0 0 / 0.6), 0 1px 0 var(--tui-hl));
  overflow: hidden;
}
.tui-ladder::before, .tui-ladder::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: linear-gradient(90deg, var(--tui-green) 0 70%, var(--tui-amber) 70% 88%, var(--tui-red) 88%);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
          mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}
.tui-ladder::before { opacity: 0.14; }
.tui-ladder::after { clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0); filter: drop-shadow(0 0 3px rgb(255 255 255 / 0.25)); transition: clip-path 90ms linear; }
/* Upright, for a channel strip: it fills from the foot, green at the bottom and red at the top. Size it with width and height. */
.tui-ladder--v { width: 10px; height: 140px; }
.tui-ladder--v::before, .tui-ladder--v::after {
  background: linear-gradient(0deg, var(--tui-green) 0 70%, var(--tui-amber) 70% 88%, var(--tui-red) 88%);
  -webkit-mask: repeating-linear-gradient(0deg, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
          mask: repeating-linear-gradient(0deg, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}
.tui-ladder--v::after { clip-path: inset(calc((1 - var(--v)) * 100%) 0 0 0); }
/* A progress slot: ink filling a groove, never a colour bar. */
.tui-progress {
  --v: 0.4;
  position: relative;
  height: 8px;
  border-radius: 4px;
  border-inline: var(--tui-trim-stop-w, 0px) solid transparent;
  background: var(--tui-trim-stop, none), var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl));
  overflow: hidden;
}
.tui-progress::after {
  content: '';
  position: absolute;
  inset: 2px;
  right: auto;
  width: calc(100% - 4px);
  border-radius: 3px;
  background: var(--tb-edge, var(--tui-ink));
  /* The bar is always its full length and is uncovered from the left: a clip is paint only, where a width lays the page out every frame. */
  clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0 round var(--pg-r, 3px));
  transition: clip-path 300ms var(--tui-ease);
}
/* A slot that follows a value moving all the time (reading, scrubbing) takes it at once. */
.tui-progress[data-follow]::after { transition: none; }

/* ------------------------------------------------------------- navigation */

/* Tabs: keys in a tray. kit.mjs gives them arrow keys. */
/* A tray wider than its container scrolls inside itself, never the page. */
.tui-tabs { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: 3px; padding: 3px; border-radius: 9px; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-tabs::-webkit-scrollbar { display: none; }
/* More tabs than fit (kit.mjs sets data-more and adds the two keys): the kit's icon key sits over the end that has
   tabs out of sight, on the tray, held there as the tabs scroll under it. Both keys are always in place and take no
   room, so the strip never moves when one shows; the end you can see all of has none. */
.tui-tabs__more {
  --h: 30px;
  position: sticky;
  z-index: 1;
  flex: none;
  align-self: center;
  width: 30px;
  padding: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 140ms var(--tui-ease), visibility 0s 140ms;
}
.tui-tabs__more svg { width: 14px; height: 14px; }
.tui-tabs__more[data-side="start"] { left: 0; margin-right: -33px; }
.tui-tabs__more[data-side="end"] { right: 0; margin-left: -33px; }
/* The shoulder: the tray's own tone fading out over a third of the key's width on its inner side, so a word passes
   under the key instead of being cut flat at its edge. Tab-high, inside the recess. */
.tui-tabs__more::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 10px; pointer-events: none;
  /* The tray's own fill, lined up with the tray (3px of padding above the key), faded by a mask. */
  background: var(--tui-well-fill) var(--tui-well); background-size: 100% calc(100% + 6px); background-position: 0 -3px;
  /* Faded at top and bottom too, so the recess keeps its own shade above and below the words. */
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.tui-tabs__more[data-side="start"]::after { left: 100%; -webkit-mask-image: linear-gradient(to right, #000, transparent), linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(to right, #000, transparent), linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.tui-tabs__more[data-side="end"]::after { right: 100%; -webkit-mask-image: linear-gradient(to left, #000, transparent), linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(to left, #000, transparent), linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.tui-tabs:is([data-more="start"], [data-more="both"]) > .tui-tabs__more[data-side="start"],
.tui-tabs:is([data-more="end"], [data-more="both"]) > .tui-tabs__more[data-side="end"] { visibility: visible; opacity: 1; transition: opacity 140ms var(--tui-ease), visibility 0s; }
.tui-tabs [role="tab"] {
  appearance: none;
  flex: none;
  white-space: nowrap;
  height: 30px;
  padding: 0 var(--tui-4);
  border: 0;
  border-radius: 6px;
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink-2);
  background: transparent;
  cursor: pointer;
  /* A tab goes down under the finger as a key does: 70ms and 1px, since it is chosen many times a day. */
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease), color 70ms, background-color 70ms;
}
.tui-tabs [role="tab"]:active { transform: translateY(1px); }
@media (hover: hover) and (pointer: fine) { .tui-tabs [role="tab"]:hover { color: var(--tui-ink); } }
.tui-tabs [role="tab"][aria-selected="true"] {
  color: var(--tui-ink);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1px 2px rgb(var(--tui-sh) / 0.3));
}

/* A bar across the top of a page: wordmark, keys, one action. */
.tui-bar {
  display: flex;
  align-items: center;
  gap: var(--tui-4);
  min-height: 56px;
  padding: 0 var(--tui-5);
}
.tui-bar__brand { display: flex; align-items: center; gap: var(--tui-2); font-weight: 700; letter-spacing: -0.01em; color: var(--tui-ink); text-decoration: none; }
.tui-bar__links { display: flex; gap: var(--tui-1); margin-left: auto; }
.tui-bar__links a { padding: 6px 10px; border-radius: 6px; font-size: var(--tui-t-small); font-weight: 500; color: var(--tui-ink-2); text-decoration: none; }
.tui-bar__links a[aria-current] { color: var(--tui-ink); }
@media (hover: hover) and (pointer: fine) { .tui-bar__links a:hover { color: var(--tui-ink); } }

/* A side rail: the selected line lights its lamp. */
.tui-side { display: grid; gap: 2px; align-content: start; }
.tui-side > .tui-label { padding: var(--tui-4) var(--tui-3) var(--tui-2); }
.tui-side a {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  height: 34px;
  padding: 0 var(--tui-3);
  border-radius: var(--tui-r-m);
  font-size: var(--tui-t-body);
  font-weight: 500;
  color: var(--tui-ink-2);
  text-decoration: none;
}
.tui-side a::after { content: ''; width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: color-mix(in oklab, var(--tui-green) 18%, var(--tui-face-lo)); box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.35); }
@media (hover: hover) and (pointer: fine) { .tui-side a:hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 50%, transparent); } }
.tui-side a[aria-current="page"] {
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-side a[aria-current="page"]::after { background: var(--tui-green); box-shadow: 0 0 6px 1px color-mix(in oklab, var(--tui-green) 60%, transparent); }
.tui-side svg { width: 16px; height: 16px; flex: none; }

/* ------------------------------------------------------------------ table */

.tui-table { width: 100%; border-collapse: collapse; font-size: var(--tui-t-body); font-variant-numeric: tabular-nums; }
.tui-table th {
  padding: 0 var(--tui-3) var(--tui-2);
  text-align: left;
  font: 600 var(--tui-t-label)/1.2 var(--tui-sans);
  color: var(--tui-ink-2);
  border-bottom: 1px solid var(--tui-rule);
}
.tui-table td { padding: 11px var(--tui-3); border-bottom: 1px solid var(--tui-rule); vertical-align: middle; }
.tui-table tr:last-child td { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .tui-table tbody tr:hover td { background: color-mix(in oklab, var(--tui-face-hi) 45%, transparent); } }
.tui-table .is-num { text-align: right; }
/* A sortable header (data-sort, wired by kit.mjs): its words are a key; the arrow says which way. */
.tui-table__sort { all: unset; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; border-radius: 2px; }
.tui-table__sort::after { content: '↕'; font-size: 1.05em; letter-spacing: 0; opacity: 0.4; }
.tui-table th[aria-sort] { color: var(--tui-ink); }
.tui-table th[aria-sort='ascending'] .tui-table__sort::after { content: '↑'; opacity: 1; }
.tui-table th[aria-sort='descending'] .tui-table__sort::after { content: '↓'; opacity: 1; }
.tui-table th.is-num .tui-table__sort { flex-direction: row-reverse; }
@media (hover: hover) and (pointer: fine) { .tui-table__sort:hover { color: var(--tui-ink); } }
.tui-table__sort:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
/* A chosen row (aria-selected): the face lifts under it and its words go to full ink. */
.tui-table tbody tr[aria-selected='true'] td { background: color-mix(in oklab, var(--tui-face-hi) 80%, transparent); color: var(--tui-ink); box-shadow: var(--tb-row, none); }
.tui-table tbody tr[aria-selected='true'] td:first-child { --tb-row: inset 3px 0 0 var(--tb-edge); }
.tui-table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------- dialog, toast */

.tui-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: var(--tui-6);
  border: 0;
  border-radius: 14px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.3), 0 30px 60px -20px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)));
}
.tui-dialog::backdrop { background: var(--tui-backdrop); }

/* The scrim behind a sheet or a drawer. Today's flat film is the base, and stays under reduced transparency or without
   backdrop-filter. Otherwise it is a light wash of the finish's own ground, with a blur that grows toward the plate: a mask
   gradient fades a 16px blur down to a fifth of itself on the far side, so the page keeps its colour. --scrim-to is the
   direction of the plate's edge (the sheet is at the bottom; a drawer says it by data-edge). */
.tui-sheet::backdrop, .tui-drawer::backdrop { background: var(--tui-backdrop); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (prefers-reduced-transparency: no-preference) {
    .tui-sheet::backdrop, .tui-drawer::backdrop {
      --scrim-to: to bottom;
      --scrim-fade: linear-gradient(var(--scrim-to), color-mix(in oklab, var(--tui-ink) 20%, transparent), var(--tui-ink) 85%);
      background: color-mix(in oklab, var(--tui-desk) 42%, transparent);
      -webkit-backdrop-filter: blur(16px);
      backdrop-filter: blur(16px);
      -webkit-mask-image: var(--scrim-fade);
      mask-image: var(--scrim-fade);
    }
    .tui-drawer::backdrop, .tui-drawer[data-edge="right"]::backdrop { --scrim-to: to right; }
    .tui-drawer[data-edge="left"]::backdrop { --scrim-to: to left; }
    .tui-drawer[data-edge="bottom"]::backdrop { --scrim-to: to bottom; }
    .tui-drawer[data-edge="top"]::backdrop { --scrim-to: to top; }
  }
}
/* It settles in 220ms and goes in 120ms, the dim layer with it: a dialog is heavy, so no bounce. */
dialog.tui-dialog { transition: opacity 120ms var(--tui-ease), scale 120ms var(--tui-ease), overlay 120ms allow-discrete, display 120ms allow-discrete; }
dialog.tui-dialog[open] { transition-duration: 220ms; }
dialog.tui-dialog:not([open]) { opacity: 0; scale: 0.985; }
@starting-style { dialog.tui-dialog[open] { opacity: 0; scale: 0.985; } }
dialog.tui-dialog::backdrop { opacity: 0; transition: opacity 120ms var(--tui-ease), overlay 120ms allow-discrete, display 120ms allow-discrete; }
dialog.tui-dialog[open]::backdrop { opacity: 1; transition-duration: 220ms; }
@starting-style { dialog.tui-dialog[open]::backdrop { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.tui-dialog:not([open]) { scale: none; } }
.tui-dialog__actions { display: flex; justify-content: flex-end; gap: var(--tui-2); margin-top: var(--tui-6); }
@keyframes tui-rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

/* Toasts: a small plate with a lamp, stacked bottom right. See kit.mjs. */
.tui-toasts { position: fixed; right: var(--tui-4); bottom: var(--tui-4); z-index: 50; display: grid; gap: var(--tui-2); justify-items: end; pointer-events: none; }
.tui-toast {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  max-width: 360px;
  padding: var(--tui-3) var(--tui-4);
  border-radius: 10px;
  font-size: var(--tui-t-body);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 16px 32px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  pointer-events: auto;
  /* It rises 8px as it arrives; the toasts under it are moved by kit.mjs, which hands them the gap as a translate to glide out of. */
  transition: translate 220ms var(--tui-ease), opacity 160ms var(--tui-ease);
}
@starting-style { .tui-toast { opacity: 0; translate: 0 8px; } }
.tui-toast.is-leaving { opacity: 0; translate: 0 6px; transition-duration: 160ms; }
@media (prefers-reduced-motion: reduce) { .tui-toast { transition-property: opacity; } .tui-toast.is-leaving { translate: none; } }

/* Tooltips on anything with data-tip: kit/parts/tooltip.css. */

@media (prefers-reduced-motion: reduce) {
  .tui *, .tui *::before, .tui *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .tui-lamp[data-blink], .tui-lamp:where([data-on], .is-on):not([data-blink]) { animation: none; }
}

/* ------------------------------------------------------------------- plot */

/* A plot on a display: gridlines printed faint, traces drawn in light.
   Put it inside .tui-glass (dark display glass) or any panel (ink traces). */
.tui-plot { display: block; width: 100%; height: auto; overflow: visible; }
.tui-plot .grid { stroke: var(--tui-rule); stroke-width: 1; }
/* The figures on an axis are read, not glanced at: secondary ink, 4.5:1. */
.tui-plot .axis { fill: var(--tui-ink-2); font: 500 10px var(--tui-sans); letter-spacing: 0.04em; }
.tui-plot .trace { fill: none; stroke: var(--tui-ink); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.tui-plot .trace--2 { stroke: var(--tui-ink-3); stroke-dasharray: 3 3; }
.tui-plot .fill { fill: var(--tui-ink); opacity: 0.07; }
.tui-plot .now { stroke: var(--tui-red); stroke-width: 1; }
/* Dark glass for a plot or a readout, whatever the finish around it. */
.tui-glass {
  /* An ink ring vanishes on dark glass: focus here is the display's own light. */
  --tui-focus: var(--tui-vfd);
  border-radius: var(--tui-r-m);
  padding: var(--tui-4);
  background:
    linear-gradient(165deg, rgb(255 255 255 / 0.06), transparent 35%),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px),
    var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 2px 8px rgb(0 0 0 / 0.85), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  color: var(--tui-vfd);
  --tui-ink: var(--tui-vfd);
  --tui-ink-2: color-mix(in oklab, var(--tui-vfd) 70%, transparent);
  --tui-ink-3: color-mix(in oklab, var(--tui-vfd) 42%, transparent);
  --tui-rule: color-mix(in oklab, var(--tui-vfd) 10%, transparent);
}
.tui-glass .tui-plot .trace { filter: drop-shadow(0 0 3px color-mix(in oklab, var(--tui-vfd) 60%, transparent)); }
.tui-glass .tui-plot .fill { fill: var(--tui-vfd); opacity: 0.08; }
.tui-glass .tui-label { color: var(--tui-ink-2); }
/* A key/value list, printed like the plate on the back of a device. */
.tui-spec { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; font-size: var(--tui-t-body); }
.tui-spec dt, .tui-spec dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--tui-rule); }
.tui-spec dt { color: var(--tui-ink-2); padding-right: var(--tui-4); }
.tui-spec dd { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.tui-spec > :nth-last-child(-n+2) { border-bottom: 0; }

/* Forced states, for showing every state of a part at once (docs, specimens). */
.tui-key.is-hover { filter: brightness(1.03); }
.tui-key.is-focus, .tui-switch.is-focus, .tui-input.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* ------------------------------------------------------------ forced states and disabled, for every part */

/* Forced states show a part's states side by side in documentation. */
.tui-seg label.is-down span, .tui-check.is-down, .tui-radio.is-down { transform: translateY(1.5px); box-shadow: var(--tui-pressed); }
.tui-seg label.is-hover span, .tui-check.is-hover, .tui-radio.is-hover, .tui-switch.is-hover, .tui-rocker.is-hover { filter: brightness(1.03); }
.tui-seg label.is-focus span, .tui-check.is-focus, .tui-radio.is-focus, .tui-rocker.is-focus, .tui-select.is-focus, .tui-textarea.is-focus,
.tui-tabs [role="tab"].is-focus, tui-knob.is-focus .tui-knob__body, .tui-fader.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-tabs [role="tab"].is-hover { color: var(--tui-ink); }
@media (prefers-reduced-motion: reduce) { .tui-tabs [role="tab"], .tui-tabs__more { transition: none; } }

/* Disabled: 45% and no movement, on every control. */
.tui-check:disabled, .tui-radio:disabled, .tui-rocker:disabled, .tui-fader:disabled, .tui-select:disabled, .tui-textarea:disabled, .tui-input:disabled,
.tui-seg input:disabled + span, .tui-tabs [role="tab"]:disabled, tui-knob[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-check:disabled, .tui-radio:disabled, .tui-seg input:disabled + span { transform: none; }
tui-knob[aria-disabled="true"] { pointer-events: none; }

/* ------------------------------------------------------------ a fingertip's reach */

/* A finger needs 44px. On a touch screen the small controls (keys 28 and 36px, the switch, the rocker, the segmented selector,
   a choice, a sortable heading) keep their faces and take a 44px press area: an invisible box centred on the
   control, which is no taller than the control where it is already 44. Under a mouse nothing changes. */
@media (pointer: coarse) {
  .tui-choice, .tui-table__sort { position: relative; }
  /* .tui-key--finger: the key's face stands the full 44 too, for a small key a page asks to grow. */
  .tui-key--finger { --h: 44px; }
  .tui-key::before, .tui-switch::before, .tui-rocker::after, .tui-seg > label::before, .tui-choice::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
  /* A heading's words are 13px tall: the area reaches up over its cell and a little down, not over the row below. */
  .tui-table__sort::before { content: ''; position: absolute; inset: -20px -4px -11px; }
  /* A field's words are 16px at least: below that, a phone zooms the page when the field takes focus. */
  .tui-input, .tui-select, .tui-textarea { font-size: max(16px, var(--tui-t-body)); }
}

/* ------------------------------------------------------------ the Quiet volume, by hand */

/* Most of Quiet is the depth tokens above. Two parts carry their light in
   the rule itself, so Quiet redraws them: the key (a flat cap whose states
   are one tint step each, the contrast cap ringed, the flat key a tint chip)
   and the switch (no ridged grip; on, the slot takes the contrast colour and
   a lamp lights in it). The toast needs nothing: it is --tui-depth-float.
   The scope stops at a Tactile region inside a Quiet one. */
@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-key { --skirt: 1px; transition: transform 70ms var(--tui-ease), background-color 120ms, box-shadow 120ms; }
  .tui-key.is-hover { filter: none; background: var(--tui-quiet-key-hover); box-shadow: var(--tui-depth-key-hover); }
  @media (hover: hover) and (pointer: fine) { .tui-key:hover { filter: none; background: var(--tui-quiet-key-hover); box-shadow: var(--tui-depth-key-hover); } }
  .tui-key:active, .tui-key[aria-pressed="true"], .tui-key[aria-expanded="true"], .tui-key.is-down { filter: none; background: var(--tui-quiet-key-down); }
  .tui-key--primary { background: var(--tb-cap, var(--tui-cap)); box-shadow: inset 0 1px 0 var(--tui-quiet-cap-hl), 0 0 0 1px var(--tui-quiet-cap-ring), 0 1px 2px rgb(var(--tui-sh) / 0.18); }
  .tui-key--primary.is-hover { background: var(--tb-hover, var(--tui-quiet-cap-hover)); box-shadow: inset 0 1px 0 var(--tui-quiet-cap-hl), 0 0 0 1px var(--tui-quiet-cap-ring), 0 1px 2px rgb(var(--tui-sh) / 0.18); }
  @media (hover: hover) and (pointer: fine) { .tui-key--primary:hover { background: var(--tb-hover, var(--tui-quiet-cap-hover)); box-shadow: inset 0 1px 0 var(--tui-quiet-cap-hl), 0 0 0 1px var(--tui-quiet-cap-ring), 0 1px 2px rgb(var(--tui-sh) / 0.18); } }
  .tui-key--primary:active, .tui-key--primary[aria-pressed="true"], .tui-key--primary[aria-expanded="true"], .tui-key--primary.is-down { background: var(--tb-down, var(--tui-quiet-cap-down)); box-shadow: 0 0 0 1px var(--tui-quiet-cap-ring), inset 0 1px 1px rgb(0 0 0 / 0.35); }
  .tui-key--flat { background: transparent; box-shadow: none; }
  .tui-key--flat.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-ink) 6%, transparent); box-shadow: none; }
  @media (hover: hover) and (pointer: fine) { .tui-key--flat:hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-ink) 6%, transparent); box-shadow: none; } }
  .tui-key--flat:active, .tui-key--flat.is-down { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-ink) 10%, transparent); box-shadow: none; }

  /* A knob is a control, not a plate: it takes a control's hairline. */
  tui-knob .tui-knob__body { box-shadow: var(--tui-depth-key); }

  .tui-switch::after { background: var(--tui-quiet-key); box-shadow: inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-edge), 0 1px 2px rgb(var(--tui-sh) / 0.14); }
  .tui-switch::before { content: ''; position: absolute; top: 50%; left: 10px; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--tui-green); box-shadow: 0 0 5px 1px color-mix(in oklab, var(--tui-green) 60%, transparent); opacity: 0; transition: opacity 180ms; }
  .tui-switch:checked { background: var(--tui-cap); box-shadow: inset 0 0 0 1px var(--tui-quiet-cap-ring); }
  .tui-switch:checked::before { opacity: 1; }
  .tui-switch:checked::after { box-shadow: inset 0 1px 0 var(--tui-quiet-hl), 0 1px 2px rgb(0 0 0 / 0.3); }
}
/* On a touch screen, Quiet's lamp is drawn on the switch's 44px press area (the one box both need). */
@media (pointer: coarse) {
  @scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
    .tui-switch::before { inset: -9px 0; width: auto; height: auto; margin: 0; border-radius: 0; box-shadow: none; background: radial-gradient(circle at 12.5px 50%, var(--tui-green) 0 2.5px, color-mix(in oklab, var(--tui-green) 45%, transparent) 3px, transparent 8px); }
  }
}

/* ---------------------------------------------------------------- part: accordion */
/* Accordion: printed sections, each with a small square key at the end of
   its head, printed +. Opening a section latches the key below the plate and
   its printing turns to −; the section's text slides out under the head.
   Native <details>: give them one name and only one opens at a time. */
.tui-accordion { display: grid; }
.tui-accordion__item { border-bottom: 1px solid var(--tui-rule); }
.tui-accordion__item:first-child { border-top: 1px solid var(--tui-rule); }
.tui-panel > .tui-accordion:first-child .tui-accordion__item:first-child,
.tui-accordion--flush .tui-accordion__item:first-child { border-top: 0; }
.tui-accordion--flush .tui-accordion__item:last-child { border-bottom: 0; }

.tui-accordion__item > summary {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  min-height: 52px;
  padding: var(--tui-2) 2px;
  list-style: none;
  font: 600 14px/1.35 var(--tui-sans);
  letter-spacing: -0.005em;
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
  border-radius: var(--tui-r-m);
  -webkit-tap-highlight-color: transparent;
}
.tui-accordion__item > summary::-webkit-details-marker { display: none; }
.tui-accordion__item > summary::marker { content: ''; }
/* The key: a cap on a 1.5px skirt, printed + (the bar that makes it − drops away when open). */
.tui-accordion__item > summary::after {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 6px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 8px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2.5px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-accordion__item > summary:hover::after, .tui-accordion__item > summary.is-hover::after { filter: brightness(1.03); }
.tui-accordion__item > summary:active::after, .tui-accordion__item > summary.is-down::after,
.tui-accordion__item[open] > summary::after {
  transform: translateY(1.5px);
  filter: brightness(0.97);
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-pressed);
}
.tui-accordion__item > summary:focus-visible, .tui-accordion__item > summary.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* An index number printed before the head, like a manual's sections. */
.tui-accordion__n {
  flex: none;
  width: 22px;
  font: 500 var(--tui-t-label)/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  color: var(--tui-ink-2);
}
.tui-accordion__meta { font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }

.tui-accordion__body { padding: 0 2px var(--tui-5); color: var(--tui-ink-2); }
.tui-accordion__body > :first-child { margin-top: 0; }
.tui-accordion__body > :last-child { margin-bottom: 0; }
/* Numbered: the text lines up with the head's words, not with the number. */
.tui-accordion__item:has(> summary .tui-accordion__n) > .tui-accordion__body { padding-left: calc(22px + var(--tui-3) + 2px); }
/* What is inside settles 4px down into place in 220ms as the row opens, and fades in 120ms as it shuts. The height itself
   changes at once, as the site's own folds do (laying the page out every frame costs a phone more than it gives). */
.tui-accordion__item::details-content {
  opacity: 0;
  translate: 0 -4px;
  transition: opacity 120ms var(--tui-ease), translate 120ms var(--tui-ease), content-visibility 120ms allow-discrete;
}
.tui-accordion__item[open]::details-content { opacity: 1; translate: none; transition-duration: 220ms; }
@media (prefers-reduced-motion: reduce) { .tui-accordion__item::details-content { translate: none; transition: none; } }

/* ---------------------------------------------------------------- part: agent-run */
/* Agent run: an ordinary panel. A name and a status line over a Stop key, the
   plan under them as plan steps, and the tool calls as a plain list of rows
   with a hairline between them. The kit's tool call is drawn flat here: no
   ticket, no perforation, just its lamp, its name, its state in words and its
   time. The running lamp breathes by opacity and nothing else, held still off
   screen and under reduced motion; the clock is text. */
.tui-agent-run { position: relative; display: grid; gap: var(--tui-4); min-width: 0; container-type: inline-size; text-align: left; }
.tui-agent-run__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tui-2) var(--tui-4); margin: 0; }
.tui-agent-run__title { display: grid; gap: 3px; min-width: 0; }
.tui-agent-run__name { margin: 0; font: 600 var(--tui-t-lead)/1.25 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-agent-run__status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--tui-3); margin: 0; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-agent-run__status .tui-lamp { width: 9px; height: 9px; }
.tui-agent-run__state { color: var(--tui-ink); font-weight: 600; }
.tui-agent-run__elapsed { font-variant-numeric: tabular-nums; }
.tui-agent-run[data-state="running"] .tui-agent-run__status .tui-lamp { animation: tui-agent-run-breathe 2.4s ease-in-out infinite; }
@keyframes tui-agent-run-breathe { 50% { opacity: 0.3; } }
.tui-agent-run[data-paused] .tui-lamp, .tui-agent-run[data-paused][data-state="running"] .tui-agent-run__status .tui-lamp { animation-play-state: paused; }
.tui-agent-run__stop[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* The tool calls: rows in a plain list. */
.tui-agent-run__calls { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--tui-rule); }
.tui-agent-run__calls > li { min-width: 0; border-bottom: 1px solid var(--tui-rule); }
.tui-agent-run tui-tool-call { border-radius: 0; background: transparent; box-shadow: none; }
.tui-agent-run tui-tool-call::before { content: none; }
.tui-agent-run .tui-tool-call__head { border-radius: 6px; }
/* Said aloud, never seen. */
.tui-agent-run__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-agent-run__stop { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-agent-run[data-state="running"] .tui-agent-run__status .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: alert-dialog */
/* Alert dialog: the kit's dialog plate with a caution strip riveted across
   its head. The strip is a shallow engraved recess holding the one lamp
   (red for an act that cannot be undone, amber for one that can) beside a
   printed legend. The question is the title; one sentence says what
   happens; a typed guard, when the act is grave, is a field like any other.
   Escape and the safe key put it away; nothing outside it does. */
.tui-alert-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
}
.tui-alert-dialog__form { display: grid; gap: var(--tui-3); margin: 0; padding: var(--tui-5) var(--tui-6) var(--tui-6); }

/* The caution strip: a recess along the head, lit on its lower lip. */
.tui-alert-dialog__strip {
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  justify-self: start;
  min-height: 26px;
  margin: 0 0 var(--tui-1);
  /* A pill: the words end half its 26px height from its end (the lamp starts it). */
  padding: 0 13px 0 10px;
  border-radius: 999px;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-alert-dialog__title {
  margin: 0;
  font: 650 var(--tui-t-h3)/1.2 var(--tui-sans);
  letter-spacing: -0.01em;
  color: var(--tui-ink);
  text-wrap: balance;
}
.tui-alert-dialog__body { margin: 0; font: 400 var(--tui-t-body)/1.5 var(--tui-sans); color: var(--tui-ink-2); text-wrap: pretty; }
.tui-alert-dialog__body b, .tui-alert-dialog__guard b { font-weight: 650; color: var(--tui-ink); }
.tui-alert-dialog__guard { margin-top: var(--tui-1); }
.tui-alert-dialog__guard .tui-label b { text-transform: none; letter-spacing: 0; font-family: var(--tui-mono); }
.tui-alert-dialog .tui-dialog__actions { flex-wrap: wrap; margin-top: var(--tui-3); }

/* A dialog drawn in place, for a specimen: the plate without the top layer. */
.tui-alert-dialog--static { position: static; display: block; margin: 0; }
dialog.tui-alert-dialog.tui-alert-dialog--static { opacity: 1; scale: none; transition: none; }

/* It arrives and leaves as the kit's dialog does (core.css); with reduced motion it fades and does not scale. */
@media (prefers-reduced-motion: reduce) {
  dialog.tui-alert-dialog:not([open]) { scale: none; }
}

@media (max-width: 420px) {
  .tui-alert-dialog__form { padding: var(--tui-4) var(--tui-4) var(--tui-5); }
  .tui-alert-dialog .tui-dialog__actions { justify-content: stretch; }
  .tui-alert-dialog .tui-dialog__actions > * { flex: 1 1 auto; }
}


/* ---------------------------------------------------------------- part: alert */
/* Alert: a message window let into the surface, with an annunciator — a
   small lit legend like the STEREO window on a receiver. The legend is the
   only colour: lit display-white for a note, green when done, amber to check,
   red for a fault. The words beside it say what happened and what to do. */
.tui-alert {
  --lit: var(--tui-vfd);
  position: relative;
  container-type: inline-size;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--tui-2) var(--tui-3);
  padding: 10px 10px 10px 10px;
  border-radius: 9px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  font-size: var(--tui-t-body);
  line-height: 1.45;
  color: var(--tui-ink);
}
.tui-alert[data-alert="success"] { --lit: var(--tui-green); }
.tui-alert[data-alert="warning"] { --lit: var(--tui-amber); }
/* Red is lifted toward the display's white so the legend reads at 4.5:1; a finish that prints its window solid says how far. */
.tui-alert[data-alert="error"] { --lit: color-mix(in oklab, var(--tui-red) var(--tui-fault-lit, 78%), var(--tui-vfd)); }

/* The annunciator: dark glass, the legend lit behind it. */
.tui-alert__legend {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--tui-r-s);
  font: 700 10.5px/1 var(--tui-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lit);
  background:
    linear-gradient(170deg, rgb(255 255 255 / 0.07), transparent 45%),
    radial-gradient(80% 90% at 50% 55%, color-mix(in oklab, var(--lit) var(--tui-legend-wash, 16%), transparent), transparent 75%),
    var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 1.5px 3px rgb(0 0 0 / 0.85), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  text-shadow: var(--tui-legend-glow, 0 0 5px color-mix(in oklab, var(--lit) 60%, transparent), 0 0 14px color-mix(in oklab, var(--lit) 25%, transparent));
}
.tui-alert__legend[data-blink] { animation: tui-blink 1.2s steps(1) infinite; }

.tui-alert:has(> .tui-alert__dismiss) { padding-right: 44px; }
/* No fixed basis: the words share the tag's line at every width and wrap after it, so the tag is never alone above them. */
.tui-alert__text { flex: 1 1 0; min-width: 9ch; margin: 0; padding-top: 2px; color: var(--tui-ink-2); }
.tui-alert__text b, .tui-alert__text strong { font-weight: 700; color: var(--tui-ink); }
.tui-alert__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2); margin-left: auto; }
/* The ×: pinned top right, whatever wraps below it. */
.tui-alert__dismiss { position: absolute; top: 8px; right: 8px; color: var(--tui-ink-2); }
.tui-alert__dismiss svg { width: 14px; height: 14px; }
/* A long message puts its keys on their own line, under the words. */
.tui-alert--stacked .tui-alert__actions { flex-basis: 100%; margin-left: 0; padding-left: 76px; }
/* In a narrow place the tag is pinned to the corner and the words start after it on the first line, then run the full width beneath it
   (an indent, not a column). A flex item cannot float, so every tag takes the same width here and the gap after it is the same 10px for all
   (shortcut: a tag longer than nine capitals overflows its chip); the keys go under the words, flush with them, and the dismiss key keeps the first line's right end clear. */
@container (max-width: 400px) {
  .tui-alert:has(> .tui-alert__dismiss) { padding-right: 10px; }
  .tui-alert__legend { position: absolute; top: 10px; left: 10px; width: 5.9rem; min-width: 0; padding: 0; white-space: nowrap; }
  .tui-alert__text { flex-basis: 100%; text-indent: calc(5.9rem + 10px); }
  .tui-alert__text::before { content: ''; float: right; width: 26px; height: 24px; margin-bottom: -6px; }
  .tui-alert .tui-alert__actions { flex-basis: 100%; margin-left: 0; padding-left: 0; }
  .tui-alert .tui-alert__dismiss { position: absolute; }
}

/* Filled: the whole plate takes the tone, for a state that stops the screen being live (a lost link, stale data) and
   must be seen from across a room. Same footprint, same parts; only the paint changes. The legend keeps its size and
   becomes ink on the fill. Amber, green and white-on-glass carry dark ink; the red is pulled toward the glass so
   its white ink holds 4.5:1. */
.tui-alert[data-weight="filled"] {
  --fill: var(--tui-vfd-bg);
  --on: var(--tui-vfd);
  background: var(--fill);
  color: var(--on);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), inset 0 -1px 0 rgb(0 0 0 / 0.2), 0 0 0 1px color-mix(in oklab, var(--fill) 70%, var(--tui-vfd-bg));
}
.tui-alert[data-weight="filled"][data-alert="success"] { --fill: var(--tui-green); --on: var(--tui-vfd-bg); }
.tui-alert[data-weight="filled"][data-alert="warning"] { --fill: var(--tui-amber); --on: var(--tui-vfd-bg); }
.tui-alert[data-weight="filled"][data-alert="error"] { --fill: color-mix(in oklab, var(--tui-red) var(--tui-fill-red, 88%), var(--tui-vfd-bg)); --on: var(--tui-white); }
.tui-alert[data-weight="filled"] .tui-alert__legend {
  color: var(--on);
  background: color-mix(in oklab, var(--on) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--on) 60%, transparent);
  text-shadow: none;
}
.tui-alert[data-weight="filled"] .tui-alert__text,
.tui-alert[data-weight="filled"] .tui-alert__text b,
.tui-alert[data-weight="filled"] .tui-alert__text strong,
.tui-alert[data-weight="filled"] .tui-alert__dismiss { color: var(--on); }

.tui-alert.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity 160ms var(--tui-ease), transform 160ms var(--tui-ease); }
@media (prefers-reduced-motion: reduce) { .tui-alert__legend[data-blink] { animation: none; } }

/* ---------------------------------------------------------------- part: aspect-ratio */
/* Aspect ratio: a frame that holds one shape and crops what is in it to fit,
   so a row of pictures stays a row whatever they are. Plain CSS. The frame is
   a recess, so while a picture loads there is a place for it; the picture
   covers the recess when it arrives. Say the shape with data-ratio="16/9" or
   a class, and what to keep of a crop with --tui-fit-x and --tui-fit-y. */
.tui-ratio {
  --ratio: 16 / 9;
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  align-self: start;
  aspect-ratio: var(--ratio);
  overflow: hidden;
  border-radius: var(--tui-ratio-r, var(--tui-r-m));
  color: var(--tui-ink-2);
  background: var(--tui-well-fill) var(--tui-well);
}
.tui-ratio[data-ratio="16/9"], .tui-ratio--16-9 { --ratio: 16 / 9; }
.tui-ratio[data-ratio="4/3"], .tui-ratio--4-3 { --ratio: 4 / 3; }
.tui-ratio[data-ratio="1/1"], .tui-ratio--1-1 { --ratio: 1 / 1; }
.tui-ratio[data-ratio="3/2"], .tui-ratio--3-2 { --ratio: 3 / 2; }
.tui-ratio[data-ratio="21/9"], .tui-ratio--21-9 { --ratio: 21 / 9; }
.tui-ratio[data-ratio="3/4"], .tui-ratio--3-4 { --ratio: 3 / 4; }
.tui-ratio[data-ratio="9/16"], .tui-ratio--9-16 { --ratio: 9 / 16; }

/* What is inside fills the frame and is cropped to it; a picture keeps its own shape and shows the middle of it. */
.tui-ratio > :is(img, video, iframe, svg, canvas, object, embed, .tui-ratio__fill),
.tui-ratio > picture > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  object-fit: cover;
  object-position: var(--tui-fit-x, 50%) var(--tui-fit-y, 50%);
}
.tui-ratio > picture { display: contents; }
.tui-ratio[data-fit="contain"] > :is(img, video, picture > img) { object-fit: contain; }
.tui-ratio[data-fit="fill"] > :is(img, video, picture > img) { object-fit: fill; }
/* Anything else (a block of text, a map) is set in the frame and kept inside it. */
.tui-ratio__fill { display: grid; place-items: center; padding: var(--tui-3); text-align: center; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); }

/* A hairline round the edge, drawn over the picture, so a pale one on a pale page still has an edge. */
.tui-ratio--edge::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--tui-rule);
  pointer-events: none;
}

/* With a caption: the frame and its words, one figure. */
.tui-ratio-figure { display: grid; gap: var(--tui-2); min-width: 0; margin: 0; }
.tui-ratio__caption { margin: 0; font: 400 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-ratio__caption b { font-weight: 600; color: var(--tui-ink); }

/* In a card with its own padding: a frame set in it takes the card's radius less the padding. */
.tui-ratio-card { --pad: var(--tui-2); display: grid; gap: var(--tui-3); min-width: 0; padding: var(--pad); border-radius: var(--tui-r-l); background: var(--tui-face); box-shadow: var(--tui-raised); }
.tui-ratio-card > .tui-ratio, .tui-ratio-card > .tui-ratio-figure > .tui-ratio { --tui-ratio-r: calc(var(--tui-r-l) - var(--pad)); }

@media (pointer: coarse) {
  .tui-ratio__caption { font-size: var(--tui-t-body); }
}

/* ---------------------------------------------------------------- part: aurora */
/* Aurora: a slow mesh of three to five soft colour blobs, the light inside a
   lit display and nowhere else. See aurora.mjs. The layer fills the display
   it sits in; the display decides how the light meets its material (the
   cloth selector masks it and adds it with plus-lighter).

   Each blob is a radial gradient painted once on its own layer. It drifts on
   the compositor: `translate` across, `transform` up and down and `scale`
   breathing, each on its own seeded cycle, ease-in-out and back, so the mesh
   never repeats in step and nothing is repainted. Blobs lie over one another
   with soft edges, so where two cross the light is a mix of their hues and
   never washes to white (the matrix samples the same mix, aurora.mjs). */
tui-aurora {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
  isolation: isolate;
}
.tui-aurora__blob {
  --s: calc(var(--r) * (60cqmax + 40cqmin));
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2);
  /* --k is the colour it is painted in: its own, unless the display it sits in lifts it. */
  --k: var(--c);
  --pace: 1;   /* how much quicker, and */
  --reach: 1;  /* how much further it drifts: more in a small box, below */
  background: radial-gradient(closest-side, var(--k), color-mix(in srgb, var(--k) 55%, transparent) 40%, color-mix(in srgb, var(--k) 18%, transparent) 72%, transparent);
  animation:
    tui-aurora-x calc(var(--tx) / 2 / var(--pace)) ease-in-out calc(var(--px) * var(--tx) * -1 / var(--pace)) infinite alternate,
    tui-aurora-y calc(var(--ty) / 2 / var(--pace)) ease-in-out calc(var(--py) * var(--ty) * -1 / var(--pace)) infinite alternate,
    tui-aurora-s calc(var(--ts) / 2 / var(--pace)) ease-in-out calc(var(--ps) * var(--ts) * -1 / var(--pace)) infinite alternate;
}
@keyframes tui-aurora-x { from { translate: calc(var(--ax) * -50cqmax * var(--reach)) 0; } to { translate: calc(var(--ax) * 50cqmax * var(--reach)) 0; } }
@keyframes tui-aurora-y { from { transform: translateY(calc(var(--ay) * -50cqmax * var(--reach))); } to { transform: translateY(calc(var(--ay) * 50cqmax * var(--reach))); } }
@keyframes tui-aurora-s { from { scale: 0.85; } to { scale: 1.15; } }
/* A drift sized to its box hardly shows in a small one (a cloth selector tile is about 80px across): there the light goes further and quicker, so it is seen to move (reports #34 to #36). */
@container (max-width: 160px) { .tui-aurora__blob { --pace: 2.2; --reach: 1.6; } }
/* Off screen, in a hidden tab: held where it is. */
tui-aurora[data-run="false"] .tui-aurora__blob { animation-play-state: paused; }
/* Reduced motion: one still frame, every blob at its seeded place. */
@media (prefers-reduced-motion: reduce) {
  .tui-aurora__blob { animation: none; }
}

/* ---------------------------------------------------------------- part: avatar */
/* Avatar: a person's mark, struck like a coin. A raised rim catches the lamp;
   the field inside it sits a little lower, so the rim shades its upper edge
   and its lower edge is lit. Initials are stamped into the field; a photo is
   set under the rim like a print behind a bezel. A status lamp is mounted in
   the rim, in its own small bezel. */
.tui-avatar {
  --size: 40px;
  --field: calc(var(--size) * 0.075);
  position: relative;
  isolation: isolate;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  vertical-align: middle;
  font: 700 calc(var(--size) * 0.36)/1 var(--tui-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--tui-ink-2);
  user-select: none;
  /* The rim: turned metal, brightest toward the lamp. */
  background:
    radial-gradient(90% 90% at 30% 22%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(150deg, var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 78%, rgb(var(--tui-sh))));
  box-shadow: var(--tui-raised);
}
/* On a key, the mark sits inside the cap, so the key's own rim and skirt still show where it is. */
.tui-key > .tui-avatar { --size: calc(var(--h) - 4px); }
/* The field, struck below the rim. */
.tui-avatar::before, .tui-avatar::after {
  content: '';
  position: absolute;
  inset: var(--field);
  border-radius: inherit;
  pointer-events: none;
}
.tui-avatar::before {
  z-index: -1;
  background: radial-gradient(130% 110% at 36% 24%, var(--tui-face-hi), var(--tui-face) 70%, color-mix(in oklab, var(--tui-face) 88%, rgb(var(--tui-sh))));
}
/* The rim's shadow on the field, over a photo too: dark under the upper wall, lit along the lower one. */
.tui-avatar::after {
  z-index: 2;
  box-shadow:
    var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.9)),
    inset 1px 0 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 70%, transparent));
}
/* Stamped initials: the cut's upper wall is in shadow, its lower lip lit. */
.tui-avatar__mark {
  position: relative;
  z-index: 0;
  text-shadow: 0 1px 0 var(--tui-hl), 0 -0.5px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4));
}
.tui-avatar__mark svg { display: block; width: calc(var(--size) * 0.46); height: calc(var(--size) * 0.46); filter: drop-shadow(0 1px 0 var(--tui-hl)); }
/* A photo, set under the rim. If it fails to load (alt=""), the initials beneath show through. */
.tui-avatar > img {
  position: absolute;
  z-index: 1;
  inset: var(--field);
  width: calc(100% - var(--field) * 2);
  height: calc(100% - var(--field) * 2);
  border-radius: inherit;
  object-fit: cover;
}
/* The status lamp, mounted in the rim at five o'clock in a small bezel. */
.tui-avatar > .tui-lamp {
  --d: clamp(7px, calc(var(--size) * 0.2), 12px);
  position: absolute;
  z-index: 3;
  right: calc(var(--size) * 0.02);
  bottom: calc(var(--size) * 0.02);
  width: var(--d);
  height: var(--d);
  box-shadow: 0 0 0 max(1.5px, calc(var(--size) * 0.04)) var(--tui-face-hi), 0 0 0 max(2.5px, calc(var(--size) * 0.06)) rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)), inset 0 1px 1.5px rgb(0 0 0 / 0.45);
}
.tui-avatar > .tui-lamp:is([data-on], .is-on) {
  box-shadow: 0 0 0 max(1.5px, calc(var(--size) * 0.04)) var(--tui-face-hi), 0 0 0 max(2.5px, calc(var(--size) * 0.06)) rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)), 0 0 7px 1px color-mix(in oklab, var(--c) 70%, transparent);
}

.tui-avatar--sm { --size: 28px; letter-spacing: 0; }
.tui-avatar--lg { --size: 56px; }
.tui-avatar--xl { --size: 80px; }
/* A company or a team: a squared coin. */
.tui-avatar--square { border-radius: 26%; }
/* The count at the end of a stack: the field printed darker. */
.tui-avatar--more { font-size: calc(var(--size) * 0.3); letter-spacing: 0; color: var(--tui-ink); }
.tui-avatar--more::before { background: linear-gradient(var(--tui-face-lo), color-mix(in oklab, var(--tui-face-lo) 70%, var(--tui-face))); }

/* A stack: coins overlap from the left, each casting its shadow on the next
   (the lamp is to the left), so the first lies on top. */
.tui-avatar-group { display: inline-flex; align-items: center; isolation: isolate; }
.tui-avatar-group > .tui-avatar { box-shadow: var(--tui-depth-plate, var(--tui-raised), 3px 0 4px -1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3))); }
.tui-avatar-group > .tui-avatar + .tui-avatar { margin-left: calc(var(--size) * -0.3); }
.tui-avatar-group > :nth-child(1) { z-index: 8; }
.tui-avatar-group > :nth-child(2) { z-index: 7; }
.tui-avatar-group > :nth-child(3) { z-index: 6; }
.tui-avatar-group > :nth-child(4) { z-index: 5; }
.tui-avatar-group > :nth-child(5) { z-index: 4; }
.tui-avatar-group > :nth-child(6) { z-index: 3; }
.tui-avatar-group > :nth-child(7) { z-index: 2; }
.tui-avatar-group > :nth-child(n+8) { z-index: 1; }
.tui-avatar-group--sm > .tui-avatar { --size: 28px; font-size: 10px; letter-spacing: 0; }
.tui-avatar-group--lg > .tui-avatar { --size: 56px; }

/* ---------------------------------------------------------------- part: backdrop */
/* Backdrop: the base every Background shares. A decorative layer behind a
   section: a div with aria-hidden, the first child of a .tui-backdrop-host, and
   one modifier that says which surface (--brushed-metal, --lamp-pool,
   --grille-moire, --louvre-light). It sits at z-index -1 inside the host's own
   stacking context, so the host's content is always above it and nothing needs
   a z-index of its own. It never takes the pointer.

   Every surface is made from the finish's tokens (face, desk, ink), so it
   follows all twelve finishes, and its light is kept low enough that the page's
   own text clears 4.5:1 on its brightest and its darkest pixel. The moving
   ones (--grille-moire, --louvre-light) move a gradient layer by transform and
   nothing else: no blur, no drop shadow, no repaint. backdrop.mjs holds them
   still off screen and in a hidden tab (data-run="false"), and leans the light
   of --brushed-metal and --lamp-pool toward a fine pointer, eased. Under
   reduced motion each is one still frame (the animation is only declared for
   no-preference, so a still frame needs no override). */
.tui-backdrop-host { position: relative; isolation: isolate; }
.tui-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  contain: strict;
}
.tui-backdrop::before, .tui-backdrop::after { content: ''; position: absolute; }
.tui-backdrop[data-run="false"]::before, .tui-backdrop[data-run="false"]::after { animation-play-state: paused; }
/* Light leans only while it is being eased, so a still backdrop holds no layer of its own. */
.tui-backdrop[data-live]::before { will-change: transform; }

/* ---------------------------------------------------------------- part: banner */
/* Banner: a strip across the top of a page for one announcement. A raised
   plate the width of the page, a lamp, one line, an optional key that goes
   somewhere and a dismiss key. It is a labelled region, not an alert: it is
   there on load and says its thing once. The lamp only agrees with the words.
   When it goes it closes like a drawer, its one grid row easing to nothing, so
   the page glides up by its height instead of jumping. */
.tui-banner {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr;
  container-type: inline-size;
  background: var(--tui-face);
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), 0 1px 0 var(--tui-rule), 0 4px 8px -6px rgb(var(--tui-sh) / var(--tui-sh-a)));
  color: var(--tui-ink);
  font-size: var(--tui-t-body);
  line-height: 1.45;
  text-align: left;
}
/* The same bead-blast as a panel. */
.tui-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tui-noise), linear-gradient(170deg, color-mix(in oklab, var(--tui-hl) 7%, transparent), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}
.tui-banner__row {
  position: relative;
  min-height: 44px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 var(--tui-3);
  padding: var(--tui-2) 52px;
}
.tui-banner__line { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding-block: var(--tui-1); }
.tui-banner__line > .tui-lamp { margin-top: 6px; }
.tui-banner__text { margin: 0; overflow-wrap: anywhere; min-width: 0; max-width: 72ch; color: var(--tui-ink-2); text-wrap: pretty; }
.tui-banner__text b, .tui-banner__text strong { font-weight: 700; color: var(--tui-ink); }
.tui-banner__link { flex: none; color: var(--tui-ink); font-weight: 700; }
/* The dismiss key: pinned to the right, whatever wraps beside it. */
.tui-banner .tui-banner__dismiss { position: absolute; top: 50%; right: var(--tui-2); translate: 0 -50%; color: var(--tui-ink-2); }
.tui-banner__dismiss:hover { color: var(--tui-ink); }
/* The strip runs to the edge of the page, so the ring is drawn inside the key, where nothing cuts it off. */
.tui-banner .tui-banner__dismiss:is(:focus-visible, .is-focus) { outline-offset: -3px; }
.tui-banner__dismiss svg { width: 14px; height: 14px; }

/* Going: the row closes to nothing, so what is under it rises with it. */
.tui-banner.is-leaving { grid-template-rows: 0fr; opacity: 0; pointer-events: none; transition: grid-template-rows 220ms var(--tui-ease), opacity 160ms var(--tui-ease); }
.tui-banner.is-leaving > .tui-banner__row { min-height: 0; overflow: hidden; padding-block: 0; }
.tui-banner.is-leaving > .tui-banner__row > * { visibility: hidden; transition: visibility 0s 160ms; }

/* Pinned to the top of the window while the page scrolls under it. */
.tui-banner--sticky { position: sticky; top: 0; z-index: 5; }

@media (pointer: coarse) {
  .tui-banner .tui-banner__dismiss { --h: 44px; right: 2px; }
  .tui-banner__link { --h: 44px; }
}
@media (prefers-reduced-motion: reduce) { .tui-banner.is-leaving { transition: none; } }
/* A strip in a narrow place (a specimen, a card) gives the line the room the cross does not need. */
@container (max-width: 240px) { .tui-banner__row { padding: var(--tui-2) 32px var(--tui-2) var(--tui-3); } .tui-banner .tui-banner__dismiss { right: 2px; } }

/* ---------------------------------------------------------------- part: bars */
/* Bars: printed bars on the panel, one value each. The bars are ink laid flat
   on the plate (never a colour, and never glass); the axis is engraved into
   it, a groove along the zero line with the light on its lower lip and a faint
   rule at each tick. The values are a real list, one item for each bar, so a
   screen reader reads "Mon, 42" and a keyboard user is not given a picture to
   guess at; the bars and the axis are drawn over that and hidden from it.
   Columns by default, rows with .tui-bars--row. Set --max on the figure and
   --v on each item, both in the same unit. On display glass the ink is the
   display's light. */
.tui-bars {
  --max: 100;
  --bars-h: 168px;
  --bars-row-h: 24px;
  --bars-label: 5.5em;
  display: grid;
  gap: var(--tui-3);
  min-width: 0;
  margin: 0;
}
.tui-bars__title { margin: 0; }
.tui-bars__chart { position: relative; min-width: 0; padding: 20px 0 0 2.9em; }
.tui-bars__set { display: flex; align-items: stretch; gap: var(--tui-2); margin: 0; padding: 0; list-style: none; }
.tui-bars__item { position: relative; display: grid; grid-template-rows: var(--bars-h) auto; flex: 1 1 0; min-width: 0; }
.tui-bars__slot { position: relative; grid-row: 1; }
.tui-bars__label {
  grid-row: 2;
  min-width: 0;
  padding-top: 7px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 var(--tui-t-small)/1.2 var(--tui-sans);
  color: var(--tui-ink-2);
}
.tui-bars__bar {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(100%, 44px);
  height: calc(var(--v) / var(--max) * 100%);
  border-radius: 2px 2px 0 0;
  background: var(--tui-ink);
  transform: translateX(-50%);
  transition: height 220ms var(--tui-ease);
}
.tui-bars__value {
  position: absolute;
  left: 50%;
  bottom: calc(var(--v) / var(--max) * 100%);
  padding-bottom: 4px;
  transform: translateX(-50%);
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink);
  white-space: nowrap;
  transition: bottom 220ms var(--tui-ease);
}
/* A bar the reader is sent to: struck through with hatching and outlined, so it is not the ink alone, and its figure bold. */
.tui-bars__item[data-mark] .tui-bars__bar { background: repeating-linear-gradient(135deg, var(--tui-ink) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1.5px var(--tui-ink); }
.tui-bars__item[data-mark] .tui-bars__value { font-weight: 700; }
.tui-bars__item[data-mark] .tui-bars__label { color: var(--tui-ink); font-weight: 600; }
.tui-bars__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The axis: engraved, and read by eye only. Each tick sits at --at, in the same unit as --max; the first is the zero line. */
.tui-bars__axis { position: absolute; left: 0; right: 0; top: 20px; height: var(--bars-h); pointer-events: none; }
.tui-bars__axis span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--at) / var(--max) * 100%);
  box-sizing: border-box;
  height: 10px;
  padding-right: calc(100% - 2.4em);
  transform: translateY(50%);
  text-align: right;
  font: 500 10px/10px var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--tui-ink-2);
}
.tui-bars__axis span::after { content: ''; position: absolute; left: 3em; right: 0; top: 50%; height: 1px; background: var(--tui-rule); }
.tui-bars__axis span:first-child::after {
  top: calc(50% - 1px);
  height: 2px;
  background: linear-gradient(rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)) 0 1px, var(--tui-hl) 1px 2px);
}

/* Rows: the label at the start, the bar growing to the right, the figure at its end. */
.tui-bars--row .tui-bars__chart { padding: 0 3.4em 1.9em 0; }
.tui-bars--row .tui-bars__set { flex-direction: column; gap: 6px; }
.tui-bars--row .tui-bars__item { grid-template-rows: none; grid-template-columns: var(--bars-label) minmax(0, 1fr); align-items: center; flex: none; }
.tui-bars--row .tui-bars__slot { grid-row: auto; grid-column: 2; height: var(--bars-row-h); }
.tui-bars--row .tui-bars__label { grid-row: auto; grid-column: 1; padding: 0 10px 0 0; text-align: right; }
.tui-bars--row .tui-bars__bar { left: 0; top: 50%; bottom: auto; width: calc(var(--v) / var(--max) * 100%); height: 70%; max-height: 18px; border-radius: 0 2px 2px 0; transform: translateY(-50%); transition: width 220ms var(--tui-ease); }
.tui-bars--row .tui-bars__value { left: calc(var(--v) / var(--max) * 100%); top: 50%; bottom: auto; padding: 0 0 0 7px; transform: translateY(-50%); transition: left 220ms var(--tui-ease); }
.tui-bars--row .tui-bars__axis { position: absolute; top: auto; bottom: 0; left: var(--bars-label); right: 3.4em; height: 1.4em; }
.tui-bars--row .tui-bars__axis span { top: 0; bottom: auto; left: calc(var(--at) / var(--max) * 100%); right: auto; height: auto; padding: 7px 0 0; transform: translateX(-50%); text-align: center; }
.tui-bars--row .tui-bars__axis span::before { content: ''; position: absolute; left: 50%; top: 0; width: 1px; height: 5px; background: var(--tui-rule); }
.tui-bars--row .tui-bars__axis span::after { display: none; }
.tui-bars--row .tui-bars__axis span:first-child::before { height: 6px; width: 2px; margin-left: -1px; background: linear-gradient(90deg, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)) 0 1px, var(--tui-hl) 1px 2px); }
/* The zero line, engraved down the left edge of the bars. */
.tui-bars--row .tui-bars__set { position: relative; }
.tui-bars--row .tui-bars__set::before {
  content: '';
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: var(--bars-label);
  width: 2px;
  background: linear-gradient(90deg, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)) 0 1px, var(--tui-hl) 1px 2px);
  transform: translateX(-2px);
}

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-bars__axis span:first-child::after { background: var(--tui-quiet-line-2); height: 1px; }
  .tui-bars--row .tui-bars__axis span:first-child::before, .tui-bars--row .tui-bars__set::before { background: var(--tui-quiet-line-2); width: 1px; margin-left: 0; }
}

@media (max-width: 480px) {
  .tui-bars { --bars-h: 148px; --bars-label: 4.6em; }
  .tui-bars__set { gap: 6px; }
  .tui-bars__chart { padding-left: 2.6em; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-bars__bar, .tui-bars__value { transition: none; }
}
@media (forced-colors: active) {
  .tui-bars__bar { background: CanvasText; forced-color-adjust: none; }
}

/* ---------------------------------------------------------------- part: battery */
/* Battery: a cell outline, a terminal at one end and the charge as lamp
   segments set into a recess, lit from the empty end. The lit segments take
   one lamp colour for the whole level: green, amber below two fifths, red below
   a fifth. While it charges the top lit segment (the one the level has reached)
   breathes, so the part says "filling" and not only "this much". The level is
   said in words as well (the figure beside it, and aria-valuetext on the
   meter), so neither colour nor the cycling segment is the only sign. Under
   reduced motion nothing cycles: the top segment simply stays lit and the words
   say Charging. The segments that are lit carry data-on (battery.mjs sets them,
   or write them in). */
.tui-battery {
  /* The positioned box for the spoken line, which is out of the flow: it must not escape a scroller. */
  position: relative;
  --n: 5;
  --c: var(--tui-green);
  display: inline-flex;
  align-items: center;
  gap: var(--tui-3);
  vertical-align: middle;
  font: 600 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink);
}
.tui-battery[data-state="mid"] { --c: var(--tui-amber); }
.tui-battery[data-state="low"] { --c: var(--tui-red); }
.tui-battery__text { display: inline-flex; align-items: baseline; gap: var(--tui-2); white-space: nowrap; }
.tui-battery__note { font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); }

/* The cell: a recess with a bezel round it, so its outline shows at 3:1 on any plate. */
.tui-battery__cell {
  position: relative;
  display: flex;
  flex: none;
  gap: 3px;
  box-sizing: border-box;
  width: calc(var(--n) * 14px + (var(--n) - 1) * 3px + 8px);
  height: 26px;
  margin-right: 6px;
  padding: 4px;
  border-radius: 7px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset), 0 0 0 1.5px color-mix(in oklab, var(--tui-ink) 58%, transparent);
}
/* The terminal: a small cap on the end of the cell, drawn in the same bezel. */
.tui-battery__cell::after {
  content: '';
  position: absolute;
  left: calc(100% + 1.5px);
  top: 30%;
  bottom: 30%;
  width: 4.5px;
  border-radius: 0 3px 3px 0;
  background: color-mix(in oklab, var(--tui-ink) 58%, transparent);
}
/* A segment: a dim cap, concentric with the cell (7px less the 4px it is set in). */
.tui-battery__cell > i {
  flex: 1;
  min-width: 0;
  border-radius: 3px;
  background: color-mix(in oklab, var(--c) 18%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.4);
}
.tui-battery__cell > i[data-on] {
  color: var(--c);
  background: linear-gradient(color-mix(in oklab, white 34%, transparent), transparent 55%), var(--c);
  box-shadow: 0 0 6px color-mix(in oklab, var(--c) 65%, transparent), inset 0 0 0 1px rgb(var(--tui-sh) / 0.18);
}
/* Charging: the segment at the top of the level breathes. */
.tui-battery[data-charging] .tui-battery__cell > i[data-on]:not(:has(~ i[data-on])) { animation: tui-battery-charge 1400ms ease-in-out infinite; }
@keyframes tui-battery-charge { 50% { opacity: 0.3; } }
.tui-battery[data-paused] .tui-battery__cell > i { animation-play-state: paused; }

/* Standing: the cell is a column, filling upward, with the terminal on top. */
.tui-battery--vertical { flex-direction: column; align-items: flex-start; }
.tui-battery--vertical .tui-battery__cell { flex-direction: column-reverse; width: 26px; height: calc(var(--n) * 14px + (var(--n) - 1) * 3px + 8px); margin: 6px 0 0; }
.tui-battery--vertical .tui-battery__cell::after { left: 30%; right: 30%; top: auto; bottom: calc(100% + 1.5px); width: auto; height: 4.5px; border-radius: 3px 3px 0 0; }

.tui-battery--sm .tui-battery__cell { width: calc(var(--n) * 9px + (var(--n) - 1) * 2px + 6px); height: 18px; padding: 3px; gap: 2px; border-radius: 5px; }
.tui-battery--sm .tui-battery__cell > i { border-radius: 2px; }
.tui-battery--sm { font-size: var(--tui-t-small); }

/* Said, not seen: the level and whether it is charging, for a screen reader. */
.tui-battery__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-battery[data-charging] .tui-battery__cell > i[data-on]:not(:has(~ i[data-on])) { animation: none; }
}

/* ---------------------------------------------------------------- part: bottom-sheet */
/* Bottom sheet: a panel that rises from the bottom edge of the window, on the
   native <dialog>. A face plate that stops at two heights, half and full, and
   goes back down the way it came. Rounded where it meets the page, square at
   the frame, with a grip in the top edge to drag it by. The scrim is the
   dialog's own backdrop. Modal, so focus is held inside and the page behind
   is inert; Escape closes it. bottom-sheet.mjs adds the triggers, the heights
   and the drag.

   It moves by transform only. The plate is always as tall as its full height;
   at half it has slid down by half of that, and the foot is pulled back up by
   the same distance so the key that saves is still in sight. */
.tui-sheet {
  --sheet-full: min(92dvh, 760px);
  --sheet-half: 0.5;
  --sy: 0px;
  --r: 16px;
  position: fixed;
  inset: auto 0 0 0;
  width: min(100%, 560px);
  height: calc(var(--sheet-full) + var(--stretch, 0px)); /* --stretch: set by the script while the sheet is pulled up past full, else 0 */
  max-width: none;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
  color: var(--tui-ink);
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  background: var(--tui-face);
  outline: none;
  overscroll-behavior: contain;
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 -2px 3px rgb(var(--tui-sh) / 0.2), 0 -24px 48px -16px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
  transform: translateY(var(--sheet-full));
}
.tui-sheet[open] { display: flex; flex-direction: column; transform: translateY(calc(var(--sy) + var(--drag, 0px))); }
.tui-sheet[data-detent="half"] { --sy: calc(var(--sheet-full) * (1 - var(--sheet-half))); }
.tui-sheet[data-detent="full"] { --sy: 0px; }
.tui-sheet--tall { --sheet-full: min(96dvh, 880px); }

/* The grip: a slot let into the top edge, with its own key around it. Drag it, or press it to step between the heights. */
.tui-sheet__top { flex: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.tui-sheet__grip {
  appearance: none;
  display: block;
  position: relative;
  width: 96px;
  height: 28px;
  margin: 4px auto 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-sheet__grip::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 6px;
  margin: -3px 0 0 -22px;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-sheet__grip:hover::before { filter: brightness(0.94); }
.tui-sheet__grip:focus-visible, .tui-sheet__grip.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 0; }
.tui-sheet[data-dragging] .tui-sheet__grip, .tui-sheet__grip.is-down { cursor: grabbing; }
.tui-sheet[data-dragging] .tui-sheet__grip::before, .tui-sheet__grip.is-down::before { filter: brightness(0.88); }

.tui-sheet__head { display: flex; align-items: center; gap: var(--tui-3); padding: 2px 12px 12px 20px; border-bottom: 1px solid var(--tui-rule); }
.tui-sheet__head > :first-child { flex: 1; min-width: 0; }
.tui-sheet__title { margin: 0; font: 700 var(--tui-t-lead)/1.2 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-sheet__title:focus-visible { outline: none; }

/* The body scrolls only when the sheet is full; at half, a drag on it moves the sheet. */
.tui-sheet__body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px; }
.tui-sheet__body :is(.tui-input, .tui-select, .tui-textarea) { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }
.tui-sheet:not([data-detent="full"]) .tui-sheet__body { overflow: hidden; touch-action: none; }
.tui-sheet[data-detent="full"] .tui-sheet__body { touch-action: pan-y; }

.tui-sheet__foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--tui-2);
  padding: 14px 20px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--tui-rule);
  background: var(--tui-face);
  /* At half the plate's bottom is below the window: lift the foot by the same distance, so it stays in view. */
  transition: transform 280ms var(--tui-ease);
}
.tui-sheet[data-detent="half"] .tui-sheet__foot { transform: translateY(calc(-1 * var(--sy) - min(var(--drag, 0px), 0px))); }
.tui-sheet[data-detent="full"] .tui-sheet__foot { transform: translateY(calc(-1 * min(var(--drag, 0px), 0px))); }

/* The announcement of a height ("Half height") is for a screen reader alone. */
.tui-sheet__said { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Not a dialog (a specimen in a page, a docs cell): it sits in the flow at the height it is given. */
.tui-sheet.tui-sheet:not(dialog) { position: relative; inset: auto; display: flex; flex-direction: column; transform: none; width: 100%; height: 220px; margin: 0; }
.tui-sheet.tui-sheet:not(dialog) .tui-sheet__foot { transform: none; }

/* The page behind stands still while a sheet is open. */
:root:has(dialog.tui-sheet[open]) { overflow: hidden; }

/* Rising: the plate travels up from the bottom edge and the scrim comes up, both kept on screen until they have left. */
@supports (transition-behavior: allow-discrete) {
  /* It arrives in 280ms and leaves in 200ms: the transition that plays is the one on the state it is entering. */
  .tui-sheet { transition: transform 200ms var(--tui-ease), overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .tui-sheet[open] { transition-duration: 280ms; }
  .tui-sheet:not(dialog) { transition: none; }
  .tui-sheet[data-dragging], .tui-sheet[data-dragging] .tui-sheet__foot { transition: none; }
  .tui-sheet::backdrop { opacity: 0; transition: opacity 200ms var(--tui-ease), overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .tui-sheet[open]::backdrop { opacity: 1; transition-duration: 280ms; }
  @starting-style {
    .tui-sheet[open] { transform: translateY(var(--sheet-full)); }
    .tui-sheet[open]::backdrop { opacity: 0; }
  }
}
.tui-sheet[data-dragging] .tui-sheet__foot { transition: none; }

@media (pointer: coarse) {
  .tui-sheet__grip { width: 120px; height: 44px; margin-top: 0; }
  .tui-sheet :is(.tui-key, .tui-input, .tui-select) { --h: 44px; height: 44px; }
  .tui-sheet .tui-key--icon { width: 44px; }
  .tui-sheet .tui-seg span { height: 44px; }
  .tui-sheet .tui-choice { min-height: 44px; }
  .tui-sheet__foot > .tui-key { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .tui-sheet, .tui-sheet::backdrop, .tui-sheet__foot { transition: none !important; }
}

/* ---------------------------------------------------------------- part: breadcrumb */
/* Breadcrumb: the trail an instrument prints across the top of its menu
   screen, SETUP › AUDIO › OUTPUT. Printed in the label face, the levels
   above in the second ink with their rule engraved under the pointer, the
   level you are on in full ink. Small engraved chevrons stand between them,
   drawn, so a screen reader never reads them. When the trail is too long
   for its line, breadcrumb.mjs folds the middle levels into a … key that
   opens a menu; without the script the trail wraps. */
.tui-breadcrumb {
  --sep: 13px;
  min-width: 0;
  font: 600 var(--tui-t-small)/1.2 var(--tui-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tui-ink-2);
}
.tui-breadcrumb > ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tui-breadcrumb li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}
.tui-breadcrumb li[hidden] { display: none; }
/* The chevron between two levels: drawn, not typed, so it is never read. */
.tui-breadcrumb li + li::before {
  content: '';
  flex: none;
  width: 5px;
  height: 5px;
  margin: 0 calc((var(--sep) - 5px) / 2 + 2px) 0 calc((var(--sep) - 5px) / 2);
  border: solid var(--tui-ink-3);
  border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
}

/* A level above: printed in the second ink; the rule is engraved under it on hover, as the kit's link does. */
.tui-breadcrumb a {
  display: inline-block;
  min-width: 0;
  padding: 6px 1px 5px;
  border-radius: 2px;
  color: var(--tui-ink-2);
  text-decoration: underline 1px transparent;
  text-underline-offset: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 90ms var(--tui-ease), text-decoration-color 90ms var(--tui-ease);
}
.tui-breadcrumb a:hover, .tui-breadcrumb a.is-hover { color: var(--tui-ink); text-decoration-color: var(--tui-ink-3); }
.tui-breadcrumb a:focus-visible, .tui-breadcrumb a.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 1px; color: var(--tui-ink); }
/* The level you are on: full ink, heavier, not a way out. */
.tui-breadcrumb [aria-current="page"] {
  display: inline-block;
  min-width: 0;
  padding: 6px 1px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  color: var(--tui-ink);
  text-decoration: none;
  cursor: default;
}
/* An icon in place of the first level's words (it keeps them as its name). */
.tui-breadcrumb svg { display: block; width: 14px; height: 14px; }
.tui-breadcrumb__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The fold: a small flat key printed with three dots, for the levels the trail had no room for. */
.tui-breadcrumb__fold { flex: none; }
.tui-breadcrumb__more {
  appearance: none;
  display: inline-grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 2.5px;
  width: 26px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--tui-ink-2);
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tui-breadcrumb__more > i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.tui-breadcrumb__more:hover, .tui-breadcrumb__more.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 60%, transparent); }
/* Out: the key is pressed into the plate while its menu is open. */
.tui-breadcrumb__more[aria-expanded="true"], .tui-breadcrumb__more.is-down { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well, none); box-shadow: var(--tui-inset); }
.tui-breadcrumb__more:focus-visible, .tui-breadcrumb__more.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
/* The menu's lines are the levels, top first, in the label face like the trail. */
.tui-menu.tui-breadcrumb__menu [role="menuitem"] { grid-template-columns: 0 minmax(0, 1fr) auto; column-gap: 0; padding-left: 12px; font: 600 var(--tui-t-small)/1.2 var(--tui-sans); letter-spacing: 0.06em; text-transform: uppercase; }

/* Folded by the script: one line, and the level you are on gives way first, with an ellipsis. */
.tui-breadcrumb[data-folding] > ol { flex-wrap: nowrap; overflow: hidden; }
.tui-breadcrumb[data-folding] li { flex: none; }
.tui-breadcrumb[data-folding] li:last-child { flex: 0 1 auto; }
/* While it measures: everything at full width, in one line, unseen for that instant. */
.tui-breadcrumb.is-measuring li { flex: none !important; }
.tui-breadcrumb.is-measuring li[data-folded] { display: inline-flex; }
.tui-breadcrumb.is-measuring .tui-breadcrumb__fold { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tui-breadcrumb a { transition: none; }
}

/* ---------------------------------------------------------------- part: brushed-metal */
/* Brushed metal: grain drawn once, as fine streaks along the brushing (four
   gradient tiles of unrelated sizes, so the streaks never fall into a pattern), and
   a raking light drawn as a conic sheen whose centre is far below the plate, so
   its bands run nearly straight and fan a little. The sheen is one layer that
   turns about that far point (backdrop.mjs sets --bd-turn from a fine pointer,
   eased); still, the whole surface is painted once. */
.tui-backdrop--brushed-metal {
  --bd-turn: 0deg;
  --bd-lit: light-dark(color-mix(in srgb, white 46%, transparent), color-mix(in srgb, var(--tui-ink) 4.5%, transparent));
  --bd-shade: light-dark(color-mix(in srgb, var(--tui-ink) 10%, transparent), rgb(0 0 0 / 0.3));
  --bd-hi: light-dark(color-mix(in srgb, white 45%, transparent), color-mix(in srgb, var(--tui-ink) 5%, transparent));
  --bd-lo: light-dark(color-mix(in srgb, var(--tui-ink) 8%, transparent), rgb(0 0 0 / 0.3));
  background:
    radial-gradient(ellipse 130px 0.7px, var(--bd-hi), transparent) 0 0 / 263px 7px,
    radial-gradient(ellipse 90px 0.7px, var(--bd-lo), transparent) 0 0 / 181px 11px,
    radial-gradient(ellipse 160px 0.7px, var(--bd-hi), transparent) 0 0 / 331px 13px,
    radial-gradient(ellipse 70px 0.7px, var(--bd-lo), transparent) 0 0 / 149px 5px,
    var(--tui-face);
}
.tui-backdrop--brushed-metal::before {
  inset: -60%;
  transform-origin: 50% 123%;
  rotate: var(--bd-turn);
  /* It starts and ends on transparent: a band that began at full shade met the clear end at 360deg as a hard straight line. */
  background: conic-gradient(from -40deg at 50% 123%, transparent 0deg, var(--bd-shade) 6deg, transparent 14deg, var(--bd-lit) 24deg, transparent 38deg, var(--bd-shade) 52deg, transparent 66deg, var(--bd-lit) 80deg, transparent 96deg, var(--bd-shade) 112deg, transparent 126deg);
}
.tui-backdrop--brushed-metal::after {
  inset: 0;
  background: radial-gradient(120% 90% at 28% -10%, var(--bd-lit), transparent 60%), linear-gradient(180deg, transparent 55%, var(--bd-shade));
}

/* ---------------------------------------------------------------- part: bulk-bar */
/* Bulk bar: a plate that comes up from the foot of the table while rows are
   chosen. A lamp, how many, and the keys that act on all of them. It rides at
   the bottom of the screen while the table is on it (sticky), and it moves by
   transform alone: shut, it sits just below its place, unseen and inert; open,
   it is at rest. Under reduced motion it simply appears. */
.tui-bulk-bar { position: sticky; bottom: var(--tui-4); z-index: 3; height: 0; pointer-events: none; }
.tui-bulk-bar__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-2) var(--tui-4);
  min-height: 52px;
  padding: 8px 8px 8px var(--tui-4);
  border-radius: calc(var(--tui-r-m) + 4px);
  background: var(--tui-face);
  color: var(--tui-ink);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 14px 28px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  transform: translateY(calc(100% + var(--tui-6, 24px)));
  visibility: hidden;
  transition: transform 200ms var(--tui-ease), visibility 0s linear 200ms;
}
.tui-bulk-bar[data-open] .tui-bulk-bar__bar { transform: none; visibility: visible; pointer-events: auto; transition: transform 200ms var(--tui-ease), visibility 0s; }
.tui-bulk-bar__count { display: flex; align-items: center; gap: var(--tui-2); flex: 1 1 auto; margin: 0; font: 600 var(--tui-t-body)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; }
.tui-bulk-bar__keys { display: flex; flex-wrap: wrap; gap: var(--tui-2); }
/* Said aloud, never seen. */
.tui-bulk-bar__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-bulk-bar__keys .tui-key { --h: 44px; min-width: 44px; }
  .tui-bulk-bar__bar { padding: 8px; }
}
@media (max-width: 560px) {
  .tui-bulk-bar__bar { padding: 10px 8px 8px; }
  .tui-bulk-bar__count { flex-basis: 100%; padding-left: var(--tui-2); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-bulk-bar__bar, .tui-bulk-bar[data-open] .tui-bulk-bar__bar { transition: none; }
}

/* ---------------------------------------------------------------- part: button-group */
/* Button group: keys that belong together set side by side in one slot cut
   into the plate, as the transport keys of a deck are. Each key is still
   its own cap on its own skirt and goes down on its own; only the corners
   that face a neighbour are tightened, so the row reads as one bank. A split
   key is one action and the menu of its other ways, two caps in one slot.
   A printed readout may sit between keys (3 of 12) on the slot's floor. */
.tui-key-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: calc(var(--tui-r-m) + 3px);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  vertical-align: middle;
}
.tui-key-group > .tui-key { --skirt: 1.5px; }
.tui-key-group > .tui-key:not(:first-child) { border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.tui-key-group > .tui-key:not(:last-child) { border-top-right-radius: 3px; border-bottom-right-radius: 3px; }
/* The contrast key keeps its own ink on the slot's floor; nothing else changes. */
.tui-key-group > .tui-key:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* Printed between keys: what the keys step through. */
.tui-key-group__text {
  display: inline-flex;
  align-items: center;
  height: var(--h, 36px);
  padding: 0 var(--tui-3);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  white-space: nowrap;
}

/* Small: the keys of a table head or a toolbar. */
.tui-key-group--sm { gap: 2px; padding: 2px; border-radius: 8px; }
.tui-key-group--sm > .tui-key { --h: 28px; padding: 0 var(--tui-3); font-size: 12px; border-radius: 6px; }
.tui-key-group--sm > .tui-key--icon { width: 28px; padding: 0; }
.tui-key-group--sm > .tui-key:not(:first-child) { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.tui-key-group--sm > .tui-key:not(:last-child) { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.tui-key-group--sm .tui-key-group__text { --h: 28px; font-size: 12px; }

/* One over the other: the corners that face up and down are tightened instead. */
.tui-key-group--vertical { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.tui-key-group--vertical > .tui-key { justify-content: flex-start; }
.tui-key-group--vertical > .tui-key:not(:first-child) { border-radius: 3px; }
.tui-key-group--vertical > .tui-key:not(:last-child) { border-radius: 3px; }
.tui-key-group--vertical > .tui-key:first-child { border-radius: var(--tui-r-m) var(--tui-r-m) 3px 3px; }
.tui-key-group--vertical > .tui-key:last-child { border-radius: 3px 3px var(--tui-r-m) var(--tui-r-m); }
.tui-key-group--vertical > .tui-key:only-child { border-radius: var(--tui-r-m); }

/* Split: the action, and a narrow cap printed with the arrow for its other ways. */
.tui-key-group--split { flex-wrap: nowrap; }
.tui-key-group > .tui-key-group__more { width: 30px; padding: 0; }
.tui-key-group--sm > .tui-key-group__more { width: 24px; padding: 0; }
/* The arrow is the menu key's own (menu.css); here it sits alone in the cap. */
.tui-key-group > .tui-key-group__more::after { margin: 0; }

/* Without a slot: keys that belong together but sit on a plate of their own, e.g. a dialog's foot. */
.tui-key-group--bare { padding: 0; gap: var(--tui-2); background: none; box-shadow: none; }
.tui-key-group.tui-key-group--bare > .tui-key.tui-key { border-radius: var(--tui-r-m); }

@media (prefers-reduced-motion: reduce) {
  .tui-key-group > .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: calendar */
/* Calendar: a month on a plate. The month and the year are printed on two
   drums behind a window; paging rolls them. Days are printed; the chosen day
   is a latched contrast cap, a range a groove cut between two caps, events
   lamps under a day. kit/parts/calendar.mjs builds and wires it. */
tui-calendar {
  --tui-calendar-cell: 42px;
  container: tui-calendar / inline-size;
  display: grid;
  gap: var(--tui-3);
  width: min(100%, calc(var(--tui-calendar-cell) * 7 + 4px));
  font-variant-numeric: tabular-nums;
}
tui-calendar > data { display: none; }

/* Page keys either side of the drum window. */
.tui-calendar__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--tui-2); }
.tui-calendar__head .tui-key { --h: 30px; }

/* The window: a recess with two drums behind it, month and year, a hairline between. */
.tui-calendar__window {
  --face: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  height: 32px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: hidden;
}
.tui-calendar__drum {
  position: relative;
  overflow: hidden;
  min-width: 0;
  /* The drum's printed face: a cylinder, brightest where it faces the window. */
  background: linear-gradient(to bottom, color-mix(in oklab, var(--tui-face-hi) 70%, rgb(var(--tui-sh))), var(--tui-face-hi) 38%, var(--tui-face-hi) 58%, color-mix(in oklab, var(--tui-face-hi) 62%, rgb(var(--tui-sh))));
  margin: 3px 0 3px 3px;
  border-radius: 5px 2px 2px 5px;
}
.tui-calendar__drum + .tui-calendar__drum { min-width: 58px; margin: 3px 3px 3px 2px; border-radius: 2px 5px 5px 2px; }
/* Curvature: the faces above and below turn away into shadow; the window's upper wall shades the top. */
.tui-calendar__drum::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--tui-depth-floor, linear-gradient(to bottom, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), transparent 34%, transparent 70%, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4))));
  box-shadow: var(--tui-depth-shade, inset 0 1px 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
}
.tui-calendar__strip { position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%; display: grid; }
.tui-calendar__face {
  height: var(--face);
  padding: 0 10px;
  font: 600 var(--tui-t-body)/var(--face) var(--tui-sans);
  letter-spacing: 0.01em;
  color: var(--tui-ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The grid: printed weekday heads, then the days. */
.tui-calendar__grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tui-calendar__grid th { height: 22px; padding: 0 0 4px; font: 500 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); text-align: center; }
.tui-calendar__grid td { position: relative; height: var(--tui-calendar-cell); padding: 0; text-align: center; outline: none; cursor: pointer; }
.tui-calendar__grid td.is-blank { cursor: default; }
.tui-calendar__cap {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: min(34px, calc(100% - 4px));
  height: 34px;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease), background-color 70ms;
}
.tui-calendar__grid td:hover .tui-calendar__cap, .tui-calendar__grid td.is-hover .tui-calendar__cap { background: color-mix(in oklab, var(--tui-face-hi) 70%, transparent); box-shadow: var(--tui-depth-key-hover, inset 0 1px 0 var(--tui-hl), 0 1px 2px rgb(var(--tui-sh) / 0.2)); }
.tui-calendar__grid td:focus-visible .tui-calendar__cap, .tui-calendar__grid td.is-focus .tui-calendar__cap { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
/* Today: printed bold, boxed by a hairline — never a colour. */
.tui-calendar__grid td[aria-current="date"] .tui-calendar__cap { font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--tui-ink-2); }
/* Events: lamps under the figure. */
.tui-calendar__lamps { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 2px; }
.tui-calendar__lamps .tui-lamp { width: 4px; height: 4px; box-shadow: 0 0 3px 0 color-mix(in oklab, var(--c) 70%, transparent); }
/* The chosen day: the contrast cap, latched below the plate. */
.tui-calendar__grid td.is-chosen .tui-calendar__cap, .tui-calendar__grid td.is-down .tui-calendar__cap {
  color: var(--tb-ink, var(--tui-cap-ink));
  font-weight: 700;
  background: linear-gradient(var(--tb-cap, var(--tui-cap-hi)), var(--tb-cap, var(--tui-cap)));
  box-shadow: var(--tui-depth-pressed, var(--tui-pressed), inset 0 -1px 0 color-mix(in oklab, var(--tui-cap-hl) 60%, transparent));
  transform: translateY(1px);
}
/* A range: a groove cut between its two caps, running under them to their centres. */
.tui-calendar__grid td.is-between::before, .tui-calendar__grid td.is-start::before, .tui-calendar__grid td.is-end::before {
  content: '';
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  right: 0;
  background: var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 60%, transparent));
}
.tui-calendar__grid td.is-start::before { left: 50%; }
.tui-calendar__grid td.is-end::before { right: 50%; }
.tui-calendar__grid tr > td:first-child.is-between::before, .tui-calendar__grid td.is-between:has(+ td.is-blank)::before { border-radius: 6px 0 0 6px; }
.tui-calendar__grid tr > td:last-child.is-between::before { border-radius: 0 6px 6px 0; }
.tui-calendar__grid td.is-between .tui-calendar__cap { font-weight: 600; }
/* While the end is still being picked, the groove is drawn in outline only. */
tui-calendar.is-picking td:is(.is-between, .is-start, .is-end)::before { background: transparent; box-shadow: inset 0 1px 0 var(--tui-ink-3), inset 0 -1px 0 var(--tui-ink-3); }
.tui-calendar__grid td.is-tentative .tui-calendar__cap { box-shadow: inset 0 0 0 1.5px var(--tui-ink); }
/* Unavailable: printed at 45%, struck through, never pressed. */
.tui-calendar__grid td[aria-disabled="true"] { cursor: not-allowed; }
.tui-calendar__grid td[aria-disabled="true"] .tui-calendar__cap { opacity: 0.45; text-decoration: line-through; text-decoration-thickness: 1px; background: none; box-shadow: none; transform: none; }
/* A day that cannot be chosen still takes focus: it lifts while focused, so the ring shows at 3:1. */
.tui-calendar__grid td[aria-disabled="true"]:focus-visible .tui-calendar__cap, .tui-calendar__grid td[aria-disabled="true"].is-focus .tui-calendar__cap { opacity: 0.75; }

/* The line under the grid: the focused day and its events, each lamp with its words. */
.tui-calendar__note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 30px; margin: 0; padding-top: var(--tui-3); border-top: 1px solid var(--tui-rule); }
/* Narrow plates: smaller drum faces so the month's whole name fits. */
@container tui-calendar (max-width: 250px) {
  .tui-calendar__face { padding: 0 6px; font-size: var(--tui-t-small); }
  .tui-calendar__drum + .tui-calendar__drum { min-width: 44px; }
  .tui-calendar__head { gap: 6px; }
}
.tui-calendar__note-day { font: 600 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink); }
/* A half groove with nothing to meet at the edge of a week is left out. */
.tui-calendar__grid tr > td:first-child.is-end::before, .tui-calendar__grid tr > td:last-child.is-start::before { display: none; }

/* ---------------------------------------------------------------- part: callout */
/* Callout: a note let into running text. The Alert's idea made quiet: no
   window, no glass, nothing lit but one lamp. A narrow groove is cut down the
   margin of the paragraph and the lamp sits seated at its head; beside it a
   printed word says what kind of note it is (Note, Tip, Caution) and the words
   follow in the text's own ink. The colour is only the lamp's: the word and
   the sentence carry the meaning. Quiet draws the groove as a hairline. */
.tui-callout {
  --groove: 10px;
  position: relative;
  max-width: 68ch;
  margin: var(--tui-5) 0;
  padding: 1px 0 1px calc(var(--groove) + var(--tui-4));
  color: var(--tui-ink);
  line-height: 1.55;
}
.tui-callout::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--groove);
  border-radius: calc(var(--groove) / 2);
  background: var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* The lamp is seated in the head of the groove. */
.tui-callout > .tui-lamp { position: absolute; top: calc(var(--groove) / 2); left: calc(var(--groove) / 2); translate: -50% -50%; }
.tui-callout__title { margin: 0 0 2px; color: var(--tui-ink-2); font-weight: 700; }
.tui-callout > :not(.tui-lamp, .tui-callout__title) { margin-block: 0; }
.tui-callout > :not(.tui-lamp, .tui-callout__title) + :not(.tui-lamp) { margin-top: var(--tui-2); }
.tui-callout b, .tui-callout strong { font-weight: 700; }
.tui-callout code { font-size: 0.92em; }
@media (forced-colors: active) { .tui-callout::before { background: none; border: 1px solid CanvasText; } }

/* ---------------------------------------------------------------- part: candlestick */
/* Candlestick: a wick from low to high and a body from open to close. Up is a
   hollow body in green, down a solid body in red, so the two differ in more
   than their lamp. The volume strip under the price shares the columns, each
   bar in the colour of its session at a lower strength. The crosshair reads
   the close on the price axis and the session at the foot. */
.tui-candlestick .wick { stroke-width: 1; shape-rendering: crispEdges; }
.tui-candlestick .wick.up { stroke: var(--tui-green); }
.tui-candlestick .wick.down { stroke: var(--tui-red); }
.tui-candlestick .body { shape-rendering: crispEdges; }
.tui-candlestick .body.up { fill: var(--tui-vfd-bg); stroke: var(--tui-green); stroke-width: 1.25; }
.tui-candlestick .body.down { fill: var(--tui-red); stroke: var(--tui-red); stroke-width: 1.25; }
.tui-candlestick .vol { shape-rendering: crispEdges; opacity: 0.55; }
.tui-candlestick .vol.up { fill: var(--tui-green); }
.tui-candlestick .vol.down { fill: var(--tui-red); }
.tui-candlestick .tui-chart__marks [data-here].body { stroke: var(--tui-vfd); }
.tui-candlestick .tui-chart__swatch.k-up { width: 9px; height: 13px; background: var(--tui-vfd-bg); box-shadow: inset 0 0 0 1.5px var(--tui-green); }
.tui-candlestick .tui-chart__swatch.k-down { width: 9px; height: 13px; background: var(--tui-red); }

@media (pointer: coarse) {
  .tui-candlestick .tui-chart__plot { min-height: 300px; }
}
@media (max-width: 480px) {
  .tui-candlestick .tui-chart__legend { gap: 0 var(--tui-3); }
}

/* ---------------------------------------------------------------- part: carousel */
/* Carousel: a viewer. Slides pass one at a time through a gate cut into the
   plate; under it, transport keys either side of a frame counter on an LCD,
   and a row of lamp keys, the one for the slide in the gate lit.
   kit/parts/carousel.mjs builds the gate and the bar around the slides. */
tui-carousel { display: grid; gap: var(--tui-3); width: min(100%, 640px); min-width: 0; }
tui-carousel:not(:defined) { overflow: hidden; }

/* The gate: a recess with a lip, the slides behind it. */
.tui-carousel__gate {
  position: relative;
  padding: 6px;
  border-radius: var(--tui-r-l);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* The gate's upper wall shades the top of whatever slide is in it. */
.tui-carousel__gate::after {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 1;
  border-radius: var(--tui-r-m);
  box-shadow: var(--tui-depth-shade, inset 0 6px 8px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)), inset 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
  pointer-events: none;
}
.tui-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--tui-r-m);
  outline: none;
}
.tui-carousel__track::-webkit-scrollbar { display: none; }
.tui-carousel__gate:has(.tui-carousel__track:focus-visible) { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-carousel__slide {
  position: relative;
  display: grid;
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--tui-face);
}

/* The bar: transport keys, the counter, the lamp keys. */
.tui-carousel__bar { display: flex; align-items: center; gap: var(--tui-2); min-width: 0; }
.tui-carousel__bar > .tui-key--round { --h: 34px; }
.tui-carousel__count { min-width: 0; }
.tui-carousel__picks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0; margin-left: auto; }
/* Each lamp key is a 24px target with a 7px lamp; the slide in the gate lights its lamp. */
.tui-carousel__picks button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.tui-carousel__picks button:hover .tui-lamp { filter: brightness(1.15); }
.tui-carousel__picks button:focus-visible, .tui-carousel__picks button.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 0; }
.tui-carousel__rotate { flex: none; }

/* A slide with a picture and a printed caption: the common case. */
.tui-carousel__picture { display: grid; place-items: center; min-height: 220px; padding: var(--tui-5); }
.tui-carousel__caption { display: grid; gap: 2px; padding: var(--tui-3) var(--tui-4) var(--tui-4); border-top: 1px solid var(--tui-rule); }
.tui-carousel__caption b { font-size: var(--tui-t-body); color: var(--tui-ink); }
.tui-carousel__caption span { font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* Narrow viewers: the counter and the transport keys are enough. */
tui-carousel { container: tui-carousel / inline-size; }
@container tui-carousel (max-width: 300px) {
  .tui-carousel__picks { display: none; }
  .tui-carousel__bar { justify-content: center; }
  .tui-carousel__picture { min-height: 150px; padding: var(--tui-3); }
}

/* ---------------------------------------------------------------- part: chart-frame */
/* Chart frame: what the wave 5d charts share. A chart is a title on the panel
   and a display well under it: dark glass in every finish, with the readout
   at the top, the plot, and the key to the series. The series are the lamps
   (blue, amber, green) and the display's own light, and from the third on they
   carry a pattern as well, so a series is never only a colour. Nothing here
   moves: a chart is read, so a point is marked the moment the pointer or the
   keys reach it, with a ring and a crosshair, and nothing eases to it. In
   Quiet the well is flat with a hairline, and the grid is lighter. */
.tui-chart {
  --c1: var(--tui-blue);
  --c2: var(--tui-amber);
  --c3: var(--tui-green);
  --c4: var(--tui-vfd);
  --c5: color-mix(in oklab, var(--tui-vfd) 52%, var(--tui-vfd-bg));
  display: grid;
  gap: var(--tui-3);
  min-width: 0;
  margin: 0;
  text-align: left;
}
.tui-chart__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tui-2) var(--tui-4); }
.tui-chart__title { margin: 0; }
.tui-chart__well {
  --tui-focus: var(--tui-vfd);
  --tui-ink: var(--tui-vfd);
  --tui-ink-2: color-mix(in oklab, var(--tui-vfd) 72%, transparent);
  --tui-ink-3: color-mix(in oklab, var(--tui-vfd) 45%, transparent);
  --tui-rule: color-mix(in oklab, var(--tui-vfd) 13%, transparent);
  position: relative;
  box-sizing: border-box;
  display: grid;
  gap: var(--tui-2);
  min-width: 0;
  padding: var(--tui-3) var(--tui-3) var(--tui-2);
  border-radius: calc(var(--tui-r-s) + 3px);
  background: var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.7), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  color: var(--tui-vfd);
}
/* The readout: two lines kept, so the plot does not jump when the words change. */
.tui-chart__read { box-sizing: border-box; min-height: 2.9em; margin: 0; font: 500 var(--tui-t-small)/1.45 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-chart__read strong { font-weight: 700; }
.tui-chart__read[data-idle] { color: var(--tui-ink-2); }
.tui-chart__plot { position: relative; min-width: 0; border-radius: 3px; touch-action: pan-y; outline: none; user-select: none; -webkit-user-select: none; }
.tui-chart__plot:focus-visible, .tui-chart__plot.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-chart__svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.tui-chart text { font: 500 11px var(--tui-sans); font-variant-numeric: tabular-nums; fill: var(--tui-ink-2); }
.tui-chart__grid line { stroke: var(--tui-rule); stroke-width: 1; shape-rendering: crispEdges; }
.tui-chart__grid line.zero { stroke: var(--tui-ink-3); }
.tui-chart text.total { fill: var(--tui-ink); font-weight: 600; }

/* The series: lamps, then the display's light. Pattern fills (third on) are set on the mark as a url(); the ground and the ink of the pattern are here. */
.tui-chart .s1 { --c: var(--c1); }
.tui-chart .s2 { --c: var(--c2); }
.tui-chart .s3 { --c: var(--c3); }
.tui-chart .s4 { --c: var(--c4); }
.tui-chart .s5 { --c: var(--c5); }
.tui-chart__pat-ground.s3 { fill: var(--c3); }
.tui-chart__pat-ground.s4 { fill: var(--c4); }
.tui-chart__pat-ground.s5 { fill: var(--c5); }
.tui-chart__pat-ink { fill: var(--tui-vfd-bg); }
.tui-chart .s1:is(rect, circle, path, polygon) { fill: var(--c1); }
.tui-chart .s2:is(rect, circle, path, polygon) { fill: var(--c2); }

/* The point the reader is on: a ring over everything, drawn last. */
.tui-chart__over .ring { fill: none; stroke: var(--tui-vfd); stroke-width: 2; rx: 2px; }
.tui-chart__over .band { fill: var(--tui-vfd); opacity: 0.07; }
.tui-chart__cross line { stroke: var(--tui-ink-2); stroke-width: 1; stroke-dasharray: 3 3; shape-rendering: crispEdges; }
.tui-chart__cross .tag { fill: var(--tui-vfd); }
.tui-chart__cross text { fill: var(--tui-vfd-bg); font-weight: 600; }

/* The key to the series: the same swatch as the picture, and a word. */
.tui-chart__legend { display: flex; flex-wrap: wrap; gap: 2px var(--tui-3); margin: 0; padding: 0; list-style: none; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); }
.tui-chart__lkey { display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px; margin: 0 -6px; border: 0; border-radius: var(--tui-r-s); background: none; font: inherit; color: inherit; }
button.tui-chart__lkey { cursor: pointer; min-height: 24px; }
button.tui-chart__lkey:hover { background: color-mix(in oklab, var(--tui-vfd) 10%, transparent); }
button.tui-chart__lkey:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 0; }
button.tui-chart__lkey[aria-pressed="false"] { color: var(--tui-ink-3); text-decoration: line-through; }
button.tui-chart__lkey[aria-pressed="false"] .tui-chart__swatch { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.tui-chart__swatch { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--c); }
.tui-chart__swatch.s3 { background: repeating-linear-gradient(135deg, var(--tui-vfd-bg) 0 1.6px, var(--c3) 1.6px 4.2px); }
.tui-chart__swatch.s4 { background: radial-gradient(circle at 50% 50%, var(--tui-vfd-bg) 0 1.2px, transparent 1.5px) 0 0 / 5.5px 5.5px, var(--c4); }
.tui-chart__swatch.s5 { background: repeating-linear-gradient(90deg, var(--tui-vfd-bg) 0 1.5px, var(--c5) 1.5px 4px); }

/* Said aloud, never seen: the help, the live words and the table until someone asks for it. */
.tui-chart__help, .tui-chart__live { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-chart__data:not([data-shown]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-chart__data[data-shown] { min-width: 0; overflow-x: auto; }
.tui-chart__data[data-shown] .tui-chart__table { width: 100%; border-collapse: collapse; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }
.tui-chart__data[data-shown] caption { padding-bottom: var(--tui-2); text-align: left; color: var(--tui-ink-2); }
.tui-chart__data[data-shown] :is(th, td) { padding: 6px 8px; border-bottom: 1px solid var(--tui-rule); text-align: right; white-space: nowrap; }
.tui-chart__data[data-shown] :is(th.first, th[scope="row"]) { text-align: left; }
/* The figure holds the words that are absolute, so they cannot widen a page from inside a scroller. */
.tui-chart { position: relative; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-chart__well { background: var(--tui-vfd-bg); }
  .tui-chart__grid line { stroke: color-mix(in oklab, var(--tui-vfd) 9%, transparent); }
}

@media (pointer: coarse) {
  button.tui-chart__lkey { min-height: 44px; }
  .tui-chart__legend { gap: 0 var(--tui-3); }
}
@media (max-width: 480px) {
  .tui-chart__well { padding: var(--tui-3) 10px var(--tui-2); }
}
@media (forced-colors: active) {
  .tui-chart__well { forced-color-adjust: none; border: 1px solid CanvasText; }
  .tui-chart__over .ring { stroke: Highlight; }
}
.tui-chart text.axis-title { fill: var(--tui-ink-2); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.tui-chart__axisline { stroke: var(--tui-ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.tui-chart__lkey.note { color: var(--tui-ink-2); padding: 4px 0; margin: 0; }

/* ---------------------------------------------------------------- part: chat */
/* Chat: a teleprinter, with restraint. What you type sits in a recess, as it
   did in the composer; the assistant's answer is printed on a slip torn
   along a perforation, and an amber lamp blinks at the print head while it
   prints. Code comes up on display glass. kit/parts/chat.mjs builds the
   thread and the composer. */
tui-chat {
  --tui-chat-h: 540px;
  container-type: inline-size;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: var(--tui-chat-h);
  width: min(100%, 620px);
  min-width: 0;
  overflow: hidden;
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}

/* The thread: the platen the slips feed onto. */
.tui-chat__thread {
  display: flex;
  flex-direction: column;
  gap: var(--tui-4);
  min-height: 0;
  padding: var(--tui-5) var(--tui-5) var(--tui-4);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: none;
}
.tui-chat__thread:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -4px; border-radius: var(--tui-r-l); }
.tui-chat__msg { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; max-width: min(100%, 520px); margin: 0; }
.tui-chat__body > * { margin: 0; }
.tui-chat__body > * + * { margin-top: var(--tui-2); }
.tui-chat__body p { line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* A part set into the thread (chat.add): a tool call, the reasoning. On the plate beside the slips, as wide as a slip. */
.tui-chat__part { align-self: flex-start; width: 100%; max-width: min(100%, 520px); min-width: 0; }

/* Yours: typed into the machine, so it sits in a recess, to the right. */
.tui-chat__msg[data-from="user"] { align-self: flex-end; justify-items: end; max-width: min(84%, 440px); }
.tui-chat__msg[data-from="user"] .tui-chat__body {
  padding: 10px 14px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  color: var(--tui-ink);
}
.tui-chat__attached { display: flex; flex-wrap: wrap; gap: 4px; }

/* The assistant's: a thermal slip. The top was torn from the roll along its
   perforation (small bites, narrow tabs between them). While it prints the
   bottom runs clean into the print head's slot; when it is done the head lets
   go and the end shows the tear-off teeth. The paper is the ::before layer:
   grain, the lamp on its upper left, its edges falling away as it bows, all
   cut out by a mask. The article carries the shadow as a filter, so the lift
   follows the torn edges, and sets the ink tokens to the paper's own in
   either finish.
   The stock itself is after the printer on titi.re: an uncoated thermal roll
   with short fibres and a mottle in it, the dot rows of the head, a row of
   perforation pinholes under the torn top, a bow and a lift at the foot, and
   a toothed tear at the end. All of it is a gradient or a tiny inline image,
   drawn from the paper tokens, so the same slip is paper in every finish and
   only its shadow and its edge follow the finish. */
.tui-chat__msg[data-from="assistant"] {
  --tear: 5px;
  --bite: 3px;
  --slot-shade: transparent;
  --curl: 0.15;
  --tui-ink: var(--tui-paper-ink);
  --tui-ink-2: var(--tui-paper-ink-2);
  --tui-ink-3: #6e6d64;
  --tui-rule: rgb(36 36 31 / 0.2);
  --tui-hl: rgb(255 255 255 / 0.85);
  --tui-focus: var(--tui-paper-ink);
  --edge: color-mix(in srgb, var(--tui-paper-ink) 60%, #5a4c2e);
  /* The fibres and the mottle: the stock. Finishes that draw the slip their own way (a flat edge) lay these over their paper. */
  --slip-fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' fill='none' stroke-linecap='round'%3E%3Cpath d='M0.0 107.3Q4.2 109.7 9.0 108.5' stroke='%23fff' stroke-opacity='0.35' stroke-width='0.61'/%3E%3Cpath d='M113.3 67.6Q112.3 71.8 108.5 73.7' stroke='%23fff' stroke-opacity='0.37' stroke-width='0.77'/%3E%3Cpath d='M91.8 20.3Q88.9 22.9 86.6 26.1' stroke='%2368603f' stroke-opacity='0.12' stroke-width='0.51'/%3E%3Cpath d='M73.9 191.1Q75.8 192.9 78.1 194.0' stroke='%2368603f' stroke-opacity='0.07' stroke-width='0.57'/%3E%3Cpath d='M212.9 125.3Q209.7 127.5 210.7 131.2' stroke='%23fff' stroke-opacity='0.45' stroke-width='0.41'/%3E%3Cpath d='M172.2 193.9Q178.9 199.7 182.9 207.5' stroke='%2368603f' stroke-opacity='0.17' stroke-width='0.73'/%3E%3Cpath d='M240.0 192.1Q243.2 196.3 247.3 199.7' stroke='%23fff' stroke-opacity='0.46' stroke-width='0.77'/%3E%3Cpath d='M84.4 209.8Q81.2 210.9 81.9 214.2' stroke='%2368603f' stroke-opacity='0.14' stroke-width='0.63'/%3E%3Cpath d='M204.7 104.1Q196.2 104.5 187.7 104.2' stroke='%2368603f' stroke-opacity='0.13' stroke-width='0.50'/%3E%3Cpath d='M11.5 12.5Q19.2 14.4 26.3 17.8' stroke='%2368603f' stroke-opacity='0.11' stroke-width='0.61'/%3E%3Cpath d='M25.4 91.0Q24.4 94.4 23.8 98.0' stroke='%2368603f' stroke-opacity='0.08' stroke-width='0.84'/%3E%3Cpath d='M238.6 185.8Q239.4 192.2 243.5 197.2' stroke='%2368603f' stroke-opacity='0.13' stroke-width='0.54'/%3E%3Cpath d='M127.9 61.6Q124.0 69.7 124.1 78.7' stroke='%23fff' stroke-opacity='0.26' stroke-width='0.83'/%3E%3Cpath d='M165.8 69.2Q167.4 77.1 172.4 83.5' stroke='%2368603f' stroke-opacity='0.13' stroke-width='0.50'/%3E%3Cpath d='M24.1 191.5Q28.7 198.4 35.2 203.6' stroke='%23fff' stroke-opacity='0.44' stroke-width='0.60'/%3E%3Cpath d='M0.2 4.9Q0.7 7.8 -0.8 10.3' stroke='%2368603f' stroke-opacity='0.10' stroke-width='0.69'/%3E%3Cpath d='M237.6 118.3Q243.5 122.8 250.3 126.0' stroke='%2368603f' stroke-opacity='0.10' stroke-width='0.52'/%3E%3Cpath d='M119.3 149.5Q122.6 153.9 125.7 158.4' stroke='%2368603f' stroke-opacity='0.08' stroke-width='0.68'/%3E%3Cpath d='M195.9 119.1Q199.9 124.0 205.5 126.8' stroke='%23fff' stroke-opacity='0.25' stroke-width='0.66'/%3E%3Cpath d='M92.7 47.4Q87.2 49.3 81.4 50.2' stroke='%23fff' stroke-opacity='0.43' stroke-width='0.78'/%3E%3Cpath d='M174.3 57.8Q178.1 60.0 180.7 63.6' stroke='%2368603f' stroke-opacity='0.15' stroke-width='0.65'/%3E%3Cpath d='M101.4 123.2Q99.4 128.8 93.9 131.0' stroke='%2368603f' stroke-opacity='0.16' stroke-width='0.41'/%3E%3Cpath d='M188.1 116.7Q194.5 118.6 201.1 117.0' stroke='%2368603f' stroke-opacity='0.17' stroke-width='0.51'/%3E%3Cpath d='M40.3 88.3Q34.7 87.0 29.2 88.3' stroke='%2368603f' stroke-opacity='0.09' stroke-width='0.65'/%3E%3Cpath d='M145.0 238.4Q149.5 239.4 153.8 240.8' stroke='%2368603f' stroke-opacity='0.16' stroke-width='0.43'/%3E%3Cpath d='M138.9 173.8Q139.6 181.9 139.0 190.0' stroke='%23fff' stroke-opacity='0.45' stroke-width='0.70'/%3E%3Cpath d='M33.1 133.0Q29.5 136.6 29.0 141.6' stroke='%23fff' stroke-opacity='0.36' stroke-width='0.79'/%3E%3Cpath d='M193.9 185.3Q195.9 188.4 199.5 189.6' stroke='%2368603f' stroke-opacity='0.08' stroke-width='0.72'/%3E%3Cpath d='M203.4 90.8Q204.9 95.6 203.4 100.3' stroke='%23fff' stroke-opacity='0.35' stroke-width='0.76'/%3E%3Cpath d='M236.0 127.5Q228.1 131.2 219.8 133.7' stroke='%2368603f' stroke-opacity='0.12' stroke-width='0.70'/%3E%3Cpath d='M167.2 200.9Q164.9 204.4 160.9 203.5' stroke='%23fff' stroke-opacity='0.47' stroke-width='0.71'/%3E%3Cpath d='M224.5 187.2Q227.0 187.3 229.6 187.3' stroke='%23fff' stroke-opacity='0.35' stroke-width='0.67'/%3E%3Cpath d='M121.8 116.7Q124.3 120.3 128.5 121.6' stroke='%23fff' stroke-opacity='0.23' stroke-width='0.80'/%3E%3Cpath d='M97.0 222.1Q97.4 227.2 101.3 230.6' stroke='%23fff' stroke-opacity='0.34' stroke-width='0.59'/%3E%3Cpath d='M69.2 230.7Q75.1 233.4 81.2 235.7' stroke='%2368603f' stroke-opacity='0.14' stroke-width='0.45'/%3E%3Cpath d='M32.1 29.9Q28.9 30.9 26.7 33.4' stroke='%23fff' stroke-opacity='0.35' stroke-width='0.57'/%3E%3Cpath d='M146.7 227.0Q143.1 228.1 142.3 231.7' stroke='%2368603f' stroke-opacity='0.13' stroke-width='0.45'/%3E%3Cpath d='M99.2 235.7Q94.0 240.0 89.9 245.4' stroke='%23fff' stroke-opacity='0.31' stroke-width='0.84'/%3E%3Cpath d='M149.0 139.3Q147.9 145.0 148.8 150.8' stroke='%23fff' stroke-opacity='0.32' stroke-width='0.75'/%3E%3Cpath d='M22.3 112.3Q17.7 116.9 13.5 122.1' stroke='%2368603f' stroke-opacity='0.11' stroke-width='0.61'/%3E%3Cpath d='M227.0 30.0Q227.3 33.4 227.5 36.7' stroke='%2368603f' stroke-opacity='0.12' stroke-width='0.61'/%3E%3Cpath d='M167.7 177.4Q175.7 178.4 183.3 181.1' stroke='%2368603f' stroke-opacity='0.10' stroke-width='0.52'/%3E%3Cpath d='M17.3 206.6Q15.3 208.8 12.7 210.2' stroke='%23fff' stroke-opacity='0.38' stroke-width='0.41'/%3E%3Cpath d='M222.8 94.1Q224.1 96.8 225.6 99.3' stroke='%23fff' stroke-opacity='0.39' stroke-width='0.52'/%3E%3Cpath d='M100.8 158.9Q97.7 166.3 93.3 173.1' stroke='%2368603f' stroke-opacity='0.18' stroke-width='0.74'/%3E%3Cpath d='M29.2 39.5Q32.3 37.7 34.3 40.7' stroke='%23fff' stroke-opacity='0.45' stroke-width='0.70'/%3E%3Ccircle cx='171.4' cy='68.1' r='0.67' fill='%23504634' fill-opacity='0.10'/%3E%3Ccircle cx='237.1' cy='58.3' r='0.73' fill='%23504634' fill-opacity='0.22'/%3E%3Ccircle cx='188.7' cy='192.7' r='0.55' fill='%23504634' fill-opacity='0.14'/%3E%3Ccircle cx='217.6' cy='156.6' r='0.39' fill='%23504634' fill-opacity='0.15'/%3E%3Ccircle cx='211.9' cy='11.2' r='0.58' fill='%23504634' fill-opacity='0.24'/%3E%3Ccircle cx='190.5' cy='224.7' r='0.66' fill='%23504634' fill-opacity='0.13'/%3E%3Ccircle cx='192.2' cy='16.7' r='0.57' fill='%23504634' fill-opacity='0.21'/%3E%3Ccircle cx='176.5' cy='236.2' r='0.49' fill='%23504634' fill-opacity='0.16'/%3E%3Ccircle cx='58.4' cy='214.9' r='0.47' fill='%23504634' fill-opacity='0.23'/%3E%3C/svg%3E") 0 0 / 240px 240px;
  --slip-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.014 0.02' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0 0.18 0 0 0 0.2 -0.07'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 320px 320px;
  /* The perforation: a row of pinholes under the torn top, each with a lit lip below it. */
  --slip-pin:
    radial-gradient(ellipse 1.1px 0.8px at 50% 50%, color-mix(in srgb, var(--edge) 46%, transparent), transparent 100%) 0 calc(var(--bite) + 5px) / 6px 3px repeat-x,
    radial-gradient(ellipse 1.2px 0.5px at 50% 50%, rgb(255 255 255 / 0.55), transparent 100%) 0 calc(var(--bite) + 6.5px) / 6px 3px repeat-x;
  --slip-fx: var(--slip-pin), var(--slip-fibre), var(--slip-mottle);
  position: relative;
  isolation: isolate;
  align-self: flex-start;
  width: 100%;
  padding: 20px 18px calc(16px + var(--tear));
  color: var(--tui-paper-ink);
  filter:
    drop-shadow(0 0.5px 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)))
    drop-shadow(0 2px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)))
    drop-shadow(0 8px 10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.55)));
}
.tui-chat__msg[data-from="assistant"][aria-busy="true"] {
  --tear: 0px;
  --slot-shade: rgb(30 24 12 / 0.34);
  --curl: 0;
}
.tui-chat__msg[data-from="assistant"]::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgb(255 255 255 / 0.7), transparent 2px),
    linear-gradient(0deg, var(--slot-shade), transparent 9px),
    linear-gradient(45deg, color-mix(in srgb, var(--edge) calc(var(--curl) * 100%), transparent), transparent 62%) 0 100% / 28px 28px no-repeat,
    linear-gradient(-45deg, color-mix(in srgb, var(--edge) calc(var(--curl) * 100%), transparent), transparent 62%) 100% 100% / 28px 28px no-repeat,
    linear-gradient(90deg, color-mix(in srgb, var(--edge) 8%, transparent), transparent 5%, transparent 94%, color-mix(in srgb, var(--edge) 11%, transparent)),
    linear-gradient(0deg, color-mix(in srgb, var(--edge) 9%, transparent), transparent 26px),
    radial-gradient(130% 70% at 12% 0%, var(--tui-paper-sheen, rgb(255 255 255 / 0.4)), transparent 62%),
    var(--slip-fx),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7 0.45' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.33 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0 / 200px 200px,
    /* The print head's dot rows: a grid you only see up close, as on real thermal paper (after titi.re's receipt). */
    repeating-linear-gradient(0deg, rgb(0 0 0 / 0.014) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.02) 0 1px, transparent 1px 4px),
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  mask-image:
    radial-gradient(circle at 50% 0, #0000 calc(var(--bite) - 0.4px), #000 calc(var(--bite) + 0.2px)),
    linear-gradient(#000, #000),
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg);
  mask-size: 8px 100%, 100% calc(100% - var(--tear)), calc(var(--tear) * 2) var(--tear);
  mask-position: 4px 0, 0 0, 0 100%;
  mask-repeat: repeat-x, no-repeat, repeat-x;
  mask-composite: intersect, add, add;
  -webkit-mask-composite: source-in, source-over, source-over;
}
/* A new line comes off the head a step at a time (chat.mjs adds .is-feeding for one beat), the way the thermal roll advances in titi.re's printer. */
.tui-chat__body > .is-feeding { animation: tui-chat-line 220ms steps(3, end) both; }
@keyframes tui-chat-line { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
/* The print head's slot: the slip runs into it, its lit edge is the lamp's light. */
.tui-chat__msg[data-from="assistant"][aria-busy="true"]::after {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  bottom: -5px;
  height: 10px;
  z-index: -2;
  border-radius: 5px;
  background: linear-gradient(#070708, #1c1d1f);
  box-shadow:
    inset 0 2px 3px #000,
    0 1px 0 rgb(255 255 255 / 0.1),
    0 5px 9px -4px color-mix(in oklab, var(--tui-amber) 55%, transparent);
}
/* What prints is ink on paper: sans, as everywhere in the kit, laid down in
   rows of the print head, a little fainter here and there. Never less than
   6:1 on the paper. */
@media (forced-colors: none) {
  .tui-chat__msg[data-from="assistant"] .tui-chat__body > p:not(.tui-chat__stopped) {
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='140'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.011 0.07' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.94 0 0 0 0 0.93 0 0 0 0 0.89 0 0 0 0.34 -0.09'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E") 0 0 / 360px 140px,
      repeating-linear-gradient(0deg, rgb(239 236 227 / 0.06) 0 1px, transparent 1px 3px),
      linear-gradient(var(--tui-paper-ink), var(--tui-paper-ink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .tui-chat__msg[data-from="assistant"] .tui-chat__body > p:nth-child(2n):not(.tui-chat__stopped) { background-position: -140px -50px, 0 0, 0 0; }
}
.tui-chat__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-2); min-height: 22px; margin: 0 0 4px; padding-bottom: 6px; border-bottom: 1px dotted rgb(36 36 31 / 0.3); }
.tui-chat__meta .tui-status, .tui-chat__meta > .tui-label { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-chat__meta .tui-key { margin-right: -6px; }
.tui-chat__msg[aria-busy="true"] .tui-chat__meta .tui-key { display: none; }
/* The print head: a lamp at the end of the line being printed. */
.tui-chat__head { margin-left: 5px; vertical-align: 1px; }
.tui-chat__stopped { font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* Code, on display glass. */
.tui-chat__code { padding: 0; overflow: hidden; }
.tui-chat__code-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 0 14px; }
.tui-chat__code-bar .tui-key { color: var(--tui-ink-2); }
.tui-chat__code pre { margin: 0; padding: 8px 14px 14px; overflow-x: auto; font: 400 12.5px/1.6 var(--tui-mono); white-space: pre; }

/* Empty: a tray with an unlit lamp, one sentence, suggestions to start with. */
.tui-chat__empty { display: grid; justify-items: center; align-content: center; gap: var(--tui-3); flex: 1; padding: var(--tui-6) var(--tui-4); text-align: center; }
.tui-chat__empty p { max-width: 36ch; margin: 0; color: var(--tui-ink-2); }
.tui-chat__suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--tui-2); }
.tui-chat__thread:has(.tui-chat__msg) .tui-chat__empty { display: none; }

/* The composer: one well with the text, the attach key and the send key. */
.tui-chat__composer { display: grid; gap: 6px; padding: var(--tui-3) var(--tui-4) var(--tui-3); border-top: 1px solid var(--tui-rule); }
.tui-chat__files:empty { display: none; }
.tui-chat__files { display: flex; flex-wrap: wrap; gap: 4px; }
.tui-chat__file { text-transform: none; letter-spacing: 0.01em; font-weight: 500; font-size: 11.5px; }
.tui-chat__file button { display: grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; padding: 0; border: 0; border-radius: 3px; background: none; color: var(--tui-ink-2); cursor: pointer; }
.tui-chat__file button:hover { color: var(--tui-ink); }
.tui-chat__file button svg { width: 10px; height: 10px; }
.tui-chat__well {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 5px 5px 5px 14px;
  border-radius: 12px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-chat__well:has(.tui-chat__input:focus-visible), .tui-chat__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-chat__input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  max-height: 140px;
  padding: 8px 0;
  border: 0;
  resize: none;
  field-sizing: content;
  font: 400 var(--tui-t-body)/1.4 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
}
.tui-chat__input:focus-visible { outline: none; }
.tui-chat__input::placeholder { color: var(--tui-ink-3); }
.tui-chat__keys { display: flex; align-items: center; gap: 6px; }
.tui-chat__keys .tui-key--sm { --h: 32px; width: 32px; }
.tui-chat__send { --h: 34px; }
.tui-chat__help { margin: 0; padding-left: 4px; font-size: 11.5px; color: var(--tui-ink-2); }
@container (max-width: 380px) { .tui-chat__help { display: none; } }

/* ---------------------------------------------------------------- part: checklist */
/* Checklist: the kit's check keys in nested groups. A group's key is
   tri-state: all of its items done, none, or some. Some is drawn as a half-
   sunk key with a bar printed on it, so it reads without colour. The counter
   in the head is a small recessed plate; the lamp beside it lights when every
   item is done. The rows are the check's own 18px key with a 40px hit area. */
tui-checklist, .tui-checklist { display: block; min-width: 0; }

.tui-checklist__head { display: flex; align-items: center; gap: var(--tui-3); margin-bottom: var(--tui-2); padding-bottom: var(--tui-3); border-bottom: 1px solid var(--tui-rule); }
.tui-checklist__title { flex: 1; min-width: 0; margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-checklist__count {
  padding: 4px 10px;
  border-radius: 6px;
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}

.tui-checklist__list { position: relative; margin: 0; padding: 0; list-style: none; }
/* A group's items step in under its key, joined to it by a fine engraved line. */
.tui-checklist__list .tui-checklist__list { padding-left: 32px; }
.tui-checklist__list .tui-checklist__list::before { content: ''; position: absolute; top: 0; bottom: 14px; left: 15px; width: 1px; background: var(--tui-rule); }

.tui-checklist__row {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  min-height: 40px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* A finger needs 44px: on a touch screen each row (the whole row is the key) is 44 tall, still a list, not
   separate keys with gaps between. Ten rows grow by 40px; a mouse sees nothing change. */
@media (pointer: coarse) { .tui-checklist__row { min-height: 44px; } }
.tui-checklist__row:hover { background: color-mix(in oklab, var(--tui-face-hi) 50%, transparent); }
.tui-checklist__label { flex: 1; min-width: 0; color: var(--tui-ink); }
.tui-checklist__group > .tui-checklist__row .tui-checklist__label { font-weight: 600; }
.tui-checklist__sub { font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); white-space: nowrap; }
/* A finished item is struck through in the printing, not faded out of reach. */
.tui-checklist__list li:not(.tui-checklist__group) > .tui-checklist__row:has(input:checked) .tui-checklist__label { color: var(--tui-ink-2); text-decoration: line-through; text-decoration-color: var(--tui-ink-3); }
.tui-checklist__row:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* Some: the key sunk half way, with a bar across it. */
:is(tui-checklist, .tui-checklist) .tui-check:indeterminate, :is(tui-checklist, .tui-checklist) .tui-check[aria-checked="mixed"] {
  transform: translateY(0.75px);
  box-shadow:
    var(--tui-depth-pressed, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)),
    inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    0 0.75px 0 var(--tui-skirt),
    0 1px 2px rgb(var(--tui-sh) / 0.2));
}
:is(tui-checklist, .tui-checklist) .tui-check:indeterminate::after, :is(tui-checklist, .tui-checklist) .tui-check[aria-checked="mixed"]::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: calc(50% - 1px);
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
}
:is(tui-checklist, .tui-checklist) .tui-check:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* ---------------------------------------------------------------- part: chip-group */
/* Chip group: small plates you press on and off, laid in a tray that wraps.
   The drawing is the segmented control's own (the tray, the caps, the pressed
   cap below the plate, the lamp that lights with it), so every finish and both
   volumes follow it with no rule here. This file adds what a filter needs on
   top: chips that stand apart and wrap onto more rows, a count printed on a
   chip, a limit that leaves the rest of the chips unpressable, and a status
   line that says how many are down. Multiple chips are checkboxes; one chip of
   several is a radio group, and the arrow keys are the browser's own. */
.tui-seg:is(tui-chip-group, .tui-chip-group) {
  --seg-h: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  /* The chips' 7px and the floor's 4px. */
  border-radius: calc(var(--tui-r-m) + 4px);
  vertical-align: middle;
  justify-self: start;
}
:is(tui-chip-group, .tui-chip-group) > label span { border-radius: var(--tui-r-m); }
/* Small: the chips' 6px and the floor's 4px. */
.tui-seg:is(tui-chip-group, .tui-chip-group).tui-chip-group--sm { --seg-h: 24px; border-radius: 10px; }
.tui-chip-group--sm > label span { padding: 0 10px; gap: 6px; font-size: 12px; border-radius: 6px; }
/* A count printed on the chip: figures, in the ink of the chip. */
:is(tui-chip-group, .tui-chip-group) small { margin-left: 2px; font: 600 11px/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
:is(tui-chip-group, .tui-chip-group) input:checked + span small { color: var(--tui-ink); }

/* A limit reached: the chips that are up cannot go down, and say so by being still. A chip that is down can always be let go. */
:is(tui-chip-group, .tui-chip-group) input[aria-disabled="true"]:not(:checked) + span { opacity: 0.45; cursor: not-allowed; }
:is(tui-chip-group, .tui-chip-group) input[aria-disabled="true"]:not(:checked) + span:hover { filter: none; }

/* Spoken, not seen: how many are down, and that the limit is reached. */
.tui-chip-group__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:is(tui-chip-group, .tui-chip-group) { position: relative; }

@media (pointer: coarse) {
  .tui-seg:is(tui-chip-group, .tui-chip-group), .tui-seg:is(tui-chip-group, .tui-chip-group).tui-chip-group--sm { --seg-h: 44px; gap: 6px; padding: 5px; }
  :is(tui-chip-group, .tui-chip-group) > label span { min-width: 44px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  :is(tui-chip-group, .tui-chip-group) span { transition: none; }
}

/* ---------------------------------------------------------------- part: choice-card */
/* Choice card: a radio or a check set as a large plate. The plate is a big
   key: a cap on a skirt carrying a name, a sentence and a price, with a small
   check key printed in its corner. Chosen, the plate goes down below the
   panel and the corner key latches, so the choice is read by where the plate
   sits and by the tick, never by colour. The real input lies over the whole
   plate, so the browser's own press, label, focus and arrow keys all work,
   and a group of radios is a native radio group. No script. */
.tui-choice-cards { margin: 0; padding: 0; border: 0; min-width: 0; }
.tui-choice-cards > legend { padding: 0; margin-bottom: var(--tui-3); }
.tui-choice-cards__set { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--tui-4); padding-bottom: 4px; }
.tui-choice-cards--stack .tui-choice-cards__set { grid-template-columns: 1fr; }

.tui-choice-card {
  --skirt: 3px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'name mark' 'desc desc' 'price price';
  align-content: start;
  gap: 6px var(--tui-3);
  min-width: 0;
  min-height: 44px;
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  cursor: pointer;
  background: var(--tui-depth-cap,
    radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key,
    inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)),
    0 var(--skirt) 0 var(--tui-skirt),
    0 calc(var(--skirt) + 1px) 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    0 calc(var(--skirt) + 6px) 12px -6px rgb(var(--tui-sh) / var(--tui-sh-a)));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-choice-card:hover, .tui-choice-card.is-hover { filter: brightness(1.03); }
/* The real input covers the plate: it takes the press, and it is the focus. */
.tui-choice-card__input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tui-choice-card:has(.tui-choice-card__input:focus-visible), .tui-choice-card.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
/* Chosen: below the plate, with its edge shading the top. */
.tui-choice-card:has(.tui-choice-card__input:checked), .tui-choice-card.is-down, .tui-choice-card:active:not(:has(:disabled)) {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}
.tui-choice-card:has(.tui-choice-card__input:disabled) { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.tui-choice-card:has(.tui-choice-card__input:disabled:checked) { transform: translateY(var(--skirt)); }
.tui-choice-card__input:disabled { cursor: not-allowed; }

.tui-choice-card__name { grid-area: name; font: 600 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.005em; }
.tui-choice-card__desc { grid-area: desc; font-size: var(--tui-t-small); line-height: 1.5; color: var(--tui-ink-2); }
.tui-choice-card__price { grid-area: price; margin-top: var(--tui-2); font: 700 var(--tui-t-h3)/1.1 var(--tui-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tui-choice-card__price small { font: 400 var(--tui-t-small)/1.2 var(--tui-sans); letter-spacing: 0; color: var(--tui-ink-2); }

/* The small check key in the corner: a square one for a check, a round one for a radio. */
.tui-choice-card__mark {
  grid-area: mark;
  position: relative;
  align-self: start;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 1.5px 0 var(--tui-skirt), 0 2px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-choice-card__input[type="radio"] ~ .tui-choice-card__mark { border-radius: 50%; }
.tui-choice-card__input:checked ~ .tui-choice-card__mark { transform: translateY(1.5px); box-shadow: var(--tui-pressed); }
.tui-choice-card__input[type="checkbox"]:checked ~ .tui-choice-card__mark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid var(--tui-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.tui-choice-card__input[type="radio"]:checked ~ .tui-choice-card__mark::after { content: ''; position: absolute; inset: 5.5px; border-radius: 50%; background: var(--tui-ink); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-choice-card { --skirt: 1px; transition: transform 70ms var(--tui-ease), background-color 120ms, box-shadow 120ms; }
  .tui-choice-card:hover, .tui-choice-card.is-hover { filter: none; background: var(--tui-quiet-key-hover); box-shadow: var(--tui-depth-key-hover); }
  .tui-choice-card:has(.tui-choice-card__input:checked), .tui-choice-card.is-down, .tui-choice-card:active:not(:has(:disabled)) { filter: none; background: var(--tui-quiet-key-down); }
}

@media (pointer: coarse) {
  .tui-choice-card { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-choice-card, .tui-choice-card__mark { transition: none; }
}

/* ---------------------------------------------------------------- part: claim-check */
/* Claim check: a cloakroom ticket, the kind with a number printed on both
   halves. At rest the two halves sit together as one small tag, a dashed
   perforation between them. Press it and the right-hand stub tears free and
   slides into a little book docked beside the tag, where a tab lights with
   the same number, printed, through the book's own cover; the counterfoil
   stays on the item. Press again and the stub pulls back out of the book and
   rejoins the counterfoil. One native button; the state is the stub's
   position and the lit tab, never colour alone. See claim-check.mjs. */
.tui-claimcheck {
  display: inline-flex;
  align-items: center;
  gap: var(--tui-3);
  border: 0;
  margin: 0;
  padding: var(--tui-2);
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tui-claimcheck:focus-visible, .tui-claimcheck.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; border-radius: var(--tui-r-m); }
.tui-claimcheck:disabled { cursor: not-allowed; opacity: 0.45; }
.tui-claimcheck:active:not(:disabled) .tui-claimcheck__tag, .tui-claimcheck.is-down .tui-claimcheck__tag { transform: scale(0.98); }

/* The tag: two halves of one plate, a dashed tear line between them. */
.tui-claimcheck__tag {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
  transform: scale(1);
  transition: transform 70ms var(--tui-ease);
}
.tui-claimcheck:hover:not(:disabled) .tui-claimcheck__tag, .tui-claimcheck.is-hover .tui-claimcheck__tag { filter: brightness(1.03); }
.tui-claimcheck__half {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--tui-2) var(--tui-3);
}
.tui-claimcheck__half--counterfoil { min-width: 68px; }
.tui-claimcheck__half--stub {
  min-width: 36px;
  background: color-mix(in oklab, var(--tui-face-lo) 55%, transparent);
  transform: translateX(0);
  transition: transform 220ms var(--tui-ease), opacity 220ms var(--tui-ease);
}
/* The grommet hole a cloakroom tag hangs by, punched through the plate. */
.tui-claimcheck__hole {
  position: absolute;
  top: 5px;
  left: 50%;
  translate: -50% 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-claimcheck__perf {
  flex: none;
  width: 0;
  border-left: 1.5px dashed var(--tui-ink-3);
  opacity: 0.55;
}
.tui-claimcheck__digit {
  font: 700 13px/1 var(--tui-mono);
  letter-spacing: 0.04em;
  color: var(--tui-ink-2);
  font-variant-numeric: tabular-nums;
}
.tui-claimcheck__word {
  font: 600 10px/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-3);
}

/* The book: closed until a stub is in it, then its tab lights with the number. */
.tui-claimcheck__book {
  position: relative;
  flex: none;
  width: 26px;
  height: 36px;
  border-radius: 2px var(--tui-r-s) var(--tui-r-s) 2px;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-claimcheck__pages {
  position: absolute;
  inset: 3px 2px 3px 5px;
  border-radius: 1px;
  background: repeating-linear-gradient(90deg, var(--tui-face-lo) 0 1.5px, transparent 1.5px 4px);
  opacity: 0.7;
}
.tui-claimcheck__tab {
  position: absolute;
  top: -7px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 14px;
  padding: 0 3px;
  border-radius: 2px;
  font: 700 9.5px/1 var(--tui-mono);
  color: var(--tui-ink);
  background: var(--tui-face-hi);
  box-shadow: var(--tui-raised);
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.7);
  transition: transform 220ms var(--tui-ease), opacity 180ms var(--tui-ease), color 180ms var(--tui-ease), background 180ms var(--tui-ease), box-shadow 180ms var(--tui-ease);
}

/* Saved: the stub slides into the book and fades, the tab rises out lit. */
.tui-claimcheck[aria-pressed="true"] .tui-claimcheck__half--stub { transform: translateX(14px); opacity: 0; }
.tui-claimcheck[aria-pressed="true"] .tui-claimcheck__tab {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  color: var(--tui-amber);
  background: var(--tui-face);
  box-shadow: var(--tui-pressed), 0 0 6px 0 color-mix(in oklab, var(--tui-amber) 55%, transparent);
}

/* Compact: the tag's word is dropped, for a small card corner or a table row. */
.tui-claimcheck--compact .tui-claimcheck__word { display: none; }
.tui-claimcheck--compact .tui-claimcheck__half--counterfoil { min-width: 0; padding-inline: var(--tui-2); }

@media (pointer: coarse) {
  .tui-claimcheck { padding: var(--tui-3); min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-claimcheck__tag, .tui-claimcheck__half--stub, .tui-claimcheck__tab { transition: none; }
}

/* ---------------------------------------------------------------- part: cloth-selector */
/* Cloth selector: a row of mode tiles covered in stretched cloth, set into a
   machined tray, one of them lit from behind. It is a real radio group: a
   fieldset of native radios, so it posts one value with no script and the
   arrow keys work as they do everywhere. See cloth-selector.mjs.

   The cloth and its light are the "lit cloth" material, the --lc-* variables,
   the recipe the Cloth Fader and the Cloth-lit Cubes use, written out here so
   the part ships with the kit:
     1. the cloth: a weave tile, a heather, a grey, and the shading of a cloth
        pulled over a block;
     2. a soft bloom of the lamp's colour, scattered in the fibres;
     3. a core of the lamp's pale colour, let through only where the weave is
        open (the weave as an alpha mask), so the fibres show over the light.
   Each tile has its own lamp behind it. Changing the mode fades one lamp down
   and the next one up; nothing moves across. Unlit, the icon and the word are
   pressed into the cloth.

   Corners are concentric: an 8px tile in a 6px margin makes the 14px tray. */

/* The material, by tone: pale cloth on a light finish, charcoal on a dark one.
   Only the lamps and the cloth are colour here. */
:root, [data-finish="aluminium"], [data-tone="light"] {
  --lc-cloth: #c8c9c4;
  --lc-twill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Crect width='4' height='4' fill='black' fill-opacity='0.22'/%3E%3Cg fill='white' fill-opacity='0.06'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='1' y='0' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='0' y='1' width='1' height='1'/%3E%3C/g%3E%3Cg fill='black' fill-opacity='0.06'%3E%3Crect x='2' y='0' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='0' y='2' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --lc-speaker: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6'%3E%3Cdefs%3E %3ClinearGradient id='h' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='white' stop-opacity='0.2'/%3E%3Cstop offset='.45' stop-color='white' stop-opacity='0.05'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.12'/%3E%3C/linearGradient%3E %3ClinearGradient id='v' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='white' stop-opacity='0.17'/%3E%3Cstop offset='.45' stop-color='white' stop-opacity='0.03'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.132'/%3E%3C/linearGradient%3E %3ClinearGradient id='u' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='black' stop-opacity='0.1'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.16'/%3E%3C/linearGradient%3E %3C/defs%3E%3Crect width='6' height='6' fill='black' fill-opacity='0.3'/%3E%3Crect x='0' y='0.25' width='3' height='2.5' fill='url(%23u)'/%3E%3Crect x='3.25' y='0' width='2.5' height='3' fill='url(%23u)'/%3E%3Crect x='0.25' y='3' width='2.5' height='3' fill='url(%23u)'/%3E%3Crect x='3' y='3.25' width='3' height='2.5' fill='url(%23u)'/%3E%3Crect x='0.25' y='-0.25' width='2.5' height='3.5' rx='1.15' fill='url(%23v)'/%3E%3Crect x='2.75' y='0.25' width='3.5' height='2.5' rx='1.15' fill='url(%23h)'/%3E%3Crect x='-0.25' y='3.25' width='3.5' height='2.5' rx='1.15' fill='url(%23h)'/%3E%3Crect x='3.25' y='2.75' width='2.5' height='3.5' rx='1.15' fill='url(%23v)'/%3E%3C/svg%3E");
  --lc-bloom-a: 30%;
  --lc-edge: rgb(0 0 0 / 0.17);
  --lc-shine: rgb(255 255 255 / 0.16);
  /* The words pressed into the cloth: 4.5:1 on the darkest weave. */
  --lc-deboss: #1e1f1d;
  --lc-lip: rgb(255 255 255 / 0.4);
  --lc-wall: rgb(0 0 0 / 0.16);
  --lc-scrim: rgb(0 0 0 / 0.36);
  --lc-halo: rgb(0 0 0 / 0.7);
  --lc-word-bloom: 0.5;
  --lc-core-filament: #fff3dc;
  --lc-core-green: #9ff0a8;
  --lc-core-amber: #ffd986;
  --lc-core-red: #ffb5a6;
  --lc-core-blue: #b4d7ff;
  --lc-core-white: #ffffff;
  --lc-core-mix: 42%;
  /* An aurora on pale cloth: added light would whiten it, so hard-light, which lifts the channels its colours have and deepens the others. */
  --lc-aur-a: 0.85;
  --lc-aur-blend: hard-light;
  --lc-aur-lift: 20%;   /* its colours lifted toward white first, so the lit cloth is brighter than the unlit, as light is */
}
/* Charcoal cloth: the pressed letters catch the light instead of losing it, and a paler core reads as the same lamp. */
[data-finish="graphite"], [data-tone="dark"] {
  --lc-cloth: #3d3e41;
  --lc-twill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Crect width='4' height='4' fill='black' fill-opacity='0.4'/%3E%3Cg fill='white' fill-opacity='0.045'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='1' y='0' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='0' y='1' width='1' height='1'/%3E%3C/g%3E%3Cg fill='black' fill-opacity='0.1'%3E%3Crect x='2' y='0' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='0' y='2' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --lc-speaker: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6'%3E%3Cdefs%3E %3ClinearGradient id='h' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='white' stop-opacity='0.13'/%3E%3Cstop offset='.45' stop-color='white' stop-opacity='0.03'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.2'/%3E%3C/linearGradient%3E %3ClinearGradient id='v' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='white' stop-opacity='0.1105'/%3E%3Cstop offset='.45' stop-color='white' stop-opacity='0.018'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.22000000000000003'/%3E%3C/linearGradient%3E %3ClinearGradient id='u' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='black' stop-opacity='0.16'/%3E%3Cstop offset='1' stop-color='black' stop-opacity='0.24'/%3E%3C/linearGradient%3E %3C/defs%3E%3Crect width='6' height='6' fill='black' fill-opacity='0.46'/%3E%3Crect x='0' y='0.25' width='3' height='2.5' fill='url(%23u)'/%3E%3Crect x='3.25' y='0' width='2.5' height='3' fill='url(%23u)'/%3E%3Crect x='0.25' y='3' width='2.5' height='3' fill='url(%23u)'/%3E%3Crect x='3' y='3.25' width='3' height='2.5' fill='url(%23u)'/%3E%3Crect x='0.25' y='-0.25' width='2.5' height='3.5' rx='1.15' fill='url(%23v)'/%3E%3Crect x='2.75' y='0.25' width='3.5' height='2.5' rx='1.15' fill='url(%23h)'/%3E%3Crect x='-0.25' y='3.25' width='3.5' height='2.5' rx='1.15' fill='url(%23h)'/%3E%3Crect x='3.25' y='2.75' width='2.5' height='3.5' rx='1.15' fill='url(%23v)'/%3E%3C/svg%3E");
  --lc-bloom-a: 42%;
  --lc-edge: rgb(0 0 0 / 0.42);
  --lc-shine: rgb(255 255 255 / 0.07);
  --lc-deboss: #b9b8b4;
  --lc-lip: rgb(255 255 255 / 0.07);
  --lc-wall: rgb(0 0 0 / 0.7);
  --lc-scrim: rgb(0 0 0 / 0.3);
  --lc-halo: rgb(0 0 0 / 0.5);
  --lc-word-bloom: 0.8;
  --lc-core-filament: #fff3dc;
  --lc-core-green: #c4ffcb;
  --lc-core-amber: #ffe4a6;
  --lc-core-red: #ffd0c6;
  --lc-core-blue: #d3e8ff;
  --lc-core-white: #ffffff;
  --lc-core-mix: 30%;
  --lc-aur-a: 0.85;
  --lc-aur-blend: plus-lighter;
  --lc-aur-lift: 0%;
}

.tui-cloth-selector {
  --cs-w: 80px;       /* a tile's width at most; tiles shrink to share a narrow row */
  --cs-h: 72px;
  --cs-r: 8px;
  --cs-gap: 6px;
  --lc-twill-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Crect width='4' height='4' fill='white' fill-opacity='.82'/%3E%3Cg fill='white'%3E%3Crect x='0' y='0' width='2' height='1'/%3E%3Crect x='1' y='3' width='2' height='1'/%3E%3Crect x='2' y='2' width='2' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='0' y='1' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --lc-speaker-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6'%3E%3Crect width='6' height='6' fill='white' fill-opacity='.46'/%3E%3Cpath d='M0 0H6M0 3H6M0 6H6M0 0V6M3 0V6M6 0V6' stroke='white' stroke-opacity='.78' stroke-width='.5'/%3E%3Cg fill='white'%3E%3Ccircle cx='0' cy='0' r='.6'/%3E%3Ccircle cx='3' cy='0' r='.6'/%3E%3Ccircle cx='6' cy='0' r='.6'/%3E%3Ccircle cx='0' cy='3' r='.6'/%3E%3Ccircle cx='3' cy='3' r='.6'/%3E%3Ccircle cx='6' cy='3' r='.6'/%3E%3Ccircle cx='0' cy='6' r='.6'/%3E%3Ccircle cx='3' cy='6' r='.6'/%3E%3Ccircle cx='6' cy='6' r='.6'/%3E%3C/g%3E%3C/svg%3E");
  --lc-heather: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07 .34' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.9 0 0 0 -.45 1.9 0 0 0 -.45 1.9 0 0 0 -.45 0 0 0 0 1'/%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.34 .07' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.9 0 0 0 -.45 1.9 0 0 0 -.45 1.9 0 0 0 -.45 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='240' height='240' fill='gray'/%3E%3Crect width='240' height='240' filter='url(%23a)' opacity='.5'/%3E%3Crect width='240' height='240' filter='url(%23b)' opacity='.5'/%3E%3C/svg%3E");
  --lc-weave: var(--lc-twill);
  --lc-mask: var(--lc-twill-mask);
  --lc-pitch: 4px;
  /* The lamp: filament unless data-lamp says otherwise. --lc-tone is how much of it lights the cloth. */
  --lc-bloom: #ffc56e;
  --lc-core: var(--lc-core-filament);
  --lc-tone: 1;
  --lc-a: calc(var(--lc-bloom-a) * var(--lc-tone));
  display: inline-grid;
  gap: var(--tui-2);
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}
.tui-cloth-selector[data-lamp="green"] { --lc-bloom: var(--tui-green); --lc-core: var(--lc-core-green); --lc-tone: 1.7; }
.tui-cloth-selector[data-lamp="amber"] { --lc-bloom: var(--tui-amber); --lc-core: var(--lc-core-amber); }
.tui-cloth-selector[data-lamp="red"] { --lc-bloom: var(--tui-red); --lc-core: var(--lc-core-red); --lc-tone: 1.3; }
.tui-cloth-selector[data-lamp="blue"] { --lc-bloom: var(--tui-blue); --lc-core: var(--lc-core-blue); --lc-tone: 1.6; }
.tui-cloth-selector[data-lamp="white"] { --lc-bloom: var(--tui-white); --lc-core: var(--lc-core-white); --lc-tone: 1.3; }
/* Your own lamp: one hex in --lc-lamp, the pale core taken from it. The modifier names it a lamp, where a literal colour is allowed. */
.tui-cloth-selector--own-lamp { --lc-bloom: var(--lc-lamp, #ffc56e); --lc-core: color-mix(in oklab, var(--lc-lamp, #ffc56e) var(--lc-core-mix), #fff); --lc-tone: 1.2; }
/* Aurora: the lamp behind the chosen tile is a slow mesh of colours (aurora.css), the one place a tile holds more than one hue.
   It is still only the lamp: it sits in the glow, shaped like it, added to the cloth as light. The icon and the word are lit
   near white, tinted by the field's brightest colour, which clothSelectorHTML writes into --lc-lamp. */
.tui-cloth-selector--aurora { --lc-bloom: var(--lc-lamp); --lc-core: color-mix(in oklab, var(--lc-lamp) 24%, #fff); --lc-tone: 1; }
.tui-cloth-selector--aurora .tui-cloth-selector__glow {
  background: none;
  mix-blend-mode: var(--lc-aur-blend);
  -webkit-mask: radial-gradient(96% 78% at 50% 40%, rgb(0 0 0) 25%, rgb(0 0 0 / 0.5) 62%, transparent);
  mask: radial-gradient(96% 78% at 50% 40%, rgb(0 0 0) 25%, rgb(0 0 0 / 0.5) 62%, transparent);
}
.tui-cloth-selector--aurora .tui-aurora { opacity: var(--lc-aur-a); }
.tui-cloth-selector--aurora .tui-aurora__blob { --k: color-mix(in oklab, var(--c), white var(--lc-aur-lift)); }
/* A tile that is not lit holds its field still. */
.tui-cloth-selector__input:not(:checked) + .tui-cloth-selector__face .tui-aurora__blob { animation-play-state: paused; }
/* paused: the lit tile's field held where it is. The page sets it from a Pause key of its own, since an aurora drifts for longer
   than five seconds (WCAG 2.2.2); the recipe is on the docs page. There is no built-in key. */
.tui-cloth-selector[paused] .tui-aurora__blob { animation-play-state: paused; }
/* Under reduced motion the aurora is one still frame already, so a key marked [data-cs-pause] has nothing to do. */
@media (prefers-reduced-motion: reduce) { [data-cs-pause] { display: none; } }
/* Speaker cloth: a coarser plain weave whose open squares show the light as pinholes. */
.tui-cloth-selector[data-weave="speaker"] { --lc-weave: var(--lc-speaker); --lc-mask: var(--lc-speaker-mask); --lc-pitch: 6px; }

/* The printed legend, like the one above a mode switch. Floated, so it is a plain grid item and not drawn on a border. */
.tui-cloth-selector__legend { float: left; width: 100%; margin: 0; padding: 0 2px; }

/* ------------------------------------------------------------------ the tray */
.tui-cloth-selector__tray {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, var(--cs-w));
  gap: var(--cs-gap);
  width: fit-content;
  max-width: 100%;
  padding: var(--cs-gap);
  border-radius: calc(var(--cs-r) + var(--cs-gap));
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-cloth-selector--block { display: grid; width: 100%; }
.tui-cloth-selector--block .tui-cloth-selector__tray { width: auto; grid-auto-columns: minmax(0, 1fr); }

/* ------------------------------------------------------------------ a tile */
.tui-cloth-selector__tile {
  position: relative;
  display: block;
  min-width: 0;
  container-type: inline-size;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The radio itself: there, focusable and posted, but drawn by the tile. */
.tui-cloth-selector__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }

/* The cloth, pulled over a block that stands in the tray. Its sides show below it as a skirt. */
.tui-cloth-selector__face {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--cs-h);
  padding: 4px;
  border-radius: var(--cs-r);
  background:
    var(--lc-weave) 0 0 / var(--lc-pitch) var(--lc-pitch),
    var(--lc-heather) var(--cs-cut, 0 0) / 240px 240px,
    var(--lc-cloth);
  background-blend-mode: normal, soft-light, normal;
  box-shadow:
    var(--tui-depth-key, inset 0 1.5px 0 rgb(255 255 255 / 0.3),
    inset 0 -1px 0 rgb(0 0 0 / 0.22),
    0 2px 0 color-mix(in oklab, var(--lc-cloth) 72%, rgb(var(--tui-sh))),
    0 3px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)),
    0 6px 9px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)));
  transition: transform 90ms var(--tui-ease), box-shadow 90ms var(--tui-ease);
}
/* Each tile is cut from a different part of the bolt, so no two carry the same slubs. */
.tui-cloth-selector__tile:nth-child(2) { --cs-cut: -83px -151px; }
.tui-cloth-selector__tile:nth-child(3) { --cs-cut: -171px -37px; }
.tui-cloth-selector__tile:nth-child(4) { --cs-cut: -29px -97px; }
.tui-cloth-selector__tile:nth-child(5) { --cs-cut: -127px -203px; }
.tui-cloth-selector__tile:nth-child(6) { --cs-cut: -211px -129px; }
/* The cloth wraps the block's edges: it darkens toward the sides and catches the lamp up and to the left. Over everything, light included. */
.tui-cloth-selector__face::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 28% 0%, var(--lc-shine), transparent 62%),
    linear-gradient(90deg, var(--lc-edge), transparent 16%, transparent 84%, var(--lc-edge)),
    linear-gradient(to bottom, rgb(255 255 255 / 0.05), transparent 26%, transparent 72%, rgb(0 0 0 / 0.12));
}

/* The chosen tile sits a touch lower: pressed down into the tray, its skirt gone. */
.tui-cloth-selector__input:checked + .tui-cloth-selector__face {
  transform: translateY(1.5px);
  box-shadow:
    var(--tui-depth-pressed, inset 0 1px 0 rgb(255 255 255 / 0.2),
    inset 0 -1px 0 rgb(0 0 0 / 0.2),
    0 0.5px 0 color-mix(in oklab, var(--lc-cloth) 72%, rgb(var(--tui-sh))),
    0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)));
}
.tui-cloth-selector__tile:active .tui-cloth-selector__input:not(:checked, :disabled) + .tui-cloth-selector__face,
.tui-cloth-selector__tile.is-down .tui-cloth-selector__face { transform: translateY(1px); }
.tui-cloth-selector__tile:hover .tui-cloth-selector__input:not(:checked, :disabled) + .tui-cloth-selector__face,
.tui-cloth-selector__tile.is-hover .tui-cloth-selector__face { filter: brightness(1.07); }
.tui-cloth-selector__input:focus-visible + .tui-cloth-selector__face,
.tui-cloth-selector__tile.is-focus .tui-cloth-selector__face { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-cloth-selector__input:disabled + .tui-cloth-selector__face { opacity: 0.45; cursor: not-allowed; }
.tui-cloth-selector__tile:has(.tui-cloth-selector__input:disabled) { cursor: not-allowed; }

/* ------------------------------------------------------------------ the lamp behind the cloth */
/* Each lit layer fades on its own. Going out it takes a little longer, like a filament cooling; coming on it waits a beat for the old one to dim. */
.tui-cloth-selector__scrim,
.tui-cloth-selector__glow,
.tui-cloth-selector__g--bloom,
.tui-cloth-selector__g--core,
.tui-cloth-selector__word::before,
.tui-cloth-selector__word::after {
  opacity: 0;
  transition: opacity 340ms ease-out;
}
.tui-cloth-selector__g--off { transition: color 340ms ease-out, filter 340ms ease-out; }
.tui-cloth-selector__word { transition: color 340ms ease-out, text-shadow 340ms ease-out; }
.tui-cloth-selector__input:checked + .tui-cloth-selector__face :is(.tui-cloth-selector__scrim, .tui-cloth-selector__glow, .tui-cloth-selector__g--bloom, .tui-cloth-selector__g--core, .tui-cloth-selector__g--off),
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word,
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word::before,
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word::after {
  transition-duration: 260ms;
  transition-delay: 90ms;
  transition-timing-function: var(--tui-ease);
}

/* A soft shade under the icon and the word, so the lamp reads over its own light on pale cloth. */
.tui-cloth-selector__scrim {
  position: absolute;
  inset: 14% 10%;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(closest-side, var(--lc-scrim), transparent);
}
/* Light scattered in the fibres round the lamp: a bloom that is not masked, so it is even under a twill. */
.tui-cloth-selector__glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: plus-lighter;
  background: radial-gradient(84% 62% at 50% 36%, color-mix(in oklab, var(--lc-bloom) calc(var(--lc-a) * 0.85), transparent), color-mix(in oklab, var(--lc-bloom) calc(var(--lc-a) * 0.2), transparent) 70%, transparent);
}
.tui-cloth-selector__input:checked + .tui-cloth-selector__face :is(.tui-cloth-selector__scrim, .tui-cloth-selector__glow) { opacity: 1; }

/* ------------------------------------------------------------------ the icon: pressed in, or lit through */
.tui-cloth-selector__icon { position: relative; z-index: 2; display: grid; flex: none; width: 22px; height: 22px; }
.tui-cloth-selector__icon svg { grid-area: 1 / 1; display: block; width: 100%; height: 100%; overflow: visible; }
/* Unlit: a shape pressed into the cloth, its upper wall in shade and its lower lip catching the room's light. */
.tui-cloth-selector__g--off { color: var(--lc-deboss); filter: drop-shadow(0 -0.5px 0 var(--lc-wall)) drop-shadow(0 1px 0 var(--lc-lip)) blur(0); }
/* The bloom: the lamp's colour, blurred into the fibres. */
.tui-cloth-selector__g--bloom { color: var(--lc-bloom); filter: blur(3px); mix-blend-mode: plus-lighter; }
/* The core: the icon's shape, softened by the cloth and let through where the weave is open. */
.tui-cloth-selector__g--core {
  color: var(--lc-core);
  filter: blur(0.45px) drop-shadow(0 0 1.5px var(--lc-bloom));
  mix-blend-mode: plus-lighter;
  -webkit-mask: var(--lc-mask) 0 0 / var(--lc-pitch) var(--lc-pitch);
  mask: var(--lc-mask) 0 0 / var(--lc-pitch) var(--lc-pitch);
}
/* Lit, the pressed shape stays as a soft shade under the light, as the word does. */
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__g--off { color: var(--lc-halo); filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 0 transparent) blur(1.4px); }
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__g--bloom { opacity: 0.75; }
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__g--core { opacity: 1; }

/* ------------------------------------------------------------------ the word: the same two ways */
.tui-cloth-selector__word {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  font: 700 var(--tui-t-label)/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--lc-deboss);
  text-shadow: 0 -0.5px 0 var(--lc-wall), 0 1px 0 var(--lc-lip);
}
/* The lit copies are drawn from data-t and are not read out: the word itself is the name. */
.tui-cloth-selector__word::before,
.tui-cloth-selector__word::after {
  content: attr(data-t) / '';
  position: absolute;
  inset: 0;
  text-shadow: none;
  mix-blend-mode: plus-lighter;
  pointer-events: none;
}
.tui-cloth-selector__word::before { color: var(--lc-bloom); filter: blur(2.5px); }
.tui-cloth-selector__word::after {
  color: var(--lc-core);
  filter: blur(0.35px) drop-shadow(0 0 1.5px var(--lc-bloom));
  -webkit-mask: var(--lc-mask) 0 0 / var(--lc-pitch) var(--lc-pitch);
  mask: var(--lc-mask) 0 0 / var(--lc-pitch) var(--lc-pitch);
}
/* Lit, the word itself is only a shade the shape of its letters, close under the light, so the light reads on pale cloth. */
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word { color: transparent; text-shadow: 0 0 2px var(--lc-halo), 0 0.5px 5px var(--lc-halo); }
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word::before { opacity: var(--lc-word-bloom); }
.tui-cloth-selector__input:checked + .tui-cloth-selector__face .tui-cloth-selector__word::after { opacity: 1; }

/* A tile narrower than its word: the icon and the word come down a size. */
@container (max-width: 60px) {
  .tui-cloth-selector:not(.tui-cloth-selector--compact) .tui-cloth-selector__word { font-size: 9px; letter-spacing: 0.04em; }
  .tui-cloth-selector:not(.tui-cloth-selector--compact) .tui-cloth-selector__icon { width: 19px; height: 19px; }
}
@container (max-width: 46px) {
  .tui-cloth-selector:not(.tui-cloth-selector--compact) .tui-cloth-selector__face { padding: 2px; gap: 8px; }
  .tui-cloth-selector:not(.tui-cloth-selector--compact) .tui-cloth-selector__word { font-size: 8px; letter-spacing: 0.01em; }
  .tui-cloth-selector:not(.tui-cloth-selector--compact) .tui-cloth-selector__icon { width: 17px; height: 17px; }
}

/* ------------------------------------------------------------------ compact: icons only, the word as a tooltip */
.tui-cloth-selector--compact { --cs-w: 44px; --cs-h: 44px; }
.tui-cloth-selector--compact .tui-cloth-selector__icon { width: 18px; height: 18px; }
.tui-cloth-selector--compact .tui-cloth-selector__input + .tui-cloth-selector__face .tui-cloth-selector__word {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 10;
  max-width: none;
  padding: 5px 8px;
  border-radius: 5px;
  translate: -50% 0;
  font: 500 11px/1 var(--tui-sans);
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--tui-cap-ink);
  text-shadow: none;
  background: var(--tui-cap);
  box-shadow: 0 4px 10px -4px rgb(0 0 0 / 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--tui-ease);
}
.tui-cloth-selector--compact .tui-cloth-selector__word::before,
.tui-cloth-selector--compact .tui-cloth-selector__word::after { display: none; }
.tui-cloth-selector--compact .tui-cloth-selector__tile:hover .tui-cloth-selector__word,
.tui-cloth-selector--compact .tui-cloth-selector__input:focus-visible + .tui-cloth-selector__face .tui-cloth-selector__word,
.tui-cloth-selector--compact .tui-cloth-selector__tile.is-focus .tui-cloth-selector__word { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .tui-cloth-selector__face,
  .tui-cloth-selector__face *,
  .tui-cloth-selector__face *::before,
  .tui-cloth-selector__face *::after { transition: none !important; }
}

/* ---------------------------------------------------------------- part: code-block */
/* Code block: code on display glass. A bar along the top holds the file name
   on a tab, seated in the glass with a lit edge under it, and the copy key at
   the far end. Under it the lines run, each with its number engraved in a
   gutter that stays put when a long line scrolls sideways. The numbers are
   drawn by the stylesheet, not written in the text, so they are never selected,
   never copied and never read aloud. Highlighting, if a block asks for it, is
   the display's own light at a few strengths (bright, plain, dim) with weight
   and italic to tell them apart: it is never a colour a page adds. The glass,
   its ink and its focus light are .tui-glass's, in every finish and volume. */
.tui-glass.tui-code-block {
  --cb-lh: 1.65;
  --cb-gutter: 3.4ch;
  --cb-start: 1;
  position: relative; /* holds the copy key's spoken status, so it cannot widen a page from outside a scroller */
  margin: 0;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

/* The bar: the tab, and the keys at the far end. */
.tui-code-block__bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--tui-2);
  min-height: 38px;
  padding-right: var(--tui-1);
  border-bottom: 1px solid var(--tui-rule);
}
.tui-code-block__bar .tui-key { align-self: center; }
/* The file name. A tab: a faint lift of light behind the name, and the lit edge under it that says this is the one open. */
.tui-code-block__tab {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-4) 0 14px;
  border-right: 1px solid var(--tui-rule);
  font: 500 12px/1 var(--tui-mono);
  color: var(--tui-ink);
  background: color-mix(in oklab, var(--tui-ink) 7%, transparent);
}
.tui-code-block__tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-code-block__tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--tui-ink);
}
/* No file name: the language is printed as a legend instead. */
.tui-code-block__lang { align-self: center; padding-left: 14px; }

/* The lines. The region scrolls both ways when it has to, and is a stop of its own so the keyboard can scroll it. */
.tui-code-block__scroll {
  max-height: var(--cb-max, none);
  padding: 10px 0 12px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--tui-ink) 35%, transparent) transparent;
}
.tui-code-block__scroll:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -3px; }
.tui-code-block__pre { margin: 0; font: 400 12.5px/var(--cb-lh) var(--tui-mono); tab-size: 2; }
.tui-code-block__code {
  display: inline-block;
  min-width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--tui-ink);
  white-space: pre;
  counter-reset: cb calc(var(--cb-start) - 1);
}
/* Without the script the text is plain, and sits clear of the glass edge. */
.tui-code-block__code:not(:has(.tui-code-block__line)) { padding: 0 16px; }

.tui-code-block__line { display: block; padding-right: 16px; counter-increment: cb; }
.tui-code-block__line::before {
  content: counter(cb);
  content: counter(cb) / '';
  position: sticky;
  left: 0;
  z-index: 1;
  display: inline-block;
  box-sizing: border-box;
  width: calc(var(--cb-gutter) + 22px);
  margin-right: 14px;
  padding-right: 10px;
  text-align: right;
  color: var(--tui-ink-2);
  font-variant-numeric: tabular-nums;
  user-select: none;
  /* The gutter is a plate of its own over the lines that pass under it, with its edge engraved. */
  background: linear-gradient(var(--tui-vfd-bg), var(--tui-vfd-bg));
  box-shadow: inset -1px 0 0 var(--tui-rule), inset -2px 0 0 color-mix(in oklab, var(--tui-ink) 4%, transparent);
}
.tui-code-block--bare .tui-code-block__line::before { display: none; }
.tui-code-block--bare .tui-code-block__code:has(.tui-code-block__line) { padding-left: 16px; }
/* A line the reader was sent to: lit across, its number bright, and a bar at the edge so it is not the lighting alone. */
.tui-code-block__line[data-mark] { background: color-mix(in oklab, var(--tui-ink) 9%, transparent); box-shadow: inset 2px 0 0 var(--tui-ink); }
.tui-code-block__line[data-mark]::before { color: var(--tui-ink); font-weight: 600; background: color-mix(in oklab, var(--tui-vfd-bg) 91%, var(--tui-ink)); }

/* A little highlighting: the display's light at three strengths. */
.tui-code-block__code[data-lit] { color: color-mix(in oklab, var(--tui-ink) 88%, transparent); }
.tui-code-block__code .tui-tok-k { color: var(--tui-ink); font-weight: 600; }
.tui-code-block__code .tui-tok-s { color: var(--tui-ink); }
.tui-code-block__code .tui-tok-n { color: var(--tui-ink); }
.tui-code-block__code .tui-tok-c { color: var(--tui-ink-2); font-style: italic; }
.tui-code-block__code .tui-tok-p { color: var(--tui-ink-2); }

@media (pointer: coarse) {
  .tui-code-block__bar { min-height: 48px; }
  .tui-code-block__bar .tui-key { --h: 44px; }
}

/* ---------------------------------------------------------------- part: collapsible */
/* Collapsible: one section that opens in place, the single-row cousin of the
   accordion. A square key sits at the start of its head with a printed
   chevron; opening latches the key below the plate and turns the chevron to
   point down, and the text slides out under the head. Native <details>, so it
   opens and closes with no script (the text arrives at once); with kit.mjs the
   closing is eased too. The slide is a grid row growing from 0fr to 1fr, so the
   section is never given a height of its own. */
.tui-collapsible { --co-key: 22px; display: block; border-bottom: 1px solid var(--tui-rule); }
.tui-collapsible:first-child:not(.tui-collapsible--plate) { border-top: 1px solid var(--tui-rule); }

.tui-collapsible > summary {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  min-height: 44px;
  padding: var(--tui-2) 2px;
  list-style: none;
  font: 600 14px/1.35 var(--tui-sans);
  letter-spacing: -0.005em;
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
  border-radius: var(--tui-r-m);
  -webkit-tap-highlight-color: transparent;
}
.tui-collapsible > summary::-webkit-details-marker { display: none; }
.tui-collapsible > summary::marker { content: ''; }
.tui-collapsible > summary:focus-visible, .tui-collapsible > summary.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

.tui-collapsible__title { flex: 1; min-width: 0; }
.tui-collapsible__meta { flex: none; margin-left: auto; font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }

/* The key: a square cap on its skirt, with the chevron printed on it. */
.tui-collapsible__key {
  position: relative;
  flex: none;
  width: var(--co-key);
  height: var(--co-key);
  border-radius: 6px;
  background: var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2.5px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-collapsible__key::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border: solid var(--tui-ink);
  border-width: 0 1.75px 1.75px 0;
  transform: translate(-70%, -50%) rotate(-45deg);
  transition: transform 180ms var(--tui-ease);
}
.tui-collapsible > summary:hover > .tui-collapsible__key, .tui-collapsible > summary.is-hover > .tui-collapsible__key { filter: brightness(1.03); }
.tui-collapsible > summary:active > .tui-collapsible__key, .tui-collapsible > summary.is-down > .tui-collapsible__key,
.tui-collapsible[open]:not([data-closing]) > summary > .tui-collapsible__key {
  transform: translateY(1.5px);
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}
.tui-collapsible[open]:not([data-closing]) > summary > .tui-collapsible__key::after { transform: translate(-50%, -70%) rotate(45deg); }

/* The text: one grid row, so its height is whatever the words need. The inner
   box has room round it (and takes it back in its margin) so a focus ring on
   something inside is not cut off. The space under the last line is that
   line's own margin, so it slides away with the rest. */
.tui-collapsible__body { display: grid; grid-template-rows: 1fr; padding-left: calc(var(--co-key) + var(--tui-3) + 2px); color: var(--tui-ink-2); }
.tui-collapsible__inner { min-height: 0; overflow: hidden; padding: 6px; margin: -6px; }
.tui-collapsible__inner > :first-child { margin-top: 0; }
.tui-collapsible__inner > :last-child { margin-bottom: var(--tui-4); }
.tui-collapsible[data-closing] .tui-collapsible__inner { pointer-events: none; }
/* Opening and closing are the same transition, so a press that comes before it has finished turns it round where it is. */
.tui-collapsible[open] > .tui-collapsible__body { transition: grid-template-rows 200ms var(--tui-ease), opacity 160ms var(--tui-ease); }
.tui-collapsible:not([open]) > .tui-collapsible__body { grid-template-rows: 0fr; opacity: 0; }
@starting-style { .tui-collapsible[open] > .tui-collapsible__body { grid-template-rows: 0fr; opacity: 0; } }
.tui-collapsible[data-closing] > .tui-collapsible__body { grid-template-rows: 0fr; opacity: 0; }

/* On a plate of its own, for a section that stands apart on a page. */
.tui-collapsible--plate { padding: 0 var(--tui-3); border: 0; border-radius: var(--tui-r-l); background: var(--tui-face); box-shadow: var(--tui-raised); }
.tui-collapsible--plate > summary { padding-inline: 0; }
.tui-collapsible--plate > .tui-collapsible__body { padding-left: calc(var(--co-key) + var(--tui-3)); }

@media (pointer: coarse) {
  .tui-collapsible { --co-key: 28px; }
  .tui-collapsible > summary { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-collapsible__key, .tui-collapsible__key::after, .tui-collapsible[open] > .tui-collapsible__body { transition: none; }
}

/* ---------------------------------------------------------------- part: color-picker */
/* Colour picker: a form field for choosing a colour. A plane for saturation and
   brightness, a strip for hue, an optional strip for opacity, a hex field, red,
   green and blue fields, a row of swatches and a preview. The plane and the
   strips are recesses (the kit's well) drawn with gradients, and only their
   thumbs move, by transform. The colour a person is choosing is data: it shows
   in the plane, the strips, the swatches and the preview, and nowhere else.
   The thumbs, the fields and every ring are the kit's tokens, so every finish
   and both volumes are theirs. kit/parts/color-picker.mjs builds and wires it.
   Without the script the input inside is a plain hex field. */
tui-color-picker, .tui-color-picker__chip, .tui-color-picker__swatch, .tui-color-picker__preview {
  /* Squares of two token tones: what a see-through colour lies over. */
  --cp-check: repeating-conic-gradient(color-mix(in oklab, var(--tui-ink) 16%, var(--tui-face)) 0 25%, var(--tui-face) 0 50%) 0 0 / 10px 10px;
  /* A colour that is not there: a slash. */
  --cp-none: linear-gradient(to top right, transparent calc(50% - 1px), var(--tui-ink-2) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
tui-color-picker {
  --cp-thumb: 20px;
  --cp-strip: 24px;
  --cp-track: 16px;
  --cp-plane: 168px;
  --cp-in: 38px;
  --cp-h: 0; --cp-s: 0; --cp-v: 0; --cp-a: 1; --cp-rgb: 0 0 0;
  position: relative;
  display: grid;
  gap: 12px;
  width: min(100%, 320px);
  min-width: 0;
  text-align: left;
  color: var(--tui-ink);
}
tui-color-picker:is(:disabled, [disabled]) { opacity: 0.45; cursor: not-allowed; }
tui-color-picker:is(:disabled, [disabled]) * { cursor: not-allowed; }

/* The plane: saturation across, brightness up. White fades in from the left, black from the bottom, over the pure hue. */
.tui-color-picker__plane {
  position: relative;
  height: var(--cp-plane);
  border-radius: var(--tui-r-m);
  container-type: size;
  touch-action: none;
  cursor: crosshair;
  forced-color-adjust: none;
  background:
    linear-gradient(to top, hsl(0 0% 0%), hsl(0 0% 0% / 0)),
    linear-gradient(to right, hsl(0 0% 100%), hsl(0 0% 100% / 0)),
    hsl(var(--cp-h) 100% 50%);
  box-shadow: var(--tui-inset);
}
.tui-color-picker__plane:focus-visible, .tui-color-picker__plane.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* The thumb is a ring, hollow so the colour under it shows, in two tones so it reads on any colour. */
.tui-color-picker__thumb {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  width: var(--cp-thumb);
  height: var(--cp-thumb);
  border: 2px solid var(--tui-face-hi);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1.5px var(--tui-ink), var(--tui-depth-plate, 1px 2px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)));
  pointer-events: none;
}
.tui-color-picker__plane > .tui-color-picker__thumb { transform: translate(calc(var(--cp-s) * 1cqw - var(--cp-thumb) / 2), calc((100 - var(--cp-v)) * 1cqh - var(--cp-thumb) / 2)); }
tui-color-picker[data-empty] .tui-color-picker__thumb { opacity: 0; }

/* The strips: a hit area, and in it a recessed track with the thumb on it. */
.tui-color-picker__strips { display: grid; gap: 2px; }
.tui-color-picker__strip { position: relative; height: var(--cp-strip); border-radius: calc(var(--cp-strip) / 2); touch-action: none; cursor: pointer; }
.tui-color-picker__strip:focus-visible, .tui-color-picker__strip.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-color-picker__track {
  position: absolute;
  inset: calc((var(--cp-strip) - var(--cp-track)) / 2) 0;
  border-radius: calc(var(--cp-track) / 2);
  container-type: inline-size;
  forced-color-adjust: none;
  box-shadow: var(--tui-inset);
}
.tui-color-picker__strip--hue > .tui-color-picker__track {
  background: linear-gradient(to right, hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%));
}
.tui-color-picker__strip--alpha > .tui-color-picker__track {
  background: linear-gradient(to right, rgb(var(--cp-rgb) / 0), rgb(var(--cp-rgb) / 1)), var(--cp-check);
}
.tui-color-picker__track > .tui-color-picker__thumb { top: 50%; margin-top: calc(var(--cp-thumb) / -2); }
.tui-color-picker__strip--hue .tui-color-picker__thumb { transform: translateX(calc(var(--cp-h) / 360 * 100cqw - var(--cp-thumb) / 2)); }
.tui-color-picker__strip--alpha .tui-color-picker__thumb { transform: translateX(calc(var(--cp-a) * 100cqw - var(--cp-thumb) / 2)); }

/* The preview, the hex field and, where the browser has one, the eyedropper. */
.tui-color-picker__row { display: flex; align-items: flex-end; gap: var(--tui-2); min-width: 0; }
.tui-color-picker__preview {
  flex: none;
  width: var(--cp-in);
  height: var(--cp-in);
  border-radius: var(--tui-r-m);
  forced-color-adjust: none;
  background: linear-gradient(rgb(var(--cp-rgb) / var(--cp-a)), rgb(var(--cp-rgb) / var(--cp-a))), var(--cp-check);
  box-shadow: var(--tui-inset);
}
tui-color-picker[data-empty] .tui-color-picker__preview { background: var(--cp-none), var(--cp-check); }
.tui-color-picker__field, .tui-color-picker__chan { display: grid; gap: 6px; min-width: 0; }
.tui-color-picker__field { flex: 1 1 0; }
.tui-color-picker__field > .tui-label, .tui-color-picker__chan > .tui-label { padding-left: 2px; }
.tui-key.tui-color-picker__dropper { --h: var(--cp-in); flex: none; }

/* The fields are the kit's well, as every field is. */
.tui-color-picker__input {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: var(--cp-in);
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-color-picker__input::placeholder { color: var(--tui-ink-3); }
.tui-color-picker__input:focus-visible, .tui-color-picker__input.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-color-picker__input:disabled { opacity: 0.45; cursor: not-allowed; }
.tui-color-picker__num { padding: 0 var(--tui-2); text-align: center; -moz-appearance: textfield; appearance: textfield; }
.tui-color-picker__num::-webkit-inner-spin-button, .tui-color-picker__num::-webkit-outer-spin-button { display: none; -webkit-appearance: none; }
/* An error is marked on the lip around the cut, as the kit's fields mark it. */
.tui-color-picker__input[aria-invalid="true"] { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-color-picker__chan > .tui-label { text-align: center; padding-left: 0; }
.tui-color-picker__channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--tui-2); }
tui-color-picker[alpha] .tui-color-picker__channels { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Swatches: chips of the colours on offer. The one held is ringed in two tones. */
.tui-color-picker__swatches { display: flex; flex-wrap: wrap; gap: var(--tui-2); margin: -5px; padding: 5px; }
.tui-color-picker__swatch {
  appearance: none;
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--tui-r-m);
  cursor: pointer;
  forced-color-adjust: none;
  background: linear-gradient(var(--sw), var(--sw)), var(--cp-check);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tui-ink) 30%, transparent);
}
.tui-color-picker__swatch:hover { filter: brightness(1.04); }
.tui-color-picker__swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tui-ink) 30%, transparent), 0 0 0 2px var(--tui-face-hi), 0 0 0 3.5px var(--tui-ink); }
.tui-color-picker__swatch:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-color-picker__swatch[aria-pressed="true"]:focus-visible { outline-offset: 5px; }
.tui-color-picker__swatch[aria-disabled="true"] { cursor: default; }

.tui-color-picker__contrast { margin: 0; padding-left: 2px; font: 400 var(--tui-t-small)/1.4 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-color-picker__contrast:empty, .tui-color-picker__error:empty { display: none; }
.tui-color-picker__error { margin: 0; padding-left: 2px; font-size: var(--tui-t-small); line-height: 1.4; color: var(--tui-red-ink, var(--tui-red)); }
.tui-color-picker__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Without the script: the hex field, in the well. */
tui-color-picker:not(:defined) > .tui-input, tui-color-picker:not(:defined) > input { width: 100%; }

/* A swatch key for a popover: the chip sits on the key's face. */
.tui-color-picker__chip {
  flex: none;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  forced-color-adjust: none;
  background: linear-gradient(var(--sw, transparent), var(--sw, transparent)), var(--cp-check);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tui-ink) 35%, transparent);
}
.tui-color-picker__chip[data-empty] { background: var(--cp-none), var(--cp-check); }
.tui-key > .tui-color-picker__chip { margin-left: -2px; }
.tui-popover.tui-color-picker__popover { width: min(360px, calc(100vw - 16px)); max-width: none; }

@media (pointer: coarse) {
  tui-color-picker { --cp-thumb: 26px; --cp-strip: 44px; --cp-track: 20px; --cp-plane: 200px; --cp-in: 48px; }
  .tui-color-picker__input { font-size: 16px; }
  .tui-color-picker__swatch { width: 44px; height: 44px; }
  .tui-color-picker__chip { width: 20px; height: 20px; }
}
@media (max-width: 480px) {
  .tui-color-picker__channels { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-color-picker .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: column-browser */
/* Column browser: folders as columns in one recessed well, side by side,
   divided by engraved rules, with the path printed above it. A row is the
   file tree's: a printed folder or page, the name, a count or a size, and a
   chevron for a folder; the rows chosen down the path sit in a recess, and
   the one being worked on has its lamp lit, the way the side rail marks the
   current page. A file's details stand in the last column on a small raised
   plate. In a box narrower than 520px one column shows at a time and the
   path gains a Back key. Nothing is tinted; the only colour is the lamp.
   See column-browser.mjs. */
tui-column-browser { position: relative; display: block; min-width: 0; container-type: inline-size; font-size: var(--tui-t-body); text-align: left; }
tui-column-browser > ul { margin: 0; padding-left: var(--tui-5); }
.tui-column-browser__frame { display: grid; gap: var(--tui-2); min-width: 0; }

/* The path. */
.tui-column-browser__path { display: flex; align-items: center; gap: var(--tui-1); min-width: 0; min-height: 28px; }
.tui-column-browser__path ol { display: flex; align-items: center; min-width: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; }
.tui-column-browser__path li { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; }
.tui-column-browser__path li:last-child { flex-shrink: 0; max-width: 100%; }
.tui-column-browser__path .tui-key--flat { min-width: 0; max-width: 16ch; padding: 0 var(--tui-2); overflow: hidden; text-overflow: ellipsis; }
.tui-column-browser__here { display: block; padding: 0 var(--tui-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--tui-t-small)/28px var(--tui-sans); color: var(--tui-ink); }
.tui-column-browser__sep { flex: none; width: 12px; height: 12px; color: var(--tui-ink-2); }
.tui-column-browser__back { display: none; flex: none; }

/* The well, and the columns in it. */
.tui-column-browser__cols {
  display: flex;
  height: var(--tui-column-h, 300px);
  min-width: 0;
  padding: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--tui-ink-2) 45%, transparent) transparent;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-column-browser__col {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--tui-column-w, 216px);
  min-width: 0;
  min-height: 0;
  /* An engraved rule: a dark cut with a bright edge beside it. */
  border-right: 1px solid var(--tui-rule);
  box-shadow: 1px 0 0 var(--tui-edge-hl, var(--tui-hl));
}
.tui-column-browser__list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 4px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--tui-ink-2) 45%, transparent) transparent;
}

.tui-column-browser__row {
  /* Its words for a screen reader are placed inside it, so they stay in its column and its scroll. */
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px 0 7px;
  border-radius: 6px;
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  outline: none;
}
.tui-column-browser__row:hover, .tui-column-browser__row.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
.tui-column-browser__row:focus-visible, .tui-column-browser__row.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
/* Chosen down the path: a recess. The one being worked on: its lamp lit. */
.tui-column-browser__row[aria-selected="true"] { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-column-browser__row > .tui-lamp { width: 6px; height: 6px; opacity: 0; }
/* The lamp is the kit's own, lit (data-on) by the script on that one row. */
.tui-column-browser__row[data-lit] > .tui-lamp { opacity: 1; }
.tui-column-browser__mark { display: inline-flex; flex: none; }
.tui-column-browser__mark svg { width: 15px; height: 15px; }
.tui-column-browser__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-folder > .tui-column-browser__name { font-weight: 600; color: var(--tui-ink); }
.tui-column-browser__meta { flex: none; font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-column-browser__meta:empty { display: none; }
.tui-column-browser__chev { flex: none; width: 12px; height: 12px; margin-right: -3px; color: var(--tui-ink-2); }
.tui-column-browser__sr, .tui-column-browser__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A column with nothing to list: Loading, could not open (with Retry), or empty. */
.tui-column-browser__state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2); margin: 0; padding: 10px 12px; font-size: var(--tui-t-small); line-height: 1.4; color: var(--tui-ink-2); }
.tui-column-browser__state[data-error] > span:not(.tui-lamp) { flex: 1 1 100%; order: 1; color: var(--tui-ink); }
.tui-column-browser__state[data-error] > .tui-lamp { order: 0; }
.tui-column-browser__state[data-error] > .tui-key { order: 2; }

/* The details of a chosen file. */
.tui-column-browser__preview { display: grid; align-content: start; justify-items: start; gap: 10px; flex: 0 0 var(--tui-column-preview-w, 232px); min-width: 0; padding: 14px 16px; overflow-y: auto; }
.tui-column-browser__plate {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  width: 58px;
  height: 66px;
  border-radius: 8px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-column-browser__plate svg { width: 22px; height: 22px; }
.tui-column-browser__plate b { font: 600 9.5px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-column-browser__title { margin: 0; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-column-browser__facts { display: grid; gap: 6px; margin: 0; }
.tui-column-browser__facts dt { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-column-browser__facts dd { margin: 2px 0 0; font-size: var(--tui-t-small); color: var(--tui-ink); }

/* Specimens: drawn, not live. */
tui-column-browser[data-static] .tui-column-browser__row, tui-column-browser[data-static] .tui-key { pointer-events: none; }
tui-column-browser[data-static] .tui-lamp[data-blink] { animation: none; }
/* A specimen has nothing to focus, so nothing in it scrolls: it is drawn as it stands. */
tui-column-browser[data-static] :is(.tui-column-browser__cols, .tui-column-browser__list, .tui-column-browser__preview) { overflow: hidden; }

/* A narrow box: one column at a time, and a Back key. */
@container (max-width: 519px) {
  .tui-column-browser__col:not([data-current]), .tui-column-browser__preview:not([data-current]) { display: none; }
  .tui-column-browser__col[data-current], .tui-column-browser__preview[data-current] { flex: 1 1 auto; border-right: 0; box-shadow: none; }
  .tui-column-browser__cols { overflow-x: hidden; }
  .tui-column-browser__back { display: inline-flex; }
  .tui-column-browser__path li:not(:nth-last-child(-n+2)) { display: none; }
}
@media (pointer: coarse) {
  .tui-column-browser__row { height: 44px; }
  tui-column-browser .tui-key, .tui-column-browser__path .tui-key--flat { --h: 44px; min-width: 44px; }
  .tui-column-browser__path { min-height: 44px; }
  .tui-column-browser__here { line-height: 44px; }
  .tui-column-browser__cols { height: var(--tui-column-h-coarse, 380px); }
}

/* ---------------------------------------------------------------- part: combobox */
/* Combobox: a field that filters a long list as you type. Until the script
   runs it is the kit's own select. Then the select's well holds the text,
   with a small key at its end, and the options card slides out of a slot
   under the well, as the menu's card comes out from under its key. The line
   under the finger or the arrow keys is pressed into the card; letters that
   match print heavier, never in a colour; the chosen option's lamp is lit.
   Several choices sit in the well as the tag input's tags. */
tui-combobox { position: relative; display: block; min-width: 0; }
tui-combobox[data-disabled] { opacity: 0.45; cursor: not-allowed; }

.tui-combobox__well {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 4px 38px 4px 4px;
  border-radius: calc(var(--tui-r-m) + 4px);
  cursor: text;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-combobox__well:has(.tui-combobox__input:focus-visible), tui-combobox.is-focus .tui-combobox__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] .tui-combobox__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
/* The slot the card comes out of: a dark cut along the well's foot, there while the card is out. */
.tui-combobox__well::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -5px;
  height: 3px;
  border-radius: 2px;
  background: var(--tui-rocker-bezel);
  box-shadow: var(--tui-depth-well, inset 0 1px 1px rgb(0 0 0 / 0.6), 0 1px 0 var(--tui-hl));
  opacity: 0;
  transition: opacity 120ms var(--tui-ease);
  pointer-events: none;
}
tui-combobox[data-open] .tui-combobox__well::after { opacity: 1; }
/* Hung above for want of room, the card has no slot to come out of. */
tui-combobox[data-open]:has(.tui-combobox__card[data-placed="top"]) .tui-combobox__well::after { opacity: 0; }

.tui-combobox__input {
  appearance: none;
  flex: 1 1 120px;
  min-width: 96px;
  height: 30px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
.tui-combobox__input::placeholder { color: var(--tui-ink-3); }
.tui-combobox__input:focus-visible { outline: none; }
.tui-combobox__tag { height: 30px; }

/* The key at the well's end: a small cap printed with the arrow; latched while the card is out. */
.tui-combobox__key {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink-2);
  cursor: pointer;
  background: var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-combobox__key::before { content: ''; width: 8px; height: 5px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform 150ms var(--tui-ease); }
.tui-combobox__key:hover, .tui-combobox__key.is-hover { color: var(--tui-ink); filter: brightness(1.03); }
.tui-combobox__key:active, .tui-combobox__key.is-down, tui-combobox[data-open] .tui-combobox__key { transform: translateY(1.5px); filter: brightness(0.97); box-shadow: var(--tui-pressed); color: var(--tui-ink); }
tui-combobox[data-open] .tui-combobox__key::before { transform: scaleY(-1); }

/* The card. */
.tui-combobox__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  min-width: 200px;
  max-width: calc(100vw - 16px);
  max-height: min(312px, max(160px, var(--tui-room, 312px)));
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-radius: 11px;
  font: 400 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.25),
    0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  text-align: left;
}
.tui-combobox__card:not([popover]) { position: relative; }
.tui-combobox__card[popover]:not(:popover-open) { display: none; }
.tui-combobox__card:popover-open { animation: tui-combobox-out 150ms var(--tui-ease); }
.tui-combobox__card[data-placed="top"]:popover-open { animation-name: tui-combobox-up; }
@keyframes tui-combobox-out { from { opacity: 0; transform: translateY(-6px); } }
@keyframes tui-combobox-up { from { opacity: 0; transform: translateY(6px); } }
/* Opened but not yet placed: unseen for that frame. */
.tui-combobox__card:popover-open:not([data-placed]) { opacity: 0; }

.tui-combobox__list [role="group"] { display: grid; }
.tui-combobox__list [role="group"] + [role="group"] { margin-top: 3px; padding-top: 3px; border-top: 1px solid var(--tui-rule); }
.tui-combobox__heading { padding: 8px 10px 5px 33px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-combobox__option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 34px;
  padding: 0 10px 0 9px;
  border-radius: 7px;
  font: 500 var(--tui-t-body)/1.25 var(--tui-sans);
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* The lamp: off until the option is chosen. Amber for the one chosen from a list, green for each of several. */
.tui-combobox__option::before {
  --c: var(--tui-amber);
  content: '';
  justify-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 1px 0 var(--tui-hl);
}
[aria-multiselectable="true"] .tui-combobox__option::before { --c: var(--tui-green); }
.tui-combobox__option[data-chosen]::before { color: var(--c); background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--c); box-shadow: var(--tui-glow); }
.tui-combobox__option[data-chosen] { color: var(--tui-ink); }
.tui-combobox__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Matched letters: heavier printing in the full ink. */
.tui-combobox__option b { font-weight: 700; color: var(--tui-ink); }
.tui-combobox__hint { font: 400 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }
.tui-combobox__hint b { font-weight: 600; }
/* Under the finger or the arrow keys: pressed into the card. */
.tui-combobox__option.is-active, .tui-combobox__option.is-hover { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-combobox__option[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-combobox__empty, .tui-combobox__wait { display: flex; align-items: center; gap: var(--tui-2); margin: 0; padding: 10px 12px 11px; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-combobox__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Quiet: the slot is a hairline, as every edge is there. */
@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-combobox__well::after { height: 1px; bottom: -4px; background: var(--tui-quiet-line-2); box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tui-combobox__card:popover-open { animation: none; }
}

/* A finger needs 44px (kit/src/core.css, a fingertip's reach). The key at the well's end keeps its 30px cap and takes a
   44px press area all round (its ::before is the printed arrow). Chosen tags are the tag input's, which reach on their own. */
@media (pointer: coarse) {
  .tui-combobox__key::after { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
}

/* ---------------------------------------------------------------- part: command */
/* Command palette: a modal plate whose entry line is a display. What you type
   glows in the vacuum-fluorescent window, with the count of matches beside
   it; the results are printed on the plate below, the chosen one pressed into
   it. Shortcuts are shown as the keys you would press. Native <dialog>. */
.tui-command {
  width: min(600px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 24px));
  margin: 12vh auto auto;
  padding: 0;
  border: 0;
  /* The same as the gap to the display window and the rows, so their corners are free. */
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.3), 0 30px 60px -20px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)));
  overflow: hidden;
}
.tui-command[open] { display: flex; flex-direction: column; }
.tui-command::backdrop { background: var(--tui-backdrop); }
/* A key opens it, many times a day: it fades in and out in 90ms and does not travel. */
dialog.tui-command, dialog.tui-command::backdrop { transition: opacity 90ms var(--tui-ease), overlay 90ms allow-discrete, display 90ms allow-discrete; }
dialog.tui-command:not([open]), dialog.tui-command:not([open])::backdrop { opacity: 0; }
@starting-style { dialog.tui-command[open], dialog.tui-command[open]::backdrop { opacity: 0; } }
/* While it is open the page behind holds still: a wheel or a swipe over the plate or its backdrop never scrolls it
   (the list scrolls itself, and stops at its ends). The gutter is kept, so nothing behind moves sideways either. */
.tui-command { overscroll-behavior: contain; }
:root:has(.tui-command[open]:modal) { overflow: hidden; scrollbar-gutter: stable; }
/* In a page (a specimen): a plate in the flow. */
.tui-command--inline { display: flex; flex-direction: column; position: static; margin: 0; width: 100%; }

/* The entry line: a VFD window, a prompt, the query, the count. */
.tui-command__display {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  margin: 12px 12px 4px;
  padding: 0 14px 0 16px;
  border-radius: 8px;
  color: var(--tui-vfd);
  background:
    linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.025) 0 1px, transparent 1px 3px),
    var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.8), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  font: 400 17px/1 var(--tui-mono);
  text-shadow: 0 0 6px color-mix(in oklab, var(--tui-vfd) 55%, transparent), 0 0 18px color-mix(in oklab, var(--tui-vfd) 18%, transparent);
}
.tui-command__display::before { content: '›'; flex: none; font-size: 20px; opacity: 0.7; }
.tui-command__display:has(:focus-visible) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-command__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  font: inherit;
  letter-spacing: -0.01em;
  color: inherit;
  text-shadow: inherit;
  caret-color: var(--tui-vfd);
  background: none;
}
.tui-command__input:focus-visible { outline: none; }
.tui-command__input::placeholder { color: color-mix(in oklab, var(--tui-vfd) 55%, transparent); text-shadow: none; }
.tui-command__input::-webkit-search-cancel-button { display: none; }
.tui-command__count { flex: none; font: 500 11px/1 var(--tui-mono); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* The results. */
.tui-command__list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 12px; scrollbar-width: thin; }
.tui-command__group { display: grid; }
.tui-command__group + .tui-command__group { margin-top: 4px; }
.tui-command__heading {
  padding: 12px 10px 6px;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
}
.tui-command__item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  min-height: 40px;
  padding: 0 10px 0 11px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
}
.tui-command__item > svg { width: 16px; height: 16px; color: var(--tui-ink-2); }
.tui-command__item > :not(svg, kbd, .tui-command__keys, .tui-lamp):not(:first-child) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-command__item small { margin-left: 8px; font-size: var(--tui-t-small); font-weight: 400; color: var(--tui-ink-2); }
.tui-command__item[aria-selected="true"], .tui-command__item.is-hover {
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-command__item[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* A shortcut is drawn as the keys to press: small caps on a skirt.
   (:nth-child(n) only lifts the rule over a page's own kbd styling.) */
:is(.tui-command__keys, .tui-command__foot) kbd:nth-child(n) {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font: 600 10.5px/1 var(--tui-sans);
  letter-spacing: 0;
  color: var(--tui-ink-2);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 3px rgb(var(--tui-sh) / 0.2));
}
.tui-command__keys { display: inline-flex; gap: 4px; grid-column: 3; }

.tui-command__empty { display: grid; justify-items: center; gap: 8px; margin: 0; padding: 30px 16px 34px; text-align: center; color: var(--tui-ink-2); }
.tui-command__empty .tui-status { color: var(--tui-ink); font-weight: 600; font-size: var(--tui-t-body); }

.tui-command__foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--tui-rule);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink-2);
}
.tui-command__foot > span { display: inline-flex; align-items: center; gap: 6px; }
.tui-command__foot > :last-child { margin-left: auto; }

/* ---------------------------------------------------------------- part: commit */
/* Commit key: a kit key standing in its own cut in the plate. Pressed, it
   latches 2px deeper than a press — below the lip of the cut — and a 4×4 LED
   matrix in its face scans amber until the work is done: a green tick and
   the cap springs back, or a red cross and it pops back. The guarded version
   has a hinged smoked cover over the cut, lifted by the first press. Any
   other box can wear the same cover and hinge: make it .tui-guarded
   (position: relative), put a .tui-commit__cover span inside and set data-cover;
   --guard-p (the eye distance, 420px) and --guard-a (the lift, 98deg) fit it to a bigger box.
   commit.mjs builds the matrix and the legends and runs the states. */

tui-commit {
  position: relative;
  display: inline-grid;
  vertical-align: middle;
}

/* The cut: the key's own hole in the plate. Its lower lip sits where the
   skirt meets the plate, so a latched cap goes under it. */
.tui-commit__cut {
  display: inline-grid;
  align-self: start;
  justify-self: start;
  padding: 3px 3px 2px;
  border-radius: 10px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: hidden;
  min-width: max-content;
}
tui-commit:has(.tui-key--lg) .tui-commit__cut { padding-bottom: 3px; border-radius: 12px; }
tui-commit:has(.tui-key--sm) .tui-commit__cut { padding: 2px 2px 1.5px; border-radius: 8px; }
tui-commit:has(.tui-commit__key:focus-visible) .tui-commit__cut, tui-commit.is-focus .tui-commit__cut { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-commit__key:focus-visible { outline: none; }

.tui-commit__key { --m: 15px; padding-left: calc(var(--tui-4) - 3px); }
.tui-commit__key.tui-key--lg { --m: 18px; padding-left: calc(var(--tui-6) - 6px); }
.tui-commit__key.tui-key--sm { --m: 12px; padding-left: var(--tui-2); }

/* Busy: latched, a skirt and 2px down, shaded deep by the cut's upper wall. */
tui-commit[data-state="busy"] .tui-commit__key {
  transform: translateY(calc(var(--skirt) + 2px));
  filter: brightness(0.95);
  opacity: 1;
  cursor: progress;
  box-shadow:
    var(--tui-depth-pressed, inset 0 7px 6px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 3.4)),
    inset 4px 0 4px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    inset -4px 0 4px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3)));
}
tui-commit[data-state="busy"] .tui-commit__key:hover { filter: brightness(0.95); }
/* Done: it springs back up past its rest by a pixel, and settles. Failed: it pops straight back. */
tui-commit[data-state="done"] .tui-commit__key { animation: tui-commit-spring 280ms var(--tui-ease); }
tui-commit[data-state="failed"] .tui-commit__key { animation: tui-commit-pop 120ms ease-out; }
@keyframes tui-commit-spring {
  from { transform: translateY(calc(var(--skirt) + 2px)); }
  55% { transform: translateY(-1px); }
  to { transform: none; }
}
@keyframes tui-commit-pop { from { transform: translateY(calc(var(--skirt) + 2px)); } }

/* The legends share one cell, so the key is always as wide as the longest
   and never moves when the words change. Printed beside the window. */
.tui-commit__legend { display: grid; }
.tui-commit__legend > span {
  grid-area: 1 / 1;
  text-align: left;
  visibility: hidden;
  opacity: 0;
  transition: opacity 110ms var(--tui-ease), visibility 0s linear 110ms;
}
tui-commit:not([data-state]) [data-for="idle"], tui-commit[data-state="idle"] [data-for="idle"],
tui-commit[data-state="busy"] [data-for="busy"], tui-commit[data-state="done"] [data-for="done"], tui-commit[data-state="failed"] [data-for="failed"] {
  visibility: visible;
  opacity: 1;
  transition: opacity 110ms var(--tui-ease) 60ms, visibility 0s;
}

/* The matrix: sixteen LEDs behind a small dark window in the cap. */
.tui-commit__matrix {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1px;
  width: var(--m);
  height: var(--m);
  padding: calc((var(--m) - 3px) * 0.14);
  border-radius: 3px;
  background:
    linear-gradient(160deg, rgb(255 255 255 / 0.09), transparent 45%),
    var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(0 0 0 / 0.85), inset 0 0 0 0.5px rgb(255 255 255 / 0.06), 0 1px 0 var(--tui-hl));
}
.tui-commit__matrix i {
  --led: var(--tui-amber);
  position: relative;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-vfd) 17%, var(--tui-vfd-bg));
  box-shadow: inset 0 0.5px 0.5px rgb(0 0 0 / 0.6);
}
.tui-commit__matrix i::after {
  content: '';
  position: absolute;
  inset: -0.25px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgb(255 255 255 / 0.75), transparent 55%), var(--led);
  box-shadow: 0 0 2.5px 0.5px color-mix(in oklab, var(--led) 75%, transparent);
  opacity: 0;
}
/* Busy: a wave of amber from the top left corner. */
tui-commit[data-state="busy"] .tui-commit__matrix i::after {
  animation: tui-commit-scan 1000ms linear calc(var(--d) * 90ms) infinite both;
}
@keyframes tui-commit-scan {
  0%, 100% { opacity: 0.12; }
  18% { opacity: 1; }
  48% { opacity: 0.3; }
}
/* Done: a tick drawn in green, stroke by stroke. Failed: a red cross. */
tui-commit[data-state="done"] .tui-commit__matrix i { --led: var(--tui-green); }
tui-commit[data-state="done"] .tui-commit__matrix :is(i:nth-child(8), i:nth-child(9), i:nth-child(11), i:nth-child(14))::after { opacity: 1; animation: tui-commit-on 160ms var(--tui-ease) both; }
tui-commit[data-state="done"] .tui-commit__matrix i:nth-child(14)::after { animation-delay: 50ms; }
tui-commit[data-state="done"] .tui-commit__matrix i:nth-child(11)::after { animation-delay: 100ms; }
tui-commit[data-state="done"] .tui-commit__matrix i:nth-child(8)::after { animation-delay: 150ms; }
tui-commit[data-state="failed"] .tui-commit__matrix i { --led: var(--tui-red); }
tui-commit[data-state="failed"] .tui-commit__matrix :is(i:nth-child(1), i:nth-child(4), i:nth-child(6), i:nth-child(7), i:nth-child(10), i:nth-child(11), i:nth-child(13), i:nth-child(16))::after { opacity: 1; }
@keyframes tui-commit-on { from { opacity: 0; } }

/* What failed, printed under the key; the live region says it too. Leave a line of room below a commit key. */
tui-commit[data-state="failed"][data-why]::after {
  content: attr(data-why);
  position: absolute;
  top: calc(100% + 6px);
  left: 3px;
  font: 500 var(--tui-t-small)/1.3 var(--tui-sans);
  color: var(--tui-ink-2);
  white-space: nowrap;
}

/* The guard: a smoked cover hinged along the top of the cut. The first
   press lifts it past upright; it drops again when the key goes idle. */
:is(tui-commit[data-guard], .tui-guarded)::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: -3px;
  left: 14px;
  right: 14px;
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(90deg, transparent 0 22%, rgb(var(--tui-sh) / 0.35) 22% calc(22% + 1px), transparent calc(22% + 1px) calc(78% - 1px), rgb(var(--tui-sh) / 0.35) calc(78% - 1px) 78%, transparent 78%),
    var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 70%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)));
  pointer-events: none;
}
.tui-commit__cover {
  --rim: color-mix(in oklab, var(--tui-ink) 24%, transparent);
  position: absolute;
  z-index: 1;
  inset: -2px;
  border-radius: 13px;
  pointer-events: none;
  transform-origin: 50% 0;
  transform: perspective(var(--guard-p, 420px)) rotateX(0deg);
  transition: transform 260ms var(--tui-ease);
  /* Clear, lightly smoked polycarbonate: a tint, one soft reflection, and edges that catch. */
  background:
    linear-gradient(112deg, transparent 22%, color-mix(in oklab, var(--tui-hl) 38%, transparent) 34%, transparent 47%),
    linear-gradient(rgb(var(--tui-sh) / 0.07), rgb(var(--tui-sh) / 0.16));
  box-shadow:
    var(--tui-depth-plate, inset 0 0 0 1px var(--rim),
    inset 0 1.5px 0 var(--tui-hl),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 50%, transparent),
    inset 0 0 0 2.5px color-mix(in oklab, var(--tui-hl) 25%, transparent),
    0 3px 5px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)));
}
/* The finger tab. */
.tui-commit__cover::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 28px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 0 0 5px 5px;
  background: linear-gradient(rgb(var(--tui-sh) / 0.1), rgb(var(--tui-sh) / 0.2));
  box-shadow: var(--tui-depth-plate, inset 0 0 0 1px var(--rim), inset 0 -1px 0 var(--tui-hl), 0 2px 3px -1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)));
  clip-path: inset(2px -4px -4px -4px);
}
:is(tui-commit, .tui-guarded)[data-cover="open"] .tui-commit__cover { transform: perspective(var(--guard-p, 420px)) rotateX(var(--guard-a, 98deg)); }
/* Covered, the key does not move: the first press goes into the cover. */
tui-commit[data-guard]:not([data-cover="open"]) .tui-commit__key:active {
  transform: none;
  filter: none;
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 var(--skirt) 0 var(--tui-skirt), 0 calc(var(--skirt) + 1px) 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)));
}
tui-commit[data-guard]:not([data-cover="open"]):has(.tui-commit__key:active) .tui-commit__cover { transform: perspective(420px) rotateX(-3deg); transition-duration: 70ms; }

/* Spoken, not shown. */
.tui-commit__said, .tui-commit__note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  /* No scan and no spring: a steady amber matrix. Every state still shows. */
  tui-commit[data-state] .tui-commit__matrix i::after, tui-commit[data-state] .tui-commit__key { animation: none !important; }
  tui-commit[data-state="busy"] .tui-commit__matrix i::after { opacity: 0.85; }
  .tui-commit__cover, .tui-commit__legend > span { transition: none !important; }
}

/* ---------------------------------------------------------------- part: compare-table */
/* Compare table: plans or products as columns, features as rows. The head is
   pinned to the top of the box and the feature names to its left; one column
   may be lifted and ringed as the one to look at. A mark is a shape and a word
   (a disc with a tick, a dash, a half disc), so it reads without colour; the
   word is read aloud, and the shapes are what a sighted reader sees. On a phone
   the table keeps its width and scrolls inside its own box, which the keyboard
   can reach, so the page never scrolls sideways. */
.tui-compare {
  --cmp-first: 150px;
  --cmp-col: 132px;
  position: relative;
  max-height: var(--cmp-height, min(76vh, 620px));
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--cmp-bg, var(--tui-face));
  box-shadow: var(--tui-depth-plate, inset 0 0 0 1px var(--tui-rule));
}
.tui-compare:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-compare__table { width: 100%; min-width: calc(var(--cmp-first) + var(--cmp-col) * 3); border-collapse: separate; border-spacing: 0; font: 500 var(--tui-t-body)/1.35 var(--tui-sans); text-align: left; }
.tui-compare__caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-compare__sr, .tui-compare__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tui-compare__table :is(th, td) { padding: 12px var(--tui-3); border-bottom: 1px solid var(--tui-rule); vertical-align: middle; background: var(--cmp-bg, var(--tui-face)); }
.tui-compare__table tbody tr:last-child > :is(th, td), .tui-compare__table tfoot td { border-bottom: 0; }
/* The head: pinned to the top. */
.tui-compare__table thead :is(th, td) { position: sticky; top: 0; z-index: 2; vertical-align: bottom; padding-top: var(--tui-3); box-shadow: inset 0 -1px 0 var(--tui-rule); border-bottom: 0; }
.tui-compare__table thead th { min-width: var(--cmp-col); font-weight: 600; }
.tui-compare__plan { display: block; font: 600 var(--tui-t-lead)/1.2 var(--tui-sans); }
.tui-compare__price { display: block; margin-top: 2px; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-compare__plan-note { display: block; font: 400 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-compare__tag { display: block; margin-bottom: 4px; font: 600 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink); }
/* The feature names: pinned to the left. */
.tui-compare__table tbody th[scope="row"], .tui-compare__table tfoot th[scope="row"], .tui-compare__corner { position: sticky; left: 0; z-index: 1; width: var(--cmp-first); min-width: var(--cmp-first); font-weight: 500; }
.tui-compare__corner { z-index: 3; }
.tui-compare__table thead .tui-compare__corner { z-index: 3; }
.tui-compare__group th { position: static; padding: 14px var(--tui-3) 6px; font: 600 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); border-bottom: 1px solid var(--tui-rule); }
.tui-compare__group th[scope="rowgroup"] { left: 0; }
.tui-compare__table td { font-variant-numeric: tabular-nums; }
/* The featured column: lifted, with a rule down each side. */
.tui-compare__table [data-featured] { background: color-mix(in oklab, var(--tui-face-hi) 85%, var(--cmp-bg, var(--tui-face))); box-shadow: inset 1px 0 0 var(--tui-ink), inset -1px 0 0 var(--tui-ink); }
.tui-compare__table thead [data-featured] { box-shadow: inset 1px 0 0 var(--tui-ink), inset -1px 0 0 var(--tui-ink), inset 0 1px 0 var(--tui-ink), inset 0 -1px 0 var(--tui-rule); border-radius: 6px 6px 0 0; }
.tui-compare__table tfoot [data-featured] { box-shadow: inset 1px 0 0 var(--tui-ink), inset -1px 0 0 var(--tui-ink), inset 0 -1px 0 var(--tui-ink); border-radius: 0 0 6px 6px; }

/* The marks. */
.tui-compare__mark { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }
.tui-compare__mark svg { width: 16px; height: 16px; }
.tui-compare__mark[data-state="yes"] { color: var(--tui-face); background: var(--tui-ink); }
.tui-compare__mark[data-state="no"] { color: var(--tui-ink-2); }
.tui-compare__mark[data-state="partial"] { color: var(--tui-ink); }
.tui-compare__note { margin-left: 8px; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); vertical-align: middle; }
.tui-compare__figure { font-weight: 600; }

@media (pointer: coarse) {
  .tui-compare { --cmp-first: 128px; --cmp-col: 120px; }
  .tui-compare__table tfoot .tui-key { --h: 44px; min-width: 44px; }
  .tui-compare__table :is(th, td) { padding-block: 14px; }
}
@media (max-width: 560px) {
  .tui-compare { --cmp-first: 116px; --cmp-col: 116px; }
  .tui-compare__table :is(th, td) { padding-inline: var(--tui-2); }
}

/* ---------------------------------------------------------------- part: composer */
/* Composer: the prompt box. One deep recess holds the text, and the keys sit
   on its floor: attach at one end; at the other a small LCD that counts tokens
   (amber near the limit, red over it) and the send key, which becomes a stop
   key while the reply runs. It is a real form: a labelled <textarea> and real
   buttons. The text grows with what is typed up to a height, then scrolls. The
   well's radius is the key's plus the floor around it, so the corners agree. */
.tui-composer { display: grid; gap: 6px; min-width: 0; margin: 0; }
/* The label is there for the field and read aloud; a composer is rarely printed with one. */
.tui-composer__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-composer--labelled .tui-composer__label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; padding-left: 2px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }

.tui-composer__well {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 13px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-composer__well:has(.tui-composer__input:focus-visible), .tui-composer__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-composer__input {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  max-height: var(--tc-max, 220px);
  margin: 0;
  padding: 8px 8px 4px;
  border: 0;
  border-radius: 7px;
  resize: none;
  field-sizing: content;
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
.tui-composer__input::placeholder { color: var(--tui-ink-3); }
.tui-composer__input:disabled { opacity: 0.55; cursor: not-allowed; }

.tui-composer__files:empty { display: none; }
.tui-composer__files { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 0; }
.tui-composer__file { gap: 4px; max-width: 100%; text-transform: none; letter-spacing: 0.01em; font-weight: 500; font-size: 11.5px; }
.tui-composer__file > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-composer__file button { display: grid; flex: none; place-items: center; width: 22px; height: 22px; margin: 0 -6px 0 0; padding: 0; border: 0; border-radius: 3px; background: none; color: var(--tui-ink-2); cursor: pointer; }
.tui-composer__file button:hover { color: var(--tui-ink); }
.tui-composer__file button:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
.tui-composer__file button svg { width: 10px; height: 10px; }

/* The floor: attach at the start, the rest at the end. */
.tui-composer__bar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tui-composer__bar .tui-key--icon { --h: 32px; }
.tui-composer__send, .tui-composer__stop { --h: 34px; margin-left: 0; }
.tui-composer__tail { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.tui-composer__count { flex: none; font-size: 14px; transition: background-color 160ms var(--tui-ease), box-shadow 160ms var(--tui-ease); }
.tui-composer__count[data-state="warn"] {
  background: linear-gradient(170deg, rgb(255 255 255 / 0.22), transparent 40%), color-mix(in oklab, var(--tui-amber) 88%, var(--tui-lcd));
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 0 var(--tui-hl), 0 0 12px -2px color-mix(in oklab, var(--tui-amber) 65%, transparent);
}
.tui-composer__count[data-state="over"] {
  background: linear-gradient(170deg, rgb(255 255 255 / 0.22), transparent 40%), color-mix(in oklab, var(--tui-red) 66%, var(--tui-lcd));
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 0 var(--tui-hl), 0 0 12px -2px color-mix(in oklab, var(--tui-red) 65%, transparent);
}
.tui-composer__unit { font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }

/* While it runs: the send key gives way to the stop key, and a lamp blinks beside the count. */
.tui-composer__stop, .tui-composer__run { display: none; }
.tui-composer[data-running] .tui-composer__send { display: none; }
.tui-composer[data-running] .tui-composer__stop { display: inline-flex; }
.tui-composer[data-running] .tui-composer__run { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); }

.tui-composer__help { margin: 0; padding-left: 4px; font-size: 11.5px; color: var(--tui-ink-2); }
.tui-composer__help .tui-kbd { margin: 0 1px; }
/* Said aloud, never seen: the limit, and the sentence when it is crossed. */
.tui-composer__limit, .tui-composer__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-composer { position: relative; }

@media (pointer: coarse) {
  .tui-composer__bar .tui-key--icon { --h: 44px; }
  .tui-composer__send, .tui-composer__stop { --h: 44px; }
  .tui-composer__input { font-size: 16px; min-height: 48px; }
  .tui-composer__help { display: none; }
  .tui-composer__file button { width: 32px; height: 32px; }
}
@media (max-width: 400px) {
  .tui-composer__unit { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-composer__count { transition: none; }
  .tui-composer__run .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: consent-flap */
/* Consent flap: a plate pinned to the page foot. Its face (the line and three
   actions) is hinged along its top edge; pressing Choose tilts it up and lets
   the panel under it drop open, baring three rocker switches. Pressing Save
   choices closes the panel and swings the face back down flat, with a small
   overshoot that reads as a latch catching. The panel is `hidden` when shut,
   so its switches are never in the tab order until the face is open. */
.tui-consentflap {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: var(--tui-3);
  pointer-events: none;
}
.tui-consentflap__form {
  pointer-events: auto;
  width: min(100%, 600px);
  perspective: 1400px;
}
.tui-consentflap__face {
  position: relative;
  transform-origin: top center;
  transform: rotateX(0deg);
  background: var(--tui-face);
  border-radius: var(--tui-r-l);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 10px 24px -14px rgb(var(--tui-sh) / 0.35));
  padding: var(--tui-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-3);
  transition: transform 320ms var(--tui-ease), border-radius 320ms var(--tui-ease);
}
.tui-consentflap__line { margin: 0; flex: 1 1 240px; min-width: 0; color: var(--tui-ink-2); text-wrap: pretty; }
.tui-consentflap__actions { display: flex; flex-wrap: wrap; gap: var(--tui-2); }

/* The panel: the compartment the face covers when shut. It sits right under
   the face in the same plate, closed to nothing and opened to its content's
   height, so there is no jump when it appears. */
.tui-consentflap__panel {
  overflow: hidden;
  background: var(--tui-face);
  border-radius: 0 0 var(--tui-r-l) var(--tui-r-l);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)));
  margin-top: 2px;
  padding: 0 var(--tui-4);
  max-height: 0;
  transition: max-height 320ms var(--tui-ease), padding 320ms var(--tui-ease);
}
.tui-consentflap__panel:not([hidden]) { max-height: 220px; padding: var(--tui-3) var(--tui-4) var(--tui-4); }
.tui-consentflap__switches { display: flex; flex-wrap: wrap; gap: var(--tui-4); margin: 0 0 var(--tui-3); border: 0; padding: 0; }
.tui-consentflap__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tui-consentflap__switch { flex-direction: row-reverse; gap: var(--tui-2); }
.tui-consentflap__panel .tui-key--primary { width: 100%; justify-content: center; }

/* Open: the face tilts up on its hinge, revealing the panel below it as its own
   top corners square off to meet the face's bottom edge. */
.tui-consentflap[data-open="true"] .tui-consentflap__face { transform: rotateX(-10deg); border-radius: var(--tui-r-l) var(--tui-r-l) 0 0; }

/* Shutting: the face overshoots flat before it settles, reading as the latch
   catching, then the whole plate gets a brief, tiny downward nudge. */
.tui-consentflap.is-latching .tui-consentflap__face { transition: transform 220ms cubic-bezier(0.3, 1.8, 0.4, 1), border-radius 220ms var(--tui-ease); }
.tui-consentflap.is-latching .tui-consentflap__form { animation: tui-consentflap-latch 220ms var(--tui-ease); }
@keyframes tui-consentflap-latch { 0% { transform: translateY(0); } 55% { transform: translateY(2px); } 100% { transform: translateY(0); } }

.tui-consentflap__said { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Not fixed to the window (the live demo stage, a specimen, a docs cell): it
   sits in the flow, at the width it is given. */
[data-stage-bay] .tui-consentflap, [data-specimen] .tui-consentflap, [data-states-row] .tui-consentflap {
  position: relative;
  inset: auto;
  padding: 0;
  pointer-events: auto;
}

@media (pointer: coarse) {
  .tui-consentflap .tui-key--sm { --h: 44px; padding: 0 var(--tui-4); font-size: var(--tui-t-body); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-consentflap__face, .tui-consentflap__panel { transition: none; }
  .tui-consentflap.is-latching .tui-consentflap__form { animation: none; }
}

/* ---------------------------------------------------------------- part: context-menu */
/* Context menu: the menu's own card, opened where you pointed. This file only
   dresses the thing it opens on: a target that says it has a menu, sinks a
   little while a touch is being held towards the long-press, and stays sunk
   while its card is out. The card is .tui-menu; see menu.css. */
.tui-context {
  position: relative;
  cursor: context-menu;
  border-radius: var(--tui-r-m);
  -webkit-touch-callout: none;
  transition: background-color 500ms linear, box-shadow 500ms linear;
}
.tui-context:focus-visible, .tui-context.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-context:hover, .tui-context.is-hover { box-shadow: inset 0 0 0 1px var(--tui-rule); }
/* Held towards a long-press: the target sinks over the half second it takes. */
.tui-context[data-pressing] {
  user-select: none;
  -webkit-user-select: none;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* Its card is out: the target stays down, as a key whose menu is open does. */
.tui-context[data-context-open], .tui-context.is-open {
  transition: none;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* The line that says how: printed under or beside the target. */
.tui-context__hint { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
@media (prefers-reduced-motion: reduce) { .tui-context { transition: none; } }

/* ---------------------------------------------------------------- part: copy-key */
/* Copy key: a key that copies a value. Its lamp sits in the cap, dark at
   rest; when the text has been copied the lamp lights green, winks once, and
   the legend says Copied until it goes back to its old word. If the browser
   refuses the clipboard the lamp lights amber and the text is selected for
   the keyboard instead. The cap is the kit's key and its volumes are the
   key's; the one thing here that is not is the little well that holds the
   text to select when the key has no text on the page of its own. */
.tui-copy-key { min-width: 76px; }
.tui-copy-key__legend { display: inline-block; min-width: 6.5ch; text-align: center; }
.tui-copy-key[data-state="copied"] .tui-lamp, .tui-copy-key[data-state="selected"] .tui-lamp {
  color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c);
  box-shadow: var(--tui-glow);
}
.tui-copy-key[data-state="copied"] .tui-lamp { animation: tui-copy-wink 360ms steps(1) 1; }
@keyframes tui-copy-wink { 0% { opacity: 1; } 35% { opacity: 0.2; } 70% { opacity: 1; } }
/* Said aloud, never seen. */
.tui-copy-key__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The text to take by hand, when the clipboard said no and the key has no text of its own to select. */
.tui-copy-key__fallback {
  appearance: none;
  box-sizing: border-box;
  width: min(100%, 20ch);
  height: 36px;
  min-width: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 400 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-copy-key__fallback:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
@media (pointer: coarse) {
  .tui-copy-key { --h: 44px; min-width: 76px; }
  .tui-copy-key__fallback { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-copy-key { transition: none; }
  .tui-copy-key[data-state="copied"] .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: darkroom-tray */
/* Darkroom tray: a print developing in a shallow enamel tray under a red
   safelight, then lifted out by a pair of tongs and pegged to a drying line.
   Everything here is drawn: the tray is an object (a shallow tray seen from
   slightly above, a thin rolled rim all the way round, low inner walls
   darkening to the floor, ribs on the floor), the developer is a surface
   filling the tray with a drifting specular band, a meniscus at the walls and
   slow concentric ripples, and the print is a layered landscape (sky, three
   ridges, a lake, pines) with paper grain from the kit's own feTurbulence
   noise. No image file, no photo, no fetched picture.
   One number, --dev (0 to 1, set on .tui-darkroomtray__print from value),
   drives every layer's own opacity curve and the image's contrast, so the
   sky comes up first, then the ridges, then the lake, and the shadows deepen
   last: a print coming up in developer, not one fade.
   Every colour is a kit token or a color-mix of tokens, so all four finish
   families follow. */

/* The element itself is the block the tray is drawn in: it takes its
   container's width, so .tui-darkroomtray can be a share of the stage. */
tui-darkroom-tray { display: block; width: 100%; }

.tui-darkroomtray {
  --dt-enamel: color-mix(in oklab, var(--tui-paper-hi) 62%, var(--tui-face-hi));
  --dt-enamel-hi: color-mix(in oklab, var(--dt-enamel) 84%, var(--tui-paper-hi));
  --dt-enamel-lo: color-mix(in oklab, var(--dt-enamel) 44%, var(--tui-skirt));
  --dt-well: color-mix(in oklab, var(--dt-enamel-lo) 56%, var(--tui-skirt));
  /* The print is paper with ink on it, so its colours are mixed from the
     paper tokens: the picture keeps its tonal range in every finish, the way
     a photograph does. */
  --dt-ridge: color-mix(in oklab, var(--tui-green) 42%, var(--tui-paper-ink-2));
  position: relative;
  display: grid;
  justify-items: start;
  gap: var(--tui-2);
  width: 70%;
  min-width: 220px;
  max-width: 100%;
  margin-inline: auto;
}
/* On a phone the tray takes the bay's whole width, less its own gutter. */
@media (max-width: 600px) { .tui-darkroomtray { width: 100%; } }

.tui-darkroomtray__stage { position: relative; width: 100%; }
.tui-darkroomtray__scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 520 / 452;
}

/* The bench: the shadow the tray sits in, so it stands on something. No
   plate, no edge of its own. */
.tui-darkroomtray__bench {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 40%;
  bottom: -2%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(56% 52% at 50% 66%, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.55)), transparent 72%);
}

/* The line: a rod across the back of the bench, a spare peg parked on it. */
.tui-darkroomtray__line {
  position: absolute;
  left: 1%;
  right: 1%;
  top: 2.2%;
  height: 2px;
  z-index: 0;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--tui-face-hi), color-mix(in oklab, var(--tui-face-lo) 70%, var(--tui-ink-3)));
  box-shadow: 0 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7));
}
.tui-darkroomtray__peg,
.tui-darkroomtray__clip {
  position: absolute;
  width: 2%;
  aspect-ratio: 1 / 1.9;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(90deg, var(--tui-paper) 0 18%, var(--tui-paper-hi) 34% 62%, var(--tui-paper) 84% 100%);
  box-shadow: 0 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), inset 0 1px 0 var(--tui-hl);
}
/* The two legs of a peg, cut down the middle. */
.tui-darkroomtray__peg::after,
.tui-darkroomtray__clip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 34%;
  width: 1px;
  height: 62%;
  background: color-mix(in oklab, var(--tui-paper-ink-2) 60%, transparent);
}
.tui-darkroomtray__peg { left: 63%; top: 1px; margin-left: -1%; }
/* Hung: the peg straddles the line and clips the print's top edge. */
.tui-darkroomtray__clip { left: 50%; top: 0.5%; margin-left: -1%; z-index: 5; }

/* The tray: shallow enamel, seen from a little above. The body is the rim
   and the outside of the walls; the well is cut into it. */
.tui-darkroomtray__tray {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 31%;
  bottom: 3%;
  z-index: 1;
  border-radius: 6.5% / 8%;
  background: linear-gradient(180deg, var(--dt-enamel-hi) 0 5%, var(--dt-enamel) 42%, color-mix(in oklab, var(--dt-enamel) 86%, var(--tui-skirt)) 94%, var(--dt-enamel-hi) 100%);
  box-shadow:
    0 1px 0 color-mix(in oklab, var(--tui-hl) 65%, transparent),
    0 16px 24px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)),
    0 4px 7px -5px rgb(var(--tui-sh) / var(--tui-sh-a));
}
/* The rolled rim: a bright fold, the shade under it, and the light caught
   along the top of the fold. */
.tui-darkroomtray__tray::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 2px var(--dt-enamel-hi),
    inset 0 0 0 3.5px color-mix(in oklab, var(--dt-enamel-lo) 82%, var(--dt-enamel)),
    inset 0 3px 0 -1.5px color-mix(in oklab, var(--tui-hl) 55%, var(--dt-enamel-hi)),
    inset 0 -3px 0 -1.5px color-mix(in oklab, var(--dt-enamel) 70%, var(--tui-paper-hi));
}
/* The well: the thin wall and the floor, darkening from the rim. The same
   thin band all the way round, so the front rim is the back rim and the tray
   stays shallow. */
.tui-darkroomtray__tray::after {
  content: '';
  position: absolute;
  inset: 2.6% 1.8%;
  border-radius: 5% / 6.5%;
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--dt-well) 78%, var(--tui-skirt)) 0%,
    var(--dt-well) 20%,
    color-mix(in oklab, var(--dt-well) 90%, var(--dt-enamel-lo)) 62%,
    color-mix(in oklab, var(--dt-well) 72%, var(--dt-enamel)) 100%);
  box-shadow:
    inset 0 7px 7px -5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6)),
    inset 0 -4px 4px -4px color-mix(in oklab, var(--tui-hl) 60%, transparent);
}
/* The ribs that stiffen a real tray's floor, drawn on the bare floor in front
   of the print and not level with it: the mask clears them above the print's
   lower edge while it lies in the tray, so no rib runs across the picture and
   reads as a stripe; with the print on the line the floor is bare and the
   whole band shows. The inset and radius mirror the well above. */
.tui-darkroomtray__scene::after {
  content: '';
  position: absolute;
  left: 4.7%;
  right: 4.7%;
  top: 32.7%;
  bottom: 4.7%;
  z-index: 1;
  border-radius: 5% / 6.5%;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    transparent 0 8px,
    color-mix(in oklab, var(--dt-enamel-hi) 40%, transparent) 8px 9px,
    color-mix(in oklab, var(--tui-skirt) 26%, transparent) 9px 10px) 0 100% / 100% 32% no-repeat;
  -webkit-mask-image: linear-gradient(0deg, black 0 10%, transparent 16%);
  mask-image: linear-gradient(0deg, black 0 10%, transparent 16%);
}
.tui-darkroomtray__scene[data-hung]::after { -webkit-mask-image: none; mask-image: none; }
/* The print: a sheet of paper with a thin white border, lying flat on the
   tray floor inside the walls (and under the developer), then pegged to the
   line. --dev is set on it and read by every layer inside. */
.tui-darkroomtray__print {
  position: absolute;
  left: 17%;
  top: 36%;
  width: 66%;
  aspect-ratio: 3 / 2;
  z-index: 2;
  border-radius: 1px;
  background: linear-gradient(158deg, var(--tui-paper-hi), var(--tui-paper) 70%);
  box-shadow:
    0 1px 0 color-mix(in oklab, var(--tui-hl) 70%, transparent),
    0 5px 8px -5px rgb(var(--tui-sh) / var(--tui-sh-a)),
    0 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6));
  /* Under the developer: a touch darker and softer than a dry print. */
  filter: brightness(0.9) saturate(0.88) blur(0.55px);
  /* The move is timed from --dt-move/--dt-delay, so hung can lengthen it to
     match the tongs' own grip and rise without restating the transition. */
  --dt-move: 820ms;
  --dt-delay: 260ms;
  transition:
    left var(--dt-move) var(--tui-ease) var(--dt-delay),
    top var(--dt-move) var(--tui-ease) var(--dt-delay),
    width var(--dt-move) var(--tui-ease) var(--dt-delay),
    filter 500ms var(--tui-ease) var(--dt-delay);
}
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__print {
  left: 31%;
  top: 3.5%;
  width: 38%;
  filter: none;
  /* The tongs grip at 30% of their 2000ms and reach the line at 62%: the
     print leaves on that same beat, over the same 640ms and curve. */
  --dt-move: 640ms;
  --dt-delay: 600ms;
}

/* The picture: a white border (the print's own paper) round a landscape. */
.tui-darkroomtray__image {
  position: absolute;
  inset: 3.4% 3.8%;
  overflow: hidden;
  background: var(--tui-paper-hi);
  /* Under the developer the print is pale and flat; developing it puts the
     contrast and the colour back, so the shadows deepen last. */
  filter: contrast(calc(0.88 + var(--dev, 0) * 0.2)) saturate(calc(0.65 + var(--dev, 0) * 0.4)) brightness(calc(1.06 - var(--dev, 0) * 0.06));
  transition: filter 260ms var(--tui-ease);
}
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__image { filter: contrast(1.07) saturate(1.05); }

/* Sky: the highlight, so it is the first thing up. */
.tui-darkroomtray__sky {
  position: absolute;
  inset: 0 0 auto 0;
  height: 64%;
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--tui-blue) 80%, var(--tui-paper)) 0%,
    color-mix(in oklab, var(--tui-blue) 52%, var(--tui-paper)) 48%,
    color-mix(in oklab, var(--tui-blue) 20%, var(--tui-paper)) 88%,
    color-mix(in oklab, var(--tui-blue) 10%, var(--tui-paper)) 100%);
  opacity: clamp(0, calc((var(--dev, 0) - 0.02) / 0.28), 1);
  transition: opacity 220ms linear;
}

/* Three ridges, far to near: aerial perspective, palest at the back. Each
   comes up on its own beat, the nearest one last. */
.tui-darkroomtray__ridge {
  position: absolute;
  left: 0;
  right: 0;
  transition: opacity 220ms linear;
}
.tui-darkroomtray__ridge--far {
  top: 36%;
  height: 32%;
  background: color-mix(in oklab, var(--dt-ridge) 28%, var(--tui-paper));
  clip-path: polygon(0 100%, 0 74%, 9% 55%, 18% 66%, 29% 38%, 38% 58%, 49% 44%, 58% 62%, 70% 40%, 80% 58%, 90% 46%, 100% 62%, 100% 100%);
  opacity: clamp(0, calc((var(--dev, 0) - 0.16) / 0.26), 1);
}
.tui-darkroomtray__ridge--mid {
  top: 44%;
  height: 30%;
  background: color-mix(in oklab, var(--dt-ridge) 56%, var(--tui-paper));
  clip-path: polygon(0 100%, 0 82%, 8% 62%, 17% 80%, 27% 52%, 36% 74%, 47% 58%, 57% 80%, 68% 54%, 79% 78%, 90% 60%, 100% 76%, 100% 100%);
  opacity: clamp(0, calc((var(--dev, 0) - 0.26) / 0.26), 1);
}
/* The near shore: a low headland on the left, in front of the lake. */
.tui-darkroomtray__ridge--near {
  top: 74%;
  right: 64%;
  height: 17%;
  background: color-mix(in oklab, var(--dt-ridge) 72%, var(--tui-paper-ink-2));
  clip-path: polygon(0 100%, 0 16%, 18% 34%, 40% 56%, 66% 78%, 100% 100%);
  opacity: clamp(0, calc((var(--dev, 0) - 0.44) / 0.26), 1);
}

/* The lake: the sky again, upside down, with the far ridge's reflection
   darkening its top edge and slow streaks across it. */
.tui-darkroomtray__lake {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  bottom: 0;
  background-image:
    repeating-linear-gradient(0deg,
      color-mix(in oklab, var(--tui-hl) 26%, transparent) 0 1px,
      transparent 1px 6px,
      color-mix(in oklab, var(--tui-paper) 16%, transparent) 6px 7px,
      transparent 7px 13px),
    linear-gradient(180deg,
      color-mix(in oklab, var(--dt-ridge) 40%, var(--tui-paper)) 0%,
      color-mix(in oklab, var(--tui-blue) 46%, var(--tui-paper)) 16%,
      color-mix(in oklab, var(--tui-blue) 60%, var(--tui-paper)) 54%,
      color-mix(in oklab, var(--tui-blue) 34%, var(--tui-paper)) 100%);
  opacity: clamp(0, calc((var(--dev, 0) - 0.34) / 0.26), 1);
  transition: opacity 220ms linear;
}

/* Pines on the lake's far shore, the last thing to come up. */
.tui-darkroomtray__pine {
  position: absolute;
  width: 4.6%;
  aspect-ratio: 1 / 2.7;
  clip-path: polygon(50% 0, 84% 44%, 68% 44%, 100% 82%, 74% 82%, 90% 100%, 10% 100%, 26% 82%, 0 82%, 32% 44%, 16% 44%);
  background: color-mix(in oklab, var(--tui-green) 46%, var(--tui-paper-ink));
  opacity: clamp(0, calc((var(--dev, 0) - 0.56) / 0.24), 1);
  transition: opacity 220ms linear;
}
.tui-darkroomtray__pine--a { left: 9%; top: 56.5%; }
.tui-darkroomtray__pine--b { left: 14.5%; top: 60%; width: 3.5%; }
.tui-darkroomtray__pine--c { left: 19%; top: 57.5%; width: 4%; }
.tui-darkroomtray__pine--d { left: 78%; top: 58.5%; width: 3.8%; }

/* Paper grain: the kit's own feTurbulence noise, multiplied into the print. */
.tui-darkroomtray__grain {
  position: absolute;
  inset: 0;
  background-image: var(--tui-noise);
  background-size: 96px 96px;
  opacity: 0.5;
  mix-blend-mode: multiply;
}

/* The developer: a surface that fills the tray, with a soft specular band
   drifting across it, its edge curling up the tray's walls (a meniscus) and
   slow concentric ripples running out of the print's own corner. It sits
   over the print, so the print is seen through it. */
.tui-darkroomtray__liquid {
  position: absolute;
  left: 4.8%;
  right: 4.8%;
  top: 34.4%;
  bottom: 5.4%;
  z-index: 3;
  overflow: hidden;
  border-radius: 3.4% / 5.2%;
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--tui-amber) 10%, color-mix(in oklab, var(--tui-ink-3) 10%, transparent)) 0%,
      color-mix(in oklab, var(--tui-amber) 7%, color-mix(in oklab, var(--tui-ink-3) 7%, transparent)) 46%,
      color-mix(in oklab, var(--tui-ink-3) 12%, transparent) 100%);
  box-shadow:
    inset 0 0 0 1px color-mix(in oklab, var(--tui-paper-hi) 40%, transparent),
    inset 1px 0 0 color-mix(in oklab, var(--tui-paper-hi) 62%, transparent),
    inset -1px 0 0 color-mix(in oklab, var(--tui-paper-hi) 62%, transparent),
    inset 0 2px 0 color-mix(in oklab, var(--tui-paper-hi) 72%, transparent),
    inset 0 4px 6px -3px color-mix(in oklab, var(--tui-ink-3) 55%, transparent),
    inset 0 -6px 10px -6px color-mix(in oklab, var(--tui-paper-hi) 70%, transparent);
}
.tui-darkroomtray__sheen {
  position: absolute;
  inset: 0 -60%;
  background: linear-gradient(102deg,
    transparent 28%,
    color-mix(in oklab, var(--tui-paper-hi) 26%, transparent) 39%,
    color-mix(in oklab, var(--tui-paper-hi) 46%, transparent) 45%,
    color-mix(in oklab, var(--tui-paper-hi) 18%, transparent) 52%,
    transparent 64%);
  animation: tui-darkroomtray-drift 15s ease-in-out infinite alternate;
}
@keyframes tui-darkroomtray-drift {
  from { transform: translateX(-12%); }
  to { transform: translateX(12%); }
}
.tui-darkroomtray__ripple {
  position: absolute;
  left: 46%;
  top: 54%;
  width: 150%;
  aspect-ratio: 1 / 0.44;
  transform: translate(-50%, -50%) scale(0.2);
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse closest-side,
    transparent 0 12%,
    color-mix(in oklab, var(--tui-ink-3) 26%, transparent) 13%,
    transparent 15.2%,
    transparent 20%,
    color-mix(in oklab, var(--tui-hl) 30%, transparent) 21%,
    transparent 23%);
  filter: blur(1.6px);
  opacity: 0;
  animation: tui-darkroomtray-ripple 12s ease-out infinite;
}
.tui-darkroomtray__ripple--b { animation-delay: -6s; }
@keyframes tui-darkroomtray-ripple {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  10% { opacity: 0.4; }
  70% { opacity: 0.12; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Drips: three drops off the print's wet corner once it leaves the tray. */
.tui-darkroomtray__drop {
  position: absolute;
  left: 32.5%;
  top: 33%;
  z-index: 4;
  width: 0.9%;
  height: 1.8%;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: color-mix(in oklab, var(--tui-amber) 30%, color-mix(in oklab, var(--tui-face-hi) 70%, transparent));
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-hl) 80%, transparent);
  opacity: 0;
}
.tui-darkroomtray__drop--b { left: 35.5%; top: 32.5%; width: 0.7%; height: 1.4%; }
.tui-darkroomtray__drop--c { left: 38.5%; top: 33.5%; }
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__drop--a { animation: tui-darkroomtray-drop 900ms var(--tui-ease) 620ms both; }
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__drop--b { animation: tui-darkroomtray-drop 900ms var(--tui-ease) 860ms both; }
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__drop--c { animation: tui-darkroomtray-drop 900ms var(--tui-ease) 1080ms both; }
@keyframes tui-darkroomtray-drop {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(900%) scale(0.9); }
}

/* The safelight: the room's red lamp tinting the whole stage, a soft wash from
   the top (20% red) fading to about half strength at the bottom (10%), its
   edges feathered so no frame edge shows; it fades once the print is on the
   line. Colour from the kit's own red and transparent only. */
.tui-darkroomtray__safelight {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--tui-red) 20%, transparent),
    color-mix(in oklab, var(--tui-red) 10%, transparent));
  -webkit-mask-image:
    linear-gradient(180deg, transparent 0, black 5%, black 95%, transparent 100%),
    linear-gradient(90deg, transparent 0, black 5%, black 95%, transparent 100%);
  mask-image:
    linear-gradient(180deg, transparent 0, black 5%, black 95%, transparent 100%),
    linear-gradient(90deg, transparent 0, black 5%, black 95%, transparent 100%);
  mask-composite: intersect, add;
  -webkit-mask-composite: source-in, source-over;
  transition: opacity 620ms var(--tui-ease);
}
.tui-darkroomtray__scene[data-hung] .tui-darkroomtray__safelight { opacity: 0.12; }

/* The tongs: a real button, over the scene, holding the drawn tongs. At rest
   they lie across the tray's right rim, hinge outside, tips on the floor.
   It is the tool, not a key: no cap, only the instrument and its focus ring. */
.tui-darkroomtray__lift {
  position: absolute;
  right: 4%;
  top: 56%;
  width: max(34px, 8.2%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  transform: translate(0, 0) rotate(22deg);
  transform-origin: 50% 50%;
  cursor: pointer;
  transition: transform 160ms var(--tui-ease), opacity 300ms var(--tui-ease);
  filter: drop-shadow(2px 5px 4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)));
  -webkit-tap-highlight-color: transparent;
}
.tui-darkroomtray__lift:disabled { cursor: not-allowed; opacity: 0.6; filter: none; }
.tui-darkroomtray__scene[data-hung] ~ .tui-darkroomtray__lift { opacity: 1; filter: drop-shadow(2px 5px 4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9))); }
.tui-darkroomtray__lift:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .tui-darkroomtray__lift:not(:disabled):hover { transform: translate(-3%, 2%) rotate(20deg); }
}
.tui-darkroomtray__tongs { display: block; width: 100%; height: auto; overflow: visible; }
.tui-darkroomtray__arm { fill: none; stroke: var(--tui-ink-2); stroke-width: 4.2; stroke-linecap: round; }
.tui-darkroomtray__glint { fill: none; stroke: color-mix(in oklab, var(--tui-paper-hi) 62%, var(--tui-ink-3)); stroke-width: 0.9; stroke-linecap: round; }
/* Rubber tips are black in every finish: the skirt is the kit's darkest solid. */
.tui-darkroomtray__tip { fill: none; stroke: var(--tui-skirt); stroke-width: 5.6; stroke-linecap: round; }
.tui-darkroomtray__hinge { fill: var(--tui-ink-3); stroke: color-mix(in oklab, var(--tui-paper-hi) 40%, transparent); stroke-width: 0.8; }
.tui-darkroomtray__pin { fill: color-mix(in oklab, var(--tui-paper-hi) 55%, var(--tui-ink-3)); }
/* Pressed (hung set): the tongs dip to the print's near corner, grip, rise
   with it, and come back across the rim, in time with the print's own move. */
.tui-darkroomtray__scene[data-hung] ~ .tui-darkroomtray__lift { animation: tui-darkroomtray-grip 2000ms var(--tui-ease) both; }
@keyframes tui-darkroomtray-grip {
  0% { transform: translate(0, 0) rotate(22deg); }
  16% { transform: translate(-69%, 48%) rotate(22deg); }
  30% { transform: translate(-69%, 46%) rotate(22deg); }
  62% { transform: translate(-240%, -199%) rotate(22deg); }
  80% { transform: translate(-240%, -196%) rotate(22deg); }
  100% { transform: translate(0, 0) rotate(22deg); }
}

/* The printed readout: the same words as the live region. */
.tui-darkroomtray__readout {
  padding: 3px var(--tui-2);
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-darkroomtray__digit {
  font: 600 12px/1.3 var(--tui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--tui-ink-2);
}
.tui-darkroomtray__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-darkroomtray__print,
  .tui-darkroomtray__image,
  .tui-darkroomtray__sky,
  .tui-darkroomtray__ridge,
  .tui-darkroomtray__lake,
  .tui-darkroomtray__pine,
  .tui-darkroomtray__safelight,
  .tui-darkroomtray__lift { transition: none; }
  .tui-darkroomtray__sheen,
  .tui-darkroomtray__ripple,
  .tui-darkroomtray__drop,
  .tui-darkroomtray__scene[data-hung] ~ .tui-darkroomtray__lift { animation: none; }
  .tui-darkroomtray__ripple { opacity: 0.34; transform: translate(-50%, -50%) scale(0.55); }
  .tui-darkroomtray__scene[data-hung] .tui-darkroomtray__drop { opacity: 0; }
}

/* ---------------------------------------------------------------- part: data-grid */
/* Data grid: the kit's table, edited in place the way a spreadsheet is. One
   cell is in focus at a time, drawn as the focus ring laid inside its edges;
   an edit opens as a small recess in the cell, the kit's own field. Nothing is
   saved by typing: a cell with a change is marked with a small tick at its
   corner and printed heavier, and the row it is in lights an amber lamp, says
   "Edited" and holds Save and Discard in its last cell. The row's last cell
   stays at the right edge when the table is wider than the screen, so the two
   keys are never scrolled away. kit/parts/data-grid.mjs builds and wires it. */
tui-data-grid, .tui-data-grid { position: relative; display: block; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.tui-data-grid__table { width: 100%; min-width: var(--dg-min, 620px); }
.tui-data-grid__table th { padding-top: var(--tui-2); }
.tui-data-grid__table tbody td { position: relative; height: 46px; padding-top: 0; padding-bottom: 0; }
.tui-data-grid__table td[aria-readonly="true"] { color: var(--tui-ink-2); }
.tui-data-grid__table tbody td:not(.tui-data-grid__act):hover { cursor: cell; }
.tui-data-grid__table td:focus { outline: none; }
.tui-data-grid__table td:focus-visible, .tui-data-grid__table td.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-data-grid__table td:has(:focus-visible):not([data-editing]) { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-data-grid__val { white-space: nowrap; }
/* The earlier value is said to a screen reader; the eye gets the tick. */
.tui-data-grid__was, .tui-data-grid__say, .tui-data-grid__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A cell with a change: a tick in its corner, and heavier. */
.tui-data-grid__table td[data-edited] { font-weight: 700; color: var(--tui-ink); }
.tui-data-grid__table td[data-edited]::after { content: ''; position: absolute; top: 0; left: 0; width: 9px; height: 9px; background: var(--tui-ink); clip-path: polygon(0 0, 100% 0, 0 100%); }
/* A row with changes: a bar down its left edge and the face lifted under it. */
.tui-data-grid__table tbody tr[data-dirty] td { background: color-mix(in oklab, var(--tui-face-hi) 70%, transparent); }
.tui-data-grid__table tbody tr[data-dirty] td:first-child { box-shadow: inset 3px 0 0 var(--tui-ink); }

/* The edit: a recess in the cell. */
.tui-data-grid__table td[data-editing] { padding: 5px; }
.tui-data-grid__input {
  appearance: none;
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 var(--tui-2);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-align: inherit;
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  outline: 2px solid var(--tui-focus);
  outline-offset: 1px;
}
.tui-data-grid__input[aria-invalid="true"] { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), var(--tui-inset); }
.tui-data-grid__cell-error { position: absolute; z-index: 2; top: calc(100% - 2px); left: 5px; max-width: 260px; padding: 4px 8px; border-radius: 6px; font: 600 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); background: var(--tui-face); box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)), 0 4px 10px -4px rgb(var(--tui-sh) / 0.4)); }
.tui-data-grid__cell-error[hidden] { display: none; }

/* The row's last cell: lamp, word, keys. It keeps its width whether or not the row has changes, so nothing moves when one is made. */
.tui-data-grid__table th.tui-data-grid__act, .tui-data-grid__table td.tui-data-grid__act { width: 214px; min-width: 214px; white-space: nowrap; }
@media (min-width: 561px) and (max-width: 760px) {
  /* Held at the right edge, so Save and Discard are never scrolled away. */
  .tui-data-grid__table th.tui-data-grid__act, .tui-data-grid__table td.tui-data-grid__act { position: sticky; right: 0; z-index: 1; background: var(--dt-bg, var(--tui-face)); }
  .tui-data-grid__table tbody tr[data-dirty] td.tui-data-grid__act { box-shadow: -10px 0 8px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)); }
}
.tui-data-grid__changes { display: flex; align-items: center; justify-content: flex-end; gap: var(--tui-2); }
.tui-data-grid__changes[hidden] { display: none; }
.tui-data-grid__state { font: 600 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink); }
.tui-data-grid__keys { display: flex; gap: var(--tui-2); }
.tui-data-grid__error { margin: 2px 0 0; font: 600 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); white-space: normal; }
.tui-data-grid__error[hidden] { display: none; }
.tui-data-grid__none { margin: 0; padding: var(--tui-4) var(--tui-3); font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-data-grid__none[hidden] { display: none; }

/* A phone: each row stands as its own card, a label and a value to a line, so there is nothing to scroll sideways and nothing to hold in place. The roles stay those of a grid. */
@media (max-width: 560px) {
  tui-data-grid, .tui-data-grid { overflow: visible; }
  .tui-data-grid__table, .tui-data-grid__table tbody { display: block; min-width: 0; }
  .tui-data-grid__table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tui-data-grid__table tbody tr { display: grid; margin-bottom: var(--tui-3); border-radius: calc(var(--tui-r-m) + 2px); box-shadow: inset 0 0 0 1px var(--tui-rule); overflow: hidden; }
  .tui-data-grid__table tbody tr[hidden], .tui-data-grid__table td[hidden] { display: none; }
  .tui-data-grid__table tbody td { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); align-items: center; height: auto; min-height: 48px; text-align: left; }
  .tui-data-grid__table tbody td::before { content: attr(data-label); font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
  .tui-data-grid__table tbody td.tui-data-grid__act { display: block; width: auto; min-width: 0; min-height: 0; }
  .tui-data-grid__table tbody td.tui-data-grid__act::before { content: none; }
  .tui-data-grid__table tbody td.tui-data-grid__act:not(:has(.tui-data-grid__changes:not([hidden]), .tui-data-grid__error:not([hidden]))) { display: none; }
  .tui-data-grid__changes { justify-content: space-between; }
  .tui-data-grid__table tbody td:last-child { border-bottom: 0; }
  .tui-data-grid__table tbody td.is-num { text-align: left; }
}

@media (pointer: coarse) {
  .tui-data-grid__table tbody td { height: 52px; }
  .tui-data-grid__input { height: 44px; font-size: 16px; }
  .tui-data-grid__keys .tui-key { --h: 44px; min-width: 44px; }
}

/* ---------------------------------------------------------------- part: data-table */
/* Data table: the kit's table with the tools a working one needs. A filter
   well and a count above it; a plate that slides out of a slot under them
   while rows are chosen, its lamp lit, with what can be done to them; a check
   key at the head of every row, the one in the header sunk half way when only
   some are chosen; and a header that stays at the top of its box while the
   rows scroll under it. kit/parts/data-table.mjs builds and wires it. */
tui-data-table, .tui-data-table { position: relative; display: grid; gap: var(--tui-3); min-width: 0; }
/* bare: the tools and the bar are somewhere else (a table toolbar and a bulk bar drive it). */
tui-data-table[bare] > :is(.tui-data-table__tools, .tui-data-table__bar) { display: none; }
/* Keys for the bar wait unseen until the script gives them a bar. */
tui-data-table:not([data-ready]) > .tui-data-table__actions { display: none; }

.tui-data-table__tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--tui-2) var(--tui-4); min-width: 0; }
.tui-data-table__filter { display: grid; gap: 6px; flex: 1 1 200px; max-width: 320px; min-width: 0; }
.tui-data-table__filter > .tui-label { padding-left: 2px; }
.tui-data-table__well {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink-2);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: text;
}
.tui-data-table__well .tui-icon { flex: none; width: 14px; height: 14px; }
.tui-data-table__well:has(input:focus-visible), .tui-data-table__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-data-table__query {
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
.tui-data-table__query::placeholder { color: var(--tui-ink-3); }
.tui-data-table__query:focus-visible { outline: none; }
/* The browser's own clear key is a colour of its own: Escape clears the well instead. */
.tui-data-table__query::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.tui-data-table__count { margin: 0 0 0 auto; padding-bottom: 10px; font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); white-space: nowrap; }
/* A query built elsewhere (filterBy) reads its own count: this one steps aside. */
tui-data-table[data-query-bound] .tui-data-table__count { display: none; }

/* The bar: a plate out of a slot, its lamp lit while anything is chosen. */
.tui-data-table__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-2) var(--tui-3);
  min-height: 44px;
  padding: 6px 6px 6px var(--tui-3);
  border-radius: calc(var(--tui-r-m) + 2px);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), inset 0 8px 8px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.2));
  animation: tui-data-table-out 150ms var(--tui-ease);
}
.tui-data-table__bar[hidden] { display: none; }
@keyframes tui-data-table-out { from { opacity: 0; transform: translateY(-6px); } }
.tui-data-table__chosen { flex: 1 1 auto; font-variant-numeric: tabular-nums; color: var(--tui-ink); }
.tui-data-table__keys { display: flex; flex-wrap: wrap; gap: var(--tui-2); }

/* The box the rows scroll in, with the header held at its top. */
:is(tui-data-table, .tui-data-table) .tui-table-wrap { max-height: var(--dt-height, min(70vh, 640px)); overflow: auto; overscroll-behavior: contain; }
:is(tui-data-table, .tui-data-table) thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: var(--tui-2);
  border-bottom: 0;
  background: var(--dt-head, var(--tui-face));
  box-shadow: inset 0 -1px 0 var(--tui-rule);
}

/* The check keys' column: as narrow as a key. */
:is(tui-data-table, .tui-data-table) .tui-data-table__pick { width: 1%; padding-right: 0; }
:is(tui-data-table, .tui-data-table) .tui-data-table__pick .tui-check { display: block; }
/* Some chosen: the head's key sunk half way, a bar across it, as the checklist's group key. */
:is(tui-data-table, .tui-data-table) .tui-check:indeterminate, :is(tui-data-table, .tui-data-table) .tui-check[aria-checked="mixed"], :is(tui-data-table, .tui-data-table) .tui-check[data-mixed] {
  transform: translateY(0.75px);
  box-shadow:
    var(--tui-depth-pressed, inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    inset 0 1px 0 var(--tui-hl),
    0 0.75px 0 var(--tui-skirt),
    0 1px 2px rgb(var(--tui-sh) / 0.2));
}
:is(tui-data-table, .tui-data-table) .tui-check:indeterminate::after, :is(tui-data-table, .tui-data-table) .tui-check[aria-checked="mixed"]::after, :is(tui-data-table, .tui-data-table) .tui-check[data-mixed]::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: calc(50% - 1px);
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
}
:is(tui-data-table, .tui-data-table) .tui-check:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
/* A chosen row: the face lifts under it and its words go to full ink. */
:is(tui-data-table, .tui-data-table) tbody tr[data-selected] td { background: color-mix(in oklab, var(--tui-face-hi) 80%, transparent); color: var(--tui-ink); }

/* A finger needs 44px, and only a finger: on a touch screen the check cell is the press target, 44 wide and as
   tall as its row, and the header row grows to 44 so a sort key's whole cell sorts. The drawings keep their
   size; a mouse sees nothing change. A row tap is left for "open this row". */
@media (pointer: coarse) {
  /* 44 wide without moving the columns: the cell is 12 + 18 + 2px, and its press area runs on 12px into the next
     cell's empty left padding (a lamp column that is whole with a mouse stays whole). */
  :is(tui-data-table, .tui-data-table) .tui-data-table__pick { position: relative; padding-right: 2px; cursor: pointer; }
  :is(tui-data-table, .tui-data-table) .tui-data-table__pick::after { content: ''; position: absolute; inset: 0 calc(-1 * var(--tui-3)) 0 0; }
  /* The sticky header cells stack in order; the check's sits one up so its reach is not under the next one's. */
  :is(tui-data-table, .tui-data-table) thead th.tui-data-table__pick { z-index: 2; }
  :is(tui-data-table, .tui-data-table) tbody td.tui-data-table__pick { height: 44px; }
  :is(tui-data-table, .tui-data-table) thead th { height: 44px; vertical-align: bottom; }
  :is(tui-data-table, .tui-data-table) .tui-table__sort::before { content: ''; position: absolute; inset: 0; }
}

.tui-data-table__none { margin: 0; padding: var(--tui-4) var(--tui-3); font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-data-table__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-data-table__bar { animation: none; }
}

/* ---------------------------------------------------------------- part: date-field */
/* Date field: a date in segments (day, month, year) in the field's well, with
   the kit's calendar key set on its floor. The well, the key and the calendar
   card are the kit's, so every finish and both volumes are theirs. The segment
   you are on is a small plate let into the well, its corners the well's radius
   less the gap, so the corners sit together. Without the script the element
   holds a native date input, which is all the field is. */
tui-date-field { position: relative; display: block; min-width: 0; width: min(100%, 300px); }
tui-date-field:not(:defined) > input { width: 100%; }
.tui-date-field__well {
  --df-h: 38px;
  --df-inset: 5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: var(--df-h);
  padding: 0 var(--df-inset) 0 var(--tui-2);
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: text;
}
.tui-date-field__well:has(.tui-date-field__seg:focus-visible), tui-date-field.is-focus .tui-date-field__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-date-field[data-error] .tui-date-field__well, .tui-field[data-error] .tui-date-field__well {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
tui-date-field[data-off] .tui-date-field__well { opacity: 0.45; cursor: not-allowed; }

.tui-date-field__segs { flex: 1 1 auto; display: inline-flex; align-items: center; min-width: 0; }
.tui-date-field__seg {
  appearance: none;
  flex: none;
  box-sizing: border-box;
  width: calc(2ch + 10px);
  height: calc(var(--df-h) - 2 * var(--df-inset));
  margin: 0;
  padding: 0 5px;
  border: 0;
  border-radius: calc(var(--tui-r-m) - var(--df-inset));
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--tui-ink);
  caret-color: transparent;
  background: transparent;
  outline: none;
  cursor: inherit;
}
.tui-date-field__seg[data-part="year"] { width: calc(4ch + 10px); }
.tui-date-field__seg::placeholder { color: var(--tui-ink-3); }
.tui-date-field__seg::selection { background: transparent; }
/* The segment you are on: a plate let into the well. */
.tui-date-field__seg:focus, tui-date-field.is-focus .tui-date-field__seg:first-of-type { background: color-mix(in oklab, var(--tui-ink) 13%, transparent); }
.tui-date-field__seg:disabled { cursor: not-allowed; }
.tui-date-field__seg[data-bad] { text-decoration: underline; text-decoration-style: wavy; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.tui-date-field__sep { flex: none; padding: 0 1px; font: 400 var(--tui-t-body)/1 var(--tui-sans); color: var(--tui-ink-2); user-select: none; }
.tui-date-field__well > .tui-key { --h: 28px; flex: none; margin-left: auto; border-radius: calc(var(--tui-r-m) - var(--df-inset)); }
.tui-date-field__well > .tui-key[aria-expanded="true"] { transform: translateY(var(--skirt)); box-shadow: var(--tui-pressed); }
.tui-date-field__well > .tui-key[hidden] { display: none; }
tui-date-field:not(:defined) .tui-date-field__key { display: none; }

/* The card: a plate in the top layer (a popover), placed by the script. */
.tui-date-field__card:not(:popover-open) { display: none; }
.tui-date-field__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  --tui-calendar-cell: 40px;
  width: min(calc(var(--tui-calendar-cell) * 7 + 36px), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.3), 0 24px 48px -18px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
.tui-date-field__card::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--tui-noise); opacity: var(--tui-grain); pointer-events: none; }
.tui-date-field__card tui-calendar { width: 100%; }

.tui-date-field__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-date-field__well { --df-h: 52px; --df-inset: 4px; }
  .tui-date-field__seg { font-size: 16px; height: 44px; width: calc(2ch + 16px); }
  .tui-date-field__seg[data-part="year"] { width: calc(4ch + 16px); }
  .tui-date-field__well > .tui-key { --h: 44px; width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-date-field .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: date-picker */
/* Date picker: a field whose calendar card slides out of a slot under the
   well. The field is the kit's recess with the calendar key set in it; the
   card is a plate that comes out top first, its upper edge still shaded by
   the slot it left. kit/parts/date-picker.mjs builds and wires it. */
tui-date-picker { position: relative; display: block; width: min(100%, 300px); }
.tui-date-picker__well {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-date-picker__well .tui-input { flex: 1; background: transparent; box-shadow: none; font-variant-numeric: tabular-nums; }
.tui-date-picker__well .tui-input:focus-visible { outline: none; }
.tui-date-picker__well:has(.tui-input:focus-visible), .tui-date-picker__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-date-picker__well .tui-key { --h: 30px; width: 30px; flex: none; }
.tui-date-picker__well .tui-key[aria-expanded="true"] { transform: translateY(var(--skirt)); box-shadow: var(--tui-pressed); }
.tui-date-picker__field[data-error] .tui-date-picker__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

/* The card: a plate out of the slot, in the top layer (a popover) so nothing clips it. Placed by the script. */
.tui-date-picker__card:not(:popover-open) { display: none; }
.tui-date-picker__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  display: grid;
  gap: var(--tui-2);
  --tui-calendar-cell: 40px;
  width: min(calc(var(--tui-calendar-cell) * 7 + 36px), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: var(--tui-4) var(--tui-4) var(--tui-2);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    /* The slot's lower lip still shades the card's top edge. */
    inset 0 10px 10px -10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.3),
    0 24px 48px -18px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
/* Placed above the field, the slot shades the card's lower edge instead. */
.tui-date-picker__card[data-side="above"] {
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), inset 0 -10px 10px -10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.3), 0 24px 48px -18px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
.tui-date-picker__card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise);
  opacity: var(--tui-grain);
  pointer-events: none;
}
.tui-date-picker__card tui-calendar { width: 100%; }
.tui-date-picker__foot { display: flex; align-items: center; gap: var(--tui-2); min-height: 32px; margin: 0; }
.tui-date-picker__say { flex: 1; font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* ---------------------------------------------------------------- part: day-agenda */
/* Day agenda: one day on ruled hour rows, like a page of a desk diary. Hour
   labels are printed down the left in tabular figures, a hairline crosses at each
   hour, and an event is a key standing on the rows: its top is when it starts, its
   height how long it runs, and overlapping events stand side by side. The tone of
   an event is a kit lamp set before its time, the only colour on it; the face is the kit's own.
   The Now line is the dark cap's colour with a pill at the left, so it reads in
   every finish. Everything is placed by custom properties the script sets, in
   minutes, so the page's own text size and the phone's taller rows both work. */
tui-day-agenda {
  --da-hour: 56px;
  --da-gutter: 52px;
  --da-min: calc(var(--da-hour) / 2 + 2px);
  display: block;
  position: relative;
  min-width: 0;
  color: var(--tui-ink);
  font: 400 var(--tui-t-body)/1.3 var(--tui-sans);
}
tui-day-agenda > ul:not([class]) { margin: 0; padding-left: 1.2em; }
.tui-day-agenda__source { display: none; }

.tui-day-agenda__allday {
  display: flex;
  align-items: flex-start;
  gap: var(--tui-2);
  margin-bottom: var(--tui-2);
  padding: var(--tui-2) 0;
  border-bottom: 1px solid var(--tui-rule);
}
.tui-day-agenda__allday-label { flex: none; width: calc(var(--da-gutter) - var(--tui-2)); padding-top: 12px; font: 500 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-day-agenda__chips { display: flex; flex-wrap: wrap; gap: var(--tui-2); min-width: 0; margin: 0; padding: 0; list-style: none; }

/* The keys: an event on the rows, or an all-day event in the strip. */
.tui-day-agenda__event, .tui-day-agenda__chip {
  appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 5px var(--tui-2);
  border: 0;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  color: var(--tui-ink);
  cursor: pointer;
  overflow: hidden;
  background: var(--tui-face-hi);
  box-shadow: 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), 0 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2));
  -webkit-tap-highlight-color: transparent;
}
.tui-day-agenda__event:hover, .tui-day-agenda__chip:hover { filter: brightness(1.03); }
.tui-day-agenda__event:focus-visible, .tui-day-agenda__chip:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 1px; z-index: 3; }
.tui-day-agenda__event[aria-pressed="true"], .tui-day-agenda__chip[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--tui-ink), 0 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2));
}
.tui-day-agenda__chip { width: auto; min-height: 36px; flex-direction: row; align-items: center; padding-block: 0; }
.tui-day-agenda__title { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-day-agenda__time, .tui-day-agenda__place { font-size: var(--tui-t-small); line-height: 1.25; color: var(--tui-ink-2); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-day-agenda__head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tui-day-agenda__head > .tui-lamp { margin-top: 0; }
.tui-day-agenda__chip > .tui-lamp { margin-right: 6px; }
/* A short event is one line: its time, then its name. */
.tui-day-agenda__event.is-tight { flex-direction: row; align-items: center; gap: var(--tui-2); padding-block: 0; }
.tui-day-agenda__event.is-tight .tui-day-agenda__place { display: none; }

/* An editable day: the keys can be pulled up and down, lifted off the rows on the kit's float depth while they are. */
/* pan-y: a swipe over an event still scrolls the day; a held finger lifts it (see the part). */
tui-day-agenda[editable] .tui-day-agenda__event { cursor: grab; touch-action: pan-y; -webkit-touch-callout: none; }
tui-day-agenda[data-dragging] { user-select: none; -webkit-user-select: none; }
tui-day-agenda[data-dragging] .tui-day-agenda__event { cursor: grabbing; }
.tui-day-agenda__slot.is-lifted { z-index: 4; }
.tui-day-agenda__slot.is-lifted > .tui-day-agenda__event { transform: translateY(-2px); box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 16px 32px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2))); }

/* The rows. */
.tui-day-agenda__scroll { max-height: var(--da-max, none); overflow-y: auto; overscroll-behavior: contain; }
.tui-day-agenda__grid { position: relative; height: calc(var(--rows) * var(--da-hour)); }
.tui-day-agenda__hours { margin: 0; padding: 0; list-style: none; }
.tui-day-agenda__hours li {
  position: relative;
  height: var(--da-hour);
  box-sizing: border-box;
}
.tui-day-agenda__hours li::before { content: ''; position: absolute; left: calc(var(--da-gutter) - 4px); right: 0; top: 0; border-top: 1px solid var(--tui-rule); }
.tui-day-agenda__hours li span { position: absolute; left: 0; top: -0.65em; width: calc(var(--da-gutter) - var(--tui-2)); font-size: var(--tui-t-small); line-height: 1.3; text-align: right; color: var(--tui-ink-2); font-variant-numeric: tabular-nums; }
.tui-day-agenda__hours li:first-child span { top: 0; }

.tui-day-agenda__hours li[data-near] span { visibility: hidden; }
.tui-day-agenda__events { position: absolute; inset: 0 0 0 var(--da-gutter); margin: 0; padding: 0; list-style: none; }
.tui-day-agenda__slot {
  position: absolute;
  top: calc(var(--s) * var(--da-hour) / 60);
  height: max(calc(var(--l) * var(--da-hour) / 60), var(--da-min));
  left: calc(var(--c) * 100% / var(--n));
  width: calc(100% / var(--n));
  padding: 1px 2px 1px 3px;
  box-sizing: border-box;
}
.tui-day-agenda__slot { container-type: inline-size; }
.tui-day-agenda__slot > .tui-day-agenda__event { height: 100%; }
/* A tall event has room for its name on two lines. */
.tui-day-agenda__event.is-tall .tui-day-agenda__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
/* In a narrow column the time drops out first and the name keeps the room. */
@container (max-width: 170px) {
  .tui-day-agenda__event .tui-day-agenda__time { display: none; }
  /* With the time gone the lamp stands inline before the name, centred on its first line. */
  .tui-day-agenda__event:not(.is-tight) { flex-direction: row; flex-wrap: wrap; align-items: flex-start; column-gap: 6px; row-gap: 1px; }
  .tui-day-agenda__event:not(.is-tight) > .tui-day-agenda__head { height: 1.3em; }
  .tui-day-agenda__event:not(.is-tight) > .tui-day-agenda__title { flex: 1 1 0; }
  .tui-day-agenda__event:not(.is-tight) > .tui-day-agenda__place { flex: 0 0 100%; }
}

/* Now: the dark cap's colour, a pill in the gutter and a rule across. */
.tui-day-agenda__now { position: absolute; left: 0; right: 0; top: calc(var(--m) * var(--da-hour) / 60); height: 0; z-index: 2; pointer-events: none; transition: top 900ms linear; }
.tui-day-agenda__now[hidden] { display: none; }
.tui-day-agenda__now::before { content: ''; position: absolute; left: calc(var(--da-gutter) - 4px); right: 0; top: -1px; height: 2px; border-radius: 1px; background: var(--tui-cap); box-shadow: 0 0 0 1px var(--tui-face-hi); }
.tui-day-agenda__now-text {
  position: absolute;
  left: 0;
  top: -9px;
  box-sizing: border-box;
  width: calc(var(--da-gutter) - 2px);
  padding: 3px 0;
  border-radius: 4px;
  font: 700 10px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: inset 0 1px 0 var(--tui-cap-hl), 0 1px 0 var(--tui-cap-skirt);
  font-variant-numeric: tabular-nums;
}
.tui-day-agenda__now-text span { display: none; }

.tui-day-agenda__outside, .tui-day-agenda__empty { margin: var(--tui-2) 0 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-day-agenda__empty { padding: var(--tui-5) var(--tui-3); text-align: center; border-radius: var(--tui-r-m); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-day-agenda__hours li::before { border-top-color: var(--tui-quiet-line-2); }
  .tui-day-agenda__event, .tui-day-agenda__chip { box-shadow: 0 0 0 1px var(--tui-quiet-edge); }
  .tui-day-agenda__event[aria-pressed="true"], .tui-day-agenda__chip[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--tui-ink), 0 0 0 1px var(--tui-quiet-edge); }
}

@media (pointer: coarse) {
  tui-day-agenda { --da-hour: 88px; --da-gutter: 48px; }
  .tui-day-agenda__chip { min-height: 44px; }
  .tui-day-agenda__time, .tui-day-agenda__place { font-size: 12px; }
}
/* Under reduced motion the line does not glide; the script moves it once a minute. */
@media (prefers-reduced-motion: reduce) {
  .tui-day-agenda__now { transition: none; }
}

/* ---------------------------------------------------------------- part: diff-view */
/* Diff view: two versions of a file on display glass, side by side or stacked.
   A bar along the top names the file, carries a legend (a lit green lamp and a
   plus for the lines added, a lit red lamp and a minus for the lines removed)
   and the selector for the layout. Under it the lines, each with its number
   engraved in a gutter that holds still when a long line scrolls sideways. A
   changed line lights its gutter with a bar at its edge and takes a sign: the
   added ones a plus on a solid ground, the removed ones a minus on a hatched
   one, so neither is only a colour. The numbers and the signs are drawn by
   the stylesheet with an empty alternative text (the words for a screen reader
   are in the alternative text of the sign), so a copy of the code is the code.
   The glass, its ink and its focus light are .tui-glass's. */
tui-diff-view { display: block; min-width: 0; container-type: inline-size; }
.tui-glass.tui-diff { --df-lh: 1.6; --df-num: 4.2ch; position: relative; padding: 0; overflow: hidden; font-size: 12.5px; }

.tui-diff__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-4); min-height: 40px; padding: 4px 8px 4px 14px; border-bottom: 1px solid var(--tui-rule); }
.tui-diff__title { flex: 1 1 8ch; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 12px/1 var(--tui-mono); color: var(--tui-ink); }
.tui-diff__legend { display: flex; gap: var(--tui-4); margin: 0; padding: 0; list-style: none; font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-diff__legend > li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tui-diff__legend > li > span[aria-hidden="true"]:not(.tui-lamp) { font: 600 13px/1 var(--tui-mono); color: var(--tui-ink); }
.tui-diff__layout { flex: none; display: flex; gap: 2px; }
.tui-diff__layout > label { position: relative; display: block; }
.tui-diff__layout input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.tui-diff__layout span { display: flex; align-items: center; min-height: 28px; padding: 0 var(--tui-3); border-radius: 6px; font: 600 11.5px/1 var(--tui-sans); color: var(--tui-ink-2); cursor: pointer; }
.tui-diff__layout input:hover + span { color: var(--tui-ink); }
.tui-diff__layout input:checked + span { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-ink) 9%, transparent); box-shadow: inset 0 -2px 0 var(--tui-ink); }
.tui-diff__layout input:focus-visible + span, .tui-diff__layout.is-focus input:checked + span { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
@container (max-width: 639px) { .tui-diff__layout { display: none; } }

.tui-diff__body { --df-cols: 1; display: grid; grid-template-columns: repeat(var(--df-cols), minmax(0, 1fr)); max-height: var(--df-max, none); overflow-y: auto; scrollbar-width: thin; }
.tui-diff__body[data-mode="split"] { --df-cols: 2; }
.tui-diff__body[data-mode="split"] > .tui-diff__pane + .tui-diff__pane { border-left: 1px solid var(--tui-rule); }
.tui-diff__same { grid-column: 1 / -1; margin: 0; padding: var(--tui-4) 14px; color: var(--tui-ink-2); font: 400 var(--tui-t-body)/1.5 var(--tui-sans); }

.tui-diff__pane { min-width: 0; padding: 8px 0 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--tui-ink) 35%, transparent) transparent; font: 400 12.5px/var(--df-lh) var(--tui-mono); tab-size: 2; }
.tui-diff__pane:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -3px; }

.tui-diff__line { --lit: transparent; position: relative; display: flex; min-width: 100%; width: max-content; height: calc(12.5px * var(--df-lh)); color: var(--tui-ink); }
.tui-diff__line[data-type="add"] { --lit: var(--tui-green); background: color-mix(in oklab, var(--tui-ink) 8%, transparent); }
.tui-diff__line[data-type="del"] { --lit: var(--tui-red); background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--tui-ink) 10%, transparent) 0 1px, transparent 1px 5px); }
.tui-diff__line[data-type="gap"] { background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--tui-ink) 5%, transparent) 0 1px, transparent 1px 6px); }
/* The numbers: one plate in each pane, a second in a stacked one, over the lines that pass under them. */
.tui-diff__line::before, .tui-diff__line::after {
  position: sticky;
  z-index: 1;
  flex: none;
  box-sizing: border-box;
  width: calc(var(--df-num) + 10px);
  padding: 0 8px 0 0;
  text-align: right;
  color: var(--tui-ink-2);
  font-variant-numeric: tabular-nums;
  user-select: none;
  background: linear-gradient(var(--tui-vfd-bg), var(--tui-vfd-bg));
}
.tui-diff__line::before { content: attr(data-a); content: attr(data-a) / ''; left: 0; order: 0; box-shadow: inset 3px 0 0 var(--lit); }
.tui-diff__line::after { content: attr(data-b); content: attr(data-b) / ''; left: calc(var(--df-num) + 10px); order: 1; box-shadow: inset -1px 0 0 var(--tui-rule); }
.tui-diff__line[data-type="gap"]::before, .tui-diff__line[data-type="gap"]::after { content: ''; }
/* A changed line's number is bright, and the gutter is lit along its edge. */
.tui-diff__line:is([data-type="add"], [data-type="del"])::before, .tui-diff__line:is([data-type="add"], [data-type="del"])::after { color: var(--tui-ink); font-weight: 600; background: color-mix(in oklab, var(--tui-vfd-bg) 88%, var(--lit)); }
.tui-diff__body[data-mode="split"] .tui-diff__line::before { box-shadow: inset 3px 0 0 var(--lit), inset -1px 0 0 var(--tui-rule); }
.tui-diff__body[data-mode="split"] .tui-diff__line::after { display: none; }
.tui-diff__body[data-mode="split"] [data-side="right"] .tui-diff__line::before { content: attr(data-b); content: attr(data-b) / ''; }

.tui-diff__sign { order: 2; flex: none; width: 2.4ch; text-align: center; font-weight: 600; user-select: none; }
.tui-diff__line[data-type="add"] > .tui-diff__sign::before { content: '+' / 'Added: '; }
.tui-diff__line[data-type="del"] > .tui-diff__sign::before { content: '\2212' / 'Removed: '; }
.tui-diff__text { order: 3; flex: 1 0 auto; padding-right: 16px; white-space: pre; }
.tui-diff__line[data-type="add"] > .tui-diff__text { font-weight: 600; }

/* A long unchanged run, left out: one row that says how many lines. */
.tui-diff__fold { display: flex; align-items: center; justify-content: center; min-width: 100%; width: max-content; height: calc(12.5px * var(--df-lh)); margin: 3px 0; border-block: 1px solid var(--tui-rule); font: 500 11px/1 var(--tui-sans); letter-spacing: 0.04em; color: var(--tui-ink-2); background: color-mix(in oklab, var(--tui-ink) 4%, transparent); }
.tui-diff__fold > span { position: sticky; left: 0; padding: 0 14px; }

@media (pointer: coarse) {
  .tui-diff__bar { min-height: 48px; }
  .tui-diff__layout span { min-height: 44px; }
}

/* ---------------------------------------------------------------- part: divider-label */
/* Divider with a label: a rule with a word set into it. The same engraved
   groove as the separator runs out to both sides of a printed word ("or", a
   date, the name of the section below), broken where the word sits. The word is
   real text in reading order, so a screen reader says it where a sighted
   reader sees it; the two grooves are only drawn. */
.tui-divider {
  --lip: var(--tui-quiet) transparent;
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  margin: var(--tui-4) 0;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  text-align: center;
}
.tui-divider::before, .tui-divider::after {
  content: '';
  flex: 1 1 0;
  min-width: var(--tui-3);
  height: 2px;
  border-top: 1px solid var(--tui-rule);
  border-bottom: 1px solid var(--lip, var(--tui-hl));
}
.tui-divider__text { flex: 0 1 auto; min-width: 0; margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; overflow-wrap: anywhere; }
/* The word at one end: a section's name, with the rule running on from it. */
.tui-divider--start::before, .tui-divider--end::after { display: none; }
/* A sentence or a date as it is written, not printed as a legend. */
.tui-divider--plain { font: 500 var(--tui-t-small)/1.3 var(--tui-sans); letter-spacing: 0; text-transform: none; }
/* Down the page, between two columns: the word is set upright. */
.tui-divider--vertical { flex-direction: column; align-self: stretch; margin: 0 var(--tui-3); gap: var(--tui-2); }
.tui-divider--vertical::before, .tui-divider--vertical::after { flex: 1 1 0; min-width: 0; min-height: var(--tui-3); width: 2px; height: auto; border-top: 0; border-left: 1px solid var(--tui-rule); border-right: 1px solid var(--lip, var(--tui-hl)); }
@media (forced-colors: active) {
  .tui-divider::before, .tui-divider::after { border-top-color: CanvasText; }
  .tui-divider--vertical::before, .tui-divider--vertical::after { border-top-color: transparent; border-left-color: CanvasText; }
}

/* ---------------------------------------------------------------- part: doc-scan */
/* Document scan: the plate that stands where a "Processing…" spinner would, while
   a dropped PDF is read page by page. The kit's panel plate holding the kit's lamp
   (state), progress groove (pages read) and two LCD windows (the page it is on, the
   fields found), with the kit's small key for Retry. Nothing here is coloured or
   shaped: this file only holds the plate's footprint and lays its pieces out. The
   same height in all four states: the Retry key's row is kept, so nothing moves when
   a scan fails. At rest in a state, motion is the lamp's blink and, while extracting,
   a short length of ink running along the groove; under reduced motion both are
   still. See doc-scan.mjs. */
:is(tui-doc-scan, .tui-doc-scan) {
  position: relative;
  display: block;
  box-sizing: border-box;
  /* A plate asks for the room its pieces need even where nothing around it gives any (a table cell, a centred grid): a percentage is no help there, so the least is a length, held inside a phone's gutters. */
  width: 100%;
  min-width: min(17rem, calc(100vw - 2 * var(--tui-4)));
  container-type: inline-size;
}

.tui-doc-scan__plate {
  box-sizing: border-box;
  display: grid;
  align-items: center;
  gap: var(--tui-2) var(--tui-3);
  min-width: 0;
  --ds-row: 28px;
  padding: var(--tui-3);
  text-align: left;
  /* A phone's width: the state over the groove, the page and the fields down the right, and on a failure Retry beside the fields. */
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "state page page"
    "groove fields retry";
  grid-template-rows: auto minmax(var(--ds-row), auto);
}
.tui-doc-scan__plate[data-state]:not([data-state="error"]) { grid-template-areas: "state page page" "groove fields fields"; }
.tui-doc-scan__state { grid-area: state; min-width: 0; }
.tui-doc-scan__groove { grid-area: groove; align-self: center; min-width: 0; }
.tui-doc-scan__page { grid-area: page; justify-self: end; }
.tui-doc-scan__fields { grid-area: fields; justify-self: end; }
.tui-doc-scan__retry { grid-area: retry; justify-self: end; }
.tui-doc-scan__retry[hidden] { display: none; }

.tui-doc-scan__word {
  min-width: 0;
  font: 600 var(--tui-t-small)/1.2 var(--tui-sans);
  color: var(--tui-ink);
  white-space: nowrap;
}
.tui-doc-scan__plate[data-state="error"] .tui-doc-scan__word { color: var(--tui-red-ink); }
.tui-doc-scan__page, .tui-doc-scan__fields { min-width: 0; }

/* Room for it on one line: state, groove, the two windows, Retry. */
@container (min-width: 520px) {
  .tui-doc-scan__plate {
    grid-template-columns: 7.5rem minmax(48px, 1fr) auto auto auto;
    grid-template-areas: "state groove page fields retry";
    grid-template-rows: minmax(var(--ds-row), auto);
  }
  .tui-doc-scan__plate[data-state]:not([data-state="error"]) { grid-template-areas: "state groove page fields retry"; }
}

/* The groove while fields are pulled out: every page is read, so the ink stays full, and a short hatched
   length runs to and fro over it (how many fields remain is not known). The hatch is the well's own tone. */
.tui-doc-scan__groove[data-indeterminate]::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 2px;
  right: auto;
  width: calc((100% - 4px) * 0.3);
  border-radius: 3px;
  background: repeating-linear-gradient(-45deg, var(--tui-well) 0 2px, transparent 2px 6px);
  animation: tui-doc-scan-run 1.3s var(--tui-ease) infinite alternate;
}
@keyframes tui-doc-scan-run { from { translate: 0 0; } to { translate: 233.33% 0; } }
/* Off screen, nothing runs that nobody can see. */
tui-doc-scan[data-paused] .tui-doc-scan__groove::before { animation-play-state: paused; }
/* A still in the docs holds the hatch at a fixed place, part-way along. */
:is(tui-doc-scan, .tui-doc-scan)[data-static] .tui-doc-scan__groove[data-indeterminate]::before { animation: none; translate: 80% 0; }

/* Said aloud, never seen. */
.tui-doc-scan__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-doc-scan__plate { --ds-row: 44px; }
  .tui-doc-scan__retry { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-doc-scan__groove, .tui-doc-scan__groove::after { transition: none; }
  .tui-doc-scan__groove[data-indeterminate]::before {
    width: calc(100% - 4px);
    translate: none;
    animation: none;
  }
}

/* ---------------------------------------------------------------- part: drawer-index */
/* Drawer index: a file tree as a card-index cabinet. Folders at the top are
   drawers, each a front with a label holder and a cup pull. An open drawer
   slides out below its front with its files standing in it as index cards,
   each one's top edge showing over the card behind it. A folder inside is a
   divider of pressboard with a tab, cut in one of three places along the
   row, and its cards stand behind it. The card taken out stands a little
   proud of the others, its lamp lit. See drawer-index.mjs.
   Cards and labels are paper in either finish; the cabinet is the finish.
   Corners are concentric: a 6px front in an 8px carcass margin makes 14px. */
.tui-drawer-index {
  --di-card: 34px;          /* how much of each card shows over the one behind it */
  --di-press: var(--tui-board, color-mix(in oklab, var(--tui-paper) 78%, var(--tui-paper-ink)));
  position: relative;
  isolation: isolate;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(var(--tui-face-lo), color-mix(in oklab, var(--tui-face-lo) 88%, rgb(var(--tui-sh))));
  box-shadow: var(--tui-depth-plate, var(--tui-raised), inset 0 1px 0 var(--tui-hl));
  font-size: var(--tui-t-body);
}
.tui-drawer-index ul { margin: 0; padding: 0; list-style: none; }
.tui-drawer-index__cabinet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tui-drawer-index [role="treeitem"] { position: relative; outline: none; }

/* ------------------------------------------------------------------ a drawer front */
.tui-drawer-index__front {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 18px 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  background:
    var(--tui-noise),
    var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), var(--tui-face)));
  background-blend-mode: soft-light, normal;
  /* The reveal: a dark gap round the front where it sits in the carcass. */
  box-shadow:
    var(--tui-depth-key, inset 0 1px 0 var(--tui-hl),
    inset 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6)),
    0 0 0 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)),
    0 1px 0 1.5px color-mix(in oklab, var(--tui-hl) 50%, transparent));
  transition: box-shadow 200ms var(--tui-ease), transform 200ms var(--tui-ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-drawer-index__front:hover, .tui-drawer-index__front.is-hover { filter: brightness(1.025); }
/* Pulled out: the front stands proud of the carcass and throws a shadow on what is below it. */
.tui-drawer-index__drawer[aria-expanded="true"] > .tui-drawer-index__front {
  transform: translateY(-1px);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    inset 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6)),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)),
    0 3px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 9px 14px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
}
.tui-drawer-index__drawer:focus-visible > .tui-drawer-index__front,
.tui-drawer-index__front.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* The label holder: a card of paper behind a pressed frame. */
.tui-drawer-index__holder {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  max-width: calc(100% - 64px);
  padding: 7px 11px 6px;
  border-radius: 3px;
  background: linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  box-shadow:
    var(--tui-depth-well, inset 0 1px 2px rgb(0 0 0 / 0.28),
    inset 0 0 0 1px rgb(0 0 0 / 0.08),
    0 0 0 2.5px var(--tui-face-hi),
    0 0 0 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3)),
    0 1.5px 0 3px var(--tui-hl),
    0 2px 3px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)));
}
.tui-drawer-index__holder .tui-drawer-index__name { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: -0.005em; color: var(--tui-paper-ink); }
/* Short of room, the count gives way before the name does. */
.tui-drawer-index :is(.tui-drawer-index__holder, .tui-drawer-index__tab) .tui-drawer-index__meta { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--tui-t-small); color: var(--tui-paper-ink-2); font-variant-numeric: tabular-nums; }

/* The cup pull: a pressed hood with its dark hollow under it. */
.tui-drawer-index__pull {
  position: relative;
  flex: none;
  width: 50px;
  height: 20px;
  border-radius: 4px 4px 25px 25px / 4px 4px 18px 18px;
  background: linear-gradient(var(--tui-knob-hi), var(--tui-knob-mid) 55%, var(--tui-knob-lo));
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 rgb(255 255 255 / 0.5), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)), 0 4px 6px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3)));
}
.tui-drawer-index__pull::after {
  content: '';
  position: absolute;
  inset: 5px 5px 4px;
  border-radius: 2px 2px 20px 20px / 2px 2px 12px 12px;
  background: linear-gradient(rgb(0 0 0 / 0.72), rgb(0 0 0 / 0.35) 70%, rgb(255 255 255 / 0.1));
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
}

/* ------------------------------------------------------------------ the drawer, slid out */
/* The body is a grid row that grows from nothing, so it slides without being measured. Shut, it is out of reach. */
.tui-drawer-index__body {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 280ms var(--tui-ease), visibility 0s linear 280ms;
}
[aria-expanded="true"] > .tui-drawer-index__body {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 300ms var(--tui-ease), visibility 0s;
}
.tui-drawer-index__body > .tui-drawer-index__group { min-height: 0; overflow: hidden; }
/* The drawer's box: a steel tray a little narrower than its front, the cards standing on its floor. */
.tui-drawer-index__drawer > .tui-drawer-index__body > .tui-drawer-index__group {
  margin: 0 8px;
  padding: 0 10px;
  border-radius: 0 0 6px 6px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow:
    var(--tui-depth-well, inset 0 10px 10px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)),
    inset 3px 0 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    inset -3px 0 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 60%, transparent));
}
/* The cards come forward as the drawer opens, the way a drawer brings its load. */
.tui-drawer-index__group > li { transition: translate 300ms var(--tui-ease), opacity 200ms linear; }
[aria-expanded="false"] > .tui-drawer-index__body > .tui-drawer-index__group > li { translate: 0 -14px; opacity: 0; }
.tui-drawer-index__drawer > .tui-drawer-index__body > .tui-drawer-index__group::before,
.tui-drawer-index__drawer > .tui-drawer-index__body > .tui-drawer-index__group::after { content: ''; display: block; height: 14px; }
.tui-drawer-index__drawer > .tui-drawer-index__body > .tui-drawer-index__group::after { height: 10px; }

/* ------------------------------------------------------------------ a card */
/* Each card stands in front of the one before it: it covers that card's lower part and shades it. */
.tui-drawer-index__card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  height: calc(var(--di-card) + 8px);
  margin-top: -8px;
  padding: 7px 12px 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  color: var(--tui-paper-ink);
  background:
    linear-gradient(color-mix(in oklab, var(--tui-paper-ink) 16%, transparent), color-mix(in oklab, var(--tui-paper-ink) 16%, transparent)) 0 25px / 100% 1px no-repeat,
    linear-gradient(var(--tui-paper-hi), var(--tui-paper) 60%);
  box-shadow: var(--tui-depth-plate, 0 -1px 0 rgb(255 255 255 / 0.55) inset, 0 -3px 5px -2px rgb(0 0 0 / 0.22), 0 0 0 0.5px rgb(0 0 0 / 0.18));
  transition: translate 180ms var(--tui-ease), box-shadow 180ms var(--tui-ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-drawer-index__group > .tui-drawer-index__card:first-child, .tui-drawer-index__divider + .tui-drawer-index__card { margin-top: 0; }
/* Cards are filed by hand: not quite square to each other. */
.tui-drawer-index__card:nth-child(3n + 2) { margin-left: 1px; margin-right: -1px; }
.tui-drawer-index__card:nth-child(3n) { margin-left: -1px; margin-right: 1px; }
.tui-drawer-index__card .tui-drawer-index__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tui-drawer-index__card .tui-drawer-index__meta { flex: none; font-size: var(--tui-t-small); color: var(--tui-paper-ink-2); font-variant-numeric: tabular-nums; }
.tui-drawer-index__card:hover, .tui-drawer-index__card.is-hover { translate: 0 -2px; }
/* Taken out: the card stands proud of the row, its lamp lit. */
.tui-drawer-index__card[aria-selected="true"] {
  translate: 0 -6px;
  box-shadow: var(--tui-depth-float, 0 -1px 0 rgb(255 255 255 / 0.55) inset, 0 -4px 8px -2px rgb(0 0 0 / 0.3), 0 0 0 0.5px rgb(0 0 0 / 0.2));
}
.tui-drawer-index__card[aria-selected="true"] .tui-drawer-index__name { font-weight: 700; }
.tui-drawer-index__card::after {
  content: '';
  flex: none;
  opacity: 0;
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-green) 22%, var(--tui-paper));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.4);
}
.tui-drawer-index__card[aria-selected="true"]::after {
  opacity: 1;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--tui-green);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 6px 1px color-mix(in oklab, var(--tui-green) 70%, transparent);
}
.tui-drawer-index__card:focus-visible, .tui-drawer-index__card.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; z-index: 3; }

/* ------------------------------------------------------------------ a divider */
.tui-drawer-index__divider { margin-top: 20px; }
.tui-drawer-index__group > .tui-drawer-index__divider:first-child { margin-top: 24px; }
.tui-drawer-index__divide {
  position: relative;
  display: block;
  height: 16px;
  border-radius: 0 0 1px 1px;
  cursor: pointer;
  background: var(--tui-noise), linear-gradient(color-mix(in oklab, var(--di-press) 84%, var(--tui-board-lift, white)), var(--di-press) 80%);
  background-blend-mode: soft-light, normal;
  box-shadow: var(--tui-depth-plate, 0 -3px 5px -2px rgb(0 0 0 / 0.26), 0 0 0 0.5px rgb(0 0 0 / 0.24), inset 0 1px 0 rgb(255 255 255 / 0.35));
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* The tab is the same board, standing up from its top edge, cut in one of three places. */
.tui-drawer-index__tab {
  position: absolute;
  bottom: calc(100% - 1px);
  left: calc(8px + var(--tab, 0) * (100% - 16px) / 2);
  translate: calc(var(--tab, 0) * -50%) 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: max-content;
  max-width: calc(70% - 8px);
  height: 23px;
  padding: 5px 12px 0;
  border-radius: 6px 6px 0 0;
  background: var(--tui-noise), linear-gradient(color-mix(in oklab, var(--di-press) 78%, var(--tui-board-lift, white)), color-mix(in oklab, var(--di-press) 84%, var(--tui-board-lift, white)));
  background-blend-mode: soft-light, normal;
  box-shadow: var(--tui-depth-plate, 0 -2px 4px -1px rgb(0 0 0 / 0.26), 0 0 0 0.5px rgb(0 0 0 / 0.24), inset 0 1px 0 rgb(255 255 255 / 0.4));
  clip-path: inset(-8px -8px 0 -8px);
}
.tui-drawer-index__tab .tui-drawer-index__name { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--tui-paper-ink); }
.tui-drawer-index__divide:hover, .tui-drawer-index__divide.is-hover { filter: brightness(1.03); }
.tui-drawer-index__divider:focus-visible > .tui-drawer-index__divide .tui-drawer-index__tab,
.tui-drawer-index__divide.is-focus .tui-drawer-index__tab { outline: 2px solid var(--tui-focus); outline-offset: 2px; clip-path: none; }
/* The cards behind a divider stand a little in from it. */
.tui-drawer-index__divider > .tui-drawer-index__body > .tui-drawer-index__group { padding: 0 0 0 12px; }
.tui-drawer-index__divider > .tui-drawer-index__body > .tui-drawer-index__group > li:first-child { margin-top: -6px; }
.tui-drawer-index__divider > .tui-drawer-index__body > .tui-drawer-index__group > .tui-drawer-index__divider:first-child { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .tui-drawer-index__body, [aria-expanded="true"] > .tui-drawer-index__body,
  .tui-drawer-index__group > li, .tui-drawer-index__front, .tui-drawer-index__card { transition: none; }
}

/* ---------------------------------------------------------------- part: drawer */
/* Drawer: a panel that slides in from an edge of the window, on the native
   <dialog>. It is a face plate bolted to the edge: square where it meets the
   frame, rounded where it faces the page, with a machined grip let into the
   inner edge to pull it shut by. The scrim is the dialog's own backdrop.
   Modal, so focus is held inside and the page behind is inert; Escape closes
   it. drawer.mjs adds the triggers, the scrim click and the drag on the grip. */
.tui-drawer {
  --edge-size: 400px;
  --r: 16px;
  --gutter: 28px;
  position: fixed;
  margin: 0;
  padding: 0;
  border: 0;
  max-width: none;
  max-height: none;
  overflow: hidden;
  color: var(--tui-ink);
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  background: var(--tui-face);
  outline: none;
  transform: translate(var(--hide-x, 0px), var(--hide-y, 0px));
}
.tui-drawer[open] { display: flex; flex-direction: column; transform: translate(var(--dx, 0px), var(--dy, 0px)); overscroll-behavior: contain; }
.tui-drawer--sm { --edge-size: 320px; }
.tui-drawer--lg { --edge-size: 540px; }

/* The four edges. Each keeps the plate's corners square along the frame and rounds the ones that face the page. */
.tui-drawer, .tui-drawer[data-edge="right"] {
  inset: 0 0 0 auto;
  width: min(var(--edge-size), calc(100vw - 32px));
  height: 100dvh;
  padding-left: var(--gutter);
  border-radius: var(--r) 0 0 var(--r);
  --hide-x: 100%;
  box-shadow: var(--tui-depth-float, inset 1px 0 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), -2px 0 3px rgb(var(--tui-sh) / 0.2), -24px 0 48px -16px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
.tui-drawer[data-edge="left"] {
  inset: 0 auto 0 0;
  padding: 0 var(--gutter) 0 0;
  border-radius: 0 var(--r) var(--r) 0;
  --hide-x: -100%;
  box-shadow: var(--tui-depth-float, inset -1px 0 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 2px 0 3px rgb(var(--tui-sh) / 0.2), 24px 0 48px -16px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
.tui-drawer[data-edge="bottom"], .tui-drawer[data-edge="top"] {
  inset: auto 0 0 0;
  width: min(100vw, 680px);
  height: auto;
  max-height: min(86dvh, var(--edge-size));
  margin-inline: auto;
  padding: var(--gutter) 0 0;
  border-radius: var(--r) var(--r) 0 0;
  --hide-x: 0px;
  --hide-y: 100%;
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 -2px 3px rgb(var(--tui-sh) / 0.2), 0 -24px 48px -16px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
.tui-drawer[data-edge="top"] {
  inset: 0 0 auto 0;
  padding: 0 0 var(--gutter);
  border-radius: 0 0 var(--r) var(--r);
  --hide-y: -100%;
  box-shadow: var(--tui-depth-float, inset 0 -1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.2), 0 24px 48px -16px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
/* A page of a bottom or top drawer scrolls inside itself, never past the window. */
.tui-drawer[data-edge="bottom"] .tui-drawer__body, .tui-drawer[data-edge="top"] .tui-drawer__body { max-height: 100%; }

/* The grip: a slot let into the inner edge with two ribs standing in it. Drag it towards the frame to close. */
.tui-drawer__handle {
  position: absolute;
  width: 10px;
  height: 56px;
  left: 9px;
  top: 50%;
  margin-top: -28px;
  border-radius: 5px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 6px, rgb(var(--tui-sh) / 0.32) 6px 7px, var(--tui-hl) 7px 8px, transparent 8px 10px) 0 4px / 100% 48px no-repeat,
    var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: grab;
  touch-action: none;
}
.tui-drawer__handle::after { content: ''; position: absolute; inset: -12px -14px; }
.tui-drawer[data-dragging] .tui-drawer__handle { cursor: grabbing; }
.tui-drawer[data-edge="left"] .tui-drawer__handle { left: auto; right: 9px; }
.tui-drawer[data-edge="bottom"] .tui-drawer__handle, .tui-drawer[data-edge="top"] .tui-drawer__handle {
  width: 56px;
  height: 10px;
  left: 50%;
  top: 9px;
  margin: 0 0 0 -28px;
  background:
    repeating-linear-gradient(to right, transparent 0 6px, rgb(var(--tui-sh) / 0.32) 6px 7px, var(--tui-hl) 7px 8px, transparent 8px 10px) 4px 0 / 48px 100% no-repeat,
    var(--tui-well-fill) var(--tui-well);
}
.tui-drawer[data-edge="top"] .tui-drawer__handle { top: auto; bottom: 9px; }

.tui-drawer__head { flex: none; display: flex; align-items: center; gap: var(--tui-3); padding: 18px 16px 14px 20px; border-bottom: 1px solid var(--tui-rule); }
.tui-drawer__head > :first-child { flex: 1; min-width: 0; }
.tui-drawer__title { margin: 0; font: 700 var(--tui-t-lead)/1.2 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-drawer__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px 20px; }
.tui-drawer__foot { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--tui-2); padding: 14px 20px 18px; border-top: 1px solid var(--tui-rule); }

/* Not a dialog (a specimen in a page, a docs cell): it sits in the flow at the size it is given. */
.tui-drawer.tui-drawer:not(dialog) { position: relative; inset: auto; display: flex; flex-direction: column; transform: none; height: 220px; width: 100%; max-height: none; margin-inline: 0; }

/* The page behind stands still while a drawer is open. */
:root:has(dialog.tui-drawer[open]) { overflow: hidden; }

/* Sliding in: the plate travels from its edge and the scrim comes up, both kept on screen until they have left. */
@supports (transition-behavior: allow-discrete) {
  /* It arrives in 280ms and leaves in 200ms: the transition that plays is the one on the state it is entering. */
  .tui-drawer {
    transition: transform 200ms var(--tui-ease), overlay 200ms allow-discrete, display 200ms allow-discrete;
  }
  .tui-drawer[open] { transition-duration: 280ms; }
  .tui-drawer[data-dragging] { transition: none; }
  .tui-drawer::backdrop { opacity: 0; transition: opacity 200ms var(--tui-ease), overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .tui-drawer[open]::backdrop { opacity: 1; transition-duration: 280ms; }
  @starting-style {
    .tui-drawer[open] { transform: translate(var(--hide-x, 0px), var(--hide-y, 0px)); }
    .tui-drawer[open]::backdrop { opacity: 0; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .tui-drawer, .tui-drawer::backdrop { transition: none !important; }
}

/* ---------------------------------------------------------------- part: drop-zone */
/* Drop zone: an in-tray. A machined lip stands round a ribbed floor cut into
   it; the floor rises a little when a file is dragged over, and a lamp on the
   lip's front edge lights while it is. Dropped files are listed as printed
   rows under it. The real <input type=file> sits inside the key that says
   "Choose files", so the keyboard and a touch screen use the same tray.
   Corners are concentric: a 6px lip round a 6px floor makes the 12px tray. */
@property --tui-dz-depth { syntax: '<number>'; inherits: true; initial-value: 1; }

tui-drop-zone, .tui-drop-zone { display: grid; gap: var(--tui-3); min-width: 0; }

.tui-drop-zone__tray {
  --tui-dz-depth: 1;
  display: grid;
  gap: 6px;
  padding: 6px;
  border-radius: var(--tui-r-l);
  background: var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 90%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 1.5px 0 var(--tui-skirt), 0 8px 14px -8px rgb(var(--tui-sh) / var(--tui-sh-a)));
  transition: --tui-dz-depth 160ms var(--tui-ease);
}

/* The floor: a recess with ribs across it, like the rubber mat of an in-tray. */
.tui-drop-zone__floor {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--tui-1);
  min-height: var(--tui-dz-h, 148px);
  padding: var(--tui-6) var(--tui-4);
  border-radius: 6px;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, rgb(var(--tui-sh) / 0.1) 0 1px, color-mix(in oklab, var(--tui-hl) 55%, transparent) 1px 2px, transparent 2px 10px),
    var(--tui-well-fill) var(--tui-well);
  box-shadow:
    var(--tui-depth-well, inset 0 calc(3px * var(--tui-dz-depth)) calc(3px * var(--tui-dz-depth)) -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6 * var(--tui-dz-depth))),
    inset 0 calc(10px * var(--tui-dz-depth)) 12px -9px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8 * var(--tui-dz-depth))),
    inset 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.45)),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 60%, transparent));
  transform: translateY(calc((1 - var(--tui-dz-depth)) * -2px));
  cursor: default;
}
:is(tui-drop-zone, .tui-drop-zone)[data-over] .tui-drop-zone__tray { --tui-dz-depth: 0.25; }
:is(tui-drop-zone, .tui-drop-zone)[data-over] .tui-drop-zone__floor { background-position: 0 1px, 0 0; }

.tui-drop-zone__title { margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-drop-zone__hint { max-width: 34ch; margin: 0 0 var(--tui-3); font-size: var(--tui-t-small); line-height: 1.45; color: var(--tui-ink-2); }
.tui-drop-zone__pick { cursor: pointer; }
/* The real input, inside the key: focusable, named by the key, opened by Enter or Space. */
.tui-drop-zone__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.tui-drop-zone__pick:has(.tui-drop-zone__input:focus-visible), .tui-drop-zone__pick.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-drop-zone__pick:has(.tui-drop-zone__input:disabled) { opacity: 0.45; cursor: not-allowed; }

/* The lip's front edge: the lamp, what the tray is doing, and how full it is. */
.tui-drop-zone__lip { display: flex; align-items: center; gap: var(--tui-2); padding: 1px 6px 1px 4px; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-drop-zone__state { flex: 1; }
.tui-drop-zone__count { font-variant-numeric: tabular-nums; }
:is(tui-drop-zone, .tui-drop-zone)[data-over] .tui-drop-zone__state { color: var(--tui-ink); font-weight: 600; }

:is(tui-drop-zone, .tui-drop-zone)[disabled] .tui-drop-zone__tray { opacity: 0.55; }
:is(tui-drop-zone, .tui-drop-zone)[disabled] .tui-drop-zone__pick { cursor: not-allowed; }

/* Files in the tray: sheets of paper lying on the floor, the newest on top,
   the pile fanned a little. They cover the printing on the floor, which stays
   for a screen reader (it names the tray and describes the key). A sheet under
   the pointer comes to the top of the pile, and its key takes it out. */
.tui-drop-zone__floor[data-holding] > :is(.tui-drop-zone__title, .tui-drop-zone__hint) { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-drop-zone__sheets { display: grid; width: 116px; margin: 2px 0 var(--tui-4); }
.tui-drop-zone__sheet {
  /* Its place in the fan: 0 in the middle of the pile, ±1 either side. */
  --o: calc(var(--i) - (var(--n) - 1) / 2);
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 6px;
  height: 76px;
  padding: 8px 9px;
  border-radius: 2px;
  text-align: left;
  color: var(--tui-paper-ink);
  /* Three printed lines, faint, under the name. */
  background:
    repeating-linear-gradient(to bottom, color-mix(in oklab, var(--tui-paper-ink) 13%, transparent) 0 1px, transparent 1px 6px) 9px 47px / calc(100% - 18px) 16px no-repeat,
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  box-shadow: var(--tui-depth-plate, 0 0 0 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)), 0 5px 9px -5px rgb(var(--tui-sh) / var(--tui-sh-a)));
  translate: calc(var(--o) * 13px) calc(var(--o) * var(--o) * 1.5px);
  rotate: calc(var(--o) * 4deg);
}
.tui-drop-zone__sheet:hover { z-index: 1; }
.tui-drop-zone__sheet-kind { padding: 3px 4px; border-radius: 2px; font: 600 9px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-paper-ink-2); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tui-paper-ink) 28%, transparent); }
.tui-drop-zone__sheet-name { max-width: calc(100% - 4px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11px/1.2 var(--tui-sans); }
.tui-drop-zone__sheet-x { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; color: var(--tui-paper-ink-2); background: transparent; cursor: pointer; opacity: 0.55; }
.tui-drop-zone__sheet-x svg { width: 10px; height: 10px; }
.tui-drop-zone__sheet-x:hover { opacity: 1; background: color-mix(in oklab, var(--tui-paper-ink) 9%, transparent); }
.tui-drop-zone__sheet-x:disabled { display: none; }
/* Landing: a sheet drops the last few millimetres into the tray and settles, one after another. */
.tui-drop-zone__sheet[data-new] { animation: tui-dz-settle 340ms cubic-bezier(0.2, 0.8, 0.3, 1.12) calc(var(--i) * 60ms) both; }
@keyframes tui-dz-settle { from { opacity: 0; transform: translateY(-18px) rotate(-6deg) scale(1.05); } 55% { opacity: 1; } }

/* Printed rows: extension plate, name, size, and a key to take it out. */
.tui-drop-zone__list { display: grid; margin: 0; padding: 0; list-style: none; }
.tui-drop-zone__list:empty { display: none; }
.tui-drop-zone__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--tui-3); min-height: 46px; padding: 6px 2px; }
.tui-drop-zone__row + .tui-drop-zone__row { border-top: 1px solid var(--tui-rule); }
.tui-drop-zone__ext { display: grid; place-items: center; min-width: 38px; height: 22px; padding: 0 6px; border-radius: 4px; font: 600 10px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-drop-zone__text { display: grid; gap: 1px; min-width: 0; }
.tui-drop-zone__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--tui-ink); }
.tui-drop-zone__why { font-size: var(--tui-t-small); line-height: 1.35; color: var(--tui-ink-2); }
.tui-drop-zone__size { font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--tui-ink-2); }
/* A refused file: its lamp is red and its row says why, in words. */
.tui-drop-zone__row[data-refused] .tui-drop-zone__ext { display: none; }
.tui-drop-zone__row[data-refused] { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; padding-block: 10px; }
.tui-drop-zone__row[data-refused] .tui-lamp { margin-top: 7px; }
.tui-drop-zone__row[data-refused] .tui-drop-zone__name { font-weight: 600; white-space: normal; overflow-wrap: anywhere; }

/* Spoken, not seen: what was added, removed or refused. */
.tui-drop-zone__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
tui-drop-zone { position: relative; }

@media (prefers-reduced-motion: reduce) { .tui-drop-zone__tray { transition: none; } .tui-drop-zone__sheet[data-new] { animation: none; } }

/* ---------------------------------------------------------------- part: duration-field */
/* Duration field: a length of time in the field's well, a segment for each unit
   (hours, minutes, optionally days or seconds), the unit printed beside its
   number as a small suffix. The well is the kit's, so every finish and both
   volumes are theirs; the segment you are on carries the focus ring. Under the
   well, optional quick-pick keys. Nothing animates. Without the script the
   input inside the element is an ordinary text field. */
tui-duration-field { position: relative; display: grid; gap: 8px; width: min(100%, 320px); min-width: 0; }
.tui-duration-field__well {
  --df-h: 38px;
  --df-pad: 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: var(--df-h);
  padding: 0 var(--df-pad);
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* A segment: the number and its unit, one target to press. Concentric with the well. */
.tui-duration-field__seg {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: calc(var(--df-h) - var(--df-pad) * 2);
  padding: 0 6px;
  border-radius: calc(var(--tui-r-m) - var(--df-pad));
  cursor: text;
}
.tui-duration-field__seg:has(.tui-duration-field__input:focus-visible), .tui-duration-field__seg.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 0; }
.tui-duration-field__input {
  appearance: none;
  box-sizing: content-box;
  width: calc(var(--df-w, 2) * 1ch);
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: inherit;
  caret-color: transparent;
  background: transparent;
  outline: none;
}
.tui-duration-field__input::placeholder { color: var(--tui-ink-3); opacity: 1; }
.tui-duration-field__unit { font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); user-select: none; pointer-events: none; }

/* Quick picks: plain keys under the well, the one that matches the value held down. */
.tui-duration-field__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tui-duration-field__presets > .tui-key { flex: none; }

/* The line for an error: the field's hint, in the error ink. Empty, it takes no room. */
.tui-duration-field__error { margin: 0; color: var(--tui-red-ink, var(--tui-red)); }
.tui-duration-field__error:empty { display: none; }
tui-duration-field[data-error] .tui-duration-field__well, tui-duration-field[data-invalid] .tui-duration-field__well {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
.tui-duration-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Disabled and read only. */
tui-duration-field:is([disabled], [data-disabled]) :is(.tui-duration-field__well, .tui-duration-field__presets),
tui-duration-field:disabled :is(.tui-duration-field__well, .tui-duration-field__presets) { opacity: 0.45; }
tui-duration-field:is([disabled], [data-disabled]) .tui-duration-field__seg,
tui-duration-field:disabled .tui-duration-field__seg,
.tui-duration-field__input:disabled { cursor: not-allowed; }
tui-duration-field[readonly] .tui-duration-field__seg { cursor: default; }

@media (pointer: coarse) {
  .tui-duration-field__well { --df-h: 52px; }
  .tui-duration-field__seg { min-width: 44px; padding: 0 8px; }
  .tui-duration-field__input { font-size: 16px; }
  .tui-duration-field__unit { font-size: 13px; }
  .tui-duration-field__presets > .tui-key { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-duration-field .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: empty-state */
/* Empty state: an empty tray with the outline of what goes in it printed on
   its floor, the way a tool board shows where each tool hangs. An unlit lamp
   names what is missing, one sentence says how it arrives, one key adds the
   first. Outlines: slots (default, one per <i>), a sheet, a plot. */
.tui-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--tui-3);
  padding: var(--tui-8) var(--tui-6) var(--tui-6);
  text-align: center;
  border-radius: var(--tui-r-l);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-empty .tui-status { color: var(--tui-ink); font-weight: 600; font-size: var(--tui-t-body); }
.tui-empty__text { max-width: 38ch; margin: 0; color: var(--tui-ink-2); text-wrap: balance; }
.tui-empty__text + * { margin-top: var(--tui-1); }

/* The printed outline: dashed, in the faint ink of a scale. */
.tui-empty__outline {
  --line: color-mix(in oklab, var(--tui-ink-3) 75%, transparent);
  display: grid;
  gap: 6px;
  width: min(100%, 196px);
  margin-bottom: var(--tui-2);
}
.tui-empty__outline > i {
  display: block;
  height: 22px;
  border: 1.5px dashed var(--line);
  border-radius: 6px;
  background: radial-gradient(circle, var(--line) 2.5px, transparent 3px) 9px 50% / 6px 6px no-repeat;
}
.tui-empty__outline > i:nth-child(2) { opacity: 0.7; }
.tui-empty__outline > i:nth-child(n + 3) { opacity: 0.45; }
/* A sheet: a page with its top corner turned, and three printed lines. */
.tui-empty__outline--sheet {
  position: relative;
  width: 64px;
  height: 80px;
  border: 1.5px dashed var(--line);
  border-radius: 5px 16px 5px 5px;
  background:
    linear-gradient(var(--line), var(--line)) 11px 30px / 34px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) 11px 40px / 26px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) 11px 50px / 30px 1.5px no-repeat;
}
.tui-empty__outline--sheet::after {
  content: '';
  position: absolute;
  top: -1.5px;
  right: -1.5px;
  width: 16px;
  height: 16px;
  border-left: 1.5px dashed var(--line);
  border-bottom: 1.5px dashed var(--line);
  border-radius: 0 0 0 5px;
}
/* A plot: axes printed, the trace still to come. */
.tui-empty__outline--plot {
  width: min(100%, 196px);
  height: 72px;
  border-left: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
  background:
    repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 10px) 0 33% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 10px) 0 66% / 100% 1px no-repeat;
  opacity: 0.8;
}

/* Side by side when the tray is wide and short (under a table head): the
   words go in .tui-empty__words. Narrow, it folds into a left-aligned column. */
.tui-empty--row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: var(--tui-4) var(--tui-5); padding: var(--tui-5); text-align: left; }
.tui-empty--row .tui-empty__outline { width: 104px; margin: 0; }
.tui-empty__words { display: grid; justify-items: center; gap: var(--tui-2); }
.tui-empty--row .tui-empty__words { flex: 1 1 200px; justify-items: start; }
.tui-empty--row .tui-empty__text { max-width: 52ch; }
.tui-empty--row > .tui-key { flex: none; margin: 0; }

/* ---------------------------------------------------------------- part: empty-tray */
/* Empty tray: an empty machined tray, and the shape of what goes in it cut
   into its floor, the way a case is cut for the thing it carries. A raised
   plate with a bed recessed into it; in the bed a debossed file, key or card
   (data-shape); under it what is missing, why, and a key that fills it. Pure
   markup. Corners are concentric: a 6px rim round a 6px bed makes the 12px plate. */
.tui-empty-tray {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: var(--tui-5);
  width: min(100%, 380px);
  padding: 6px 6px var(--tui-6);
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
/* The same bead-blast as a panel. */
.tui-empty-tray::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}

/* The bed: a flat floor with the shape sunk further into it, as deep as every
   other recess in the kit (--tui-inset). The floor is the well's tone alone:
   the shaded floor (--tui-well-fill) darkens a share of a recess's height, so
   in a bed this tall it turned the top half black. */
.tui-empty-tray__bed {
  display: grid;
  place-items: center;
  min-height: 156px;
  padding: var(--tui-6);
  border-radius: 6px;
  background: var(--tui-well);
  box-shadow: var(--tui-inset);
}

/* The deboss: two copies of the same silhouette, one lit and one dark. The lit
   one is a pixel and a half lower, so it shows along the lower lip of the cut;
   the dark one is the cut itself, deepest under its upper wall. */
.tui-empty-tray__shape {
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 90'%3E%3Cpath fill-rule='evenodd' d='M35 5H68L91 28V79a6 6 0 0 1-6 6H35a6 6 0 0 1-6-6V11a6 6 0 0 1 6-6ZM71 12L84 25H75a4 4 0 0 1-4-4ZM40 44h42v4H40ZM40 54h42v4H40ZM40 64h28v4H40Z'/%3E%3C/svg%3E");
  position: relative;
  width: var(--tray-w, 132px);
  aspect-ratio: 4 / 3;
}
.tui-empty-tray[data-shape="key"] .tui-empty-tray__shape {
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 90'%3E%3Cpath fill-rule='evenodd' d='M30 23a22 22 0 1 0 0 44a22 22 0 1 0 0-44ZM30 37a8 8 0 1 1 0 16a8 8 0 1 1 0-16Z'/%3E%3Cpath d='M46 40h62a3 3 0 0 1 3 3v4a3 3 0 0 1-3 3H46Z'/%3E%3Cpath d='M52 35h5a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1V36a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M72 50h8v11a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2ZM88 50h8v7a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2ZM100 50h8v13a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2Z'/%3E%3C/svg%3E");
}
.tui-empty-tray[data-shape="card"] .tui-empty-tray__shape {
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 90'%3E%3Cpath fill-rule='evenodd' d='M17 13.5H103a7 7 0 0 1 7 7V69.5a7 7 0 0 1-7 7H17a7 7 0 0 1-7-7V20.5a7 7 0 0 1 7-7ZM24 33H42a3 3 0 0 1 3 3V48a3 3 0 0 1-3 3H24a3 3 0 0 1-3-3V36a3 3 0 0 1 3-3ZM21 59h34v3H21ZM61 59h14v3H61Z'/%3E%3C/svg%3E");
}
.tui-empty-tray__shape::before, .tui-empty-tray__shape::after {
  content: '';
  position: absolute;
  inset: 0;
  -webkit-mask: var(--shape) center / contain no-repeat;
  mask: var(--shape) center / contain no-repeat;
}
.tui-empty-tray__shape::before { background: var(--tui-hl); translate: 0 1.5px; }
/* Opaque, so the lit copy shows only where this one does not cover it. */
.tui-empty-tray__shape::after {
  background: linear-gradient(color-mix(in oklab, var(--tui-well) 52%, rgb(var(--tui-sh))), color-mix(in oklab, var(--tui-well) 82%, rgb(var(--tui-sh))) 30%, color-mix(in oklab, var(--tui-well) 88%, rgb(var(--tui-sh))));
}

/* What is missing, why, and what to do. */
.tui-empty-tray__front { display: grid; justify-items: center; gap: 6px; padding: 0 var(--tui-4); text-align: center; }
.tui-empty-tray__title { margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-empty-tray__reason { max-width: 36ch; margin: 0; color: var(--tui-ink-2); text-wrap: balance; }
.tui-empty-tray__next { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--tui-3) var(--tui-5); margin-top: var(--tui-3); }

/* Side by side when the tray is wide and short: the bed to the left, the words to the right. */
.tui-empty-tray--row { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--tui-4) var(--tui-5); width: min(100%, 560px); padding: 6px var(--tui-5) 6px 6px; }
.tui-empty-tray--row .tui-empty-tray__bed { flex: 0 0 168px; min-height: 132px; padding: var(--tui-4); }
.tui-empty-tray--row .tui-empty-tray__shape { --tray-w: 104px; }
/* Wrapped under the bed in a narrow container, its words clear the tray's corner: the tray's 6px and this make --tui-safe-l. */
.tui-empty-tray--row .tui-empty-tray__front { flex: 1 1 220px; align-content: center; justify-items: start; padding: 0 0 0 calc(var(--tui-safe-l) - 6px); text-align: left; }
.tui-empty-tray--row .tui-empty-tray__next { justify-content: flex-start; }
@media (max-width: 520px) { .tui-empty-tray--row { padding: 6px 6px var(--tui-5); } .tui-empty-tray--row .tui-empty-tray__bed { flex-basis: 100%; } .tui-empty-tray--row .tui-empty-tray__front { padding: 0 var(--tui-3); } }

/* ---------------------------------------------------------------- part: error-state */
/* Error state: the empty state's sibling for a view that tried and failed.
   The same tray with the outline of what should be here printed on its floor,
   but the lamp in its title is lit red, the words say what happened in plain
   language, and the key that comes first is Retry. Everything else is
   .tui-empty's, so it follows each finish exactly as the empty state does.
   Retrying holds the key down with its words changed and the lamp amber and
   blinking; the blink stops under reduced motion and the lamp stays lit. */
.tui-error-state { position: relative; gap: var(--tui-3); }
.tui-error-state > .tui-status { margin: 0; line-height: 1.3; }
.tui-error-state__title { text-wrap: balance; }
.tui-error-state .tui-empty__outline { opacity: 0.8; }
/* What to do: the key, and one way round it if there is one. */
.tui-error-state__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--tui-2) var(--tui-4); margin-top: var(--tui-1); }
/* A small print line for what a person may want to quote to support. */
.tui-error-state__detail { margin: 0; color: var(--tui-ink-2); font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; }
/* Side by side, as the empty row is. */
.tui-empty--row.tui-error-state .tui-error-state__actions { justify-content: flex-start; }

/* Retrying: the key is off but keeps the focus, and the lamp says amber. */
.tui-error-state[aria-busy="true"] .tui-status > .tui-lamp { --c: var(--tui-amber); animation: tui-blink 1.2s steps(1) infinite; }
.tui-error-state[aria-busy="true"] [data-error-retry] { pointer-events: none; }
/* Said, not seen. */
.tui-error-state__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) { .tui-error-state .tui-key, .tui-error-state .tui-key--sm { --h: 44px; } }
@media (prefers-reduced-motion: reduce) { .tui-error-state[aria-busy="true"] .tui-status > .tui-lamp { animation: none; } }

/* ---------------------------------------------------------------- part: feedback-key */
/* Feedback key: a kit key that grows, where it stands, into the feedback
   panel: the kit's panel plate holding the kit's rating lamps, textarea, flat
   close key and primary Send key, with the kit's spinner in Send while it
   sends and a kit lamp on the key when it has been. Nothing here is coloured
   or shaped: this file only holds the key's footprint, anchors the panel at
   the key's corner (its right edge when there is no room, its bottom edge when it opens up), lays the panel's rows
   out, and lets the script size the plate from the key's to its own. The
   growing itself is the script's, on the kit's easing; under reduced motion
   it swaps with no growth. */
:is(tui-feedback-key, .tui-feedback-key) {
  position: relative;
  display: inline-grid;
  max-width: 100%;
}
/* The key keeps the footprint of any key; its words never wrap. */
.tui-feedback-key__key { max-width: 100%; }
/* Underneath the panel once it is fully open, so only one of the two is ever there to press. */
:is(tui-feedback-key, .tui-feedback-key)[data-panel="open"] > .tui-feedback-key__key { visibility: hidden; }

.tui-feedback-key__panel {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  box-sizing: border-box;
  /* Never wider than the screen less a gutter each side. */
  width: min(320px, calc(100vw - 2 * var(--tui-4)));
  padding: var(--tui-4);
  text-align: left;
}
:is(tui-feedback-key, .tui-feedback-key)[opens="up"] > .tui-feedback-key__panel { top: auto; bottom: 0; }
.tui-feedback-key__panel[hidden] { display: none; }
/* While the plate grows or shrinks its edge cuts what is inside it. */
.tui-feedback-key__panel.is-moving { overflow: hidden; }

.tui-feedback-key__body { display: grid; gap: var(--tui-3); min-width: 0; }
.tui-feedback-key__head { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-3); }
.tui-feedback-key__head .tui-h4 { min-width: 0; }
.tui-feedback-key__close { flex: none; }
/* The close key is 28px; its press area is 44px, with no change to how it looks. */
.tui-feedback-key__close::after { content: ''; position: absolute; inset: -8px; }
.tui-feedback-key__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-3); }
.tui-feedback-key__foot { flex-wrap: wrap; }
.tui-feedback-key__count { margin: 0; }
.tui-feedback-key__send { margin-left: auto; }
/* Busy, not off: Send keeps its full look while it sends; the spinner says why it waits. */
.tui-feedback-key__send[aria-busy="true"] { opacity: 1; }
.tui-feedback-key__error[hidden], .tui-feedback-key__count[hidden] { display: none; }
/* The reason a send failed: a red lamp and a few words, in the Send row. */
.tui-feedback-key__error { min-width: 0; }
/* The reason takes the count's place, so the row stays one row at 320px. */
.tui-feedback-key__foot:has(> .tui-feedback-key__error:not([hidden])) > .tui-feedback-key__count { display: none; }
.tui-feedback-key__note { min-height: 72px; resize: none; }

/* A still in the docs: the panel stays in the page's flow instead of floating over it. */
:is(tui-feedback-key, .tui-feedback-key)[data-static] > .tui-feedback-key__panel { position: static; }
:is(tui-feedback-key, .tui-feedback-key)[data-static]:is([data-state="open"], [data-state="sending"], [data-state="failed"]) > .tui-feedback-key__key { display: none; }

/* Said aloud, never seen. */
.tui-feedback-key__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-feedback-key__close { --h: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-feedback-key__panel { animation: none; }
}

/* ---------------------------------------------------------------- part: ferro-switch */
/* Ferro switch: the kit's switch, same 48 x 26 box, same checkbox, same
   grip at rest. Near a hand (or a keyboard focus) ferro-switch.mjs lays a
   canvas of live ferrofluid over the grip: the grip itself goes wet, the dark
   closing in from its rim to its centre, and once the front has passed the rim
   --tui-ferro-p goes from 0 to 1 and the grip underneath is hidden (leaving,
   the dry grip comes back from its centre out). The slot's green and the grip's end of the slot stay the kit's, so
   the state never rests on the fluid. */

.tui-switch.tui-ferro-switch::after { opacity: calc(1 - var(--tui-ferro-p, 0)); }

/* The fluid's canvas: over the switch and past it (spikes rise and lean), never in the layout, never taking a press. */
.tui-ferro-switch__fluid {
  position: absolute;
  width: 84px;
  height: 56px;
  margin: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- part: fieldset */
/* Fieldset: related fields under one engraved legend, with one hint and one
   error line for the lot. It is the browser's own <fieldset> and <legend>, so
   the group has a name for a screen reader and a disabled fieldset disables
   every field in it. The legend is printed small and tracked, like a legend on
   a front panel, with a rule cut in the plate running on to the edge: a dark
   groove with the light on its lower lip. The hint sits under it; the error
   waits at the foot, empty and not drawn, until the script gives it words. */
.tui-fieldset {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
/* A floated legend is an ordinary box, so it can hold the rule; what follows clears it. */
.tui-fieldset__legend {
  float: left;
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  width: 100%;
  margin: 0 0 var(--tui-2);
  padding: 0 0 0 2px;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
}
.tui-fieldset__legend::after {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9));
  box-shadow: 0 1px 0 var(--tui-hl);
}
.tui-fieldset__legend + * { clear: left; }
.tui-fieldset__legend + .tui-fieldset__fields { padding-top: var(--tui-1); }
.tui-fieldset__hint { margin: 0 0 var(--tui-3); padding-left: 2px; font-size: var(--tui-t-small); line-height: 1.45; color: var(--tui-ink-2); }
.tui-fieldset__fields { display: grid; gap: var(--tui-4); min-width: 0; }
.tui-fieldset--row .tui-fieldset__fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.tui-fieldset--choices .tui-fieldset__fields { gap: var(--tui-3); }

/* The error: a lit red lamp and words, drawn only when there is something to say. */
.tui-fieldset__error {
  display: flex;
  align-items: flex-start;
  gap: var(--tui-2);
  margin: var(--tui-3) 0 0;
  padding-left: 2px;
  font: 500 var(--tui-t-small)/1.45 var(--tui-sans);
  color: var(--tui-red-ink, var(--tui-red));
}
.tui-fieldset__error:empty { display: none; }
.tui-fieldset__error::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 0.45em;
  border-radius: 50%;
  color: var(--tui-red);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--tui-red);
  box-shadow: var(--tui-glow);
}
/* The group's own marking when it is wrong: the legend's rule takes the red. */
.tui-fieldset[data-error] > .tui-fieldset__legend::after { background: color-mix(in oklab, var(--tui-red) 70%, rgb(var(--tui-sh))); }

/* The fields on a tray cut into the plate, for a group that should read as one. */
.tui-fieldset--well { padding: var(--tui-4); border-radius: var(--tui-r-l); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-fieldset--well > .tui-fieldset__legend { margin-top: 0; }

.tui-fieldset:disabled > .tui-fieldset__legend, .tui-fieldset:disabled > .tui-fieldset__hint { opacity: 0.6; }

@media (pointer: coarse) {
  .tui-fieldset .tui-choice { min-height: 44px; }
}

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  /* The same box as in Tactile; only the drawing turns to a hairline. */
  .tui-fieldset__legend::after { background: none; box-shadow: inset 0 1px 0 var(--tui-quiet-line-2); }
  .tui-fieldset[data-error] > .tui-fieldset__legend::after { background: none; box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-red) 70%, transparent); }
}

/* ---------------------------------------------------------------- part: file-field */
/* File field: the browser's own file input, dressed. The input itself is the
   well; the button it draws (::file-selector-button) is the key, and the name
   it prints beside it is the printed file name, so the real input is the one
   that takes the focus, opens the chooser from the keyboard, accepts a file
   dropped on it and posts with its form. Nothing is laid over it. With a
   script, a chosen set (data-file-list) is also listed under the well, one
   ruled row to a file with its size and a key that takes it out. */
.tui-file-field { position: relative; display: grid; gap: var(--tui-2); min-width: 0; }
.tui-file-field__input {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 3px;
  border: 0;
  /* The key's 7px and the floor's 3px. */
  border-radius: calc(var(--tui-r-m) + 3px);
  font: 400 var(--tui-t-body)/32px var(--tui-sans);
  color: var(--tui-ink);
  cursor: pointer;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  text-overflow: ellipsis;
}
.tui-file-field__input:focus-visible, .tui-file-field__input.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] .tui-file-field__input { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-file-field__input:disabled { opacity: 0.45; cursor: not-allowed; }

/* The key: a cap on the floor, down while it is pressed. */
.tui-file-field__input::file-selector-button {
  appearance: none;
  box-sizing: border-box;
  height: 32px;
  margin: 0 var(--tui-3) 0 0;
  padding: 0 var(--tui-4);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  letter-spacing: 0.01em;
  color: var(--tui-ink);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-file-field__input:hover::file-selector-button, .tui-file-field__input.is-hover::file-selector-button { filter: brightness(1.03); }
.tui-file-field__input:active::file-selector-button, .tui-file-field__input.is-down::file-selector-button { transform: translateY(1.5px); filter: brightness(0.97); box-shadow: var(--tui-pressed); }
.tui-file-field__input:disabled::file-selector-button { cursor: not-allowed; transform: none; filter: none; }

/* The chosen set, listed: ruled rows, the name printed, its size, a key to take it out. */
.tui-file-field__list { display: grid; margin: 0; padding: 0; list-style: none; }
.tui-file-field__list:empty { display: none; }
.tui-file-field__list li { position: relative; display: flex; align-items: center; gap: var(--tui-3); min-height: 44px; padding: 4px 4px 4px 10px; }
.tui-file-field__list li + li::before { content: ''; position: absolute; top: 0; left: 10px; right: 4px; border-top: 1px solid var(--tui-rule); }
.tui-file-field__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--tui-t-body); color: var(--tui-ink); }
.tui-file-field__size { flex: none; font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-file-field__list .tui-key { flex: none; }
.tui-file-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-file-field__input::file-selector-button { --skirt: 1px; }
  .tui-file-field__input:hover::file-selector-button, .tui-file-field__input.is-hover::file-selector-button { filter: none; background: var(--tui-quiet-key-hover); box-shadow: var(--tui-depth-key-hover); }
  .tui-file-field__input:active::file-selector-button, .tui-file-field__input.is-down::file-selector-button { filter: none; transform: translateY(1px); background: var(--tui-quiet-key-down); }
}

@media (pointer: coarse) {
  .tui-file-field__input { height: 48px; padding: 3px; font-size: 16px; line-height: 42px; }
  .tui-file-field__input::file-selector-button { height: 42px; min-width: 44px; }
  .tui-file-field__list .tui-key { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-file-field__input::file-selector-button { transition: none; }
}

/* ---------------------------------------------------------------- part: file-tree */
/* File tree: a WAI-ARIA tree printed like a wiring diagram. Guides are
   printed traces with an elbow into every item; a folder's chevron turns as
   it opens; the chosen item sits in a recess with its lamp lit, the way the
   side rail marks the current page. kit/parts/file-tree.mjs wires it. */
tui-file-tree { display: block; min-width: 0; font-size: var(--tui-t-body); }
tui-file-tree ul { margin: 0; padding: 0; list-style: none; }
tui-file-tree [role="group"] { position: relative; margin-left: 13px; padding-left: 10px; }
tui-file-tree [role="treeitem"] { position: relative; outline: none; }
/* The traces: a vertical run down each group, an elbow into each item; the last item's run stops at its elbow. */
tui-file-tree [role="group"] > [role="treeitem"]::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--tui-trace, color-mix(in oklab, var(--tui-ink-3) 55%, transparent));
}
tui-file-tree [role="group"] > [role="treeitem"]:last-child::before { bottom: auto; height: 15px; }
tui-file-tree [role="group"] > [role="treeitem"] > .tui-file-tree__row::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 15px;
  width: 8px;
  border-top: 1px solid var(--tui-trace, color-mix(in oklab, var(--tui-ink-3) 55%, transparent));
}

.tui-file-tree__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px 0 6px;
  border-radius: 6px;
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
}
[role="treeitem"]:not(.is-folder) > .tui-file-tree__row { padding-left: 22px; }
.tui-file-tree__row:hover, .tui-file-tree__row.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
[role="treeitem"]:focus-visible > .tui-file-tree__row, .tui-file-tree__row.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -1px; }
.tui-file-tree__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-folder > .tui-file-tree__row .tui-file-tree__name { font-weight: 600; color: var(--tui-ink); }
.tui-file-tree__meta { font-size: var(--tui-t-small); color: var(--tui-ink-2); font-variant-numeric: tabular-nums; }
/* The chosen item: a recess with its lamp lit. */
[role="treeitem"][aria-selected="true"] > .tui-file-tree__row, .tui-file-tree__row.is-down {
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-file-tree__row > .tui-lamp { width: 6px; height: 6px; opacity: 0; }
[role="treeitem"][aria-selected="true"] > .tui-file-tree__row > .tui-lamp, .tui-file-tree__row.is-down > .tui-lamp {
  opacity: 1;
  background: var(--tui-green);
  box-shadow: 0 0 6px 1px color-mix(in oklab, var(--tui-green) 60%, transparent);
}

/* Printed marks: a chevron that turns, a folder with its tab, a page with a folded corner. */
.tui-file-tree__chevron {
  flex: none;
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.6 8 6l-3.8 3.4z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.6 8 6l-3.8 3.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 120ms var(--tui-ease);
}
[aria-expanded="true"] > .tui-file-tree__row > .tui-file-tree__chevron { transform: rotate(90deg); }
.tui-file-tree__icon {
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'%3E%3Cpath d='M4 1.8h5.2L12.5 5v9.2H4z'/%3E%3Cpath d='M9 1.8V5.2h3.5'/%3E%3C/svg%3E");
}
.is-folder > .tui-file-tree__row .tui-file-tree__icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'%3E%3Cpath d='M1.8 3.4h4.4l1.4 1.6h6.6v8H1.8z'/%3E%3C/svg%3E");
}
[aria-expanded="true"] > .tui-file-tree__row .tui-file-tree__icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round'%3E%3Cpath d='M1.8 3.4h4.4l1.4 1.6h5.2v1.8'/%3E%3Cpath d='M1.8 3.4V13h10.6l2-6.2H4z'/%3E%3C/svg%3E");
}

/* With the slide well (slide-well.mjs) one recess travels between rows: a row no longer lights by itself, it only takes its ink. */
tui-file-tree[data-slide] { position: relative; }
tui-file-tree[data-slide] .tui-file-tree__row:hover:not(.is-hover) { background: none; }
tui-file-tree[data-slide] [role="treeitem"][aria-selected="true"] > .tui-file-tree__row:not(.is-down) { background: none; box-shadow: none; }
tui-file-tree[data-slide] .tui-slidewell { border-radius: 6px; }

/* ---------------------------------------------------------------- part: film-strip */
/* Film strip: a carousel as a strip of film in a machined viewer. The film
   runs behind a gate, a window lit from behind; the frames either side are
   under the smoked cover, dim. Sprocket holes run along both edges and let
   the lamp through where the gate is. Under the viewer, with the script: a
   frame counter on an LCD, previous and next keys and a thumbwheel that
   turns with the film. See film-strip.mjs.
   The film is film in either finish: a dark base and pale holes. Only the
   housing round it changes. Corners are concentric: an 8px viewer in an
   8px margin makes the 16px housing. */
tui-film-strip, .tui-film-strip {
  --fs-base: color-mix(in oklab, var(--tui-vfd-bg) 90%, var(--tui-paper));
  --fs-lamp: var(--tui-paper-hi);
  --fs-w: 320px;      /* a frame's width at most; it shrinks to leave 44px of each neighbour showing */
  --fs-gap: 14px;
  --fs-perf: 22px;    /* the band of sprocket holes along each edge */
  --fs-peek: 44px;
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 8px;
  width: min(100%, 620px);
  min-width: 0;
  padding: 8px;
  border-radius: 16px;
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
tui-film-strip::before, .tui-film-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}

/* ------------------------------------------------------------------ the viewer and its gate */
.tui-film-strip__viewer {
  --gw: min(var(--fs-w) + 10px, 100% - 2 * var(--fs-peek) + 10px);
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--fs-base);
  box-shadow: var(--tui-depth-well, 0 0 0 1px rgb(0 0 0 / 0.35), 0 1px 0 1px var(--tui-hl));
}
/* The lamp behind the gate: a soft white that lights the film base in the window and spills a little past its edges. */
.tui-film-strip__viewer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(calc(var(--gw) * 0.66) 78% at 50% 48%, color-mix(in oklab, var(--fs-lamp) 22%, transparent), transparent),
    linear-gradient(90deg, transparent calc(50% - var(--gw) / 2 - 26px), color-mix(in oklab, var(--fs-lamp) 13%, transparent) calc(50% - var(--gw) / 2), color-mix(in oklab, var(--fs-lamp) 13%, transparent) calc(50% + var(--gw) / 2), transparent calc(50% + var(--gw) / 2 + 26px));
}
/* The gate: a window cut in a smoked cover. The cover is the window's own
   shadow, spread to the edges of the viewer; the window has a machined lip
   and the upper wall of the viewer shades the top of the film. */
.tui-film-strip__viewer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: var(--gw);
  translate: -50% 0;
  border-radius: 3px;
  pointer-events: none;
  background: linear-gradient(rgb(0 0 0 / 0.4), transparent 10px, transparent calc(100% - 6px), rgb(0 0 0 / 0.3));
  box-shadow:
    0 0 0 100vmax rgb(0 0 0 / 0.56),
    -1px 0 0 0 rgb(255 255 255 / 0.16),
    1px 0 0 0 rgb(0 0 0 / 0.6),
    inset 1px 0 0 rgb(0 0 0 / 0.55),
    inset -1px 0 0 rgb(255 255 255 / 0.1),
    inset 0 0 16px color-mix(in oklab, var(--fs-lamp) 9%, transparent);
}

/* ------------------------------------------------------------------ the reel: a native scroller */
.tui-film-strip__reel {
  container-type: inline-size;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  outline: none;
}
.tui-film-strip__reel::-webkit-scrollbar { display: none; }
/* Turning the wheel moves the film freely; it snaps to a frame when the wheel is let go. */
[data-turning] .tui-film-strip__reel { scroll-snap-type: none; }
.tui-film-strip:has(.tui-film-strip__reel:focus-visible) .tui-film-strip__viewer,
.tui-film-strip__viewer.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* The film: a dark base with a row of holes along each edge, as long as its frames. */
.tui-film-strip__film {
  --fw: min(var(--fs-w), 100cqw - 2 * var(--fs-peek));
  display: flex;
  gap: var(--fs-gap);
  width: max-content;
  padding: var(--fs-perf) calc((100cqw - var(--fw)) / 2);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='22'%3E%3Crect x='4.5' y='7.5' width='7' height='6' rx='1.4' fill='white' fill-opacity='.82'/%3E%3Crect x='4.5' y='7.5' width='7' height='1.2' fill='black' fill-opacity='.25'/%3E%3C/svg%3E") 0 0 / 16px 22px repeat-x,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='22'%3E%3Crect x='4.5' y='8.5' width='7' height='6' rx='1.4' fill='white' fill-opacity='.82'/%3E%3Crect x='4.5' y='8.5' width='7' height='1.2' fill='black' fill-opacity='.25'/%3E%3C/svg%3E") 0 100% / 16px 22px repeat-x,
    linear-gradient(var(--fs-base), var(--fs-base));
}
/* A frame: the picture on the film, with the film's thin black line round it. */
.tui-film-strip__frame {
  position: relative;
  flex: none;
  display: grid;
  width: var(--fw);
  aspect-ratio: 3 / 2;
  margin: 0;
  overflow: hidden;
  border-radius: 3px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: color-mix(in oklab, var(--fs-base) 70%, var(--tui-paper));
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.7);
  color: var(--tui-paper-ink);
}
.tui-film-strip__frame > img, .tui-film-strip__frame > svg { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The emulsion's own faint grain over whatever is on the frame. */
.tui-film-strip__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tui-noise);
  opacity: 0.35;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* A card on a frame: printed on paper, for a frame that is words and not a picture. */
.tui-film-strip__frame { container-type: inline-size; }
.tui-film-strip__card {
  display: grid;
  align-content: space-between;
  gap: 6px;
  min-width: 0;
  padding: 7cqw 8cqw 8cqw;
  background: linear-gradient(170deg, var(--tui-paper-hi), var(--tui-paper));
  color: var(--tui-paper-ink);
}
.tui-film-strip__card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tui-film-strip__card-top svg { width: clamp(16px, 7cqw, 22px); height: clamp(16px, 7cqw, 22px); flex: none; color: var(--tui-paper-ink); }
.tui-film-strip__card small { font: 600 clamp(9px, 3.4cqw, 10.5px)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-paper-ink-2); }
.tui-film-strip__card b { display: block; margin-bottom: 0.3em; font: 700 clamp(17px, 9cqw, 30px)/1 var(--tui-sans); letter-spacing: -0.025em; color: var(--tui-paper-ink); }
.tui-film-strip__card p { margin: 0; font-size: clamp(11px, 4.4cqw, 14px); line-height: 1.35; color: var(--tui-paper-ink-2); }

/* ------------------------------------------------------------------ the deck: counter, keys, thumbwheel */
.tui-film-strip__deck {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 2px 0 4px;
  container: tui-film-deck / inline-size;
}
.tui-film-strip__count { flex: none; margin-right: auto; }
.tui-film-strip__wheel:hover .tui-film-strip__ridges, .tui-film-strip__wheel.is-hover .tui-film-strip__ridges { filter: brightness(1.06); }
.tui-film-strip__wheel.is-down .tui-film-strip__ridges, [data-turning] .tui-film-strip__ridges { filter: brightness(0.95); }
.tui-film-strip__key { --h: 32px; flex: none; }
.tui-film-strip__key[aria-disabled="true"] { transform: none; }

/* The thumbwheel: a knurled wheel set in a slot, seen from the front. Its
   ridges are laid round a circle and drawn where they face you, closer
   together toward the edges as they turn away. Only --turn changes. */
.tui-film-strip__wheel {
  position: relative;
  flex: 0 1 132px;
  min-width: 64px;
  height: 32px;
  padding: 4px;
  border-radius: 8px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  container-type: inline-size;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}
.tui-film-strip__wheel:focus-visible, .tui-film-strip__wheel.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
[data-turning] .tui-film-strip__wheel { cursor: grabbing; }
.tui-film-strip__ridges {
  position: absolute;
  inset: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(color-mix(in oklab, var(--tui-knob-mid) 60%, var(--tui-knob-lo)), var(--tui-knob-lo));
}
.tui-film-strip__ridges > i {
  --a: calc(var(--i) * 10deg - var(--turn, 0deg));
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3.5px;
  margin-left: -1.75px;
  translate: calc(sin(var(--a)) * (50cqw - 2px)) 0;
  scale: max(cos(var(--a)), 0) 1;
  background: linear-gradient(90deg, var(--tui-knob-hi), var(--tui-knob-mid) 40%, var(--tui-knob-lo) 75%, color-mix(in oklab, var(--tui-knob-lo) 70%, rgb(0 0 0)));
}
/* The light on a cylinder: dark where it turns away, a highlight toward the lamp. Fixed; the ridges turn under it. */
.tui-film-strip__ridges::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(255 255 255 / 0.1), transparent 35%, rgb(0 0 0 / 0.14)),
    linear-gradient(90deg, rgb(0 0 0 / 0.62), rgb(0 0 0 / 0.14) 16%, rgb(255 255 255 / 0.16) 38%, transparent 55%, rgb(0 0 0 / 0.16) 80%, rgb(0 0 0 / 0.66));
  box-shadow: var(--tui-depth-shade, inset 0 1px 1px rgb(0 0 0 / 0.35));
}

/* Spoken, not seen: the frame that came to rest. */
.tui-film-strip__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A narrow deck: the counter comes down a size and the wheel gives up its width first. */
@container tui-film-deck (max-width: 300px) {
  .tui-film-strip__count { font-size: 13px; }
  .tui-film-strip__deck { gap: 6px; }
}
@media (prefers-reduced-motion: no-preference) { .tui-film-strip__reel { scroll-behavior: smooth; } }

@media (pointer: coarse) {
  .tui-film-strip__wheel::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
}

/* ---------------------------------------------------------------- part: filter-builder */
/* Filter builder: conditions as plates seated in a rail. The rail is the
   kit's recessed tray; each plate is a raised face holding the kit's own
   select, input, date field and chip group, with a remove key at its end, so
   every finish and the volume follow with nothing coloured here. Above the
   rail: a tag (the count, with the kit's lamp lit while any condition filters),
   the page's own count on a small display, and the key that folds it away.
   Wide, a plate is one line (field, operator, value, remove); narrow, the
   field sits on top with the remove key, and the operator and the value under
   it, each on its own line, so nothing scrolls sideways at 320px. A plate that
   is taken out slides out inside the rail, which clips it, and then the others close up (the
   script does it with the Web Animations API, and not at all under reduced
   motion). */
:is(tui-filter-builder, .tui-filter-builder) {
  display: block;
  position: relative;
  min-width: 0;
  container-type: inline-size;
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}

.tui-filter-builder__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-3); min-width: 0; }
.tui-filter-builder__tag { flex: none; order: 1; }
.tui-filter-builder__result { flex: 0 1 auto; min-width: 0; order: 2; }
.tui-filter-builder__result[hidden] { display: none; }
.tui-filter-builder__fold { margin-left: auto; order: 3; }

.tui-filter-builder__body { display: grid; gap: var(--tui-3); min-width: 0; margin-top: var(--tui-3); }
.tui-filter-builder__body[hidden] { display: none; }

.tui-filter-builder__match { display: flex; align-items: center; gap: var(--tui-2); min-width: 0; }
.tui-filter-builder__match .tui-label { flex: none; }
.tui-filter-builder__match .tui-filter-builder__clear { margin-left: auto; }

.tui-filter-builder__empty { margin: 0; padding: var(--tui-2) 2px; font: 400 var(--tui-t-body)/1.5 var(--tui-sans); color: var(--tui-ink-2); }
.tui-filter-builder__empty[hidden] { display: none; }

/* The rail: a groove the plates sit in. */
.tui-filter-builder__rail {
  position: relative;
  display: grid;
  gap: var(--tui-2);
  margin: 0;
  padding: var(--tui-1);
  list-style: none;
  border-radius: calc(var(--tui-r-m) + var(--tui-1)); /* concentric: the plate radius plus the rail padding */
  box-sizing: border-box;
  align-content: start;
  overflow: hidden;
}
.tui-filter-builder__rail[hidden] { display: none; }

/* A plate: a printed face seated in the rail. */
.tui-filter-builder__plate {
  display: grid;
  grid-template-columns: minmax(8.75rem, 0.9fr) minmax(7.5rem, 0.7fr) minmax(0, 2.4fr) 36px;
  align-items: start;
  gap: var(--tui-2) var(--tui-1);
  min-width: 0;
  padding: var(--tui-2);
  border-radius: var(--tui-r-m);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-filter-builder__plate.is-leaving { pointer-events: none; }
.tui-filter-builder__f, .tui-filter-builder__o, .tui-filter-builder__v { min-width: 0; }
.tui-filter-builder__plate .tui-select, .tui-filter-builder__plate .tui-input { font-size: var(--tui-t-small); }
.tui-filter-builder__remove.tui-key { --h: 36px; width: 36px; }
/* The chips wrap in their own tray, level with the fields beside them. */
.tui-filter-builder__v tui-chip-group { max-width: 100%; }
.tui-filter-builder__v tui-date-field { display: block; }
/* A number is typed, not stepped: no spinner arrows, as in the kit's other number wells. */
.tui-filter-builder__v input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.tui-filter-builder__v input[type="number"]::-webkit-inner-spin-button, .tui-filter-builder__v input[type="number"]::-webkit-outer-spin-button { display: none; -webkit-appearance: none; }

.tui-filter-builder__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-3); }
.tui-filter-builder__add { gap: var(--tui-2); }

/* Said aloud, never seen. */
.tui-filter-builder__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Narrow: the field takes the whole top row; the operator and the remove key share the next; the value is under. */
@container (max-width: 520px) {
  /* The tag and the Hide key keep the first row; the display wraps under them. */
  .tui-filter-builder__fold { order: 2; }
  .tui-filter-builder__result { order: 3; flex-basis: 100%; }
  .tui-filter-builder__plate { grid-template-columns: minmax(0, 1fr) 36px; row-gap: var(--tui-2); }
  .tui-filter-builder__f { grid-column: 1 / -1; grid-row: 1; }
  .tui-filter-builder__remove.tui-key { grid-column: 2; grid-row: 2; }
  .tui-filter-builder__o { grid-column: 1; grid-row: 2; }
  .tui-filter-builder__v { grid-column: 1 / -1; grid-row: 3; }
}

@media (pointer: coarse) {
  .tui-filter-builder__plate .tui-select, .tui-filter-builder__plate .tui-input { height: 48px; font-size: 16px; }
  .tui-filter-builder__remove.tui-key, .tui-filter-builder__add.tui-key, .tui-filter-builder__clear.tui-key, .tui-filter-builder__fold.tui-key { --h: 44px; }
  .tui-filter-builder__remove.tui-key { width: 44px; }
  .tui-filter-builder__plate { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 2fr) 44px; }
}
@media (pointer: coarse) {
  @container (max-width: 520px) { .tui-filter-builder__plate { grid-template-columns: minmax(0, 1fr) 44px; } }
}

/* ---------------------------------------------------------------- part: filter-panel */
/* Filter panel: a plate of filter groups over a table or a list, with the
   filters that are on set out as chips in the chip group's tray and the
   number of matches in a small LCD. Every group, chip, key and sheet is the
   kit's own drawing, so every finish and the Quiet volume follow with no
   rule here beyond placing them. On a narrow screen the form is moved into
   the kit's bottom sheet and each change applies at once; the Filters key
   stands in for it, and without the script the form stays in the page. */
:is(tui-filter-panel, .tui-filter-panel) {
  display: block;
  min-width: 0;
}

.tui-filter-panel__form {
  display: grid;
  gap: var(--tui-4);
  min-width: 0;
  margin: 0;
  padding: var(--tui-4);
  border: 0;
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}

/* The filters that are on: a chip for each, then Clear all. Hidden while the
   row has nothing to say, with a rule of its own since the tray sets a
   display the hidden attribute alone would not beat. */
.tui-filter-panel__applied {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-2);
  min-width: 0;
}
.tui-filter-panel__applied:empty,
.tui-filter-panel__applied[hidden] { display: none; }
.tui-filter-panel__applied .tui-chip-group { max-width: 100%; }

/* The remove mark on an applied chip: a printed cross at the end of the cap. */
.tui-filter-panel__applied .tui-chip-group small { font-size: 14px; line-height: 1; }

/* The readout and the Apply key. */
.tui-filter-panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-3);
  min-width: 0;
}
.tui-filter-panel__count { flex: 1 1 auto; min-width: 0; }
.tui-filter-panel__count[hidden] { display: none; }
.tui-sheet__foot > .tui-filter-panel__count { margin-right: auto; }

/* The key that stands in for the panel on a narrow screen. The script makes
   it; without the script there is none and the form is in the page. */
.tui-filter-panel__open { display: none; }
:is(tui-filter-panel, .tui-filter-panel) .tui-filter-panel__open { gap: var(--tui-2); }

@media (max-width: 719px) {
  :is(tui-filter-panel, .tui-filter-panel)[data-wired] > .tui-filter-panel__open { display: inline-flex; }
  :is(tui-filter-panel, .tui-filter-panel)[data-wired] > .tui-filter-panel__form { display: none; }
  :is(tui-filter-panel, .tui-filter-panel)[data-wired] .tui-filter-panel__form .tui-filter-panel__foot { display: none; }
  /* In the sheet the body is the plate, so the form stops being one. */
  .tui-sheet .tui-filter-panel__form { padding: 0; background: none; box-shadow: none; }
}

@media (pointer: coarse) {
  .tui-filter-panel__foot > .tui-key { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- part: foil-card */
/* Foil card: a laminated card you grab and turn in your hand by dragging.
   The lamp stays fixed in the room; as the card's own face turns against it,
   the band of highlight sweeps across the foil (two layered gradients read
   off --tilt-x/--tilt-y, the card's own tilt as fractions of its limit),
   filtered so the same two tokens catch a holographic hue that turns with
   the card rather than any literal colour, and the shadow it throws on the
   desk below shifts and stretches the same way. A small specular catch-light
   (where a hand would hold the foil) tracks the pointer while a drag is
   active, fading back to centre on release. Four thin strips, hinged out
   of the card's own corners in the same 3D space the tilt turns, show the
   card's edge thickness once it is turned off level, each strip shaded along
   its own run from --tui-hl toward --tui-sh so it reads as a lit rim on top
   and a darker underside below, not a flat fill. Aluminium, whose raised
   fill sits near white, has its own block at the end of this file: there
   overlay/soft-light/screen have no room left to lighten or darken, so the
   foil is painted instead, as brushed metal with one bright band that
   travels as the card turns, and the edge and desk shadow are redrawn so
   they read against a light desk. No reused
   plate, rack, rail, slot, drawer or lamp as the mechanism: only the raised/
   well/focus/skirt tokens every part reads, and its own foil drawing. */

.tui-foilcard {
  position: relative;
  display: inline-grid;
  justify-items: start;
  gap: var(--tui-3);
  padding-top: var(--tui-4);
  perspective: 1000px;
}

/* The shadow the card throws on the desk it sits on: it leans away from the
   lamp (fixed, above-left) as the card tilts, the way a raised plate's own
   shadow would, and softens as the card lifts further from level. A second,
   tighter core sits inside the same soft spread so the shadow reads as a
   real cast shadow (a dark contact core, a soft penumbra) rather than one
   faint blur. Aluminium draws its own (see the aluminium block at the end). */
.tui-foilcard__shadow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -10px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * (1.4 + var(--tilt-mag) * 1))), transparent 46%),
    radial-gradient(ellipse at center, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * (0.9 + var(--tilt-mag) * 0.8))), transparent 78%);
  filter: blur(calc(4px + var(--tilt-mag) * 9px));
  translate: calc(var(--tilt-x) * 34px) calc(var(--tilt-mag) * 7px);
  scale: calc(1 + var(--tilt-mag) * 0.7) calc(1 - var(--tilt-mag) * 0.15);
  transition: translate 220ms var(--tui-ease), scale 220ms var(--tui-ease), filter 220ms var(--tui-ease), background 220ms var(--tui-ease);
}
.tui-foilcard[data-dragging] .tui-foilcard__shadow,
.tui-foilcard--compact .tui-foilcard__shadow { transition: none; }

/* The card itself: a plain raised plate, turned by --rx/--ry. Dragging
   tracks the pointer with no transition; letting go springs it back to
   level with one small rebound, the switch thumb's own return. */
.tui-foilcard__card {
  position: relative;
  width: 220px;
  height: 140px;
  margin: 0;
  padding: var(--tui-4);
  display: grid;
  align-content: space-between;
  border: 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 260ms var(--tui-spring-latch);
  will-change: transform;
}
.tui-foilcard--compact .tui-foilcard__card { width: 160px; height: 100px; padding: var(--tui-3); }
.tui-foilcard[data-dragging] .tui-foilcard__card { cursor: grabbing; transition: none; }
.tui-foilcard__card:focus-visible, .tui-foilcard__card.is-focus {
  outline: 2px solid var(--tui-focus);
  outline-offset: 3px;
}
.tui-foilcard__card:disabled { cursor: not-allowed; opacity: 0.6; }

.tui-foilcard__face {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: start;
  pointer-events: none;
}
/* The engraved mark: a real guilloche rosette, three interleaved sinusoidal
   rings inside a plain rim (SVG paths, see guillocheRing() in foil-card.mjs),
   the fine engine-turned engraving a studio pass or a banknote is stamped
   with, not a company's mark. Every stroke reads currentColor; `color` here
   is the kit's own tertiary-ink token, so the rosette follows every finish
   with no rule of its own. The faint tinted disc behind the strokes (same
   token, low alpha) keeps the engraving legible over whatever the sheen
   underneath is doing, the way a pressed plate catches a little of its own
   shadow in the cut rather than showing bare metal. */
.tui-foilcard__seal {
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
  color: var(--tui-ink-3);
  overflow: visible;
}
.tui-foilcard__seal circle:first-child {
  fill: color-mix(in oklab, var(--tui-ink-3) 12%, transparent);
  stroke: currentColor;
  stroke-width: 0.6;
}
.tui-foilcard__seal path {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.45;
  stroke-linejoin: round;
}
.tui-foilcard__title {
  font: 700 13px/1.25 var(--tui-sans);
  letter-spacing: 0.04em;
  color: var(--tui-ink);
}
/* Secondary printing, not a hint: --tui-ink-2 is the kit's 4.5:1 line;
   --tui-ink-3 is for scales only, and over the dark foil it fell to 2.5:1
   once the card turned. */
.tui-foilcard__sub {
  font-size: var(--tui-t-small);
  color: var(--tui-ink-2);
}

/* The foil itself: two bands, one reading the left/right tilt and one the
   forward/back tilt, laid over the plate with overlay so they lighten and
   darken the metal rather than paint colour on it; opacity rises with how
   far off level the card is, so it reads flat at rest and catches the lamp
   as it turns, same as a real foil surface would. The same two tokens are
   then run through saturate()/hue-rotate(): no literal colour is written
   here, only a rotation of whatever hue --tui-hl/--tui-sh already carry in
   the finish in use, so the sheen that was grey at rest turns holographic
   as the surface turns, the same way a foil badge catches colour off a
   fixed light once you tilt it, in every finish, with no finish-specific
   rule of its own. */
.tui-foilcard__foil {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: calc(0.35 + var(--tilt-mag) * 0.55);
  background:
    repeating-linear-gradient(115deg,
      transparent calc(0% - var(--tilt-x) * 40%),
      color-mix(in srgb, var(--tui-hl) 70%, transparent) calc(10% - var(--tilt-x) * 40%),
      transparent calc(20% - var(--tilt-x) * 40%)),
    linear-gradient(205deg,
      transparent calc(15% - var(--tilt-y) * 30%),
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)) calc(50% - var(--tilt-y) * 30%),
      transparent calc(85% - var(--tilt-y) * 30%));
  transition: opacity 220ms var(--tui-ease);
}
.tui-foilcard[data-dragging] .tui-foilcard__foil { transition: none; }

/* The foil's own iridescence: a fixed rainbow baked into the laminate
   itself, the one place in this part a literal colour is written rather
   than read off a token, because it is not a finish's colour at all. Real
   holographic foil shows the same rainbow whether the badge under it is
   printed light or dark; this reads identically in all four finishes by
   that same physical logic, never branching per finish. What DOES move is
   which part of the rainbow faces the lamp: the conic gradient's own start
   angle is --tilt-x/--tilt-y, so the hue sweeping across the face is a true
   consequence of the card turning, at low opacity so it reads as a glint
   caught off a lamp, never a tinted plate. */
.tui-foilcard__holo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: calc(0.22 + var(--tilt-mag) * 0.4);
  background: conic-gradient(from calc(70deg + var(--tilt-x) * 130deg + var(--tilt-y) * 70deg) at 50% 50%,
    oklch(78% 0.1 20deg), oklch(78% 0.1 100deg), oklch(78% 0.1 180deg),
    oklch(78% 0.1 260deg), oklch(78% 0.1 340deg), oklch(78% 0.1 380deg));
  transition: opacity 220ms var(--tui-ease), background 220ms var(--tui-ease);
}
.tui-foilcard[data-dragging] .tui-foilcard__holo { transition: none; }

/* The specular catch-light: a small, bright spot where a hand would be
   holding the foil, tracking the pointer's own position on the face while a
   drag is active (--px/--py, set by the custom element on pointer move, not
   by hover); it rests centred and faint when nothing is held, same token as
   the rest of the foil. */
.tui-foilcard__specular {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: calc(0.16 + var(--tilt-mag) * 0.5);
  background: radial-gradient(circle at var(--px, 50%) var(--py, 50%), var(--tui-hl), transparent 45%);
  transition: opacity 220ms var(--tui-ease), background 120ms linear;
}
.tui-foilcard[data-dragging] .tui-foilcard__specular { transition: none; }

/* Graphite's raised fill sits near black, where the shared resting foil
   (0.35) reads flat and faded on a level card. The plate itself carries a
   soft wash of its own highlight token, lit from the lamp's side, and the
   foil starts a little stronger at rest; both reach the same values at full
   tilt, so the colour play once turned is unchanged. */
[data-finish="graphite"] .tui-foilcard__card {
  background:
    radial-gradient(ellipse 110% 130% at 70% 100%, var(--tui-hl), transparent 70%),
    var(--tui-raised-fill);
}
[data-finish="graphite"] .tui-foilcard__foil { opacity: calc(0.45 + var(--tilt-mag) * 0.45); }

/* The card's own edge thickness: four thin strips hinged out of its sides,
   in the same preserve-3d space the card's rotateX/rotateY turns, so each
   is edge-on (invisible) at rest and opens into a visible sliver of the
   laminate's actual thickness once the card is turned, same token the kit
   draws any part's side in (--tui-skirt). */
/* Each strip is a flat sliver of --tui-skirt, as before; the gradient run
   across it (still --tui-skirt/--tui-hl/--tui-sh, the three tokens every
   part's own edge is drawn from, no new colour) is what makes it read as a
   card's thickness rather than a plain fill: the top strip is the lit rim
   catching the fixed lamp, the bottom strip is the darker underside falling
   away from it, and the side strips run between the two the way the rim of
   a turned coin passes from lit to shadowed as it goes round. */
.tui-foilcard__edge {
  position: absolute;
  pointer-events: none;
}
.tui-foilcard__edge--l, .tui-foilcard__edge--r {
  top: 0;
  height: 100%;
  width: var(--fc-edge, 34px);
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-skirt) 60%, var(--tui-hl)),
    var(--tui-skirt) 45%,
    rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)));
}
.tui-foilcard__edge--l { left: calc(var(--fc-edge, 34px) * -1); transform: rotateY(-90deg); transform-origin: right center; }
.tui-foilcard__edge--r { right: calc(var(--fc-edge, 34px) * -1); transform: rotateY(90deg); transform-origin: left center; }
.tui-foilcard__edge--t, .tui-foilcard__edge--b {
  left: 0;
  width: 100%;
  height: var(--fc-edge, 34px);
}
.tui-foilcard__edge--t {
  top: calc(var(--fc-edge, 34px) * -1);
  transform: rotateX(90deg);
  transform-origin: bottom center;
  background: linear-gradient(to top, var(--tui-skirt), color-mix(in oklab, var(--tui-skirt) 35%, var(--tui-hl)));
}
.tui-foilcard__edge--b {
  bottom: calc(var(--fc-edge, 34px) * -1);
  transform: rotateX(-90deg);
  transform-origin: top center;
  background: linear-gradient(to bottom, var(--tui-skirt), rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}

.tui-foilcard__readout {
  padding: 3px var(--tui-2);
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-foilcard__digit {
  font: 600 12px/1.3 var(--tui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--tui-ink-2);
}
.tui-foilcard__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Aluminium. Its raised fill sits near white, where overlay, soft-light and
   screen have no room left to lighten or darken, so here the foil is painted
   rather than blended, still from --tui-hl/--tui-sh only:
   - the foil is brushed metal: fine streaks along the brushing (the same
     unrelated-size tiles brushed-metal.css uses, so they never fall into a
     pattern) under one broad sheen, a bright band with soft grey flanks.
     --fc-band places the band from the card's own tilt, so turning the card
     walks it across the face; it is registered so the band rides the same
     spring back to level as the card instead of jumping. The flanks stop at
     a light grey, so the printing keeps its contrast at every angle;
   - the holographic colour is a faint oil-sheen wash trailing that band,
     wide, pale and feathered on every side (the mask fades it along the
     band's length too), never a crisp stripe, and only past about half the
     tilt limit: no colour at rest;
   - the card's thickness is drawn on the card itself, as two hard box-shadows
     the size of the card, pushed out on the sides that turn toward the viewer
     (left/bottom for a positive tilt, the far face of a real card showing
     past its front). They follow the rounded corners and the 3D turn because
     they are the card's own shadow, lit on the lamp side, darker on the
     shaded side;
   - the desk shadow is a soft copy of the card's own footprint behind it,
     falling down and right from the lamp and lengthening as the card lifts. */
@property --fc-band { syntax: '<percentage>'; inherits: true; initial-value: 30%; }

[data-finish="aluminium"] .tui-foilcard__card {
  --fc-band: calc(30% + var(--tilt-x) * 42% + var(--tilt-y) * 16%);
  box-shadow:
    calc(var(--tilt-x) * -5px) 0 0 0 color-mix(in oklab, var(--tui-skirt) calc(30% - var(--tilt-x) * 16%), var(--tui-well)),
    0 calc(var(--tilt-y) * 5px) 0 0 color-mix(in oklab, var(--tui-skirt) calc(30% + var(--tilt-y) * 16%), var(--tui-well)),
    var(--tui-raised);
  transition: transform 260ms var(--tui-spring-latch), box-shadow 260ms var(--tui-spring-latch), --fc-band 260ms var(--tui-spring-latch);
}
[data-finish="aluminium"] .tui-foilcard__edge { display: none; }
[data-finish="aluminium"] .tui-foilcard__sub { color: var(--tui-ink); font-weight: 500; }

[data-finish="aluminium"] .tui-foilcard__foil {
  mix-blend-mode: normal;
  opacity: 1;
  background:
    radial-gradient(ellipse 110px 0.5px, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.16)), transparent) 0 0 / 181px 3px,
    radial-gradient(ellipse 80px 0.5px, color-mix(in srgb, var(--tui-hl) 55%, transparent), transparent) 0 0 / 149px 4px,
    radial-gradient(ellipse 140px 0.5px, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.12)), transparent) 0 0 / 263px 7px,
    radial-gradient(ellipse 60px 0.5px, color-mix(in srgb, var(--tui-hl) 45%, transparent), transparent) 0 0 / 331px 5px,
    linear-gradient(105deg,
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.62)) calc(var(--fc-band) - 62%),
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.12)) calc(var(--fc-band) - 15%),
      var(--tui-hl) var(--fc-band),
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.12)) calc(var(--fc-band) + 15%),
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.62)) calc(var(--fc-band) + 62%));
}
[data-finish="aluminium"] .tui-foilcard__holo {
  mix-blend-mode: multiply;
  opacity: clamp(0, (var(--tilt-mag) - 0.45) * 0.75, 0.32);
  background: linear-gradient(105deg,
    transparent calc(var(--fc-band) + 3%),
    oklch(82% 0.07 20deg) calc(var(--fc-band) + 14%), oklch(82% 0.07 100deg) calc(var(--fc-band) + 25%),
    oklch(82% 0.07 190deg) calc(var(--fc-band) + 36%), oklch(82% 0.07 280deg) calc(var(--fc-band) + 47%),
    transparent calc(var(--fc-band) + 62%));
  mask-image: linear-gradient(15deg, transparent 5%, var(--tui-ink) 40% 60%, transparent 95%);
}
[data-finish="aluminium"] .tui-foilcard__specular {
  mix-blend-mode: normal;
  opacity: calc(var(--tilt-mag) * 0.5);
  background: radial-gradient(circle at var(--px, 50%) var(--py, 50%), var(--tui-hl), transparent 40%);
}
[data-finish="aluminium"] .tui-foilcard__shadow {
  inset: auto;
  left: 12px;
  top: calc(var(--tui-4) + 10px);
  width: 196px;
  height: 124px;
  border-radius: var(--tui-r-m);
  background: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * (1.3 + var(--tilt-mag) * 0.5)));
  filter: blur(calc(9px + var(--tilt-mag) * 7px));
  translate: calc(5px + var(--tilt-x) * 14px) calc(9px + var(--tilt-y) * 7px + var(--tilt-mag) * 5px);
  scale: calc(1 + var(--tilt-mag) * 0.05);
}
[data-finish="aluminium"] .tui-foilcard--compact .tui-foilcard__shadow { left: 9px; top: calc(var(--tui-4) + 7px); width: 142px; height: 86px; }

@media (prefers-reduced-motion: reduce) {
  .tui-foilcard__card, .tui-foilcard__shadow, .tui-foilcard__foil, .tui-foilcard__holo, .tui-foilcard__specular,
  [data-finish="aluminium"] .tui-foilcard__card { transition: none; }
}

/* ---------------------------------------------------------------- part: funnel */
/* Funnel: stages as centred bars to scale, the stage's name and count printed
   above each bar, and the drop-off written between two bars on a hatched join
   that is as wide as the bars it joins. The hatching is the "lost" part: it is
   a texture, so the drop is never only a tint. The biggest drop is in bold. */
.tui-funnel .mbar { stroke: none; }
.tui-funnel .stage[data-here] .mbar { fill: color-mix(in oklab, var(--tui-blue) 68%, var(--tui-vfd)); }
.tui-funnel .sname { fill: var(--tui-ink); font-weight: 600; font-size: 12px; }
.tui-funnel .scount { fill: var(--tui-ink-2); font-size: 12px; }
.tui-funnel .lostline { stroke: color-mix(in oklab, var(--tui-vfd) 34%, transparent); stroke-width: 1.4; }
.tui-funnel .join polygon { stroke: none; }
.tui-funnel .join text { fill: var(--tui-ink-2); font-size: 11px; paint-order: stroke; stroke: var(--tui-vfd-bg); stroke-width: 4px; stroke-linejoin: round; }
.tui-funnel .join.worst text { fill: var(--tui-ink); font-weight: 700; }
.tui-funnel .tui-chart__over .ring { fill: none; stroke: var(--tui-vfd); stroke-width: 2; rx: 3px; }

@media (pointer: coarse) {
  .tui-funnel .tui-chart__plot { min-height: 120px; }
}
@media (max-width: 480px) {
  .tui-funnel .sname, .tui-funnel .scount { font-size: 11.5px; }
}

/* ---------------------------------------------------------------- part: gauge */
/* Needle gauge: a moving-coil panel meter. A printed face under glass in a
   spun bezel; a thin needle with a counterweight on a pivot, swinging to the
   value and settling. The glare, the pivot cap's light and the needle's
   shadow belong to the room: they never turn with the needle. gauge.mjs
   prints the face and moves the needle. */

tui-gauge {
  --size: 200px;
  /* The needle floats over the face: its shadow falls down and right. */
  --tui-gauge-sx: 0.8%;
  --tui-gauge-sy: 1.4%;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: min(var(--size), 100%);
  /* In a table cell a percentage alone would let the column crush it. */
  min-width: min(var(--size), 120px);
  container-type: inline-size;
}

/* The bezel: spun metal, its bow-tie highlight fixed where the lamp puts it. */
.tui-gauge__case {
  position: relative;
  padding: 6.5%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, color-mix(in oklab, var(--tui-knob-hi) 30%, transparent) 0 0.6px, color-mix(in oklab, var(--tui-knob-lo) 16%, transparent) 0.6px 1.5px),
    conic-gradient(from 0deg, var(--tui-knob-mid) 0deg, var(--tui-knob-lo) 40deg, var(--tui-knob-mid) 80deg, var(--tui-knob-hi) 135deg, var(--tui-knob-mid) 180deg, var(--tui-knob-lo) 220deg, var(--tui-knob-mid) 260deg, var(--tui-knob-hi) 315deg, var(--tui-knob-mid) 360deg);
  box-shadow:
    var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)),
    0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    3px 8px 16px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}

/* The face: enamel, set below the bezel's lip, which shades its upper left. */
.tui-gauge__face {
  position: relative;
  aspect-ratio: var(--tui-gauge-ratio, 1);
  overflow: hidden;
  border-radius: 50%;
  background: var(--tui-face-hi);
  box-shadow:
    var(--tui-depth-well, inset 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    inset 2px 3px 6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)),
    inset -1px -1px 0 var(--tui-hl));
}

/* The print: ink on the face, figures upright. */
.tui-gauge__print { position: absolute; inset: 0; width: 100%; height: 100%; }
.tui-gauge__arc { fill: none; stroke: var(--tui-ink); stroke-width: 0.8; }
.tui-gauge__minor { fill: none; stroke: var(--tui-ink-2); stroke-width: 0.7; }
.tui-gauge__major { fill: none; stroke: var(--tui-ink); stroke-width: 1.5; }
.tui-gauge__fig {
  fill: var(--tui-ink);
  font: 500 10.5px var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
}
.tui-gauge__unit { fill: var(--tui-ink); font: 600 13px var(--tui-sans); letter-spacing: 0.01em; text-anchor: middle; dominant-baseline: central; }
.tui-gauge__band[data-band="alarm"] { fill: var(--tui-ink); }
.tui-gauge__hatch { fill: var(--tui-ink); }

/* The name plate: a lamp that lights in a band, and the name printed beside it. */
.tui-gauge__plate {
  position: absolute;
  left: 50%;
  top: 62.5%;
  display: flex;
  align-items: center;
  gap: 0.6em;
  max-width: 46%;
  translate: -50% -50%;
  font: 500 4.5cqw/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
.tui-gauge__name { overflow: hidden; text-overflow: ellipsis; }
.tui-gauge__lamp { width: 1.2em; height: 1.2em; }

/* The exact reading: a small LCD set into the face. */
.tui-gauge__lcd {
  position: absolute;
  left: 50%;
  top: 80%;
  translate: -50% -50%;
  font-size: 7.4cqw;
  white-space: nowrap;
}

/* The zero-adjust screw, its slot as the fitter left it. */
.tui-gauge__screw {
  position: absolute;
  left: 50%;
  top: 92.5%;
  width: 4.4%;
  aspect-ratio: 1;
  translate: -50% -50%;
  background: var(--tui-screw) center / contain no-repeat;
  filter: drop-shadow(0 0.5px 0 var(--tui-hl));
}

/* The needle and its shadow turn about the pivot; nothing else does. */
.tui-gauge__needle, .tui-gauge__shadow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: var(--tui-gauge-px, 50%) var(--tui-gauge-py, 50%);
  pointer-events: none;
}
.tui-gauge__needle { fill: var(--tui-ink); }
.tui-gauge__shadow { fill: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)); }
tui-gauge[data-state="running"] :is(.tui-gauge__needle, .tui-gauge__shadow) { will-change: transform; }

/* The pivot's cap: turned metal, lit from the room, so it never turns. */
.tui-gauge__boss {
  position: absolute;
  left: var(--tui-gauge-px, 50%);
  top: var(--tui-gauge-py, 50%);
  width: 7.5%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  /* The needle's own hub: its colour, with the lamp's point of light fixed on it. */
  background: radial-gradient(circle at 34% 28%, color-mix(in oklab, var(--tui-ink) 35%, var(--tui-face-hi)) 0 12%, var(--tui-ink) 55%);
  box-shadow: var(--tui-depth-plate, 0.6px 1.2px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}

/* The glass: a glare from the lamp above left, and the rim catching it. */
.tui-gauge__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 58% 36% at 31% 17%, rgb(255 255 255 / 0.3), rgb(255 255 255 / 0.06) 62%, transparent 74%),
    radial-gradient(circle closest-side at 50% 50%, transparent 94%, rgb(255 255 255 / 0.4) 97%, transparent 99.5%);
  -webkit-mask: linear-gradient(135deg, #000 20%, rgb(0 0 0 / 0.25) 55%, rgb(0 0 0 / 0.1));
          mask: linear-gradient(135deg, #000 20%, rgb(0 0 0 / 0.25) 55%, rgb(0 0 0 / 0.1));
}

/* The arc: a wide face with the pivot low, in a flat bezel. */
tui-gauge[data-face="arc"] { --size: 260px; }
tui-gauge[data-face="arc"] .tui-gauge__case {
  padding: 4%;
  /* The lip round the window is the card's corner plus the bezel's width: concentric at any size. */
  border-radius: calc(4cqw + 1px);
  background: linear-gradient(170deg, var(--tui-knob-hi), var(--tui-knob-mid) 38%, var(--tui-knob-lo));
}
/* The face is a printed card behind a window cut in the bezel: its corner is
   the card's, a single pixel, and the bezel's lip rounds the window. */
tui-gauge[data-face="arc"] .tui-gauge__face { border-radius: 1px; }
tui-gauge[data-face="arc"] .tui-gauge__plate { top: 60%; max-width: 50%; font-size: 3.3cqw; }
/* The readout is set into the moulding, clear of its curved top edge and of
   the window's edge by the same margin above and below it. */
tui-gauge[data-face="arc"] .tui-gauge__lcd { left: 8%; top: auto; bottom: 5.3%; translate: none; font-size: 4.2cqw; }
tui-gauge[data-face="arc"] .tui-gauge__screw { left: 50%; top: 88.5%; width: 3.4%; }
/* The arc's movement hides under a black moulding across the foot of the face. */
.tui-gauge__cover {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -2%;
  height: 29%;
  border-radius: 50% 50% 0 0 / 34% 34% 0 0;
  background: linear-gradient(to bottom, color-mix(in oklab, var(--tui-cloth) 80%, var(--tui-knob-hi)), var(--tui-cloth) 22%);
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 color-mix(in oklab, var(--tui-knob-hi) 40%, transparent), 0 -1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)));
}
tui-gauge[data-face="arc"] .tui-gauge__glass {
  background:
    linear-gradient(160deg, rgb(255 255 255 / 0.24), rgb(255 255 255 / 0.05) 40%, transparent 41%),
    linear-gradient(to bottom, rgb(255 255 255 / 0.2), transparent 3%);
  -webkit-mask: none;
          mask: none;
}

/* ---------------------------------------------------------------- part: gimbal-key */
/* Gimbal key: a floating action button on a sprung arm. A round foot is
   fixed to the surface; the rod and the key above it are the one part that
   tilts, pivoted where it meets the foot. gimbal-key.mjs writes the tilt to
   --tui-gimbal-angle as the page moves and relaxes it back toward 0deg. */
tui-gimbal-key {
  position: relative;
  display: inline-flex;
  /* The markup lists the foot first; drawn bottom up so the foot sits on the surface and the key rides on top. */
  flex-direction: column-reverse;
  align-items: center;
  isolation: isolate;
}

.tui-gimbal-key__arm {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  transform: rotate(var(--tui-gimbal-angle, 0deg));
  transform-origin: 50% 100%;
  will-change: transform;
}

.tui-gimbal-key__key.tui-gimbal-key__key {
  position: relative;
  z-index: 1;
  margin-bottom: -5px;
}

/* A turned steel rod: lit across its width, dark at both edges. */
.tui-gimbal-key__rod {
  display: block;
  width: 6px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--tui-skirt), var(--tui-face-hi) 38%, var(--tui-face-lo) 64%, var(--tui-skirt));
  box-shadow: var(--tui-raised);
}

/* The foot: fixed to the surface, never tilts, the hinge the arm springs from. */
.tui-gimbal-key__base {
  display: block;
  width: 26px;
  height: 9px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}

/* Settled and level: nothing left to show but the key, at rest. */
tui-gimbal-key[data-settled] .tui-gimbal-key__arm { transform: rotate(0deg); }

@media (prefers-reduced-motion: reduce) {
  /* The mechanism only ever changes a state: no tilt is drawn, settled or not. */
  .tui-gimbal-key__arm { transform: none; }
}

/* ---------------------------------------------------------------- part: grille-moire */
/* Grille moire: two perforated plates over a dark backing, each a lattice of
   drilled holes. The lower one holds still; the upper one turns a few degrees
   and back, and where its holes meet the lower one's the backing shows through,
   so the dark spots gather and thin and drift as it turns: the beat between two
   grilles. The holes are round and have a depth (the plate, the plate beneath
   it, the backing); they are never lines. Only the upper plate moves, by
   rotate and scale. */
.tui-backdrop--grille-moire {
  --bd-pitch: 6px;
  --bd-top: light-dark(var(--tui-face), var(--tui-face-hi));
  --bd-under: light-dark(color-mix(in srgb, var(--tui-face), var(--tui-ink) 8%), color-mix(in srgb, var(--tui-face-hi), var(--tui-ink) 7%));
  background: light-dark(color-mix(in srgb, var(--tui-face), var(--tui-ink) 18%), black);
}
.tui-backdrop--grille-moire::before, .tui-backdrop--grille-moire::after {
  inset: -30%;
  background: radial-gradient(circle at center, transparent 0 calc(var(--bd-pitch) * 0.25), var(--_plate) calc(var(--bd-pitch) * 0.32)) 0 0 / var(--bd-pitch) var(--bd-pitch);
}
.tui-backdrop--grille-moire::before { --_plate: var(--bd-under); }
.tui-backdrop--grille-moire::after {
  --_plate: var(--bd-top);
  rotate: 0.8deg; /* the still frame */
}
@media (prefers-reduced-motion: no-preference) {
  .tui-backdrop--grille-moire::after { will-change: transform; animation: tui-moire 26s ease-in-out infinite alternate; }
}
@keyframes tui-moire { from { rotate: -2.2deg; scale: 1; } to { rotate: 2.6deg; scale: 1.012; } }

/* ---------------------------------------------------------------- part: heatmap */
/* Heatmap: a matrix of small panel lamps set into the plate. Each socket is
   a hole with its upper wall shading the glass and its lower lip catching
   the lamp; the lens keeps its own reflection of the room's lamp, whatever
   the brightness. Behind the sockets, one canvas holds the glass and the
   light: four steps, one lamp colour per chart, the glow growing with each.
   kit/parts/heatmap.mjs builds the grid, the light, the legend and the
   readout. */
tui-heatmap {
  --tui-heatmap-c: var(--tui-amber);
  --tui-heatmap-cols: 53;
  --tui-heatmap-rh: 30px;
  --tui-heatmap-cell: clamp(8px, calc((100cqi - var(--tui-heatmap-rh) - 10px) / (var(--tui-heatmap-cols) * 1.3)), 20px);
  --tui-heatmap-gap: calc(var(--tui-heatmap-cell) * 0.3);
  container-type: inline-size;
  position: relative;
  display: grid;
  gap: var(--tui-3);
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
tui-heatmap[data-lamp="green"] { --tui-heatmap-c: var(--tui-green); }
tui-heatmap[data-lamp="red"] { --tui-heatmap-c: var(--tui-red); }
tui-heatmap[data-lamp="blue"] { --tui-heatmap-c: var(--tui-blue); }
tui-heatmap[data-lamp="white"] { --tui-heatmap-c: var(--tui-white); }

.tui-heatmap__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-4); min-height: 32px; }
.tui-heatmap__name { flex: 1 1 0; min-width: 12ch; }
.tui-heatmap__read { display: inline-flex; align-items: center; gap: var(--tui-3); font-size: var(--tui-t-small); color: var(--tui-ink-2); white-space: nowrap; }
.tui-heatmap__lcd { font-size: 17px; }

/* The matrix scrolls inside itself when it cannot fit, never the page. */
.tui-heatmap__scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; margin: -4px; padding: 4px 4px 6px; }
.tui-heatmap__grid { position: relative; isolation: isolate; display: grid; gap: var(--tui-heatmap-gap); width: max-content; }
.tui-heatmap__row, .tui-heatmap__cols {
  display: grid;
  grid-template-columns: var(--tui-heatmap-rh) repeat(var(--tui-heatmap-cols), var(--tui-heatmap-cell));
  column-gap: var(--tui-heatmap-gap);
  align-items: center;
}
.tui-heatmap__cols { width: max-content; margin-bottom: 5px; font: 500 10px/1 var(--tui-sans); letter-spacing: 0.02em; color: var(--tui-ink-2); }
.tui-heatmap__cols span { grid-row: 1; white-space: nowrap; }
.tui-heatmap__cols.is-named span { justify-self: center; }
.tui-heatmap__cols.is-staggered { row-gap: 4px; }
.tui-heatmap__cols.is-staggered span:nth-child(odd):not(:first-child) { grid-row: 2; }
.tui-heatmap__rh { font: 500 10px/1 var(--tui-sans); letter-spacing: 0.02em; color: var(--tui-ink-2); white-space: nowrap; }
.tui-heatmap__blank { display: block; width: var(--tui-heatmap-cell); aspect-ratio: 1; }

/* The glass and the light, behind the sockets. */
.tui-heatmap__light {
  position: absolute;
  z-index: -1;
  max-width: none;
  max-height: none;
  pointer-events: none;
  color: var(--tui-heatmap-c);
  outline-color: var(--tui-vfd-bg);
}

/* A socket: the glass sits a little below the plate, so the hole's upper
   wall shades it and its lower lip catches the lamp. */
.tui-heatmap__lamp {
  position: relative;
  display: block;
  width: var(--tui-heatmap-cell);
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    inset 0 1.5px 1.5px rgb(0 0 0 / 0.85),
    0 0 0 0.75px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    0 1px 0 var(--tui-hl);
}
/* The lens: the room's lamp caught high on the left, the same on every lamp. */
.tui-heatmap__lamp::before, .tui-heatmap__key-lamp::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(ellipse 30% 22% at 36% 30%, rgb(255 255 255 / 0.34), transparent 100%);
}
/* No reading: an empty socket, no lens in it. */
.tui-heatmap__lamp.is-empty { background: var(--tui-well); box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl); }
.tui-heatmap__lamp.is-empty::before { display: none; }

/* The lamp being read is ringed in print; the focused one takes the focus ring. */
.tui-heatmap__lamp:hover, .tui-heatmap__lamp.is-read, .tui-heatmap__lamp.is-hover { outline: 1.5px solid var(--tui-ink-2); outline-offset: 2px; }
.tui-heatmap__lamp:focus { outline: none; }
.tui-heatmap__lamp:focus-visible, .tui-heatmap__lamp.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

.tui-heatmap__foot { display: flex; justify-content: flex-end; }
.tui-heatmap__sum { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-heatmap__legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 14px; font-size: 11.5px; color: var(--tui-ink-2); }
.tui-heatmap__key-name { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; }
.tui-heatmap__key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* The legend's five lamps, drawn in CSS: they never change. */
.tui-heatmap__key-lamp {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 58%, color-mix(in oklab, var(--tui-heatmap-c) 22%, var(--tui-vfd-bg)), color-mix(in oklab, var(--tui-heatmap-c) 7%, var(--tui-vfd-bg)) 72%);
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.85), 0 0 0 0.75px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)), 0 1px 0 var(--tui-hl);
}
.tui-heatmap__key-lamp::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 46% 44%, color-mix(in oklab, var(--tui-heatmap-c) 55%, rgb(255 250 235)) 0, var(--tui-heatmap-c) 42%, color-mix(in oklab, var(--tui-heatmap-c) 78%, rgb(0 0 0)) 100%);
  box-shadow: 0 0 6px 0.5px color-mix(in oklab, var(--tui-heatmap-c) 55%, transparent);
  opacity: 0;
}
.tui-heatmap__key-lamp[data-step="1"]::after { opacity: 0.34; }
.tui-heatmap__key-lamp[data-step="2"]::after { opacity: 0.58; }
.tui-heatmap__key-lamp[data-step="3"]::after { opacity: 0.8; }
.tui-heatmap__key-lamp[data-step="4"]::after { opacity: 1; }

/* ---------------------------------------------------------------- part: hold-key */
/* Hold key: a kit key that goes only when held long enough. --p is how far it is held, 0 to 1. A row of red lamps
   in the key's lower lip lights one by one, and the key sinks as it fills. The lamps are the kit's own; this file
   holds no colour. */
:is(tui-hold-key, .tui-hold-key) { display: inline-flex; position: relative; max-width: 100%; min-width: 0; }
:is(tui-hold-key, .tui-hold-key) > .tui-key {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: min(15em, 100%);
  /* Short of room (a narrow phone), the words take a second line and the key grows to hold them, rather than
     running out of the dialog; with room it is the kit key's own height. */
  height: auto;
  min-height: var(--h);
  padding-block: 8px 14px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Held, the key goes down as far as it is held: half way at the touch, the rest as it fills. */
:is(tui-hold-key, .tui-hold-key)[data-holding] > .tui-key {
  transform: translateY(calc(var(--skirt) * (0.5 + 0.5 * var(--p, 0))));
  box-shadow: var(--tui-pressed);
  filter: brightness(0.97);
  transition: none;
}
:is(tui-hold-key, .tui-hold-key):is([data-state="busy"], [data-state="done"]) > .tui-key { transform: translateY(var(--skirt)); box-shadow: var(--tui-pressed); }
/* Done is the line that confirms what cannot be undone: still inert, but out of the kit's dim, words and lamps at full. */
:is(tui-hold-key, .tui-hold-key)[data-state="done"] > .tui-key { opacity: 1; cursor: default; }
/* The words and every other thing the key can say share one cell: the widest sizes the key, in every state.
   The words sit a little higher to make room for the lamps. */
.tui-hold-key__cell { display: inline-grid; justify-items: center; align-items: center; min-width: 0; max-width: 100%; transform: translateY(-3px); }
.tui-hold-key__cell > * { grid-area: 1 / 1; text-align: center; text-wrap: balance; line-height: 1.2; }
.tui-hold-key__sizer { visibility: hidden; }
.tui-hold-key__lamps { position: absolute; inset-inline: 16px; bottom: 6px; display: flex; justify-content: space-between; pointer-events: none; }
.tui-hold-key__lamps .tui-lamp { width: 5px; height: 5px; margin: 0; }
/* Unlit, they still show as lamps (the kit's red keeps a dead lens nearly black): the key reads as different before it is pressed. */
.tui-hold-key__lamps .tui-lamp:not([data-on]) { --lamp-off: 16%; }
/* Said aloud, never seen. */
.tui-hold-key__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- part: hover-card */
/* Hover card: the popover's card and leader, hung from a link or a name when
   the pointer rests on it or the keyboard reaches it. It is a preview, not a
   place to act: what it holds is read, and anything to press belongs in a
   popover. Placement and the leader come from popover.mjs; hover-card.mjs
   only decides when it is out. */
.tui-popover.tui-hover-card {
  width: 288px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
  text-align: left;
}
.tui-hover-card:not([popover]) { position: relative; }
.tui-popover.tui-hover-card[popover]:not(:popover-open) { display: none; }
.tui-hover-card__who { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--tui-3); }
.tui-hover-card__name { margin: 0; font: 700 var(--tui-t-lead)/1.15 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-hover-card__role { margin: 2px 0 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-hover-card p.tui-hover-card__text { margin: 0; color: var(--tui-ink-2); }
/* A line of facts, each a printed label over a figure. */
.tui-hover-card__facts { display: flex; gap: var(--tui-5); margin: 0; padding-top: 11px; border-top: 1px solid var(--tui-rule); }
.tui-hover-card__facts > div { display: grid; gap: 4px; }
.tui-hover-card__facts dt { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-hover-card__facts dd { margin: 0; font: 700 var(--tui-t-body)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }

/* ---------------------------------------------------------------- part: icon-picker */
/* Icon picker: a key that shows the picked icon, a clear key beside it, and the
   popover's card with the kit's search field over a grid of the kit's icons in
   a few printed groups. Each icon is a small key standing in a recess; the one
   under the arrow keys carries the focus ring, and the picked one is pressed
   with its lamp lit. Nothing here is coloured: the lamp is the kit's. */
tui-icon-picker { position: relative; display: inline-block; min-width: 0; vertical-align: middle; }
tui-icon-picker[disabled], tui-icon-picker[data-fs-disabled] { opacity: 0.45; }
.tui-icon-picker__bar { display: inline-flex; align-items: center; gap: var(--tui-2); max-width: 100%; }
.tui-icon-picker__key { --h: 38px; gap: var(--tui-2); max-width: 100%; padding: 0 var(--tui-4) 0 var(--tui-3); }
.tui-icon-picker__key .tui-icon { color: var(--tui-ink); }
.tui-icon-picker__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-icon-picker__name--empty { color: var(--tui-ink-2); font-weight: 500; }
.tui-icon-picker__clear { --h: 38px; flex: none; color: var(--tui-ink-2); }
.tui-icon-picker__clear[hidden] { display: none; }
.tui-field[data-error] .tui-icon-picker__key { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent); }

.tui-popover.tui-icon-picker__card { width: min(340px, calc(100vw - 16px)); max-width: none; padding: var(--tui-3); display: grid; gap: var(--tui-3); text-align: left; }
.tui-icon-picker__card[popover]:not(:popover-open) { display: none; }
.tui-popover--plain.tui-icon-picker__card { width: 100%; max-width: 340px; }

.tui-icon-picker__list {
  max-height: min(264px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 4px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  outline: none;
}
.tui-icon-picker__list:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-icon-picker__list[hidden] { display: none; }
.tui-icon-picker__group + .tui-icon-picker__group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--tui-rule); }
.tui-icon-picker__heading { padding: 2px 4px 4px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-icon-picker__cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }

.tui-icon-picker__cell {
  position: relative;
  display: grid;
  place-items: center;
  height: 40px;
  min-width: 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.18));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-icon-picker__cell:hover { filter: brightness(1.03); }
.tui-icon-picker__cell:active { transform: translateY(1.5px); box-shadow: var(--tui-pressed); filter: brightness(0.97); }
.tui-icon-picker__cell.is-active { outline: 2px solid var(--tui-focus); outline-offset: 2px; z-index: 1; }
.tui-icon-picker__cell[aria-selected="true"] { transform: translateY(1.5px); box-shadow: var(--tui-pressed); filter: brightness(0.97); }
.tui-icon-picker__cell > .tui-lamp { position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; }

.tui-icon-picker__empty { margin: 0; padding: 10px 4px; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-icon-picker__empty[hidden] { display: none; }
.tui-icon-picker__foot { display: flex; align-items: center; gap: var(--tui-2); min-height: 24px; padding: 0 4px; font: 500 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); }
.tui-icon-picker__foot .tui-icon { color: var(--tui-ink); }
.tui-icon-picker__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-icon-picker__key, .tui-icon-picker__clear { --h: 44px; min-width: 44px; }
  .tui-icon-picker__cells { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .tui-icon-picker__cell { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-icon-picker__cell { transition: none; }
}

/* ---------------------------------------------------------------- part: icon-rail */
/* Icon rail: a narrow sidebar of icon keys on a plate. A lamp beside the
   current one is lit; the others have their lamp unlit, like the full side
   rail's. With the rail closed a label is a tooltip, shown on hover and on
   focus; a key at its foot opens the rail out so every label is printed
   beside its icon. The icon stays exactly where it was when the rail
   opens. Corners are concentric: an 8px edge round a 6px key is the 12px
   plate; the lamps sit in the 12px margin on the left. */
tui-icon-rail, .tui-icon-rail {
  --ir-item: 44px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 62px;
  min-height: 100%;
  padding: 8px 6px 8px 12px;
  /* End bars, where a finish has them, are the rail's top and bottom borders: no key reaches them. */
  border-block: var(--tui-trim-bar-w, 0px) solid transparent;
  border-radius: var(--tui-r-l);
  background: var(--tui-trim-bar, none), var(--tui-face);
  box-shadow: var(--tui-raised);
  transition: width 160ms var(--tui-ease);
}
tui-icon-rail::before, .tui-icon-rail::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%); opacity: var(--tui-grain); pointer-events: none; }
:is(tui-icon-rail, .tui-icon-rail)[expanded] { width: 216px; overflow-x: clip; }

.tui-icon-rail__nav { flex: 1; padding-bottom: 8px; border-bottom: 1px solid var(--tui-rule); }
.tui-icon-rail__list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }

.tui-icon-rail__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--tui-3);
  width: 100%;
  height: var(--ir-item);
  padding: 0;
  border-radius: 6px;
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink-2);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tui-icon-rail__item svg, .tui-icon-rail__toggle svg { width: 18px; height: 18px; flex: none; }
.tui-icon-rail__toggle { --h: var(--ir-item); --skirt: 2px; justify-content: center; gap: var(--tui-3); width: 100%; padding: 0; border-radius: 6px; font-weight: 500; font-size: var(--tui-t-body); color: var(--tui-ink-2); }
.tui-icon-rail__item:hover, .tui-icon-rail__item.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
.tui-icon-rail__item:focus-visible, .tui-icon-rail__item.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* The one you are on is let into the plate, and its lamp is lit. */
.tui-icon-rail__item[aria-current="page"], .tui-icon-rail__item.is-current { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-icon-rail__item[aria-current="page"]:hover { background: var(--tui-well-fill) var(--tui-well); }
.tui-icon-rail__item:active, .tui-icon-rail__item.is-down { transform: translateY(1px); }
.tui-icon-rail__item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-green) 18%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.35);
}
.tui-icon-rail__item[aria-current="page"]::before, .tui-icon-rail__item.is-current::before { background: var(--tui-green); box-shadow: 0 0 6px 1px color-mix(in oklab, var(--tui-green) 60%, transparent); }

/* Closed: the label is a tooltip. It stays in the page (opacity, not display), so the icon key is still named. */
.tui-icon-rail__label {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 10;
  padding: 6px 9px;
  border-radius: 5px;
  font: 500 11.5px/1 var(--tui-sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: 0 4px 10px -4px rgb(0 0 0 / 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-3px, -50%);
  transition: opacity 110ms var(--tui-ease), transform 110ms var(--tui-ease);
}
:is(.tui-icon-rail__item, .tui-icon-rail__toggle):is(:hover, :focus-visible, .is-tip) > .tui-icon-rail__label { opacity: 1; transform: translate(0, -50%); transition-delay: 140ms; }
:is(.tui-icon-rail__item, .tui-icon-rail__toggle):focus-visible > .tui-icon-rail__label { transition-delay: 0ms; }

/* The foot: a key that opens the rail out, and stays down while it is open. */
:is(tui-icon-rail, .tui-icon-rail)[expanded] .tui-icon-rail__toggle svg { transform: rotate(180deg); }
:is(tui-icon-rail, .tui-icon-rail)[expanded] .tui-icon-rail__toggle { transform: translateY(var(--skirt)); filter: brightness(0.97); box-shadow: var(--tui-pressed); }
tui-icon-rail:not(:defined) .tui-icon-rail__toggle { display: none; }

/* Open: labels printed beside the icons, icons where they were. */
:is(tui-icon-rail, .tui-icon-rail)[expanded] :is(.tui-icon-rail__item, .tui-icon-rail__toggle) { justify-content: flex-start; padding: 0 13px; }
:is(tui-icon-rail, .tui-icon-rail)[expanded] .tui-icon-rail__label {
  position: static;
  padding: 0;
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  letter-spacing: 0;
  color: inherit;
  background: none;
  box-shadow: none;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  tui-icon-rail, .tui-icon-rail, .tui-icon-rail__label { transition: none; }
}

/* ---------------------------------------------------------------- part: icons */
/* Icons: drawn on a 16 grid with a 1.6 line, round ends, in currentColor, so
   an icon prints in whatever ink it sits in, in either finish. The size is
   the box; the line stays a tenth of it. Nothing here is coloured: an icon
   that means "on" is a lamp beside it, not a tint on the icon. */
.tui-icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  vertical-align: -0.2em;
  overflow: visible;
  color: inherit;
}
.tui-icon--sm { width: 12px; height: 12px; }
.tui-icon--lg { width: 20px; height: 20px; }
.tui-icon--xl { width: 24px; height: 24px; }

/* The set as a grid of printed cells: the glyph above, its name below. */
.tui-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: var(--tui-1);
  padding: var(--tui-1);
  border-radius: calc(var(--tui-r-m) + var(--tui-1));
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-icon-grid__cell {
  appearance: none;
  display: grid;
  grid-template-rows: 26px auto;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 68px;
  padding: 10px 4px 8px;
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 11.5px/1.15 var(--tui-sans);
  color: var(--tui-ink-2);
  text-align: center;
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.18));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-icon-grid__cell > span { max-width: 100%; overflow-wrap: anywhere; }
.tui-icon-grid__cell .tui-icon { align-self: center; color: var(--tui-ink); }
.tui-icon-grid__cell:hover, .tui-icon-grid__cell.is-hover { color: var(--tui-ink); }
.tui-icon-grid__cell:active, .tui-icon-grid__cell.is-down { transform: translateY(1.5px); box-shadow: var(--tui-pressed); filter: brightness(0.97); }
.tui-icon-grid__cell:focus-visible, .tui-icon-grid__cell.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-icon-grid[data-size="12"] .tui-icon { width: 12px; height: 12px; }
.tui-icon-grid[data-size="20"] .tui-icon { width: 20px; height: 20px; }
.tui-icon-grid[data-size="24"] .tui-icon { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- part: id-plate */
/* ID plate: a staff badge. An engraved metal plate with a clip slot cut
   through its top edge, a photo well, and name, role and serial engraved
   below. Where there is no photo the initials are debossed into the well. A
   presence lamp is the only colour: green online, amber away, dark offline,
   and the word is always printed beside it. Compact is one line for a list.
   Corners are concentric: a 12px plate round a 6px rim makes the 6px well. */
.tui-id-plate {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: var(--tui-4);
  width: min(100%, 248px);
  padding: 34px var(--tui-4) var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
/* The same bead-blast as a panel. */
.tui-id-plate::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}

/* The clip slot: a stadium cut clean through the plate. */
.tui-id-plate__clip {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 52px;
  height: 10px;
  translate: -50% 0;
  border-radius: 999px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}

/* The photo well: a recess with the print set in it. Inside, a rim shades the upper edge, the way the avatar's does. */
.tui-id-plate__photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-id-plate__photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tui-id-plate__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: var(--tui-depth-well, inset 0 2px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.9)), inset 1px 0 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)), inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 70%, transparent));
}
/* Debossed initials: cut into the well, with the lamp catching the lower lip of every stroke. */
.tui-id-plate__initials {
  font: 700 46px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--tui-ink) 24%, var(--tui-well));
  text-shadow: 0 1.5px 0 var(--tui-hl), 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6));
  user-select: none;
}

.tui-id-plate__who { display: grid; justify-items: center; gap: 4px; min-width: 0; max-width: 100%; text-align: center; }
/* Engraved: the cut's lower lip catches the lamp. */
.tui-id-plate__name { margin: 0; font: 700 var(--tui-t-h3)/1.15 var(--tui-sans); letter-spacing: -0.015em; color: var(--tui-ink); text-shadow: 0 1px 0 var(--tui-hl); overflow-wrap: anywhere; }
.tui-id-plate__role { margin: 0; font-size: var(--tui-t-body); color: var(--tui-ink-2); text-shadow: 0 1px 0 var(--tui-hl); }

/* The rating strip along the foot: the serial, then how to reach them. */
.tui-id-plate__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--tui-3);
  width: 100%;
  padding: 10px 14px 11px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-id-plate__serial { display: grid; gap: 4px; margin: 0; min-width: 0; }
.tui-id-plate__serial dt { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-id-plate__serial dd { margin: 0; font: 600 15px/1 var(--tui-sans); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; color: var(--tui-ink); text-shadow: 0 1px 0 var(--tui-hl); white-space: nowrap; }
.tui-id-plate__presence { display: inline-flex; align-items: center; gap: var(--tui-2); margin: 0; font-size: var(--tui-t-small); font-weight: 600; color: var(--tui-ink); white-space: nowrap; }

/* Compact: one line, for a list of people. The clip slot stands up along the left edge, like a badge reel's. */
.tui-id-plate--compact {
  grid-template-columns: auto minmax(0, 1fr) auto;
  justify-items: stretch;
  align-items: center;
  gap: var(--tui-3);
  width: min(100%, 440px);
  padding: 8px 14px 8px 26px;
  border-radius: var(--tui-r-m);
}
.tui-id-plate--compact .tui-id-plate__clip { top: 50%; left: 9px; width: 8px; height: 26px; translate: 0 -50%; }
.tui-id-plate--compact .tui-id-plate__photo { width: 44px; border-radius: 4px; }
.tui-id-plate--compact .tui-id-plate__initials { font-size: 17px; letter-spacing: 0.01em; text-shadow: 0 1px 0 var(--tui-hl); }
.tui-id-plate--compact .tui-id-plate__who { justify-items: start; gap: 1px; text-align: left; }
.tui-id-plate--compact .tui-id-plate__name { max-width: 100%; font-size: var(--tui-t-body); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-id-plate--compact .tui-id-plate__role { max-width: 100%; font-size: var(--tui-t-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The foot dissolves into the row: the serial under the role, the presence at the end. */
.tui-id-plate--compact { grid-template-rows: auto auto; row-gap: 2px; }
.tui-id-plate--compact .tui-id-plate__photo { grid-row: 1 / span 2; }
.tui-id-plate--compact .tui-id-plate__who { grid-column: 2; grid-row: 1; align-self: end; }
.tui-id-plate--compact .tui-id-plate__foot { display: contents; }
.tui-id-plate--compact .tui-id-plate__serial { grid-column: 2; grid-row: 2; align-self: start; }
.tui-id-plate--compact .tui-id-plate__serial dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-id-plate--compact .tui-id-plate__serial dd { font-size: 11px; font-weight: 500; letter-spacing: 0.03em; color: var(--tui-ink-2); text-shadow: none; }
.tui-id-plate--compact .tui-id-plate__presence { grid-column: 3; grid-row: 1 / span 2; }

/* ---------------------------------------------------------------- part: ink-chips */
/* Ink filter chips: the chip group with a results readout at its start. A
   chip that goes down fills with ink from the edge nearest the readout, like a
   glass capsule filling, while a thin line of the same ink runs along a groove
   in the tray from the readout to the chip; the count rolls to its new number.
   Letting go drains it back. The chips, the tray, the caps and the LCD are the
   kit's own, so every finish follows; the ink is the blue lamp taken dark (and
   lit pale on a dark finish). Without the script the readout prints its text
   and the chips are checkboxes. */
@property --ink-x { syntax: '<length-percentage>'; inherits: true; initial-value: -20px; }

.tui-seg:is(tui-ink-chips, .tui-ink-chips) {
  /* One ink in every finish: the vessel's blue-black, same hue, lifted in lightness on a dark finish. */
  --tui-ik: light-dark(color-mix(in oklab, var(--tui-blue) 36%, black), color-mix(in oklab, var(--tui-blue) 54%, black));
  --tui-ik-on: var(--tui-paper-hi);
  --tui-ik-groove: color-mix(in oklab, var(--tui-skirt) 60%, var(--tui-well));
  --tui-ik-fill: 480ms;
  --tui-ik-run: 420ms;
  --tui-ik-ease: cubic-bezier(0.35, 0.1, 0.2, 1);
  row-gap: 10px;
  column-gap: 6px;
  padding: 6px 6px 13px;
  width: 100%;
  max-width: 100%;
}
.tui-ink-chips > label { flex: 1 0 auto; }
.tui-ink-chips > label span { position: relative; justify-content: center; white-space: nowrap; }

/* The readout: a small LCD, its digits on strips that roll. */
.tui-ink-chips__readout { align-self: center; align-items: center; flex: none; gap: 0.5em; }
.tui-ink-chips__readout i { font-style: normal; }
.tui-ink-chips__digits { display: inline-flex; }
.tui-ink-chips__digit { display: block; width: 1ch; height: 1.2em; overflow: hidden; }
.tui-ink-chips__strip {
  display: block;
  transform: translateY(calc(var(--d, 0) * -1.2em));
  transition: transform 560ms cubic-bezier(0.3, 0.7, 0.1, 1) var(--roll, 0ms);
}
.tui-ink-chips__strip b { display: block; height: 1.2em; font-weight: inherit; line-height: 1.2; text-align: center; }
/* The tens follow the ones, the way a drum waits for the one beside it. */
.tui-ink-chips__digit:nth-last-child(2) .tui-ink-chips__strip { transition-delay: calc(var(--roll, 0ms) + 90ms); }
.tui-ink-chips__digit:nth-last-child(3) .tui-ink-chips__strip { transition-delay: calc(var(--roll, 0ms) + 180ms); }
.tui-ink-chips[data-flow="in"] { --roll: 700ms; }
.tui-ink-chips[data-flow="out"] { --roll: 380ms; }
/* The words for a screen reader: spoken, not seen. */
.tui-ink-chips__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The ink in a chip: the chip's face again, in ink, shown through a mask whose
   front edge is a meniscus (the corners run ahead of the middle). */
.tui-ink-chips__ink {
  --ink-x: -20px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: inherit;
  padding: inherit;
  justify-content: inherit;
  white-space: inherit;
  border-radius: inherit;
  font: inherit;
  font-style: normal;
  color: var(--tui-ik-on);
  pointer-events: none;
  background:
    radial-gradient(circle 21px at var(--ink-x) 50%, transparent 16.5px, var(--tui-hl) 17.5px, transparent 20px),
    radial-gradient(circle 34px at var(--ink-x) 50%, transparent 16px, color-mix(in oklab, var(--tui-skirt) 70%, transparent) 17.5px, transparent 34px),
    linear-gradient(180deg, var(--tui-hl), transparent 42%, color-mix(in oklab, var(--tui-skirt) 45%, transparent)),
    var(--tui-ik);
  box-shadow: inset 0 1px 0 var(--tui-hl), inset 0 -2px 3px color-mix(in oklab, var(--tui-skirt) 55%, transparent);
  mask-image: linear-gradient(90deg, var(--tui-ink) var(--ink-x), transparent var(--ink-x)), radial-gradient(circle 17px at var(--ink-x) 50%, var(--tui-ink) 98%, transparent 100%);
  mask-composite: subtract;
  -webkit-mask-image: linear-gradient(90deg, var(--tui-ink) var(--ink-x), transparent var(--ink-x)), radial-gradient(circle 17px at var(--ink-x) 50%, var(--tui-ink) 98%, transparent 100%);
  -webkit-mask-composite: source-out;
  /* It lets go first, then the line draws back. */
  transition: --ink-x var(--tui-ik-fill) var(--tui-ik-ease);
}
.tui-ink-chips input:checked + span .tui-ink-chips__ink {
  --ink-x: calc(100% + 17px);
  transition-delay: calc(var(--tui-ik-run) - 40ms);
}
.tui-ink-chips input:checked + span .tui-ink-chips__ink small { color: inherit; }
.tui-ink-chips__ink small { color: inherit; }

/* The groove and the line in it. */
.tui-ink-chips__feed { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.tui-ink-chips__feed path { fill: none; stroke-linejoin: round; }
.tui-ink-chips__groove {
  stroke: var(--tui-ik-groove);
  stroke-width: 1px;
  filter: drop-shadow(0 1px 0 var(--tui-hl));
}
.tui-ink-chips__run {
  stroke: var(--tui-ik);
  stroke-width: 2px;
  stroke-linecap: butt;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1.02;
  /* Draining: the chip lets go first, then the line goes back to the readout. */
  transition: stroke-dashoffset var(--tui-ik-run) var(--tui-ik-ease) calc(var(--tui-ik-fill) - 120ms);
}
.tui-ink-chips__run[data-on] { stroke-dashoffset: 0; transition-delay: 0ms; }

@media (pointer: coarse) {
  .tui-seg:is(tui-ink-chips, .tui-ink-chips) { padding: 6px 6px 12px; column-gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-ink-chips__ink, .tui-ink-chips__run, .tui-ink-chips__strip { transition: none !important; }
}

/* ---------------------------------------------------------------- part: inline-edit */
/* Inline edit: a printed label that becomes a field when you press it. At
   rest it is plain printing with no cap, so a page of them reads as text;
   under the pointer or the focus an engraved outline and a pencil say it can
   be changed. Pressed, it is let into the plate as the kit's field, in the
   same box and the same type, so the words stay where they were. Enter prints
   the new words back, Escape puts the old ones back, and moving away keeps
   what was typed. */
:is(tui-inline-edit, .tui-inline-edit) {
  --ie-h: 38px;
  display: inline-flex;
  position: relative;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}
:is(tui-inline-edit, .tui-inline-edit)[data-editing] { width: min(100%, max(240px, var(--ie-w, 0px))); }

.tui-inline-edit__print {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--tui-2);
  box-sizing: border-box;
  height: var(--ie-h);
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  text-align: left;
  background: none;
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}
.tui-inline-edit__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-inline-edit__text:empty::before { content: attr(data-empty); color: var(--tui-ink-2); }
/* The pencil: printed beside the words, there to be found. */
.tui-inline-edit__print svg { flex: none; width: 14px; height: 14px; color: var(--tui-ink-2); opacity: 0; transition: opacity 120ms; }
.tui-inline-edit__print:hover, .tui-inline-edit__print.is-hover { box-shadow: inset 0 0 0 1px var(--tui-rule); }
.tui-inline-edit__print:is(:hover, :focus-visible, .is-hover, .is-focus) svg { opacity: 1; }
.tui-inline-edit__print:focus-visible, .tui-inline-edit__print.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-inline-edit__print:disabled { cursor: default; opacity: 0.45; }
.tui-inline-edit__print:disabled svg { display: none; }

.tui-inline-edit__input {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: var(--ie-h);
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-inline-edit__input[hidden] { display: none; }
.tui-inline-edit__input:focus-visible, .tui-inline-edit__input.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-inline-edit__input[aria-invalid="true"] { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-inline-edit__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Without the script the words are only words. */
tui-inline-edit:not(:defined) .tui-inline-edit__print { cursor: default; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-inline-edit__print:hover, .tui-inline-edit__print.is-hover { box-shadow: inset 0 0 0 1px var(--tui-quiet-line-2); }
}

@media (pointer: coarse) {
  :is(tui-inline-edit, .tui-inline-edit) { --ie-h: 48px; }
  .tui-inline-edit__input { font-size: 16px; }
  /* No hover to find it by: the pencil is always printed. */
  .tui-inline-edit__print svg { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-inline-edit__print svg { transition: none; }
}

/* ---------------------------------------------------------------- part: input-group */
/* Input group: one recess that holds a field and what belongs to it. Words
   that are part of the value but not typed (https://, a unit, a currency)
   are printed on the floor of the well, parted from the text by an
   engraved line; a glyph sits at the start; small keys sit at the end on
   the floor, as the combobox's key does. Clear, copy and show-password keys
   are the element's own and appear only once its script runs. */
:is(tui-input-group, .tui-input-group) {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  height: 38px;
  padding: 0 4px 0 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: text;
}
:is(tui-input-group, .tui-input-group):has(> :first-child.tui-input-group__key) { padding-left: 4px; }
:is(tui-input-group, .tui-input-group):has(.tui-input-group__input:focus-visible), :is(tui-input-group, .tui-input-group).is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] :is(tui-input-group, .tui-input-group), :is(tui-input-group, .tui-input-group):has(.tui-input-group__input[aria-invalid="true"]) {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
:is(tui-input-group, .tui-input-group):has(.tui-input-group__input:disabled) { opacity: 0.45; cursor: not-allowed; }

.tui-input-group__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: inherit;
  background: transparent;
  outline: none;
}
.tui-input-group__input::placeholder { color: var(--tui-ink-3); }
/* The ring is drawn round the whole well, never round the text inside it. */
:is(tui-input-group, .tui-input-group) .tui-input-group__input:focus-visible { outline: none; }
.tui-input-group__input:disabled { cursor: not-allowed; }
.tui-input-group__input[type="search"]::-webkit-search-cancel-button { display: none; }
.tui-input-group__input--num { text-align: right; font-variant-numeric: tabular-nums; }

/* Printed on the floor: a prefix or a suffix, set off by an engraved line
   (a dark cut with the light catching its right side, as the lamp is left). */
.tui-input-group__addon {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: stretch;
  padding: 0 10px 0 var(--tui-3);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink-2);
  white-space: nowrap;
  user-select: none;
  box-shadow: inset -1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), inset -2px 0 0 var(--tui-hl);
}
.tui-input-group__input ~ .tui-input-group__addon { padding: 0 var(--tui-3) 0 10px; box-shadow: inset 1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), inset 2px 0 0 var(--tui-hl); }
/* A glyph has no line: it is printed on the floor beside the words. */
.tui-input-group__glyph { flex: none; display: grid; place-items: center; width: 32px; margin-right: -8px; color: var(--tui-ink-2); pointer-events: none; }
.tui-input-group__glyph svg { width: 16px; height: 16px; }

/* Keys on the floor: a small cap, latched while what it shows is on. */
.tui-input-group__key {
  appearance: none;
  flex: none;
  display: inline-grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 6px;
  min-width: 30px;
  height: 30px;
  margin-left: 4px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  font: 600 11.5px/1 var(--tui-sans);
  color: var(--tui-ink-2);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-input-group__key svg { width: 15px; height: 15px; }
.tui-input-group__key:hover, .tui-input-group__key.is-hover { color: var(--tui-ink); filter: brightness(1.03); }
.tui-input-group__key:active, .tui-input-group__key.is-down, .tui-input-group__key[aria-pressed="true"] { transform: translateY(1.5px); filter: brightness(0.97); color: var(--tui-ink); box-shadow: var(--tui-pressed); }
.tui-input-group__key:focus-visible, .tui-input-group__key.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-input-group__key:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.tui-input-group__key .tui-lamp { margin: 0; }
/* The kit's own keys wait for the script, and the clear key for something to clear. */
tui-input-group:not(:defined) [data-input-action], :is(tui-input-group, .tui-input-group) [data-input-action][hidden] { display: none; }
.tui-input-group__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A larger key of the kit's own at the end: the action the field is for. */
:is(tui-input-group, .tui-input-group) > .tui-key { --h: 30px; --skirt: 1.5px; margin-left: 4px; padding: 0 var(--tui-3); font-size: 11.5px; border-radius: 6px; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-input-group__addon { box-shadow: inset -1px 0 0 var(--tui-quiet-line-2); }
  .tui-input-group__input ~ .tui-input-group__addon { box-shadow: inset 1px 0 0 var(--tui-quiet-line-2); }
  .tui-input-group__key:active, .tui-input-group__key.is-down, .tui-input-group__key[aria-pressed="true"] { transform: translateY(1px); filter: none; background: var(--tui-quiet-key-down); }
  .tui-input-group__key:hover, .tui-input-group__key.is-hover { filter: none; background: var(--tui-quiet-key-hover); }
}

@media (prefers-reduced-motion: reduce) {
  .tui-input-group__key { transition: none; }
}

/* A finger needs 44px (kit/src/core.css, a fingertip's reach): a floor key keeps its 30px face and takes a press area
   44 tall. Sideways it reaches only 2px past its face, into the 4px gap, so two keys side by side never take each other's press. */
@media (pointer: coarse) {
  .tui-input-group__key { position: relative; }
  .tui-input-group__key::after { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)) -2px; }
}

/* ---------------------------------------------------------------- part: install-snippet */
/* Install snippet: the one command everyone copies, over a row of selector
   keys. The keys are the kit's selector (a native radio group, one key down at
   a time); the command is a line of display glass with a prompt engraved in its
   margin, and the Copy key sits at the far end. Pick another manager and the
   line is rewritten; every other snippet on the page follows. The prompt is
   drawn by the stylesheet, so it is never copied or read aloud. The glass and
   its light are .tui-glass's. */
.tui-install { display: grid; gap: var(--tui-2); min-width: 0; }
.tui-install > .tui-seg { justify-self: start; max-width: 100%; }
.tui-glass.tui-install__glass {
  position: relative; /* holds the copy key's spoken status */
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  min-height: 48px;
  padding: 4px 4px 4px 14px;
}
.tui-install__cmd {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 0;
  font: 400 13px/1.45 var(--tui-mono);
  color: var(--tui-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tui-install__cmd::before {
  content: '$';
  content: '$' / '';
  display: inline-block;
  margin-right: 1.2ch;
  color: var(--tui-ink-2);
  user-select: none;
}
.tui-install__glass .tui-key { flex: none; }

@media (pointer: coarse) {
  .tui-install > .tui-seg { --seg-h: 44px; }
  .tui-install__glass .tui-key { --h: 44px; }
}

/* ---------------------------------------------------------------- part: jacquard-swatch */
/* Jacquard swatch: a working QR code woven as a cloth swatch. Dark modules
   are the dark warp floating on top (vertical threads), light ones the light
   weft (horizontal threads); the cloth is paper-coloured cotton in either
   finish, since a reader needs dark on light, and only the bench it lies on
   changes. A line of light passes down it like a till reader, the raised
   threads catch it, then the lamp in the status line comes on. Reduced
   motion: no line, no glints, the key goes straight to Read. */
.tui-jacquard {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--tui-3);
  max-width: 100%;
}
.tui-jacquard__swatch {
  width: 300px;
  max-width: 100%;
  padding: var(--tui-5) var(--tui-4) var(--tui-4);
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  box-sizing: border-box;
}
.tui-jacquard__weave {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  rotate: -1.2deg;
  /* The cloth lies on the bench: a contact shadow and a soft one under it. */
  filter:
    drop-shadow(0 1px 1px color-mix(in oklab, var(--tui-vfd-bg) 45%, transparent))
    drop-shadow(0 6px 9px color-mix(in oklab, var(--tui-vfd-bg) 30%, transparent));
}

/* The threads: dark warp and light weft, each rounded across its width. */
.tui-jacquard__dk-gap { fill: color-mix(in oklab, var(--tui-paper-ink) 55%, var(--tui-vfd-bg)); }
.tui-jacquard__dk-edge { stop-color: color-mix(in oklab, var(--tui-paper-ink) 70%, var(--tui-vfd-bg)); }
.tui-jacquard__dk-mid { stop-color: color-mix(in oklab, var(--tui-paper-ink) 72%, var(--tui-paper)); }
.tui-jacquard__lt-gap { fill: color-mix(in oklab, var(--tui-paper) 70%, var(--tui-paper-ink)); }
.tui-jacquard__lt-edge { stop-color: color-mix(in oklab, var(--tui-paper) 88%, var(--tui-paper-ink)); }
.tui-jacquard__lt-mid { stop-color: var(--tui-paper-hi); }
.tui-jacquard__fray {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-paper) 80%, var(--tui-paper-ink));
  stroke-width: 0.13;
  stroke-linecap: round;
}
/* The hem: turned over at the top and sewn down with a running stitch. */
.tui-jacquard__stitch {
  fill: none;
  stroke: var(--tui-paper-ink-2);
  stroke-width: 0.17;
  stroke-linecap: round;
  stroke-dasharray: 0.55 0.4;
}
.tui-jacquard__hem-edge { fill: color-mix(in oklab, var(--tui-paper-ink) 26%, transparent); }
.tui-jacquard__holes { fill: color-mix(in oklab, var(--tui-paper-ink) 55%, transparent); }
.tui-jacquard__tag {
  font-family: var(--tui-mono);
  font-weight: 700;
  letter-spacing: 0.12px;
}
/* Light across the cloth: brighter at the top left, a soft fold, a little
   darker at the bottom right. Gentle enough that a reader still sees the code. */
.tui-jacquard__sh-hi { stop-color: var(--tui-paper-hi); stop-opacity: 0.22; }
.tui-jacquard__sh-0 { stop-color: var(--tui-paper-hi); stop-opacity: 0; }
.tui-jacquard__sh-fold { stop-color: var(--tui-paper-ink); stop-opacity: 0.1; }
.tui-jacquard__sh-hi2 { stop-color: var(--tui-paper-hi); stop-opacity: 0.14; }
.tui-jacquard__sh-lo { stop-color: var(--tui-paper-ink); stop-opacity: 0.16; }

/* The reader. The line and the band that shows the glints move together,
   in the swatch's own units (one per module), so they stay in step. */
.tui-jacquard { --jq-light: color-mix(in oklab, var(--tui-white) 72%, var(--tui-blue)); }
.tui-jacquard__glint-dk { fill: var(--tui-white); }
.tui-jacquard__glint-lt { fill: color-mix(in oklab, var(--tui-white) 60%, var(--jq-light)); }
.tui-jacquard__glint-sh { fill: color-mix(in oklab, var(--tui-paper-ink) 70%, transparent); }
.tui-jacquard__beam-0 { stop-color: var(--jq-light); stop-opacity: 0; }
.tui-jacquard__beam-1 { stop-color: var(--jq-light); stop-opacity: 0.4; }
.tui-jacquard__band { transform: translateY(-6px); }
.tui-jacquard__line--halo { fill: var(--jq-light); }
.tui-jacquard.is-sweeping .tui-jacquard__line.tui-jacquard__line--halo { animation-name: tui-jacquard-halo; }
@keyframes tui-jacquard-halo {
  from { transform: translateY(-2px); opacity: 0; }
  8% { opacity: 0.45; }
  92% { opacity: 0.45; }
  to { transform: translateY(calc(var(--jq-w) * 1px + 2px)); opacity: 0; }
}
.tui-jacquard__line {
  fill: color-mix(in oklab, var(--tui-white) 55%, var(--jq-light));
  opacity: 0;
  transform: translateY(-2px);
}
.tui-jacquard.is-sweeping .tui-jacquard__band { animation: tui-jacquard-band 1300ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 1 both; }
.tui-jacquard.is-sweeping .tui-jacquard__line { animation: tui-jacquard-line 1300ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 1 both; }
/* Held mid-pass, for a still or a docs table: the same frame every time. */
.tui-jacquard[data-held] :is(.tui-jacquard__band, .tui-jacquard__line) { animation-play-state: paused; animation-delay: -600ms; }
@keyframes tui-jacquard-band {
  from { transform: translateY(-2px); }
  to { transform: translateY(calc(var(--jq-w) * 1px + 2px)); }
}
@keyframes tui-jacquard-line {
  from { transform: translateY(-2px); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  to { transform: translateY(calc(var(--jq-w) * 1px + 2px)); opacity: 0; }
}

.tui-jacquard__foot {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
}
.tui-jacquard__said {
  display: inline-flex;
  align-items: center;
  gap: var(--tui-2);
  margin: 0;
  font: 500 11px/1 var(--tui-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tui-ink-2);
}
/* Read: the weave never changes; the lamp comes on and the words say so. */
[data-read="true"] .tui-jacquard__said { color: var(--tui-ink); }

@media (prefers-reduced-motion: reduce) {
  .tui-jacquard.is-sweeping :is(.tui-jacquard__band, .tui-jacquard__line) { animation: none; }
}

/* ---------------------------------------------------------------- part: json-viewer */
/* JSON viewer: a tree of keys and values on display glass. A bar along the top
   names it, prints the path of the row you are on and carries the copy key.
   Under it the tree: a chevron that turns for a folder, the key, the value in
   the display's own light, and at the far end of the row a small printed legend
   for its type (str, num, bool, null, obj, arr), so a type is never a colour:
   every value is one ink, and the legend and the words for a screen reader say
   what it is. The row you are on has a lit edge and a lifted ground. The glass,
   its ink and its focus light are .tui-glass's, in every finish and volume. */
tui-json-viewer { display: block; min-width: 0; }
.tui-glass.tui-json-viewer { --jv-h: 320px; --jv-step: 16px; position: relative; /* holds the copy key's spoken status */ padding: 0; overflow: hidden; font-size: 12.5px; }

.tui-json-viewer__bar { display: flex; align-items: center; gap: var(--tui-3); min-height: 38px; padding: 0 var(--tui-1) 0 14px; border-bottom: 1px solid var(--tui-rule); }
.tui-json-viewer__title { flex: none; margin: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-json-viewer__path { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 12px/1 var(--tui-mono); color: var(--tui-ink); }
.tui-json-viewer__bar .tui-key { flex: none; }

.tui-json-viewer__scroll { max-height: var(--jv-h); padding: 6px 0 8px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--tui-ink) 35%, transparent) transparent; }
.tui-json-viewer__tree, .tui-json-viewer__tree ul { margin: 0; padding: 0; list-style: none; }
.tui-json-viewer__tree { min-width: max-content; font: 400 12.5px/1.5 var(--tui-mono); color: var(--tui-ink); }
.tui-json-viewer__tree [role="treeitem"] { position: relative; outline: none; }
.tui-json-viewer__tree [role="group"] { position: relative; }
.tui-json-viewer__tree [role="group"][hidden] { display: none; }
/* A guide down the left of each open folder, under its chevron. */
.tui-json-viewer__tree [role="group"]::before { content: ''; position: absolute; top: 0; bottom: 0; left: calc(var(--lvl) * var(--jv-step) + 15px); width: 1px; background: var(--tui-rule); pointer-events: none; }

.tui-json-viewer__row { display: flex; align-items: baseline; gap: 6px; min-height: 24px; padding: 0 14px 0 calc(var(--lvl) * var(--jv-step) + 8px); cursor: default; white-space: nowrap; }
.tui-json-viewer__row:hover { background: color-mix(in oklab, var(--tui-ink) 5%, transparent); }
[role="treeitem"][aria-selected="true"] > .tui-json-viewer__row { background: color-mix(in oklab, var(--tui-ink) 9%, transparent); box-shadow: inset 2px 0 0 var(--tui-ink); }
[role="treeitem"]:focus-visible > .tui-json-viewer__row { outline: 2px solid var(--tui-focus); outline-offset: -2px; }

.tui-json-viewer__chev { flex: none; align-self: center; width: 12px; height: 12px; background: currentColor; color: var(--tui-ink-2); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.6 8 6l-3.8 3.4z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.2 2.6 8 6l-3.8 3.4z'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform 120ms var(--tui-ease); }
.tui-json-viewer__chev--leaf { visibility: hidden; }
[aria-expanded="true"] > .tui-json-viewer__row > .tui-json-viewer__chev { transform: rotate(90deg); }
.tui-json-viewer__key { flex: none; font-weight: 600; color: var(--tui-ink); }
.tui-json-viewer__key[data-index] { font-weight: 400; color: var(--tui-ink-2); }
.tui-json-viewer__sep { flex: none; margin-left: -4px; color: var(--tui-ink-2); }
.tui-json-viewer__val { min-width: 0; max-width: 56ch; overflow: hidden; text-overflow: ellipsis; color: var(--tui-ink); font-variant-numeric: tabular-nums; }
.tui-json-viewer__val[data-type="null"] { color: var(--tui-ink-2); font-style: italic; }
.tui-json-viewer__sum { color: var(--tui-ink-2); }
/* The type legend: a small printed plate at the end of the row. */
.tui-json-viewer__type { flex: none; align-self: center; margin-left: auto; padding: 2px 5px 1px; border: 1px solid var(--tui-rule); border-radius: 3px; font: 600 9.5px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-json-viewer__tree [data-type="object"] > .tui-json-viewer__row > .tui-json-viewer__type, .tui-json-viewer__tree [data-type="array"] > .tui-json-viewer__row > .tui-json-viewer__type { border-style: dashed; }
/* Said aloud, never seen. */
.tui-json-viewer__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-json-viewer__more { padding: 0 14px 0 calc(var(--lvl, 1) * var(--jv-step) + 28px); font: 400 var(--tui-t-small)/24px var(--tui-sans); font-style: italic; color: var(--tui-ink-2); }
.tui-json-viewer__scroll:focus-within { scrollbar-color: color-mix(in oklab, var(--tui-ink) 55%, transparent) transparent; }

@media (pointer: coarse) {
  .tui-json-viewer__row { min-height: 44px; align-items: center; }
  .tui-json-viewer__bar { min-height: 48px; }
  .tui-json-viewer__bar .tui-key { --h: 44px; }
  .tui-json-viewer__key, .tui-json-viewer__val, .tui-json-viewer__sep { align-self: center; }
}
@media (max-width: 480px) {
  .tui-glass.tui-json-viewer { --jv-step: 12px; }
  .tui-json-viewer__val { max-width: 22ch; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-json-viewer__chev { transition: none; }
}

/* ---------------------------------------------------------------- part: kbd */
/* Kbd: a key to press, drawn as the key. A small cap on a skirt with a shallow
   dish worked into its top, printed in the second ink, the way the legends
   on a keyboard are. It is not a control: it says which key to press. Sizes
   step 18 · 22 · 30; a combo is caps 3px apart. */
.tui-kbd {
  --h: 22px;
  --skirt: 2px;
  --r: 5px;
  position: relative;
  isolation: isolate;
  display: inline-grid;
  place-items: center;
  min-width: var(--h);
  height: var(--h);
  margin: 0 1px var(--skirt);
  padding: 0 6px;
  border-radius: var(--r);
  font: 600 11px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--tui-ink-2);
  vertical-align: 0.12em;
  background:
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow:
    var(--tui-depth-key, inset 0 1px 0 var(--tui-hl),
    0 var(--skirt) 0 var(--tui-skirt),
    0 calc(var(--skirt) + 1px) 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  user-select: none;
}
/* The dish: a second, lower face inside the cap, concentric with it (the cap's corner less the 2px rim). */
.tui-kbd::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 2px 2px 3px;
  border-radius: calc(var(--r) - 2px);
  background: var(--tui-depth-floor, linear-gradient(color-mix(in oklab, var(--tui-face-lo) 55%, transparent), transparent 70%));
  box-shadow: var(--tui-depth-shade, inset 0 1px 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
.tui-kbd--sm { --h: 18px; --skirt: 1.5px; --r: 4px; padding: 0 4px; font-size: 10px; }
.tui-kbd--lg { --h: 30px; --skirt: 3px; --r: 7px; padding: 0 10px; font-size: 13px; }
.tui-kbd--wide { min-width: calc(var(--h) * 3); }
/* Down: on a real keyboard while it is held, or forced for a specimen. */
.tui-kbd:is(.is-down, [data-down]) { transform: translateY(var(--skirt)); box-shadow: var(--tui-pressed); color: var(--tui-ink); filter: brightness(0.97); }

/* The name a screen reader speaks in place of a symbol. */
.tui-kbd__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Several caps that make one shortcut. */
.tui-kbd-combo { display: inline-flex; align-items: center; gap: 3px; vertical-align: 0.02em; white-space: nowrap; }
.tui-kbd-combo > .tui-kbd { margin-inline: 0; }
.tui-kbd-combo__plus { padding: 0 2px; font: 500 11px/1 var(--tui-sans); color: var(--tui-ink-3); }

/* ---------------------------------------------------------------- part: kv-editor */
/* Key-value editor: rows of a name and a value, each its own recess, with a
   remove key at the end of the row and an add key under the last. For
   environment variables, request headers, tags and the like. It is the kit's
   field, key and icon key set in a grid, so the finish and the volume are
   theirs. The names and values are code, so they are set in the mono face, as
   code is. A name used twice is marked on its recess and said in words under
   the row. Wide, a row is a line (name, value, remove); narrow, the name sits
   over the value and each says what it is. Without the script the rows are
   plain fields in a form; the add and remove keys wait for it. */
.tui-kv { display: grid; gap: var(--tui-3); min-width: 0; container-type: inline-size; }
.tui-kv__title { margin: 0; }
.tui-kv__cols, .tui-kv__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 36px; column-gap: var(--tui-2); align-items: start; }
.tui-kv__cols { padding: 0 2px; }
.tui-kv__cols > span { padding-left: 2px; }
.tui-kv__cols > span:last-child { grid-column: 3; }
.tui-kv__rows { display: grid; gap: var(--tui-2); margin: 0; padding: 0; list-style: none; }
.tui-kv__field { display: grid; gap: 4px; min-width: 0; }
.tui-kv__cap { display: none; }
.tui-kv .tui-kv__name, .tui-kv .tui-kv__value { font: 500 12.5px/1 var(--tui-mono); }
.tui-kv .tui-input[aria-invalid="true"] { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-kv__remove.tui-key { --h: 36px; width: 36px; }
.tui-kv:not([data-ready]) :is(.tui-kv__remove, .tui-kv__add) { display: none; }
.tui-kv:not([data-ready]) .tui-kv__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.tui-kv:not([data-ready]) .tui-kv__cols > span:last-child { display: none; }

/* A name used twice, in words, under its row. */
.tui-kv__hint { grid-column: 1 / -1; margin: 4px 0 0; padding-left: 2px; font: 600 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink); }
.tui-kv__hint[hidden] { display: none; }

/* Nothing yet. */
.tui-kv__empty { margin: 0; padding: var(--tui-3) 2px; font: 400 var(--tui-t-body)/1.5 var(--tui-sans); color: var(--tui-ink-2); }
.tui-kv__empty[hidden] { display: none; }

.tui-kv__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-4); }
.tui-kv__count { font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
/* Said aloud, never seen. */
.tui-kv__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-kv { position: relative; }

/* Narrow: the name over the value, each with its word, and the remove key beside them. */
@container (max-width: 440px) {
  .tui-kv__cols { display: none; }
  .tui-kv__row { grid-template-columns: minmax(0, 1fr) 36px; row-gap: var(--tui-2); padding-bottom: var(--tui-3); border-bottom: 1px solid var(--tui-rule); }
  .tui-kv__row:last-child { border-bottom: 0; padding-bottom: 0; }
  .tui-kv__row > .tui-kv__field:nth-of-type(1) { grid-column: 1; grid-row: 1; }
  .tui-kv__row > .tui-kv__field:nth-of-type(2) { grid-column: 1; grid-row: 2; }
  .tui-kv__row > .tui-kv__remove { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .tui-kv__cap { display: block; font: 500 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); padding-left: 2px; }
  .tui-kv:not([data-ready]) .tui-kv__row { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .tui-kv .tui-input { height: 48px; font-size: 16px; }
  .tui-kv__remove.tui-key, .tui-kv__add.tui-key { --h: 44px; }
  .tui-kv__remove.tui-key { width: 44px; }
  .tui-kv__cols, .tui-kv__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 44px; }
}
@media (pointer: coarse) {
  @container (max-width: 440px) { .tui-kv__row { grid-template-columns: minmax(0, 1fr) 44px; } }
}
@media (prefers-reduced-motion: reduce) {
  .tui-kv .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: label-maker */
/* Label maker: one strip of embossing tape, run between two spools, that IS
   the text input, not a decoration beside one. A real, native <input> fills
   the strip, its own text made transparent so only its caret and selection
   draw; a glyph layer over the same spot mirrors its value, upper-cased, as
   raised letters pressed into the plastic, lit at the top-left and shaded at
   the bottom-right so each reads as embossed, not printed or keycapped.
   Touching, clicking or typing anywhere on the strip reaches the input,
   because it fills it. A space is a blank notch, no letter raised.
   The tape is a cut length of plastic, not a recess: it lies proud of the
   plate on its own small shadow, its length driven by
   `--tui-label-maker-len` (the field and the glyph layer share that width),
   so a short label is a short strip; it stops at the plate's width and
   feeds sideways after that. Its right end is cut on the slant and its
   left corners chamfered, a gloss band and a fine lengthwise grain run
   along the plastic. `data-tape` on the host picks the plastic: black (the
   default), red or blue, finish-aware tokens only. Without the script the
   glyph layer still shows the field's starting value; it just stops
   following it. */
tui-label-maker {
  --tlm-tape: color-mix(in oklab, var(--tui-skirt) 30%, rgb(var(--tui-sh)));
  --tlm-size: 15px;
  --tlm-line: 30px;
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  min-width: 0;
  padding: var(--tui-2);
  border-radius: var(--tui-r-l);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
tui-label-maker[data-tape="red"] { --tlm-tape: var(--tui-red); }
tui-label-maker[data-tape="blue"] { --tlm-tape: var(--tui-blue); }
.tui-label-maker__spool {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--tui-face-hi), var(--tui-face-lo) 70%, var(--tui-skirt));
  box-shadow: var(--tui-raised);
}
.tui-label-maker__spool:last-child { margin-left: auto; }
/* The tape and its letters share one type: the same font, size, track and
   white space, so the caret on the native field sits on the drawn letter. */
.tui-label-maker__strip,
.tui-label-maker__input,
.tui-label-maker__glyphs {
  font: 700 var(--tlm-size) / var(--tlm-line) var(--tui-mono);
  letter-spacing: 0.1em;
  white-space: pre;
}
/* The strip: a length of black, red or blue plastic cut from the reel. It
   is not a well: nothing is inset and nothing is sunk. A gloss band and a
   hair of grain run its length over the plastic's own lit gradient, the
   top edge catches the lamp, and it drops a small shadow on the plate. The
   right end is cut on the slant; the left corners are chamfered. */
.tui-label-maker__strip {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  width: calc(var(--tui-label-maker-len, 4) * 1ch + var(--tui-label-maker-len, 4) * 0.1em + 2 * var(--tui-2));
  min-height: var(--tlm-line);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  cursor: text;
  background:
    linear-gradient(to bottom, color-mix(in oklab, var(--tui-obj-lite) 30%, transparent), transparent 2px),
    linear-gradient(to bottom, transparent 16%, color-mix(in oklab, var(--tui-obj-lite) 13%, transparent) 30%, color-mix(in oklab, var(--tui-obj-lite) 19%, transparent) 44%, transparent 58%),
    repeating-linear-gradient(to bottom, color-mix(in oklab, var(--tui-obj-lite) 5%, transparent) 0 1px, transparent 1px 4px),
    linear-gradient(to bottom, color-mix(in oklab, var(--tlm-tape) 88%, var(--tui-face-hi)), var(--tlm-tape) 48%, color-mix(in oklab, var(--tlm-tape) 84%, var(--tui-skirt)));
  clip-path: polygon(0 2px, 2px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  filter: drop-shadow(0 1px 0 color-mix(in oklab, var(--tui-obj-dark) 55%, transparent)) drop-shadow(0 2px 3px color-mix(in oklab, var(--tui-obj-dark) 30%, transparent));
}
.tui-label-maker__strip::-webkit-scrollbar { display: none; }
tui-label-maker:has(.tui-label-maker__input:is(:focus-visible, .is-focus)) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-label-maker:has(.tui-label-maker__input[aria-invalid="true"]) .tui-label-maker__strip {
  filter: drop-shadow(0 1px 0 color-mix(in oklab, var(--tui-obj-dark) 55%, transparent)) drop-shadow(0 2px 3px color-mix(in oklab, var(--tui-obj-dark) 30%, transparent)) drop-shadow(0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent)) drop-shadow(0 0 6px color-mix(in oklab, var(--tui-red) 50%, transparent));
}
tui-label-maker:has(.tui-label-maker__input:disabled) { opacity: 0.45; }
tui-label-maker:has(.tui-label-maker__input:disabled) .tui-label-maker__strip { cursor: not-allowed; }
/* The real input: it IS the tape, visually. Its own glyphs are made
   transparent (never hidden: a screen reader, find-in-page and the browser's
   own autofill chip all still meet real text) so only its caret and
   selection highlight draw; the glyph layer beneath mirrors its value. Both
   share the exact font and the same `--tui-label-maker-len`-driven width, so
   the caret tracks the letter it sits on. */
.tui-label-maker__input {
  position: relative;
  z-index: 1;
  display: block;
  flex: none;
  width: calc(var(--tui-label-maker-len, 4) * 1ch + var(--tui-label-maker-len, 4) * 0.1em);
  min-width: 0;
  box-sizing: content-box;
  padding: 0 var(--tui-2);
  margin: 0;
  border: 0;
  color: transparent;
  caret-color: var(--tui-obj-spec);
  background: transparent;
  outline: none;
}
.tui-label-maker__input::placeholder { color: color-mix(in oklab, var(--tui-obj-lite) 55%, transparent); -webkit-text-fill-color: color-mix(in oklab, var(--tui-obj-lite) 55%, transparent); }
.tui-label-maker__input:disabled { cursor: not-allowed; }
.tui-label-maker__glyphs {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  box-sizing: content-box;
  width: calc(var(--tui-label-maker-len, 4) * 1ch + var(--tui-label-maker-len, 4) * 0.1em);
  height: 100%;
  padding: 0 var(--tui-2);
  pointer-events: none;
}
/* Each letter is pressed into the plastic: the tape stretched white over
   the type wheel, a catch light on its top-left edge and a shade on its
   lower-right, and a half-pixel of wheel wobble from its index (a hair of
   side shift too), so a run reads as struck letters, not a set line. */
.tui-label-maker__char {
  flex: none;
  color: var(--tui-obj-spec);
  text-shadow: -0.5px -0.5px 0 var(--tui-obj-lite), 0.65px 0.65px 0 color-mix(in oklab, var(--tui-obj-lite) 40%, var(--tui-obj-dark));
  transform: translate(var(--tlm-x, 0px), var(--tlm-y, 0px));
}
.tui-label-maker__char--space { color: transparent; text-shadow: none; }
/* The freshly typed run: a brief press as each letter is punched in. */
.tui-label-maker__char--new { display: inline-block; animation: tui-label-maker-punch 200ms var(--tui-ease) backwards; }
.tui-label-maker__char--new:nth-last-child(2) { animation-delay: 35ms; }
.tui-label-maker__char--new:nth-last-child(3) { animation-delay: 70ms; }
.tui-label-maker__char--new:nth-last-child(4) { animation-delay: 105ms; }
@keyframes tui-label-maker-punch {
  0% { transform: translate(var(--tlm-x, 0px), calc(var(--tlm-y, 0px) - 2px)) scaleY(1.2); text-shadow: -0.5px -0.5px 0 var(--tui-obj-lite), 1.75px 1.75px 1px color-mix(in oklab, var(--tui-obj-lite) 40%, var(--tui-obj-dark)); }
  100% { transform: translate(var(--tlm-x, 0px), var(--tlm-y, 0px)) scaleY(1); }
}
tui-label-maker:not(:defined) .tui-label-maker__glyphs { display: none; }

@media (pointer: coarse) {
  tui-label-maker { --tlm-size: 16px; --tlm-line: 36px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-label-maker__char--new { animation: none; }
  .tui-label-maker__strip { scroll-behavior: auto; }
}

/* ---------------------------------------------------------------- part: lamp-pool */
/* Lamp pool: a desk in a dim room with one lamp over it. The desk is the
   finish's own, with a faint grain of long streaks; the pool is a radial gradient in the filament
   lamp's colour (the cloth selector's bloom), eased out to nothing in its stops,
   and it is the only warm thing here. It is not a new colour of the kit. At rest
   it is painted once; backdrop.mjs lets a fine pointer move the lamp a little,
   eased, by translating the pool's layer (--bd-x, --bd-y). */
.tui-backdrop--lamp-pool {
  --bd-lamp: rgb(255 197 110);
  --bd-x: 0px;
  --bd-y: 0px;
  --bd-hi: light-dark(color-mix(in srgb, white 30%, transparent), color-mix(in srgb, var(--tui-ink) 4%, transparent));
  --bd-lo: light-dark(color-mix(in srgb, var(--tui-ink) 6%, transparent), rgb(0 0 0 / 0.25));
  background:
    radial-gradient(ellipse 210px 0.7px, var(--bd-hi), transparent) 0 0 / 421px 9px,
    radial-gradient(ellipse 140px 0.7px, var(--bd-lo), transparent) 0 0 / 283px 17px,
    radial-gradient(ellipse 260px 0.7px, var(--bd-hi), transparent) 0 0 / 523px 23px,
    var(--tui-desk);
}
/* The layer reaches half the section past every side and the pool fades to nothing well inside it, so wherever the lamp is
   moved (up to 45% of the width) no edge of the layer can show as a straight line. */
.tui-backdrop--lamp-pool::before {
  inset: -50%;
  translate: var(--bd-x) var(--bd-y);
  background: radial-gradient(ellipse 31.2% 24% at 39.2% 62%,
    light-dark(color-mix(in srgb, var(--bd-lamp) 72%, transparent), color-mix(in srgb, var(--bd-lamp) 15%, transparent)),
    light-dark(color-mix(in srgb, var(--bd-lamp) 44%, transparent), color-mix(in srgb, var(--bd-lamp) 9%, transparent)) 38%,
    light-dark(color-mix(in srgb, var(--bd-lamp) 16%, transparent), color-mix(in srgb, var(--bd-lamp) 3.5%, transparent)) 62%,
    transparent 78%);
}
.tui-backdrop--lamp-pool::after {
  inset: 0;
  background: radial-gradient(ellipse at 32% 70%, transparent 20%, light-dark(color-mix(in srgb, var(--tui-ink) 12%, transparent), rgb(0 0 0 / 0.5)));
}

/* ---------------------------------------------------------------- part: lantern */
/* Magic lantern: a dark room, the picture thrown on the wall, and the object
   that throws it. The wall takes the upper three quarters of the part, plain
   and matt with a faint falloff, and carries one soft-edged circle of light:
   the slide, magnified and flipped, its edge fading over about a sixteenth of
   the diameter. The lantern stands small at the foot, seen from behind and a
   little above: a black enamelled box on four feet, a pitched lid, a ribbed
   chimney rising from the lid and bending to one side, a back door with one
   warm peephole, and the brass lens barrel showing past the far edge. A very
   faint beam fans from the lens rim to the circle, with a few still motes of
   dust in it, and a lamp flicker of no more than two per cent runs only while
   the part is on screen.
   The strip is the long slide: a paper card round black glass, one round
   picture per slide, running left and right through a slot in the box and
   sticking out both sides. It is the control: drag it, or press a small
   picture, and the strip and the circle move together, the circle the other
   way because a lens flips the image, the dark glass between two pictures
   crossing the circle as a short gap. Long runs and wraps cover the circle
   with that dark glass while the strip travels. The plate under the part
   names the slide and is the one live region.
   kit/parts/lantern.mjs builds and wires it. The room, the object and the
   card are kit tokens and color-mix of tokens only; a slide's own picture is
   a fixed-palette SVG from the page, so it keeps its colours on every finish. */

tui-lantern, .tui-lantern {
  display: grid;
  gap: var(--tui-3);
  width: min(100%, 1040px);
  min-width: 0;
}
tui-lantern:not(:defined) { overflow: hidden; }

/* ------------------------------------------------------------------ stage */

/* The whole scene. Its height follows its width at three to two; on a phone
   it stands taller, so the circle keeps its size. A size container, so the
   room's own parts can read the stage's height and width. */
.tui-lantern__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  container-type: size;
  isolation: isolate;
  background: var(--tui-skirt);
}
/* On a phone the stage stands taller than three to two, so the circle still
   comes out at 260px across or more. */
@media (max-width: 620px) { .tui-lantern__stage { min-height: 500px; } }

/* The room, and every measure the scene is drawn on. The axis is the lens
   line: the slot in the box, the barrel and the strip's centre all sit on it. */
.tui-lantern__room {
  --wall: color-mix(in oklab, var(--tui-skirt) 62%, var(--tui-face-lo));
  --glass: color-mix(in oklab, var(--tui-cloth) 72%, var(--tui-skirt));
  --brass: color-mix(in oklab, var(--tui-amber) 54%, var(--tui-paper-ink));
  --brass-hi: color-mix(in oklab, var(--tui-amber) 58%, var(--tui-paper-hi));
  --screen: min(54cqh, 88cqw);
  --gap: calc(var(--screen) * 0.06);
  --pane: calc(var(--screen) * 1.06);
  --card: max(38px, 6.2cqh);
  --cell: calc(var(--card) * 2.1);
  --axis: 91%;
  position: absolute;
  inset: 0;
}

/* The wall: matt, no border and no card round it, a little lighter where the
   light falls and darker into the corners. Aluminium and paper get a mid-grey
   wall, never a white one: a lantern needs a dark room. */
.tui-lantern__wall {
  position: absolute;
  inset: 0 0 25% 0;
  background:
    radial-gradient(56% 46% at 50% 37%, color-mix(in oklab, var(--wall) 86%, var(--tui-paper-hi)) 0%, transparent 74%),
    radial-gradient(128% 118% at 50% 44%, var(--wall) 34%, color-mix(in oklab, var(--wall) 74%, var(--tui-skirt)) 100%);
  z-index: 0;
}
.tui-lantern__wall::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tui-noise);
  opacity: var(--tui-grain);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

/* The bench at the foot: a darker surface the lantern stands on, its front
   edge catching the lamp. */
.tui-lantern__bench {
  position: absolute;
  inset: 75% 0 0 0;
  z-index: 1;
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--wall) 46%, var(--tui-skirt)),
    color-mix(in oklab, var(--wall) 12%, var(--tui-skirt)) 32%,
    color-mix(in oklab, var(--tui-skirt) 84%, var(--tui-cloth)));
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-hl) 16%, transparent);
}
.tui-lantern__bench::before {
  content: '';
  position: absolute;
  inset: -14px 0 auto;
  height: 14px;
  background: linear-gradient(transparent, color-mix(in oklab, var(--tui-skirt) 42%, transparent));
  pointer-events: none;
}

/* The beam: a very faint cone from the lens rim up to the circle's own edges,
   so the picture stays the subject. The polygon cuts the cone; the radial mask
   takes its edges off, and the gradient leaves nothing at the top. */
.tui-lantern__beam {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: polygon(
    calc(50% + 9.6cqh) var(--axis),
    calc(50% - var(--screen) / 2) 37.5%,
    calc(50% + var(--screen) / 2) 37.5%);
  -webkit-mask-image: radial-gradient(circle at calc(50% + 9.6cqh) var(--axis), black 0, black 14%, transparent 62%);
  mask-image: radial-gradient(circle at calc(50% + 9.6cqh) var(--axis), black 0, black 14%, transparent 62%);
  background: linear-gradient(to top, color-mix(in oklab, var(--tui-amber) 8%, transparent), transparent 58%);
  pointer-events: none;
}

/* The spill: a little light round the circle, the only thing outside it. */
.tui-lantern__spill {
  position: absolute;
  left: 50%;
  top: calc(37.5% - var(--screen) * 0.72);
  width: calc(var(--screen) * 1.44);
  aspect-ratio: 1;
  translate: -50% 0;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--tui-amber) 8%, transparent) 44%, transparent 72%);
  filter: blur(7px);
  pointer-events: none;
}

/* The circle of light: the one place the picture shows. Its edge fades over
   about six per cent of the diameter, with a warm cast inside it. */
.tui-lantern__screen {
  position: absolute;
  left: 50%;
  top: calc(37.5% - var(--screen) / 2);
  width: var(--screen);
  aspect-ratio: 1;
  translate: -50% 0;
  z-index: 4;
  overflow: hidden;
  border-radius: 50%;
  background: var(--glass);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 88%, transparent 100%);
  mask-image: radial-gradient(circle at 50% 50%, black 88%, transparent 100%);
  box-shadow: inset 0 0 calc(var(--screen) * 0.05) color-mix(in oklab, var(--tui-amber) 16%, transparent);
}
/* The film: the strip's own pictures, magnified, read right to left as the
   lens throws them. Slide i stands in pane n-1-i. */
.tui-lantern__film {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  will-change: transform;
}
/* One pane: one picture, and the black glass after it that crosses the circle
   as the gap between two slides. */
.tui-lantern__pane {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: var(--pane);
  height: 100%;
  padding-right: var(--gap);
  background: var(--glass);
}
.tui-lantern__picture, .tui-lantern__slide {
  position: absolute;
  inset: 0 var(--gap) 0 0;
  display: block;
  margin: 0;
  overflow: hidden;
}
.tui-lantern__slide[hidden] { display: none; }
.tui-lantern__picture svg, .tui-lantern__slide svg,
.tui-lantern__picture img, .tui-lantern__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Only the pane in the gate shows its real figure; every other pane shows the
   decorative copy. The live copy stays in the layout, just unseen: its
   gradients are still what the real figure points at, and a display:none SVG
   takes those away in Chrome. */
.tui-lantern__pane.is-live > .tui-lantern__picture { visibility: hidden; }

/* The lamp behind the slide: a warm breath over the circle, never enough to
   recolour the picture. */
.tui-lantern__lamp {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 48%, color-mix(in oklab, var(--tui-amber) 7%, transparent), transparent 66%);
  pointer-events: none;
}
/* The dark glass between two pictures: it covers the circle for a long run or
   a wrap, while the strip travels. */
.tui-lantern__gap {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  background: var(--glass);
  opacity: 0;
  pointer-events: none;
}
/* The reduced-motion cross-fade: the old picture laid over the new one. */
.tui-lantern__snapshot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--screen);
  height: 100%;
  z-index: 3;
  pointer-events: none;
}
.tui-lantern__snapshot > .tui-lantern__picture {
  inset: 0;
  width: 100%;
  height: 100%;
}

/* A few still motes in the beam, drawn by hand in gradients. */
.tui-lantern__dust {
  position: absolute;
  inset: 26% 22% 12% 22%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.75;
  background-image:
    radial-gradient(circle at 22% 62%, color-mix(in oklab, var(--tui-paper-hi) 26%, transparent) 0 1px, transparent 1.8px),
    radial-gradient(circle at 38% 44%, color-mix(in oklab, var(--tui-paper-hi) 20%, transparent) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 46% 74%, color-mix(in oklab, var(--tui-paper-hi) 22%, transparent) 0 1.1px, transparent 2px),
    radial-gradient(circle at 58% 36%, color-mix(in oklab, var(--tui-paper-hi) 18%, transparent) 0 0.8px, transparent 1.6px),
    radial-gradient(circle at 66% 58%, color-mix(in oklab, var(--tui-paper-hi) 24%, transparent) 0 1px, transparent 1.9px),
    radial-gradient(circle at 34% 84%, color-mix(in oklab, var(--tui-paper-hi) 16%, transparent) 0 0.9px, transparent 1.8px),
    radial-gradient(circle at 74% 78%, color-mix(in oklab, var(--tui-paper-hi) 20%, transparent) 0 1px, transparent 1.9px);
}

/* The lamp's flicker: no more than two per cent, only while on screen, and
   never under reduced motion. */
.tui-lantern__stage.is-lit .tui-lantern__screen { animation: tui-lantern-lamp 6.8s ease-in-out infinite; }
.tui-lantern__stage.is-lit .tui-lantern__peep-glow { animation: tui-lantern-pilot 6.8s ease-in-out infinite; }
@keyframes tui-lantern-lamp {
  0%, 100% { filter: brightness(1); }
  9% { filter: brightness(1.02); }
  15% { filter: brightness(1.004); }
  31% { filter: brightness(1.016); }
  47% { filter: brightness(1.002); }
  73% { filter: brightness(1.012); }
  86% { filter: brightness(1.005); }
}
@keyframes tui-lantern-pilot {
  0%, 100% { opacity: 0.9; }
  9% { opacity: 1; }
  15% { opacity: 0.88; }
  31% { opacity: 1; }
  47% { opacity: 0.92; }
  73% { opacity: 0.98; }
  86% { opacity: 0.9; }
}

/* -------------------------------------------------------------------- strip */

/* The strip: the long slide, crossing the foot and running behind the box.
   It fades out at the part's edges when it is longer than they are. */
.tui-lantern__strip {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--axis) - var(--card) / 2);
  height: var(--card);
  z-index: 6;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black 8%, black 92%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, black 8%, black 92%, transparent 100%);
}
.tui-lantern__stage.is-dragging .tui-lantern__strip { cursor: grabbing; }
.tui-lantern__carrier {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  display: flex;
  will-change: transform;
}

/* One small picture on the card: the paper frame, the black glass in it, and
   a round copy of the scene. The whole card is the press target and the drag
   starts anywhere on it. */
.tui-lantern__cell {
  position: relative;
  flex: none;
  width: var(--cell);
  height: var(--card);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--tui-paper);
  box-shadow:
    0 1px 2px color-mix(in oklab, var(--tui-skirt) 46%, transparent),
    inset 0 0 0 1px color-mix(in oklab, var(--tui-paper-hi) 55%, transparent);
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
.tui-lantern__cell::after {
  content: '';
  position: absolute;
  inset: -4px 0;
  /* A fingertip reaches past the card's own edge: the press target is 46px tall. */
}
.tui-lantern__window {
  position: absolute;
  inset: 8% 9%;
  display: grid;
  place-items: center;
  border-radius: 1px;
  background: var(--glass);
  box-shadow: inset 0 1px 2px color-mix(in oklab, var(--tui-cloth) 66%, transparent);
  overflow: hidden;
}
/* The blank end of the slide, half a picture wide, at each end of the strip:
   a real slide has ends, and with one the strip sticks out of the box both ways. */
.tui-lantern__lead {
  position: relative;
  flex: none;
  width: calc(var(--cell) / 2);
  height: var(--card);
  border-radius: 2px;
  background: var(--tui-paper);
  box-shadow:
    0 1px 2px color-mix(in oklab, var(--tui-skirt) 46%, transparent),
    inset 0 0 0 1px color-mix(in oklab, var(--tui-paper-hi) 55%, transparent);
}
.tui-lantern__mini {
  height: 84%;
  aspect-ratio: 1;
  width: auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--glass);
}
.tui-lantern__mini svg, .tui-lantern__mini img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tui-lantern__cell:active, .tui-lantern__cell.is-down { translate: 0 1px; filter: brightness(0.96); }
.tui-lantern__cell:focus-visible, .tui-lantern__cell.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .tui-lantern__cell:hover { filter: brightness(1.03); }
}

/* ------------------------------------------------------------------ object */

/* The lantern, drawn in its own 200 by 260 box and standing on the bench. It
   is at most 26 per cent of the part's height, and the lens axis in its own
   box (176 of 260) lands on the strip's centre. */
.tui-lantern__housing {
  position: absolute;
  left: 50%;
  bottom: 1%;
  z-index: 7;
  height: 26%;
  translate: -50% 0;
  pointer-events: none;
  filter: drop-shadow(0 5px 6px color-mix(in oklab, var(--tui-skirt) 45%, transparent));
}
.tui-lantern__housing svg { display: block; height: 100%; width: auto; overflow: visible; }

/* A black enamelled tin box, so it stays dark in every finish: the cloth token
   with a little of the finish in it. Brass appears on the lens barrel only. */
.tui-lantern__tube {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-cloth) 80%, var(--tui-face-hi));
  stroke-width: 46;
}
.tui-lantern__tube-hi {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-hl) 42%, transparent);
  stroke-width: 5;
}
.tui-lantern__ribs {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-cloth) 46%, var(--tui-skirt));
  stroke-width: 49;
  stroke-dasharray: 1.6 8.4;
}
.tui-lantern__mouth { fill: color-mix(in oklab, var(--tui-cloth) 44%, var(--tui-skirt)); }
.tui-lantern__lid-top { fill: color-mix(in oklab, var(--tui-cloth) 74%, var(--tui-face-hi)); }
.tui-lantern__lid-ridge {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-hl) 48%, transparent);
  stroke-width: 1.6;
}
.tui-lantern__lid-lip { fill: color-mix(in oklab, var(--tui-cloth) 86%, var(--tui-skirt)); }
.tui-lantern__body { fill: var(--tui-cloth); }
.tui-lantern__body-edge {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-hl) 52%, transparent);
  stroke-width: 1.8;
}
.tui-lantern__body-shade {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-skirt) 70%, transparent);
  stroke-width: 2;
}
.tui-lantern__slot { fill: color-mix(in oklab, var(--tui-cloth) 36%, var(--tui-skirt)); }
.tui-lantern__slot-light { fill: color-mix(in oklab, var(--tui-amber) 52%, transparent); }
.tui-lantern__door { fill: color-mix(in oklab, var(--tui-cloth) 86%, var(--tui-face-hi)); }
.tui-lantern__door-edge {
  fill: none;
  stroke: color-mix(in oklab, var(--tui-hl) 32%, transparent);
  stroke-width: 2;
}
.tui-lantern__latch { fill: color-mix(in oklab, var(--tui-cloth) 66%, var(--tui-face-hi)); }
.tui-lantern__peep { fill: var(--tui-amber); }
.tui-lantern__peep-glow { fill: color-mix(in oklab, var(--tui-amber) 24%, transparent); }
.tui-lantern__feet { fill: color-mix(in oklab, var(--tui-cloth) 68%, var(--tui-skirt)); }
.tui-lantern__barrel-body, .tui-lantern__barrel-ring, .tui-lantern__rim { fill: var(--brass); }
.tui-lantern__barrel-ring { fill: var(--brass-hi); }
.tui-lantern__rim { fill: var(--brass-hi); }
.tui-lantern__lens-glass { fill: var(--tui-cloth); }
.tui-lantern__glint { fill: color-mix(in oklab, var(--tui-paper-hi) 78%, transparent); }

/* The plate: the slide's place and name, printed once; it is also the live
   region that announces a change. */
.tui-lantern__plate {
  margin: 0;
  font: 500 var(--tui-t-label)/1.3 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  text-align: center;
  white-space: normal;
}

@media (prefers-reduced-motion: reduce) {
  .tui-lantern__stage.is-lit .tui-lantern__screen,
  .tui-lantern__stage.is-lit .tui-lantern__peep-glow { animation: none; }
  .tui-lantern__cell { transition: none; }
}

/* A still of the part, for the docs' tile and states: the stage takes its
   three by two at any width (no 500px floor), and the strip is drawn smaller
   than a finger, because nothing in it is pressed there. */
.tui-lantern--still .tui-lantern__stage { min-height: 0; }
.tui-lantern--still .tui-lantern__room { --card: max(12px, 9cqh); }
.tui-lantern--still .tui-lantern__cell { cursor: default; }

/* ---------------------------------------------------------------- part: ledbars */
/* LED bar chart: a meter bridge. Every bar is a column of LED segments behind
   one smoked window cut into the plate; the scale is printed at its side and
   the names under it, and a small lit readout gives the exact value of the
   column you point at. ledbars.mjs builds the columns and runs the meters.
   Colour only where a segment is lit: green, then amber, then red. */

tui-ledbars {
  --tui-ledbars-led: 5px;    /* a segment's length along its bar */
  --tui-ledbars-gap: 2px;    /* between segments */
  --tui-ledbars-thick: 10px; /* a bar's width when the columns lie down */
  --tui-ledbars-pad: 8px;    /* the window's glass around the segments */
  --tui-ledbars-len: var(--tui-ledbars-led);
  display: block;
  min-width: 0;
}

/* Title and readout share a line while they fit; the readout drops under the title when they don't. */
.tui-ledbars__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-2) var(--tui-3);
  min-width: 0;
  margin-bottom: var(--tui-3);
}
.tui-ledbars__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The readout: a small VFD in the plate. Name, value, unit. */
.tui-ledbars__read { flex: 0 1 auto; gap: 0.45em; margin-left: auto; padding: 0.42em 0.6em; max-width: 100%; }
.tui-ledbars__who {
  min-width: 3ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 0.62em/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  opacity: 0.72;
}
.tui-ledbars__val { white-space: nowrap; }

/* Columns stand up: scale | window, names under the window. */
.tui-ledbars__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "scale win" ". names";
  column-gap: 6px;
  row-gap: 7px;
  min-width: 0;
}

/* The smoked window: dark glass set into the plate, lit only by its LEDs.
   Its glare belongs to the room, so it sits over everything and never moves. */
.tui-ledbars__window {
  grid-area: win;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tui-ledbars-m, 1), minmax(0, 1fr));
  gap: var(--tui-ledbars-colgap, var(--tui-ledbars-cg, 6px));
  min-width: 0;
  padding: var(--tui-ledbars-pad);
  border-radius: var(--tui-r-s);
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px),
    var(--tui-vfd-bg);
  box-shadow:
    var(--tui-depth-well, inset 0 2px 5px rgb(0 0 0 / 0.85),
    inset 0 0 0 1px rgb(255 255 255 / 0.045),
    0 1px 0 var(--tui-hl),
    0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.45)));
  /* Focus is drawn in light on the glass. */
  --tui-focus: var(--tui-vfd);
  touch-action: pan-y;
  /* Segments switching repaint the window, never the page around it. */
  contain: layout paint;
}
.tui-ledbars__window::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(158deg, rgb(255 255 255 / 0.11), rgb(255 255 255 / 0.035) 30%, transparent 30.5%),
    linear-gradient(to bottom, rgb(255 255 255 / 0.06), transparent 10%);
}

/* A column is as narrow as a meter on a bridge, centred in its channel. */
.tui-ledbars__col {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--tui-ledbars-gap);
  justify-self: center;
  width: min(100%, var(--tui-ledbars-thick) * 2.2);
  min-width: 0;
  border-radius: 2px;
  outline: none;
}
.tui-ledbars__col:focus-visible, .tui-ledbars__col.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* A segment: a diffused LED. Unlit, its colour shows faintly through the smoke. */
.tui-ledbars__led {
  --c: var(--tui-green);
  position: relative;
  flex: none;
  height: var(--tui-ledbars-led);
  border-radius: 1px;
  background: color-mix(in oklab, var(--c) 15%, var(--tui-vfd-bg));
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.07), inset 0 -0.5px 0 rgb(0 0 0 / 0.55);
}
.tui-ledbars__led[data-zone="amber"] { --c: var(--tui-amber); }
.tui-ledbars__led[data-zone="red"] { --c: var(--tui-red); }
.tui-ledbars__led[data-zone="blue"] { --c: var(--tui-blue); }
.tui-ledbars__led[data-zone="white"] { --c: var(--tui-white); }
.tui-ledbars__led::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  /* Lit through the diffuser: the full colour, a little hotter at the die. */
  background: radial-gradient(60% 80% at 50% 45%, color-mix(in oklab, var(--c) 74%, rgb(255 255 255)), var(--c) 85%);
  box-shadow:
    inset 0 0 0 0.5px color-mix(in oklab, var(--c) 70%, rgb(0 0 0)),
    0 0 6px 0 color-mix(in oklab, var(--c) 42%, transparent);
}
.tui-ledbars__led:is(.is-on, .is-peak)::after { opacity: 1; }

/* The printed scale: figures on round values, a wedge where the colour changes.
   Its box is the segments' pitch exactly, so a figure sits on a boundary. */
.tui-ledbars__scale {
  grid-area: scale;
  position: relative;
  min-width: 26px;
  margin-top: calc(var(--tui-ledbars-pad) + var(--tui-ledbars-gap) / 2);
  margin-bottom: calc(var(--tui-ledbars-pad) - var(--tui-ledbars-gap) / 2);
}
.tui-ledbars__tick {
  position: absolute;
  right: 0;
  bottom: calc(var(--at) * 100%);
  transform: translateY(50%);
  padding-right: 8px;
  font: 500 10px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
.tui-ledbars__tick::after {
  content: '';
  position: absolute;
  right: 0;
  top: calc(50% - 0.5px);
  width: 5px;
  height: 1px;
  background: var(--tui-ink-3);
}
.tui-ledbars__line {
  position: absolute;
  right: -1px;
  bottom: calc(var(--at) * 100%);
  width: 5px;
  height: 7px;
  transform: translateY(50%);
  background: var(--tui-ink);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.tui-ledbars__line[data-line="warn"] { background: var(--tui-ink-2); }

/* The names, printed under their columns. */
.tui-ledbars__names {
  grid-area: names;
  display: grid;
  grid-template-columns: repeat(var(--tui-ledbars-m, 1), minmax(0, 1fr));
  gap: var(--tui-ledbars-colgap, var(--tui-ledbars-cg, 6px));
  padding: 0 var(--tui-ledbars-pad);
  min-width: 0;
}
.tui-ledbars__name {
  justify-self: center;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
/* Thinned names stay unprinted, except the one the readout is showing; its neighbours make room. */
.tui-ledbars__name:is(.is-skipped, .is-muted) { visibility: hidden; }
.tui-ledbars__name.is-shown { visibility: visible; color: var(--tui-ink); }

/* Columns lie down: names | window, the scale under the window. */
tui-ledbars[data-orient="horizontal"] .tui-ledbars__body {
  grid-template-columns: var(--tui-ledbars-namew, auto) minmax(0, 1fr);
  grid-template-areas: "names win" ". scale";
  row-gap: 5px;
  column-gap: 10px;
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__window {
  justify-self: start;
  grid-template-columns: none;
  grid-template-rows: repeat(var(--tui-ledbars-m, 1), var(--tui-ledbars-thick));
  row-gap: 8px;
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__col { flex-direction: row; width: auto; justify-self: stretch; }
tui-ledbars[data-orient="horizontal"] .tui-ledbars__led { width: var(--tui-ledbars-len); height: auto; }
tui-ledbars[data-orient="horizontal"] .tui-ledbars__names {
  grid-template-columns: none;
  grid-template-rows: repeat(var(--tui-ledbars-m, 1), var(--tui-ledbars-thick));
  row-gap: 8px;
  padding: var(--tui-ledbars-pad) 0;
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__name {
  justify-self: end;
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__scale {
  justify-self: start;
  width: calc(var(--tui-ledbars-n) * (var(--tui-ledbars-len) + var(--tui-ledbars-gap)));
  height: 17px;
  margin: 0 0 0 calc(var(--tui-ledbars-pad) - var(--tui-ledbars-gap) / 2);
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__tick {
  right: auto;
  bottom: auto;
  top: 0;
  left: calc(var(--at) * 100%);
  transform: translateX(-50%);
  padding: 7px 0 0;
}
tui-ledbars[data-orient="horizontal"] .tui-ledbars__tick::after { right: auto; top: 0; left: calc(50% - 0.5px); width: 1px; height: 4px; }
tui-ledbars[data-orient="horizontal"] .tui-ledbars__line {
  right: auto;
  bottom: auto;
  top: -1px;
  left: calc(var(--at) * 100%);
  width: 7px;
  height: 5px;
  transform: translateX(-50%);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

/* ---------------------------------------------------------------- part: lever-frame */
/* Lever frame: a single choice drawn as a miniature lever frame, seen front
   on from a little above. Three to six short steel levers stand upright at
   the back of their slots in the curved top of one cast bed; the chosen
   lever is pulled toward the viewer about its foot, so it gets shorter, its
   knob drops and its foot slides forward in the slot, and its plate is the
   bright one. Every lever is identical and parallel: each has its own eye,
   straight in front of it, so none leans sideways. Each lever has a small
   pin across its foot: in the way means locked, withdrawn means free. The
   locking bar runs in a slot in the front face of the bed and shifts on
   every change. The metal is mixed from the finish's own tokens, never a
   colour code. lever-frame.mjs builds the levers, the pins and the
   interlock and pulls them with the Web Animations API. */
.tui-lever-frame {
  --lf-lever: 56px;
  --lf-gap: 8px;
  --lf-pad: 10px;
  --lf-col: 72px;
  /* The curved top of the bed, how far a pulled foot slides along its slot
     (a plain length, read by the script) and the angle of a full pull. */
  --lf-top: 18px;
  --lf-slide: 7px;
  --lf-pull: 40;
  --lf-shaft: 12px;
  /* Polished flat steel, lit from high and left: the highlight, the face and
     the shadow side, all out of the finish's own object material so the bar
     keeps its shape on graphite and night. */
  --lf-steel-spec: color-mix(in oklab, var(--tui-obj-spec) 68%, var(--tui-obj-lite));
  --lf-steel-hi: color-mix(in oklab, var(--tui-obj-lite) 82%, var(--tui-obj-body));
  --lf-steel-mid: color-mix(in oklab, var(--tui-obj-body) 74%, var(--tui-obj-dark));
  --lf-steel-lo: color-mix(in oklab, var(--tui-obj-dark) 72%, var(--tui-obj-body));
  --lf-plate: color-mix(in oklab, var(--tui-face-lo) 82%, var(--tui-skirt));
  --lf-plate-on: color-mix(in oklab, var(--tui-face-hi) 86%, var(--tui-face));
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  color: var(--tui-ink);
  font-family: var(--tui-sans);
}
.tui-lever-frame > .tui-label { padding-left: 2px; }

/* One bed: the space the levers throw in, then the low cast bar they rise
   from. The face carries a plate per lever and, below it, the locking slot. */
.tui-lever-frame__bed {
  position: relative;
  padding: 0 var(--lf-pad);
  min-width: 0;
}

/* The casting, from the back: the curved top of the bed, catching the light
   along its crest and falling into shadow toward the front edge, then the
   lit arris and the plain front face below it. One bar, wider than the
   levers, with a soft shadow on the page below. */
.tui-lever-frame__bed::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--lf-lever);
  bottom: 0;
  border-radius: 6px 6px 3px 3px / 7px 7px 3px 3px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-face-hi) 60%, var(--tui-face)) 0,
    color-mix(in oklab, var(--tui-obj-lite) 42%, var(--tui-face-hi)) 2.5px,
    color-mix(in oklab, var(--tui-obj-lite) 14%, color-mix(in oklab, var(--tui-face-hi) 74%, var(--tui-face))) calc(var(--lf-top) * 0.3),
    color-mix(in oklab, var(--tui-face) 70%, var(--tui-face-hi)) calc(var(--lf-top) * 0.5),
    color-mix(in oklab, var(--tui-face) 66%, var(--tui-face-lo)) calc(var(--lf-top) * 0.72),
    color-mix(in oklab, var(--tui-face-lo) 66%, var(--tui-skirt)) calc(var(--lf-top) - 2.5px),
    color-mix(in oklab, var(--tui-face-lo) 30%, var(--tui-skirt)) calc(var(--lf-top) - 0.5px),
    color-mix(in oklab, var(--tui-face-hi) 62%, var(--tui-face)) var(--lf-top),
    color-mix(in oklab, var(--tui-face-hi) 18%, var(--tui-face)) calc(var(--lf-top) + 1.5px),
    var(--tui-face) calc(var(--lf-top) + 30%),
    color-mix(in oklab, var(--tui-face) 62%, var(--tui-face-lo)) 100%);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--tui-obj-lite) 34%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-skirt) 44%, transparent),
    0 5px 7px -4px color-mix(in oklab, var(--tui-skirt) 62%, transparent);
  pointer-events: none;
}

/* Four tiny bolts, at the ends of the bed's front face. */
.tui-lever-frame__bolt {
  position: absolute;
  z-index: 3;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%,
    color-mix(in oklab, var(--tui-face-hi) 84%, var(--tui-ink-3)) 0,
    var(--tui-face-lo) 54%,
    color-mix(in oklab, var(--tui-skirt) 70%, var(--tui-face-lo)) 100%);
  box-shadow: 0 1px 1px color-mix(in oklab, var(--tui-skirt) 58%, transparent), inset 0 1px 0 var(--tui-hl);
  pointer-events: none;
}
.tui-lever-frame__bolt::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 28%;
  width: 1px;
  height: 44%;
  margin-left: -0.5px;
  border-radius: 1px;
  background: color-mix(in oklab, var(--tui-skirt) 58%, var(--tui-ink));
  transform: rotate(28deg);
}
.tui-lever-frame__bolt[data-at="tl"] { left: 3px; top: calc(var(--lf-lever) + var(--lf-top) + 4px); }
.tui-lever-frame__bolt[data-at="tr"] { right: 3px; top: calc(var(--lf-lever) + var(--lf-top) + 4px); }
.tui-lever-frame__bolt[data-at="bl"] { left: 3px; bottom: 3px; }
.tui-lever-frame__bolt[data-at="br"] { right: 3px; bottom: 3px; }

.tui-lever-frame__levers {
  position: relative;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--lf-col);
  justify-content: center;
  align-items: start;
  gap: var(--lf-gap);
  min-width: 0;
}

/* One lever: the throw above, the slot in the curved top, its plate on the
   front face below. The whole cell is the press target, never smaller than
   44px either way. Each cell is its own eye, straight in front of its own
   lever, so every lever is pulled the same way and none leans sideways. */
.tui-lever-frame__lever {
  position: relative;
  display: grid;
  grid-template-rows: calc(var(--lf-lever) + 3px) calc(var(--lf-top) - 3px) auto;
  justify-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--tui-r-s);
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: none;
  perspective: 760px;
  perspective-origin: 50% 36%;
  -webkit-tap-highlight-color: transparent;
}

/* The moving part. It turns about its foot toward the viewer: its top
   comes down and forward, so on screen it is shorter, and its foot slides
   forward along the slot as it goes, so it looks shorter and darker as it
   leans into the light-poor front of the bed. Nothing turns sideways. */
.tui-lever-frame__throw {
  position: relative;
  z-index: 2;
  display: block;
  grid-row: 1;
  width: 100%;
  height: var(--lf-lever);
  margin-top: 3px;
  transform: translateY(calc(var(--lf-a, 0) / var(--lf-pull) * var(--lf-slide))) rotateX(calc(var(--lf-a, 0) * -1deg));
  transform-origin: 50% 100%;
  filter: brightness(calc(1 - var(--lf-a, 0) / var(--lf-pull) * 0.24));
  transition: transform 420ms var(--tui-ease), filter 420ms var(--tui-ease);
  will-change: transform;
}
.tui-lever-frame__lever.is-thrown .tui-lever-frame__throw { --lf-a: var(--lf-pull); }
/* The foot: a small square block the bar is set in, at the back of the slot. */
.tui-lever-frame__throw::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 18px;
  height: 7px;
  margin-left: -9px;
  border-radius: 1.5px;
  background: linear-gradient(to bottom,
    var(--lf-steel-spec) 0,
    var(--lf-steel-hi) 22%,
    var(--lf-steel-mid) 66%,
    var(--lf-steel-lo) 100%);
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--tui-skirt) 42%, transparent),
    0 1px 2px color-mix(in oklab, var(--tui-skirt) 52%, transparent);
}

/* The stubby flat steel bar: wide at the foot, narrow at the top, its lit
   edge on the left and a falloff across its width. */
.tui-lever-frame__shaft {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: var(--lf-shaft);
  height: calc(var(--lf-lever) - 6px);
  transform: translateX(-50%);
  clip-path: polygon(0 100%, 100% 100%, 76% 0, 24% 0);
  background:
    linear-gradient(to bottom,
      color-mix(in oklab, var(--lf-steel-hi) 24%, transparent) 0,
      transparent 18%,
      transparent 72%,
      color-mix(in oklab, var(--tui-skirt) 30%, transparent) 100%),
    linear-gradient(90deg,
      var(--lf-steel-spec) 0 5%,
      var(--lf-steel-hi) 11%,
      color-mix(in oklab, var(--lf-steel-hi) 58%, var(--lf-steel-mid)) 26%,
      var(--lf-steel-mid) 52%,
      color-mix(in oklab, var(--lf-steel-mid) 62%, var(--lf-steel-lo)) 76%,
      var(--lf-steel-lo) 88%,
      color-mix(in oklab, var(--lf-steel-hi) 34%, var(--lf-steel-lo)) 97%,
      var(--lf-steel-lo) 100%);
}

/* The plain turned knob on top, seated on the bar. Nothing stands higher. */
.tui-lever-frame__knob {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%,
      color-mix(in oklab, var(--lf-steel-spec) 74%, transparent) 0 22%, transparent 62%),
    linear-gradient(to bottom,
      var(--lf-steel-hi) 0,
      color-mix(in oklab, var(--lf-steel-hi) 52%, var(--lf-steel-mid)) 46%,
      var(--lf-steel-lo) 100%);
  box-shadow:
    0 1px 1px color-mix(in oklab, var(--tui-skirt) 44%, transparent),
    inset 0 1px 0 color-mix(in oklab, var(--lf-steel-spec) 56%, transparent);
}
/* The turned shoulder under the knob. */
.tui-lever-frame__knob::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 10px;
  height: 3px;
  border-radius: 1px;
  background: linear-gradient(to bottom, var(--lf-steel-hi), var(--lf-steel-lo));
  box-shadow: 0 1px 0 color-mix(in oklab, var(--tui-skirt) 44%, transparent);
}

/* The slot cut in the curved top for the foot to slide in: dark inside, with
   the front lip lit. The lever stands at its back end and is pulled along it. */
.tui-lever-frame__slot {
  position: absolute;
  left: 50%;
  top: calc(var(--lf-lever) + 2px);
  z-index: 1;
  width: 22px;
  height: calc(var(--lf-top) - 4px);
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-skirt) 90%, var(--tui-ink)) 0,
    color-mix(in oklab, var(--tui-skirt) 96%, var(--tui-face)) 70%,
    color-mix(in oklab, var(--tui-face-lo) 60%, var(--tui-skirt)) 100%);
  box-shadow: inset 0 2px 3px color-mix(in oklab, var(--tui-skirt) 86%, transparent),
              inset 1px 0 2px color-mix(in oklab, var(--tui-skirt) 60%, transparent),
              0 1px 0 color-mix(in oklab, var(--tui-hl) 70%, transparent);
  pointer-events: none;
}

/* The lock pin: a short steel bar across the slot just in front of the foot.
   In the way it holds the lever at the back of its slot; withdrawn into the
   bed it lets the lever go, and a pulled lever slides over it. */
.tui-lever-frame__pin {
  position: absolute;
  left: 50%;
  top: calc(var(--lf-lever) + 8px);
  z-index: 1;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 1.5px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--lf-steel-spec) 72%, var(--lf-steel-hi)),
    var(--lf-steel-mid) 60%,
    var(--lf-steel-lo));
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--tui-skirt) 42%, transparent),
    0 1px 1px color-mix(in oklab, var(--tui-skirt) 54%, transparent);
  pointer-events: none;
  transition: transform 160ms var(--tui-ease), opacity 160ms var(--tui-ease);
}
.tui-lever-frame__pin.is-dropped { transform: translateY(3px) scaleX(0.3); opacity: 0; }

/* The plate: a small stamped label on the front face under its lever, dark on
   metal and never a white key. The plate takes the whole column, so every
   plate in a row is the same width; the widest label sets the column and
   the type wraps inside the plate rather than running over it. The whole
   lever cell is the target, so pressing the plate is the same press. */
.tui-lever-frame__plate {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  grid-row: 3;
  width: 100%;
  min-height: 15px;
  margin: 6px 0 8px;
  padding: 2px 3px;
  border-radius: 2px;
  background-color: var(--lf-plate);
  background-image: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-hl) 26%, transparent) 0,
    transparent 52%,
    color-mix(in oklab, var(--tui-skirt) 18%, transparent) 100%);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--tui-hl) 58%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-skirt) 52%, transparent),
    0 1px 0 color-mix(in oklab, var(--tui-hl) 34%, transparent);
  color: var(--tui-ink);
  font: 600 9px/1.15 var(--tui-sans);
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 0 color-mix(in oklab, var(--tui-hl) 62%, transparent), 0 -1px 0 color-mix(in oklab, var(--tui-skirt) 36%, transparent);
  hyphens: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}
.tui-lever-frame__lever[aria-checked="true"] .tui-lever-frame__plate {
  background-color: var(--lf-plate-on);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--tui-hl) 82%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-skirt) 62%, transparent),
    0 0 0 1px color-mix(in oklab, var(--tui-hl) 52%, transparent),
    0 1px 1px color-mix(in oklab, var(--tui-skirt) 34%, transparent);
}

/* The interlock: a slot cut in the casting's front face, with the bar and
   its dogs inside it. Both rows of a wrapped frame carry one, and every
   one of them shifts on a change. */
.tui-lever-frame__interlock {
  position: absolute;
  left: var(--lf-pad);
  right: var(--lf-pad);
  bottom: 2px;
  z-index: 1;
  height: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in oklab, var(--tui-skirt) 76%, var(--tui-ink));
  box-shadow: inset 0 2px 3px color-mix(in oklab, var(--tui-skirt) 80%, transparent),
              0 1px 0 var(--tui-hl);
  pointer-events: none;
}
.tui-lever-frame__lock {
  position: absolute;
  inset: 0;
  transition: transform 160ms var(--tui-ease);
}
.tui-lever-frame__bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 1px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-face-hi) 48%, var(--tui-ink-3)),
    color-mix(in oklab, var(--tui-ink-3) 54%, var(--tui-face-lo)));
  box-shadow: 0 1px 1px color-mix(in oklab, var(--tui-skirt) 55%, transparent);
}
.tui-lever-frame__dogs {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--lf-col);
  justify-content: center;
  gap: var(--lf-gap);
}
.tui-lever-frame__dog {
  justify-self: center;
  width: 8px;
  height: 100%;
  border-radius: 1px 1px 2px 2px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--tui-face-hi) 52%, var(--tui-ink-3)),
    color-mix(in oklab, var(--tui-ink-2) 48%, var(--tui-face-lo)));
  box-shadow: inset 0 1px 0 var(--tui-hl), 0 1px 1px color-mix(in oklab, var(--tui-skirt) 48%, transparent);
  transform: translateY(-104%);
  transition: transform 140ms var(--tui-ease);
}
.tui-lever-frame__dog.is-dropped { transform: translateY(0); }

/* A pinned lever is held upright by its pin, whatever is chosen. Its plate
   stays quiet and its label keeps its contrast. */
.tui-lever-frame__lever[aria-disabled="true"],
.tui-lever-frame__lever.is-pinned { cursor: not-allowed; }
.tui-lever-frame__lever[aria-disabled="true"] .tui-lever-frame__throw,
.tui-lever-frame__lever.is-pinned .tui-lever-frame__throw { --lf-a: 0; }
.tui-lever-frame__lever[aria-disabled="true"] .tui-lever-frame__shaft,
.tui-lever-frame__lever.is-pinned .tui-lever-frame__shaft { opacity: 0.72; }
.tui-lever-frame__lever[aria-disabled="true"] .tui-lever-frame__knob,
.tui-lever-frame__lever.is-pinned .tui-lever-frame__knob { opacity: 0.72; }

/* The choice, said once for a screen reader. */
.tui-lever-frame__said {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tui-lever-frame__lever:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .tui-lever-frame__lever:not([aria-disabled="true"]):hover .tui-lever-frame__plate { filter: brightness(1.05); }
  .tui-lever-frame__lever:not([aria-disabled="true"]):hover .tui-lever-frame__knob { filter: brightness(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .tui-lever-frame__throw,
  .tui-lever-frame__dog,
  .tui-lever-frame__lock,
  .tui-lever-frame__pin { transition: none; }
}

/* ---------------------------------------------------------------- part: lightbox */
/* Lightbox: a grid of thumbnails that opens one picture large, in a dark room.
   The thumbnails are plates with the picture set in them; the viewer is the
   native <dialog> over a near-black scrim, the picture fitted whole inside the
   window with its caption under it, a counter at the top, and a previous and a
   next key either side (under the picture on a phone). The room is dark in
   every finish: lightbox.mjs puts the dialog in its family's dark finish, so
   the keys and the printing are the finish's own, read on black. Pictures move
   by transform and opacity and nothing else. */

/* ------------------------------------------------------------ thumbnails */
.tui-lightbox-grid {
  --lb-min: 112px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--lb-min), 100%), 1fr));
  gap: var(--tui-3);
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tui-lightbox-grid > li { min-width: 0; margin: 0; }
.tui-lightbox-thumb {
  appearance: none;
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: var(--lb-ratio, 4 / 3);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--tui-r-m);
  overflow: hidden;
  color: inherit;
  font: inherit;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-plate, 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6)), 0 1px 2px rgb(var(--tui-sh) / 0.25), 0 6px 12px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
  cursor: zoom-in;
  transition: transform 70ms var(--tui-ease), filter 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-lightbox-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--tui-fit-x, 50%) var(--tui-fit-y, 50%);
  -webkit-user-drag: none;
}
/* An edge drawn over the picture, so a pale one on a pale page still has one. */
.tui-lightbox-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(var(--tui-sh) / 0.18);
  pointer-events: none;
}
.tui-lightbox-thumb:hover, .tui-lightbox-thumb.is-hover { filter: brightness(1.04); }
.tui-lightbox-thumb:active, .tui-lightbox-thumb.is-down { transform: translateY(1px); filter: brightness(0.96); }
.tui-lightbox-thumb:focus-visible, .tui-lightbox-thumb.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }

/* ---------------------------------------------------------------- viewer */
.tui-lightbox {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--tui-ink);
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  background: rgb(var(--tui-sh, 0 0 0) / 0.98);
  outline: none;
  container: tui-lightbox / inline-size;
}
.tui-lightbox[open], .tui-lightbox:not(dialog) { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.tui-lightbox::backdrop { background: transparent; }

.tui-lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-3); min-width: 0; padding: var(--tui-4) var(--tui-5) var(--tui-2); }
.tui-lightbox__count { font: 600 var(--tui-t-small)/1 var(--tui-sans); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-lightbox__close { --h: 40px; flex: none; }

.tui-lightbox__stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "prev fig next";
  align-items: center;
  gap: var(--tui-4);
  min-width: 0;
  min-height: 0;
  padding: 0 var(--tui-5) var(--tui-5);
  touch-action: pinch-zoom;
}
.tui-lightbox__prev, .tui-lightbox__next { --h: 44px; flex: none; }
.tui-lightbox__prev { grid-area: prev; }
.tui-lightbox__next { grid-area: next; }
.tui-lightbox[data-single] .tui-lightbox__prev, .tui-lightbox[data-single] .tui-lightbox__next { visibility: hidden; }

.tui-lightbox__figure {
  grid-area: fig;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  gap: var(--tui-3);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  transition: transform 160ms var(--tui-ease), opacity 160ms var(--tui-ease);
}
.tui-lightbox__img {
  display: block;
  align-self: center;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: var(--tui-r-s);
  box-shadow: 0 0 0 1px var(--tui-rule);
  -webkit-user-drag: none;
  user-select: none;
}
.tui-lightbox__caption { box-sizing: border-box; min-height: 2.8em; max-width: min(100%, 64ch); margin: 0; text-align: center; font: 500 var(--tui-t-body)/1.4 var(--tui-sans); color: var(--tui-ink); text-wrap: balance; overflow-wrap: anywhere; }
.tui-lightbox__said { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A finger on the picture carries it; letting go either turns the page or sets it back. */
.tui-lightbox__figure[data-drag] { transition: none; transform: translate(var(--lb-dx, 0px), var(--lb-dy, 0px)); opacity: var(--lb-op, 1); }

/* Paging: the new picture comes in from the side it was turned from. */
.tui-lightbox__figure[data-dir="next"] { animation: tui-lightbox-next 200ms var(--tui-ease); }
.tui-lightbox__figure[data-dir="prev"] { animation: tui-lightbox-prev 200ms var(--tui-ease); }
@keyframes tui-lightbox-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes tui-lightbox-prev { from { opacity: 0; transform: translateX(-28px); } }
.tui-lightbox[open] { animation: tui-lightbox-in 160ms var(--tui-ease); }
@keyframes tui-lightbox-in { from { opacity: 0; } }

/* Narrow: the keys go under the picture, either side of the caption's end, so it has the whole width. */
@container tui-lightbox (max-width: 640px) {
  .tui-lightbox__bar { padding: var(--tui-3) var(--tui-4) var(--tui-1); }
  .tui-lightbox__stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "fig fig" "prev next";
    gap: var(--tui-3) var(--tui-4);
    padding: 0 var(--tui-4) var(--tui-4);
  }
  .tui-lightbox__prev { justify-self: start; }
  .tui-lightbox__next { justify-self: end; }
}

/* A picture of the open viewer in a page (a docs cell): it sits in the flow at the size it is given. */
.tui-lightbox:not(dialog) {
  position: relative;
  inset: auto;
  width: 100%;
  height: var(--lb-h, 320px);
  border-radius: var(--tui-r-l);
  background: rgb(var(--tui-sh, 0 0 0));
  animation: none;
}

/* The page behind stands still while the viewer is open. */
:root:has(dialog.tui-lightbox[open]) { overflow: hidden; }

@media (pointer: coarse) {
  .tui-lightbox__close { --h: 44px; }
  .tui-lightbox__prev, .tui-lightbox__next { --h: 48px; }
  .tui-lightbox-grid { --lb-min: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-lightbox[open], .tui-lightbox__figure[data-dir] { animation: none; }
  .tui-lightbox__figure, .tui-lightbox-thumb { transition: none; }
}

/* ---------------------------------------------------------------- part: link */
/* Link: printed type that goes somewhere. No colour of its own: the words
   stay in ink and the rule under them is engraved, a dark line cut into the
   plate with the lamp catching its lower lip. Hover cuts it darker, a press
   cuts it deeper; a visited link is a step quieter. The rule is a border and
   a shadow, not a text-decoration, because a visited link may only change
   colours, and an engraved rule has to be able to change its colour alone. */
.tui-link {
  position: relative; /* holds the screen-reader note, so a scrolling ancestor clips it */
  color: var(--tui-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--tui-ink-3);
  border-radius: 1px;
  box-shadow: 0 1px 0 var(--tui-hl);
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: color 90ms var(--tui-ease), border-color 90ms var(--tui-ease);
}
.tui-link:hover, .tui-link.is-hover { border-bottom-color: var(--tui-ink); }
/* Pressed: the rule is cut deeper and the light moves down with it. */
.tui-link:active, .tui-link.is-down { border-bottom-width: 2px; border-bottom-color: var(--tui-ink); box-shadow: 0 1px 0 var(--tui-hl); color: var(--tui-ink); }
.tui-link:visited, .tui-link.is-visited { color: var(--tui-ink-2); border-bottom-color: var(--tui-rule); }
.tui-link:visited:hover, .tui-link.is-visited.is-hover { border-bottom-color: var(--tui-ink-2); }
.tui-link:focus-visible, .tui-link.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; border-radius: 2px; }
.tui-link:not([href]), .tui-link[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; border-bottom-color: var(--tui-rule); }

/* A link that leaves: a small arrow printed after it, drawn in the link's own ink. */
.tui-link--external::after, .tui-link[target="_blank"]::after {
  content: '';
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.28em;
  vertical-align: 0.05em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 7.5 7.5 2.5M3.4 2.5h4.1v4.1' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 7.5 7.5 2.5M3.4 2.5h4.1v4.1' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* The words for a screen reader: "(opens in a new tab)". */
.tui-link__note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* In a menu of places: no rule until you are on it, and the page you are on keeps its rule. */
.tui-link--nav { color: var(--tui-ink-2); font-weight: 500; border-bottom-color: transparent; box-shadow: none; }
.tui-link--nav:hover, .tui-link--nav.is-hover { color: var(--tui-ink); border-bottom-color: var(--tui-ink-3); box-shadow: 0 1px 0 var(--tui-hl); }
.tui-link--nav:active, .tui-link--nav.is-down { color: var(--tui-ink); border-bottom-color: var(--tui-ink); }
.tui-link--nav:visited { color: var(--tui-ink-2); border-bottom-color: transparent; }
.tui-link--nav[aria-current] { color: var(--tui-ink); border-bottom-color: var(--tui-ink); box-shadow: 0 1px 0 var(--tui-hl); }

/* Printed like the legend on a front panel: a footer's list of places, a caption's source. */
.tui-link--label {
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
  border-bottom-color: var(--tui-rule);
}
.tui-link--label:hover, .tui-link--label.is-hover { color: var(--tui-ink); border-bottom-color: var(--tui-ink-2); }
.tui-link--label:visited { color: var(--tui-ink-2); }

@media (pointer: coarse) {
  .tui-link--label::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
}

/* ---------------------------------------------------------------- part: liquid-segmented */
/* Liquid segmented control: the kit's .tui-seg (tray, native radios, labels) with one glass bead for the selection.
   liquid-segmented.mjs sets data-liquid on it: "glass" (a canvas draws the bead over the tray) or "frosted" (no WebGL2,
   reduced transparency or a lost context: a frosted CSS bead, same place, same springs). Either way the keys' own raised
   look is gone: the bead is the selection. Without the script the kit's control is untouched. */

.tui-liquid-seg { position: relative; touch-action: pan-y; }
/* Concentric: the bead and each segment are full pills (radius = half the segment height); the track's radius is that plus
   the gap between pill and track edge (the track's padding), in every size. */
.tui-seg.tui-liquid-seg { --seg-gap: 3px; padding: var(--seg-gap); gap: var(--seg-gap); border-radius: calc(var(--seg-h) / 2 + var(--seg-gap)); }
.tui-seg.tui-liquid-seg span { border-radius: calc(var(--seg-h) / 2); }
.tui-liquid-seg[data-liquid] > label { z-index: 1; }
.tui-liquid-seg[data-liquid] span,
.tui-liquid-seg[data-liquid] input:checked + span {
  background: none;
  box-shadow: none;
  filter: none;
  transition: color 120ms;
}
.tui-liquid-seg[data-liquid] span, .tui-liquid-seg[data-liquid] label:active input:not(:checked) + span, .tui-liquid-seg[data-liquid] input:checked + span { transform: none !important; }
.tui-liquid-seg[data-liquid] span::before { display: none; }
.tui-liquid-seg[data-liquid] input:checked + span { color: var(--tui-ink); }

/* The frosted bead (and the box the glass bead is measured from): placed by the script, under the labels' words. */
.tui-liquid-seg__bead { position: absolute; z-index: 0; border-radius: 999px; pointer-events: none; display: none; }
.tui-liquid-seg[data-liquid="frosted"] .tui-liquid-seg__bead {
  display: block;
  background: color-mix(in oklab, var(--tui-face-hi) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 var(--tui-hl), inset 0 0 0 1px color-mix(in oklab, var(--tui-ink) 8%, transparent), 0 2px 6px rgb(var(--tui-sh) / 0.25);
}
@media (prefers-reduced-transparency: reduce) {
  .tui-liquid-seg[data-liquid="frosted"] .tui-liquid-seg__bead { background: var(--tui-face-hi); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* The glass canvas: over the control and a little past it, never in the layout, never taking a press. */
.tui-liquid-seg > .tui-liquid__canvas { position: absolute; z-index: 2; max-width: none; margin: 0; pointer-events: none; }
.tui-liquid-seg > .tui-liquid__canvas[hidden] { display: none; }

/* ---------------------------------------------------------------- part: liquid-switch */
/* Liquid switch: the kit's switch, same 48 x 26 box, same checkbox. liquid-switch.mjs sets data-liquid on it:
   "glass" (a canvas lays a glass thumb over the track and the kit's own grip is hidden) or "frosted" (no WebGL2,
   reduced transparency, or a lost context: the grip stays and is frosted). Either way the thumb is placed by
   --tui-liquid-x (px from the off end), which the script moves with the finger and its spring. Without the script
   none of this applies and the kit's switch is untouched. */

.tui-liquid-switch[data-liquid]::after { transition: none; transform: translateX(var(--tui-liquid-x, 0px)); }
.tui-liquid-switch[data-liquid]:checked::after { transform: translateX(var(--tui-liquid-x, 16px)); }
.tui-liquid-switch[data-liquid]:active::after { scale: none; }
.tui-liquid-switch { touch-action: pan-y; }

.tui-liquid-switch[data-liquid="glass"]::after { opacity: 0; }

.tui-liquid-switch[data-liquid="frosted"]::after {
  background: color-mix(in oklab, var(--tui-face-hi) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 var(--tui-hl), inset 0 0 0 1px color-mix(in oklab, var(--tui-ink) 8%, transparent), 0 2px 6px rgb(var(--tui-sh) / 0.25);
}
@media (prefers-reduced-transparency: reduce) {
  .tui-liquid-switch[data-liquid]::after { background: var(--tui-face-hi); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* The glass canvas: over the switch and a little past it (the drop and the shadow), never in the layout, never taking a press. */
:where(:has(> .tui-liquid-switch)) { position: relative; } /* so the canvas is placed, and clipped, by the switch's own row or cell: inside a scroller it must not escape it */
.tui-liquid__canvas { position: absolute; max-width: none; margin: 0; pointer-events: none; }
.tui-liquid__canvas[hidden] { display: none; }

/* ---------------------------------------------------------------- part: list */
/* List: rows in a rack. Each row is printed on the plate — a mark, a title,
   a second line, a fact or a key at the end. Chosen rows sink into a recess
   with their check key latched; a row being moved lifts out of the rack on
   its skirt and slides past the others. kit/parts/list.mjs wires the
   selectable and reorderable kinds. */
.tui-list { display: grid; margin: 0; padding: 0; list-style: none; min-width: 0; }
.tui-list__row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--tui-3);
  min-height: 56px;
  padding: 8px 10px;
  border-radius: var(--tui-r-m);
}
.tui-list__row:has(> :nth-child(4)) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
/* Hairlines between rows, inset to the text, never under a lifted or chosen row. */
.tui-list__row + .tui-list__row::before { content: ''; position: absolute; top: 0; left: 10px; right: 10px; border-top: 1px solid var(--tui-rule); }
.tui-list__row:is([aria-selected="true"], .is-lifted, .is-down)::before, .tui-list__row:is([aria-selected="true"], .is-lifted, .is-down) + .tui-list__row::before { border-color: transparent; }
.tui-list__lead { display: grid; place-items: center; min-width: 24px; color: var(--tui-ink-2); }
.tui-list__lead svg { width: 18px; height: 18px; }
.tui-list__text { display: grid; gap: 2px; min-width: 0; }
.tui-list__title { font-weight: 600; color: var(--tui-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-list__sub { font-size: var(--tui-t-small); color: var(--tui-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-list__meta { font-size: var(--tui-t-small); color: var(--tui-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.tui-list__row > .tui-key { justify-self: end; }
/* A row that is a link: hover brightens it, nothing moves. */
a.tui-list__row { color: inherit; text-decoration: none; }
a.tui-list__row:hover, .tui-list__row.is-hover { background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }

/* Selectable: the list is one tab stop; the active row carries the ring; chosen rows sit in a recess. */
.tui-list[role="listbox"] { outline: none; }
.tui-list[role="listbox"] > [role="option"] { cursor: pointer; user-select: none; }
.tui-list[role="listbox"] > [role="option"]:hover { background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
.tui-list[role="listbox"]:focus-visible > .is-active, .tui-list__row.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-list__row[aria-selected="true"], .tui-list__row.is-down {
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
/* The check key at the lead: a small key that latches, with a tick printed on it. */
.tui-list__check {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
:is([aria-selected="true"], .is-down) > .tui-list__lead > .tui-list__check { transform: translateY(1.5px); box-shadow: var(--tui-pressed); }
:is([aria-selected="true"], .is-down) > .tui-list__lead > .tui-list__check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid var(--tui-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

/* Reorderable: a running order, numbered by position; a knurled grip at the end of each row. */
.tui-list--reorder { counter-reset: tui-list-row; }
.tui-list--reorder > .tui-list__row { counter-increment: tui-list-row; grid-template-columns: auto minmax(0, 1fr) auto auto; transition: transform 120ms var(--tui-ease), box-shadow 120ms var(--tui-ease); }
.tui-list__num::before { content: counter(tui-list-row, decimal-leading-zero); font: 600 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-list__grip {
  display: grid;
  place-items: center;
  width: 28px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  color: var(--tui-ink-2);
  /* Knurled ridges, like the grip of a slide switch. */
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgb(var(--tui-sh) / 0.28) 2px 3px, var(--tui-hl) 3px 4px) center / 12px 14px no-repeat;
}
.tui-list__grip:hover { background-color: color-mix(in oklab, var(--tui-face-hi) 60%, transparent); }
.tui-list__grip:focus-visible, .tui-list__grip.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
/* Lifted out of the rack: the row stands on a skirt, above the plate, while it moves. */
.tui-list__row.is-lifted {
  z-index: 1;
  background: var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 94%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 10px 18px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  transform: translateY(-2px);
}
.is-lifted .tui-list__grip { cursor: grabbing; }

.tui-list__live { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A finger needs 44px: the grip keeps its face and takes an invisible press area (kit/src/core.css, a fingertip's reach). */
@media (pointer: coarse) {
  .tui-list__grip { position: relative; }
  .tui-list__grip::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
}

/* ---------------------------------------------------------------- part: listbox */
/* Listbox: an always-open list let into the plate as a recess. The rows are
   printed on its floor; a chosen row is a cap pressed down into it, below the
   floor's top edge, with its lamp lit, so what is chosen is read by the cap
   and the lamp and never by colour. The row under the arrow keys carries the
   focus ring. Until the script runs it is a native <select size> in the same
   recess, which already is a listbox. Several choices make the lamps green,
   one makes it amber, as the combobox's options do. */
tui-listbox { --rows: 6; position: relative; display: block; min-width: 0; }
tui-listbox[data-disabled] { opacity: 0.45; cursor: not-allowed; }

/* The list before the script: the kit's select, opened out into its recess. */
tui-listbox > select[size], tui-listbox > select[multiple] {
  height: auto;
  min-height: 96px;
  padding: 4px;
  border-radius: calc(var(--tui-r-m) + 4px);
  background: var(--tui-well-fill) var(--tui-well);
  cursor: default;
}
tui-listbox > select option { padding: 7px 10px; border-radius: var(--tui-r-m); }

.tui-listbox__list {
  display: grid;
  align-content: start;
  gap: 1px;
  max-height: calc(var(--rows) * 36px + 9px);
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-radius: calc(var(--tui-r-m) + 4px);
  font: 400 var(--tui-t-body)/1.25 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  outline: none;
}
.tui-listbox__list:focus-visible, tui-listbox.is-focus .tui-listbox__list { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] .tui-listbox__list { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

.tui-listbox__list [role="group"] { display: grid; gap: 1px; }
.tui-listbox__list [role="group"] + [role="group"] { margin-top: 3px; padding-top: 3px; border-top: 1px solid var(--tui-rule); }
.tui-listbox__heading { padding: 8px 10px 5px 33px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }

.tui-listbox__option {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 36px;
  padding: 0 10px 0 9px;
  border-radius: var(--tui-r-m);
  font-weight: 500;
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* The lamp: dark until the row is chosen. */
.tui-listbox__option::before {
  --c: var(--tui-amber);
  content: '';
  justify-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 25%, transparent), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 0 1px 0 var(--tui-hl);
}
[aria-multiselectable="true"] > .tui-listbox__option::before, [aria-multiselectable="true"] .tui-listbox__option::before { --c: var(--tui-green); }
.tui-listbox__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-listbox__hint { font: 400 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }
.tui-listbox__option:hover, .tui-listbox__option.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 40%, transparent); }

/* Chosen: a cap let down into the floor, the plate's edge shading its top. */
.tui-listbox__option[aria-selected="true"], .tui-listbox__option.is-down {
  color: var(--tui-ink);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-pressed);
  filter: brightness(0.97);
}
.tui-listbox__option[aria-selected="true"]::before, .tui-listbox__option.is-down::before { color: var(--c); background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c); box-shadow: var(--tui-glow); }
.tui-listbox__option[aria-selected="true"] .tui-listbox__text { font-weight: 600; }
/* Under the arrow keys: the focus ring is on the row while the list holds the focus. */
.tui-listbox__list:focus-visible > .is-active, .tui-listbox__list:focus-visible [role="group"] > .is-active, .tui-listbox__option.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-listbox__option[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-listbox__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-listbox__option[aria-selected="true"], .tui-listbox__option.is-down { filter: none; background: var(--tui-quiet-key-down); }
}

@media (pointer: coarse) {
  .tui-listbox__list { max-height: calc(var(--rows) * 44px + 9px); }
  .tui-listbox__option { min-height: 44px; }
  tui-listbox > select option { padding: 11px 10px; font-size: 16px; }
}

/* ---------------------------------------------------------------- part: loading-overlay */
/* Loading overlay: a pane of smoked glass laid over a panel while it works. The
   panel underneath keeps every pixel of its place (the glass is on top, not
   instead), dimmed and a little out of focus, with one plate in the middle
   carrying a spinner and a line of words. Set aria-busy="true" on the panel to
   lower it; the content underneath goes inert so a key or a Tab cannot reach it
   (kit.mjs does that, or set `inert` on .tui-loading__content yourself). The
   glass is only drawn while the panel is busy and takes no space when it is not. */
.tui-loading { position: relative; isolation: isolate; }
.tui-loading__pane {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: var(--tui-4);
  border-radius: inherit;
  background:
    linear-gradient(160deg, color-mix(in oklab, white 9%, transparent), transparent 42%),
    rgb(var(--tui-sh) / 0.55);
  box-shadow: inset 0 1px 0 color-mix(in oklab, white 16%, transparent);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms var(--tui-ease), visibility 0s linear 160ms;
}
/* The glass is laid over the whole panel, its trims too: they are borders, outside the box the pane is placed in. */
:is(.tui-panel, .tui-result) > .tui-loading__pane { inset: 0 calc(var(--tui-trim-w, 0px) * -1); }
.tui-loading[aria-busy="true"] > .tui-loading__pane { opacity: 1; visibility: visible; transition-delay: 0s; }
/* A pane nobody can see runs nothing. */
.tui-loading:not([aria-busy="true"]) .tui-spinner__ring > i::after { animation-play-state: paused; }

/* The plate on the glass: ordinary face, ordinary ink, so the words read as they do anywhere else. */
.tui-loading__plate {
  display: inline-flex;
  align-items: center;
  gap: var(--tui-3);
  max-width: 100%;
  padding: 10px var(--tui-4);
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1.35 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 16px 32px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2))),
    /* A plate on dark glass is seen by its edge, in every finish: a ring in the ink, 3:1 against the glass. */
    0 0 0 1px color-mix(in oklab, var(--tui-ink) 55%, transparent);
}
.tui-loading__plate:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-loading__text { min-width: 0; overflow-wrap: anywhere; }

/* What is underneath is seen, not used: nothing in it answers a press until the glass is lifted. */
.tui-loading[aria-busy="true"] > .tui-loading__content { user-select: none; }

@media (prefers-reduced-transparency: reduce) {
  .tui-loading__pane { background: color-mix(in oklab, var(--tui-face) 86%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* While the page is moving, the glass shows what is under it without the blur;
   popover.mjs's one page-level scroll listener takes data-scrolling off again
   about 150ms after the last scroll. Reduced motion keeps it: it removes an
   effect. */
[data-scrolling] .tui-loading__pane { -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (prefers-reduced-motion: reduce) {
  .tui-loading__pane { transition: none; }
}

/* ---------------------------------------------------------------- part: log-pad */
/* Log pad: a writing pad that is still a real textarea. A sheet of paper set
   into a machined frame, ruled with a margin. The rules are the textarea's own
   background, attached to its scrolling content and locked to its line height,
   so they move with the words instead of staying behind them. A small LCD in
   the foot counts what has been written, and lights amber near the limit and
   red over it. Corners are concentric: a 6px frame round a 6px sheet makes the
   12px plate. See log-pad.mjs. */
tui-log-pad, .tui-log-pad { --lp-lh: 28px; display: grid; gap: 6px; min-width: 0; }
.tui-log-pad__label { padding-left: 2px; }

.tui-log-pad__pad {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 6px;
  padding: 6px;
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-log-pad__pad::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, rgb(255 255 255 / 0.06), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}
/* The frame carries the focus ring: the sheet is inside it. */
.tui-log-pad__pad:has(.tui-log-pad__text:is(:focus-visible, .is-focus)) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* The sheet. Three backgrounds: the margin (fixed to the box), the rules (attached to the text, one every line), and the paper. */
.tui-log-pad__text {
  --rule: color-mix(in oklab, var(--tui-paper-ink) 13%, transparent);
  --margin: color-mix(in oklab, var(--tui-paper-ink) 26%, transparent);
  display: block;
  width: 100%;
  min-height: calc(var(--lp-lh) * 3);
  margin: 0;
  padding: 0 16px 0 54px;
  border: 0;
  border-radius: 6px;
  outline: none;
  resize: none;
  font: 400 14px/var(--lp-lh) var(--tui-sans);
  color: var(--tui-paper-ink);
  caret-color: var(--tui-paper-ink);
  background:
    linear-gradient(90deg, transparent 40px, var(--margin) 40px 41px, transparent 41px 44px, var(--margin) 44px 45px, transparent 45px) 0 0 / 100% 100% no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--lp-lh) - 1px), var(--rule) calc(var(--lp-lh) - 1px) var(--lp-lh)),
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  background-attachment: scroll, local, scroll;
  box-shadow: var(--tui-depth-well, inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)), inset 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.4)));
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--tui-paper-ink) 35%, transparent) transparent;
}
.tui-log-pad__text::placeholder { color: var(--tui-paper-ink-2); }
.tui-log-pad__text:disabled { opacity: 0.55; cursor: not-allowed; }

/* The foot: what the limit is, in print, and where the writer is against it, in light. */
.tui-log-pad__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-3); min-height: 30px; padding: 0 2px 0 8px; }
.tui-log-pad__limit { font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-log-pad__meter { flex: none; font-size: 15px; transition: background-color 160ms var(--tui-ease), box-shadow 160ms var(--tui-ease); }
/* Near the limit the glass is backlit amber; over it, red. The digits stay dark on both. */
.tui-log-pad__meter[data-state="warn"] {
  background: linear-gradient(170deg, rgb(255 255 255 / 0.22), transparent 40%), color-mix(in oklab, var(--tui-amber) 88%, var(--tui-lcd));
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 0 var(--tui-hl), 0 0 12px -2px color-mix(in oklab, var(--tui-amber) 65%, transparent);
}
.tui-log-pad__meter[data-state="over"] {
  background: linear-gradient(170deg, rgb(255 255 255 / 0.22), transparent 40%), color-mix(in oklab, var(--tui-red) 66%, var(--tui-lcd));
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.25), inset 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 0 var(--tui-hl), 0 0 12px -2px color-mix(in oklab, var(--tui-red) 65%, transparent);
}

/* Spoken, not seen: the sentence when the limit is crossed. */
.tui-log-pad__say { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
tui-log-pad { position: relative; }

@media (prefers-reduced-motion: reduce) { .tui-log-pad__meter { transition: none; } }

/* ---------------------------------------------------------------- part: log-stream */
/* Log stream: a live log printed on a strip of paper tape. Over the tape a
   head names the log, says whether it is following the newest line (a green
   lamp and Following, or an amber lamp and Paused with the count of lines
   that have come since) and offers Jump to latest; under it a filter well
   (the search field, and the four levels as chips). The tape is thermal paper
   in every finish, sprocket holes down both edges, slipping under the edge of
   the window it is read through. Each line is a time, a printed legend for its
   level and its words: debug is a dashed plate, info a plain one, warn a
   double-ruled one and error a filled one, so a level is told by its shape and
   its word, never by colour. The paper is the chat's slip and the legends are
   ink; only the lamp is colour. */
tui-log-stream { display: block; min-width: 0; }
.tui-log-stream { --ls-h: 280px; position: relative; display: grid; gap: var(--tui-3); container-type: inline-size; }

.tui-log-stream__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-4); min-height: 28px; }
.tui-log-stream__title { flex: 1 1 10ch; min-width: 0; margin: 0; }
.tui-log-stream__follow { flex: none; }
.tui-log-stream__words { font-variant-numeric: tabular-nums; }
.tui-log-stream__count { flex: none; font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-log-stream__latest { flex: none; }

.tui-log-stream__filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-3); }
.tui-log-stream__filter > tui-search-field { flex: 1 1 200px; }

/* The tape, read through a window: the paper slides under its upper edge and out below it. */
.tui-log-stream__tape {
  --tui-ink: var(--tui-paper-ink);
  --tui-ink-2: var(--tui-paper-ink-2);
  --tui-rule: color-mix(in srgb, var(--tui-paper-ink) 20%, transparent);
  --ls-hole: var(--tui-vfd-bg);
  position: relative;
  height: var(--ls-h);
  padding: 8px 0 10px;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--tui-r-m);
  font: 400 var(--tui-t-small)/1.5 var(--tui-sans);
  color: var(--tui-paper-ink);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--tui-paper-ink) 40%, transparent) transparent;
  background:
    radial-gradient(circle at 13px 11px, var(--ls-hole) 0 2.7px, transparent 3.1px) 0 0 / 26px 22px repeat-y local,
    radial-gradient(circle at 13px 11px, var(--ls-hole) 0 2.7px, transparent 3.1px) 100% 0 / 26px 22px repeat-y local,
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  box-shadow: var(--tui-depth-well, inset 0 6px 8px -4px rgb(0 0 0 / 0.55), inset 0 -6px 8px -5px rgb(0 0 0 / 0.35), 0 1px 0 var(--tui-hl));
}
/* The ring is drawn on the page around the paper, so it is the page's own. */
.tui-log-stream__tape:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

.tui-log-stream__line { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; column-gap: var(--tui-3); padding: 2px 34px 2px 34px; }
.tui-log-stream__line[hidden] { display: none; }
.tui-log-stream__time { font: 500 11.5px/1.5 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-log-stream__text { min-width: 0; font: 400 12px/1.5 var(--tui-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--tui-ink); }
/* The level legend: a printed plate, told apart by its shape and its word. */
.tui-log-stream__level { min-width: 6ch; padding: 3px 5px 2px; border: 1px solid var(--tui-ink-2); border-radius: 3px; font: 600 9.5px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-align: center; text-transform: uppercase; color: var(--tui-ink-2); }
.tui-log-stream__line[data-level="debug"] .tui-log-stream__level { border-style: dashed; border-color: var(--tui-ink-2); }
.tui-log-stream__line[data-level="info"] .tui-log-stream__level { border-color: var(--tui-ink); color: var(--tui-ink); }
.tui-log-stream__line[data-level="warn"] .tui-log-stream__level { border: 3px double var(--tui-ink); padding: 1px 3px 0; color: var(--tui-ink); }
.tui-log-stream__line[data-level="error"] .tui-log-stream__level { border-color: var(--tui-ink); background: var(--tui-ink); color: var(--tui-paper); }
.tui-log-stream__line[data-level="warn"] .tui-log-stream__text, .tui-log-stream__line[data-level="error"] .tui-log-stream__text { font-weight: 600; }
.tui-log-stream__line[data-level="debug"] .tui-log-stream__text { color: var(--tui-ink-2); }
/* Said aloud, never seen. */
.tui-log-stream__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@container (max-width: 480px) {
  .tui-log-stream__line { grid-template-columns: auto minmax(0, 1fr); row-gap: 1px; padding-inline: 32px 30px; }
  .tui-log-stream__line > .tui-log-stream__text { grid-column: 1 / -1; }
  .tui-log-stream__level { justify-self: start; }
}
@media (pointer: coarse) {
  .tui-log-stream__latest { --h: 44px; }
  .tui-log-stream__line { padding-block: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-log-stream .tui-key { transition: none; }
}
@media (forced-colors: active) {
  .tui-log-stream__tape { background: Canvas; border: 1px solid CanvasText; }
  .tui-log-stream__line[data-level="error"] .tui-log-stream__level { forced-color-adjust: none; background: CanvasText; color: Canvas; }
}

/* ---------------------------------------------------------------- part: loupe-scroll */
/* Loupe scroll: a scroll area whose scrollbar is a map of what it holds.
   Beside the text runs a narrow rail, a groove cut into the plate, with the
   content drawn small on its floor: each line of text a bar as long as the
   line, headings darker and heavier, code and pictures as boxes. A glass
   loupe rides over the part in view and shows it a little magnified. The
   scrolling underneath is the browser's own. See loupe-scroll.mjs.
   Corners are concentric: a 5px loupe 3px inside the 8px rail. */
tui-loupe-scroll {
  --ls-rail: 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ls-rail);
  gap: 14px;
  min-width: 0;
  height: 360px;
}
/* With no script: one plain region that scrolls. */
tui-loupe-scroll:not(:defined) { display: block; overflow: auto; }

.tui-loupe-scroll__view {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 6px;
  outline: none;
}
.tui-loupe-scroll__view::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) { .tui-loupe-scroll__view { scroll-behavior: smooth; } }
[data-dragging] .tui-loupe-scroll__view { scroll-behavior: auto; }
.tui-loupe-scroll__view:focus-visible, .tui-loupe-scroll__view.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* The page: plain reading, set on the kit's type. */
.tui-loupe-scroll__page { position: relative; padding: 2px 6px 24px 2px; color: var(--tui-ink); }
.tui-loupe-scroll__page > :first-child { margin-top: 0; }
.tui-loupe-scroll__page :is(h2, h3, h4) { margin: 1.6em 0 0.5em; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; color: var(--tui-ink); }
.tui-loupe-scroll__page h2 { font-size: var(--tui-t-h3); }
.tui-loupe-scroll__page h3 { font-size: var(--tui-t-lead); }
.tui-loupe-scroll__page h4 { font-size: var(--tui-t-body); }
.tui-loupe-scroll__page :is(p, ul, ol) { margin: 0 0 0.9em; line-height: 1.6; max-width: 62ch; }
.tui-loupe-scroll__page :is(ul, ol) { padding-left: 1.3em; }
.tui-loupe-scroll__page li + li { margin-top: 0.25em; }
.tui-loupe-scroll__page code { font: 500 0.92em/1 var(--tui-mono); }
.tui-loupe-scroll__page pre {
  margin: 0 0 1em;
  padding: 10px 12px;
  overflow-x: auto;
  border-radius: var(--tui-r-m);
  font: 500 12px/1.55 var(--tui-mono);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}

/* ------------------------------------------------------------------ the rail */
.tui-loupe-scroll__rail {
  position: relative;
  min-height: 0;
  border-radius: 8px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.tui-loupe-scroll__map { position: absolute; inset: 8px 7px; overflow: hidden; pointer-events: none; }
/* A line of text: a bar as long as the line, faint, like print seen from arm's length. */
.tui-loupe-scroll__bar {
  position: absolute;
  border-radius: 1px;
  background: color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 30%, transparent);
}
.tui-loupe-scroll__bar[data-kind="head"] { background: color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 82%, transparent); border-radius: 1.5px; }
.tui-loupe-scroll__bar[data-kind="code"] { background: color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 9%, transparent); box-shadow: inset 0 0 0 0.5px color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 22%, transparent); border-radius: 2px; }
.tui-loupe-scroll__bar[data-kind="code-line"] { background: color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 22%, transparent); }
.tui-loupe-scroll__bar[data-kind="media"] {
  background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 16%, transparent) 0 1px, transparent 1px 3px), color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 8%, transparent);
  border-radius: 2px;
}

/* The loupe: a slip of glass over the part in view. Its edge catches the lamp; what is under it is magnified. */
.tui-loupe-scroll__loupe {
  position: absolute;
  top: 8px;
  left: 3px;
  right: 3px;
  height: 40px;
  border-radius: 5px;
  cursor: grab;
  touch-action: none;
  box-shadow:
    var(--tui-depth-plate, 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 2px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 6px 12px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)));
}
/* Held: lifted a touch off the rail, its shadow longer. */
[data-dragging] .tui-loupe-scroll__loupe, .tui-loupe-scroll__loupe.is-down {
  cursor: grabbing;
  box-shadow:
    var(--tui-depth-float, 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3)),
    0 4px 5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 10px 18px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)));
}
.tui-loupe-scroll__lens {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(color-mix(in oklab, var(--tui-face-hi) 92%, var(--tui-well)), var(--tui-face-hi));
}
.tui-loupe-scroll__map--lens { inset: auto; top: 0; left: 4px; width: calc(100% - 8px); height: auto; overflow: visible; transform-origin: 0 0; }
.tui-loupe-scroll__map--lens .tui-loupe-scroll__bar[data-kind="text"] { background: color-mix(in oklab, var(--ls-ink, var(--tui-ink)) 44%, transparent); }
/* The glass itself: a lit bevel round the edge, a sheen across the top, the thickness at the bottom. */
.tui-loupe-scroll__loupe::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(172deg, rgb(255 255 255 / 0.42), rgb(255 255 255 / 0.08) 38%, transparent 60%, rgb(0 0 0 / 0.06));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.85),
    inset 0 0 0 1px rgb(255 255 255 / 0.35),
    inset 0 -2px 3px -1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)),
    inset 3px 0 4px -3px rgb(var(--tui-sh) / 0.3),
    inset -3px 0 4px -3px rgb(var(--tui-sh) / 0.3);
}
.tui-loupe-scroll__loupe.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

@media (max-width: 480px) { tui-loupe-scroll { --ls-rail: 48px; gap: 10px; } }

/* ---------------------------------------------------------------- part: louvre-light */
/* Louvre light: a wall lit from the side, with the shadows of slats across it,
   as light through blinds. The wall and its light are painted once. The slats
   are one oversized gradient layer, turned and skewed to lie along the light,
   and it drifts across the wall by translate alone, slowly, back and forth.
   Their soft edges are stops in the gradient, so nothing is blurred. */
.tui-backdrop--louvre-light {
  --bd-lit: light-dark(color-mix(in srgb, white 70%, transparent), color-mix(in srgb, var(--tui-ink) 7%, transparent));
  --bd-slat: light-dark(color-mix(in srgb, var(--tui-ink) 15%, transparent), rgb(0 0 0 / 0.42));
  --bd-soft: light-dark(color-mix(in srgb, var(--tui-ink) 7%, transparent), rgb(0 0 0 / 0.2));
  background: linear-gradient(180deg, var(--tui-face), color-mix(in srgb, var(--tui-face), var(--tui-desk)));
}
.tui-backdrop--louvre-light::before {
  inset: 0;
  background: linear-gradient(105deg, transparent 8%, var(--bd-lit) 40%, transparent 92%);
}
.tui-backdrop--louvre-light::after {
  inset: -60%; /* room for the skew and the drift on a tall, narrow section: no edge of the slats can come into view */
  background: repeating-linear-gradient(180deg, transparent 0 30px, var(--bd-soft) 38px, var(--bd-slat) 46px 74px, var(--bd-soft) 82px, transparent 90px 118px);
  transform: rotate(-9deg) skewX(-14deg);
}
@media (prefers-reduced-motion: no-preference) {
  .tui-backdrop--louvre-light::after { will-change: transform; animation: tui-louvre 30s ease-in-out infinite alternate; }
}
@keyframes tui-louvre { from { translate: -6% 0; } to { translate: 6% 0; } }

/* ---------------------------------------------------------------- part: material */
/*
 * Materials: what the moving parts are made of, set apart from the room.
 *
 * data-material on a key, knob, fader or switch, or on a container whose
 * parts all take it (a whole device), with one of eight values:
 *
 *   aluminium       spun and bead-blasted, today's light parts
 *   graphite        anodised dark grey with a diamond-cut chamfer
 *   porcelain       glazed: cool white, a sharp window of light, no grain
 *   black-anodised  satin black over metal; the cut edge is bare aluminium
 *   titanium        bead-blasted: warmer and darker, one broad soft light
 *   bakelite        moulded phenolic, walnut brown and glossy, cream printing
 *   anodised-blue   dye under a clear oxide; a cut edge shows bare metal
 *   anodised-green  the same process in a deep green
 *
 * It changes the moving parts only: key caps and skirts, knob bodies and
 * caps, fader and switch thumbs, the rocker's lever. The panel, the desk and
 * the printing around the parts stay the page's finish: data-finish (and its
 * tone) is the room, data-material the device in it. The nearest
 * data-material wins, so one knob can differ from the device around it.
 *
 * Anodised blue and green colour a whole device, never one key or knob on
 * its own (kit/brain/tools/verify.mjs flags a lone one).
 *
 * Each material is a block of --mat-* tokens. The parts read them in the
 * @scope below, which wins over a finish that draws the same part its own
 * way (porcelain, black, paper, phosphor) because it is nearer the part.
 * Every rule here matches one of the eight values and what is inside it;
 * any other value of data-material is someone else's and is left alone.
 */

/* What only some materials draw their own way, unset on every one first, so a
   part with a material inside a device of another never takes the device's. */
:is([data-material="aluminium"], [data-material="graphite"], [data-material="porcelain"], [data-material="black-anodised"], [data-material="titanium"], [data-material="bakelite"], [data-material="anodised-blue"], [data-material="anodised-green"]) {
  --mat-light: initial; --mat-knurl: initial; --mat-knob-sheen: initial; --mat-knob-face: initial;
}

[data-material="aluminium"] {
  --mat-face: #f2f2ef; --mat-face-lo: #cbccc8; --mat-skirt: #a4a5a1;
  --mat-hl: rgb(255 255 255 / 0.9); --mat-sheen: rgb(255 255 255 / 0.9);
  --mat-ink: #1b1c1e; --mat-red-ink: #a8281a;
  --mat-cap: #1e1f21; --mat-cap-hi: #2d2e31; --mat-cap-skirt: #070708; --mat-cap-ink: #efede8; --mat-cap-hl: rgb(255 255 255 / 0.14);
  --mat-knob-hi: #fafaf8; --mat-knob-mid: #d9dad6; --mat-knob-lo: #a9aaa6;
  --mat-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.6), inset 0 -1px 2px rgb(0 0 0 / 0.3), 0 1px 2px rgb(0 0 0 / 0.35);
  --mat-rim-hi: rgb(255 255 255 / 0.75); --mat-rim-lo: rgb(24 25 28 / 0.55);
}

[data-material="graphite"] {
  --mat-face: #28292c; --mat-face-lo: #141516; --mat-skirt: #09090a;
  --mat-hl: rgb(255 255 255 / 0.16); --mat-sheen: rgb(255 255 255 / 0.11);
  --mat-ink: #e8e6e1; --mat-red-ink: #ff6b5a;
  --mat-cap: #e9e7e2; --mat-cap-hi: #f6f4ef; --mat-cap-skirt: #a8a7a3; --mat-cap-ink: #17181a; --mat-cap-hl: rgb(255 255 255 / 0.8);
  --mat-knob-hi: #5a5b5f; --mat-knob-mid: #2c2d30; --mat-knob-lo: #141517;
  --mat-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.2), inset 0 -1px 2px rgb(0 0 0 / 0.5), 0 1px 2px rgb(0 0 0 / 0.6);
  --mat-rim-hi: rgb(214 217 222 / 0.5); --mat-rim-lo: rgb(0 0 0 / 0.6);
}

[data-material="porcelain"] {
  --mat-face: #ffffff; --mat-face-lo: #e1e4e7; --mat-skirt: #b7bdc4;
  --mat-hl: #ffffff; --mat-sheen: #ffffff;
  --mat-ink: #15171a; --mat-red-ink: #a3241a;
  --mat-cap: #121316; --mat-cap-hi: #2e3034; --mat-cap-skirt: #000; --mat-cap-ink: #f6f7f7; --mat-cap-hl: rgb(255 255 255 / 0.35);
  --mat-knob-hi: #ffffff; --mat-knob-mid: #eceef1; --mat-knob-lo: #b1b8c0;
  --mat-knob-cap-shadow: inset 0 1px 1px #fff, inset 0 -2px 3px rgb(40 52 72 / 0.25), 0 1px 2px rgb(40 52 72 / 0.35);
  --mat-rim-hi: #ffffff; --mat-rim-lo: rgb(40 52 72 / 0.62);
  /* Glazed: a sharp window of the lamp, rounded flutes, a domed face. */
  --mat-light: radial-gradient(38% 42% at 24% 16%, rgb(255 255 255 / 0.9) 0 40%, transparent 100%);
  --mat-knurl: repeating-conic-gradient(from 0deg, rgb(40 52 72 / 0.18) 0 4deg, rgb(255 255 255 / 0.55) 4deg 6deg, transparent 6deg 12deg);
  --mat-knob-sheen: linear-gradient(150deg, rgb(255 255 255 / 0.75), transparent 45%, transparent 60%, rgb(40 52 72 / 0.24));
  --mat-knob-face: radial-gradient(34% 30% at 32% 26%, #fff 0 50%, transparent 100%), radial-gradient(circle at 50% 42%, #fdfdfd, #e4e8eb 68%, #cdd3d9);
}

[data-material="black-anodised"] {
  --mat-face: #1a1a1c; --mat-face-lo: #060607; --mat-skirt: #000;
  --mat-hl: rgb(255 255 255 / 0.42); --mat-sheen: rgb(255 255 255 / 0.07);
  --mat-ink: #e6e4df; --mat-red-ink: #ff7262;
  --mat-cap: #c3c5c7; --mat-cap-hi: #dcdee0; --mat-cap-skirt: #66686b; --mat-cap-ink: #0b0c0d; --mat-cap-hl: rgb(255 255 255 / 0.9);
  --mat-knob-hi: #6a6c70; --mat-knob-mid: #1f2023; --mat-knob-lo: #08080a;
  --mat-knob-cap-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12), inset 0 1px 0.5px rgb(255 255 255 / 0.5), inset 0 -1px 2px rgb(0 0 0 / 0.7), 0 1px 2px rgb(0 0 0 / 0.9);
  --mat-rim-hi: rgb(207 211 217 / 0.55); --mat-rim-lo: rgb(0 0 0 / 0.7);
  /* Satin: the knurl is cut through the anodising to bright metal at every ridge. */
  --mat-knurl: repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.45) 0 2.2deg, rgb(255 255 255 / 0.6) 2.2deg 3deg, transparent 3deg 6deg);
  --mat-knob-sheen: linear-gradient(150deg, rgb(255 255 255 / 0.32), transparent 40%, transparent 60%, rgb(0 0 0 / 0.5));
}

[data-material="titanium"] {
  --mat-face: #a29e96; --mat-face-lo: #7a766f; --mat-skirt: #5c5852;
  --mat-hl: rgb(255 255 255 / 0.45); --mat-sheen: rgb(255 255 255 / 0.3);
  --mat-ink: #161513; --mat-red-ink: #5e0f08;
  --mat-cap: #1c1b19; --mat-cap-hi: #2c2b28; --mat-cap-skirt: #060605; --mat-cap-ink: #ece9e2; --mat-cap-hl: rgb(255 255 255 / 0.14);
  --mat-knob-hi: #c6c1b8; --mat-knob-mid: #8f8b84; --mat-knob-lo: #4c4944;
  --mat-knob-cap-shadow: inset 0 1px 1px rgb(255 255 255 / 0.4), inset 0 -1px 2px rgb(0 0 0 / 0.35), 0 1px 2px rgb(0 0 0 / 0.4);
  --mat-rim-hi: rgb(255 255 255 / 0.55); --mat-rim-lo: rgb(22 21 19 / 0.6);
  /* Bead-blasted: no spun band, one broad soft light, and a speckle in it. */
  --mat-grit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.28 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --mat-light: var(--mat-grit), radial-gradient(120% 100% at 30% 0%, rgb(255 255 255 / 0.3), transparent 70%);
  --mat-knurl: repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.26) 0 2.2deg, rgb(255 255 255 / 0.22) 2.2deg 3deg, transparent 3deg 6deg);
  --mat-knob-face: var(--mat-grit), radial-gradient(circle at 40% 35%, var(--mat-knob-hi), var(--mat-knob-mid) 60%, var(--mat-knob-lo));
}

[data-material="bakelite"] {
  --mat-face: #4b2c19; --mat-face-lo: #2a160b; --mat-skirt: #150903;
  --mat-hl: rgb(255 240 220 / 0.55); --mat-sheen: rgb(255 240 220 / 0.35);
  --mat-ink: #eadcbf; --mat-red-ink: #ff8f7d;
  --mat-cap: #eadcbf; --mat-cap-hi: #f5ecda; --mat-cap-skirt: #9a8565; --mat-cap-ink: #2a160b; --mat-cap-hl: rgb(255 255 255 / 0.8);
  --mat-knob-hi: #8c5c3c; --mat-knob-mid: #4b2c19; --mat-knob-lo: #1a0c05;
  --mat-knob-cap-shadow: inset 0 1px 1px rgb(255 236 214 / 0.35), inset 0 -1px 2px rgb(0 0 0 / 0.5), 0 1px 2px rgb(0 0 0 / 0.5);
  --mat-rim-hi: rgb(255 228 200 / 0.5); --mat-rim-lo: rgb(26 12 5 / 0.7);
  /* Glossy as it leaves the mould: a window of light, rounded flutes, a domed face. */
  --mat-light: radial-gradient(38% 42% at 24% 16%, rgb(255 240 220 / 0.5) 0 40%, transparent 100%);
  --mat-knurl: repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.35) 0 4deg, rgb(255 230 200 / 0.22) 4deg 6deg, transparent 6deg 12deg);
  --mat-knob-sheen: linear-gradient(150deg, rgb(255 240 220 / 0.4), transparent 45%, transparent 60%, rgb(0 0 0 / 0.4));
  --mat-knob-face: radial-gradient(34% 30% at 32% 26%, rgb(255 240 220 / 0.55) 0 45%, transparent 100%), radial-gradient(circle at 50% 42%, var(--mat-knob-hi), var(--mat-knob-mid) 62%, var(--mat-knob-lo));
}

/* Anodised: the dye under a clear oxide. The contrast key is the one part left bare aluminium. */
[data-material="anodised-blue"] {
  --mat-face: #33578a; --mat-face-lo: #203e68; --mat-skirt: #0f203a;
  --mat-hl: rgb(255 255 255 / 0.4); --mat-sheen: rgb(255 255 255 / 0.16);
  --mat-ink: #f2efe8; --mat-red-ink: #ffc4bb;
  --mat-knob-hi: #93add3; --mat-knob-mid: #2c4d7a; --mat-knob-lo: #0c1a30;
  --mat-rim-lo: rgb(4 10 22 / 0.7);
}

[data-material="anodised-green"] {
  --mat-face: #44664f; --mat-face-lo: #2c4838; --mat-skirt: #0e2016;
  --mat-hl: rgb(255 255 255 / 0.4); --mat-sheen: rgb(255 255 255 / 0.16);
  --mat-ink: #f2efe8; --mat-red-ink: #ffdbd3;
  --mat-knob-hi: #a1bdaa; --mat-knob-mid: #3c5b48; --mat-knob-lo: #10221a;
  --mat-rim-lo: rgb(4 16 9 / 0.7);
}

:is([data-material="anodised-blue"], [data-material="anodised-green"]) {
  --mat-cap: #c3c5c7; --mat-cap-hi: #dcdee0; --mat-cap-skirt: #66686b; --mat-cap-ink: #0b0c0d; --mat-cap-hl: rgb(255 255 255 / 0.9);
  --mat-knob-cap-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14), inset 0 1px 0.5px rgb(255 255 255 / 0.5), inset 0 -1px 2px rgb(0 0 0 / 0.6), 0 1px 2px rgb(0 0 0 / 0.8);
  --mat-rim-hi: rgb(205 211 218 / 0.7);
  --mat-knurl: repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.4) 0 2.2deg, rgb(225 230 236 / 0.55) 2.2deg 3deg, transparent 3deg 6deg);
}

@scope ([data-material="aluminium"], [data-material="graphite"], [data-material="porcelain"], [data-material="black-anodised"], [data-material="titanium"], [data-material="bakelite"], [data-material="anodised-blue"], [data-material="anodised-green"]) {
  /* Keys: the cap, its skirt and its printing, as tokens, so every key, its
     states and the Quiet volume draw themselves in the material. A flat key
     has no cap: it stays printing on the plate. */
  :is(:scope, :scope *).tui-key:not(.tui-key--flat) {
    --tui-face-hi: var(--mat-face);
    --tui-face-lo: var(--mat-face-lo);
    --tui-skirt: var(--mat-skirt);
    --tui-hl: var(--mat-hl);
    --tui-sheen: var(--mat-sheen);
    --tui-ink: var(--mat-ink);
    --tui-red-ink: var(--mat-red-ink);
    --tui-cap: var(--mat-cap);
    --tui-cap-hi: var(--mat-cap-hi);
    --tui-cap-skirt: var(--mat-cap-skirt);
    --tui-cap-ink: var(--mat-cap-ink);
    --tui-cap-hl: var(--mat-cap-hl);
    --tui-quiet-key: var(--mat-face);
    --tui-quiet-key-hover: color-mix(in oklab, var(--mat-face) 94%, #fff);
    --tui-quiet-key-down: color-mix(in oklab, var(--mat-face) 92%, #000);
    --tui-quiet-cap-hover: color-mix(in oklab, var(--mat-cap) 92%, #fff);
    --tui-quiet-cap-down: color-mix(in oklab, var(--mat-cap) 88%, #000);
    /* The volume's depth, worked out on the key itself, so it is the material's and not the room's drawing. */
    --tui-depth-key: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-line), var(--tui-quiet-whisper);
    --tui-depth-key-hover: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 0 0 1px var(--tui-quiet-line-2), var(--tui-quiet-whisper);
    --tui-depth-cap: var(--tui-quiet) linear-gradient(var(--tui-quiet-key), var(--tui-quiet-key));
    /* The cap, drawn once for every state (a finish that draws keys itself is answered below). */
    --mat-key-fill: var(--tui-depth-cap, var(--mat-light, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen), transparent 60%)), linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
    /* A physical part prints in ink, even on a glass that glows. */
    text-shadow: none;
  }
  :is(:scope, :scope *).tui-key.tui-key--primary { --tui-skirt: var(--mat-cap-skirt); --tui-hl: var(--mat-cap-hl); }
  /* At no more weight than the kit's own key, so the Quiet volume's states still draw on top. */
  :where(:scope, :scope *).tui-key:where(:not(.tui-key--primary, .tui-key--flat)) { background: var(--mat-key-fill); }

  /* The knob: body, knurl, sheen and cap all in the material, whatever the room draws. The ticks are printed on the plate and stay. */
  tui-knob:is(:scope, :scope *) {
    --k-hi: var(--mat-knob-hi);
    --k-mid: var(--mat-knob-mid);
    --k-lo: var(--mat-knob-lo);
    --tui-knob-cap-shadow: var(--mat-knob-cap-shadow);
    --tui-depth-plate: var(--tui-quiet) var(--tui-quiet-whisper);
  }
  /* The edge: a bright cut line on the body and a dark one where it meets the plate, so it shows on any room. */
  tui-knob:is(:scope, :scope *) .tui-knob__body {
    background: var(--mat-knob-mid);
    box-shadow: inset 0 0 0 1px var(--mat-rim-hi), 0 0 0 1px var(--mat-rim-lo),
      var(--tui-depth-plate, 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 3px 7px 14px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  }
  tui-knob:is(:scope, :scope *) .tui-knob__knurl {
    background: var(--mat-knurl, repeating-conic-gradient(from 0deg, rgb(0 0 0 / 0.3) 0 2.2deg, rgb(255 255 255 / 0.35) 2.2deg 3deg, transparent 3deg 6deg));
    -webkit-mask: none;
            mask: none;
  }
  tui-knob:is(:scope, :scope *) .tui-knob__sheen { background: var(--mat-knob-sheen, linear-gradient(150deg, rgb(255 255 255 / 0.45), transparent 42%, transparent 58%, rgb(0 0 0 / 0.35))); }
  tui-knob:is(:scope, :scope *) .tui-knob__cap {
    background: var(--mat-knob-face,
      repeating-radial-gradient(circle, rgb(255 255 255 / 0.06) 0 0.6px, rgb(0 0 0 / 0.035) 0.6px 1.5px),
      conic-gradient(from 0deg, var(--k-mid) 0deg, var(--k-lo) 40deg, var(--k-mid) 80deg, var(--k-hi) 135deg, var(--k-mid) 180deg, var(--k-lo) 220deg, var(--k-mid) 260deg, var(--k-hi) 315deg, var(--k-mid) 360deg));
    box-shadow: var(--tui-knob-cap-shadow);
  }
  /* The pointer is printed on the cap, in the material's ink. */
  tui-knob:is(:scope, :scope *) .tui-knob__mark::after { background: var(--mat-ink); box-shadow: 0 1px 0 rgb(255 255 255 / 0.35); }

  /* The fader's cap, with its printed line; the slot is cut in the plate and stays. */
  /* Its edge, the two lines a knob has, is drawn in either volume; Quiet takes away only the skirt and the shadow. */
  :is(:scope, :scope *).tui-fader::-webkit-slider-thumb {
    --tui-depth-cap: var(--tui-quiet) linear-gradient(var(--mat-face), var(--mat-face));
    --tui-depth-key: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), var(--tui-quiet-whisper);
    background: linear-gradient(var(--mat-ink), var(--mat-ink)) center / 100% 1.5px no-repeat,
      var(--tui-depth-cap, linear-gradient(90deg, var(--mat-face-lo), var(--mat-face) 30%, var(--mat-face) 60%, var(--mat-face-lo)));
    box-shadow: inset 0 0 0 1px var(--mat-rim-hi), 0 0 0 1px var(--mat-rim-lo),
      var(--tui-depth-key, inset 0 1px 0 var(--mat-hl), 0 2px 0 var(--mat-skirt), 0 4px 8px rgb(var(--tui-sh) / 0.35));
  }
  :is(:scope, :scope *).tui-fader::-moz-range-thumb {
    --tui-depth-cap: var(--tui-quiet) linear-gradient(var(--mat-face), var(--mat-face));
    --tui-depth-key: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), var(--tui-quiet-whisper);
    background: linear-gradient(var(--mat-ink), var(--mat-ink)) center / 100% 1.5px no-repeat,
      var(--tui-depth-cap, linear-gradient(90deg, var(--mat-face-lo), var(--mat-face) 30%, var(--mat-face) 60%, var(--mat-face-lo)));
    box-shadow: inset 0 0 0 1px var(--mat-rim-hi), 0 0 0 1px var(--mat-rim-lo),
      var(--tui-depth-key, inset 0 1px 0 var(--mat-hl), 0 2px 0 var(--mat-skirt), 0 4px 8px rgb(var(--tui-sh) / 0.35));
  }
  :is(:scope, :scope *).tui-fader.tui-fader--v::-webkit-slider-thumb {
    background: linear-gradient(var(--mat-ink), var(--mat-ink)) center / 1.5px 100% no-repeat,
      var(--tui-depth-cap, linear-gradient(var(--mat-face-lo), var(--mat-face) 30%, var(--mat-face) 60%, var(--mat-face-lo)));
  }

  /* The switch's thumb, its grip ridged; the slot is cut in the plate and lights green as before. */
  :is(:scope, :scope *).tui-switch::after {
    --tui-depth-cap: var(--tui-quiet) linear-gradient(var(--mat-face), var(--mat-face));
    --tui-depth-plate: var(--tui-quiet) inset 0 1px 0 var(--tui-quiet-hl), 0 1px 2px rgb(var(--tui-sh) / 0.14);
    --mat-ridges: var(--tui-quiet) linear-gradient(transparent, transparent);
    top: 2px;
    left: 2px;
    width: 28px;
    height: 22px;
    background: var(--mat-ridges, repeating-linear-gradient(90deg, transparent 0 2px, rgb(0 0 0 / 0.22) 2px 3px, var(--mat-hl) 3px 4px) center / 11px 8px no-repeat),
      var(--tui-depth-cap, linear-gradient(var(--mat-face), color-mix(in oklab, var(--mat-face) 90%, rgb(var(--tui-sh)))));
    box-shadow: inset 0 0 0 1px var(--mat-rim-hi), 0 0 0 1px var(--mat-rim-lo),
      var(--tui-depth-plate, inset 0 1px 0 var(--mat-hl), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)), 0 5px 12px -5px rgb(var(--tui-sh) / var(--tui-sh-a)));
  }
  :is(:scope, :scope *).tui-switch:checked::after { transform: translateX(16px); }

  /* The rocker's lever pivots in its bezel; the bezel is the plate's and stays. */
  :is(:scope, :scope *).tui-rocker {
    --tui-rocker-hi: var(--mat-knob-hi);
    --tui-rocker-mid: var(--mat-knob-mid);
    --tui-rocker-lo: color-mix(in oklab, var(--mat-knob-mid), var(--mat-knob-lo));
    --tui-rocker-sunk: color-mix(in oklab, var(--mat-knob-mid) 25%, var(--mat-knob-lo));
    --tui-rocker-wall: color-mix(in oklab, var(--mat-knob-lo) 70%, #000);
    --tui-rocker-mark: var(--mat-ink);
  }
}

/* A finish that draws its parts as lines (paper, phosphor) draws keys and the
   rocker in its own rules. A part with a material is a thing on the page,
   not a drawing of one: it keeps its own cap there too. Scoped as that
   finish's drawing is, so a Quiet region or a band inside it is left alone. */
@scope ([data-finish="paper"]:not([data-volume="quiet"]), [data-finish="phosphor"]:not([data-volume="quiet"])) to (:scope [data-finish], [data-volume="quiet"]) {
@scope ([data-material="aluminium"], [data-material="graphite"], [data-material="porcelain"], [data-material="black-anodised"], [data-material="titanium"], [data-material="bakelite"], [data-material="anodised-blue"], [data-material="anodised-green"]) {
  :is(:scope, :scope *).tui-key:is(:hover, .is-hover, :active, [aria-pressed="true"], [aria-expanded="true"], .is-down):not(.tui-key--primary, .tui-key--flat) { background: var(--mat-key-fill); }
  :is(:scope, :scope *).tui-key.tui-key--primary {
    color: var(--tui-cap-ink);
    background: radial-gradient(120% 90% at 50% 0%, rgb(255 255 255 / 0.1), transparent 60%), linear-gradient(var(--tui-cap-hi), var(--tui-cap));
  }
  :is(:scope, :scope *).tui-rocker::before {
    box-shadow: -2px 2px 3px -1px rgb(0 0 0 / 0.6);
    background:
      linear-gradient(var(--mark), var(--mark)) calc(25% - 0.75px) 48.5% / 2px 9px no-repeat,
      radial-gradient(circle, transparent 2.7px, var(--mark-sunk) 2.9px 4px, transparent 4.2px) calc(75% - 0.75px) 51.5% / 11px 11px no-repeat,
      linear-gradient(to bottom, rgb(0 0 0 / 0.45), transparent 60%) 100% 0 / 50% 100% no-repeat,
      linear-gradient(to left, rgb(0 0 0 / 0.32), transparent 45%) 100% 0 / 50% 100% no-repeat,
      linear-gradient(rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.75)) 0 0 / 50% 1px no-repeat,
      linear-gradient(90deg, var(--cap-wall) 0 5%, var(--cap-hi) 5% 14%, var(--cap-mid) 32%, var(--cap-lo) 49.6%, rgb(0 0 0 / 0.4) 49.6% 50.4%, var(--cap-sunk) 50.4%);
  }
  :is(:scope, :scope *).tui-rocker:checked::before {
    box-shadow: 2px 2px 3px -1px rgb(0 0 0 / 0.6);
    background:
      linear-gradient(var(--mark-sunk), var(--mark-sunk)) calc(25% + 0.75px) 51.5% / 2px 8px no-repeat,
      radial-gradient(circle, transparent 3px, var(--mark) 3.2px 4.4px, transparent 4.6px) calc(75% + 0.75px) 48.5% / 12px 12px no-repeat,
      linear-gradient(to bottom, rgb(0 0 0 / 0.45), transparent 60%) 0 0 / 50% 100% no-repeat,
      linear-gradient(to right, rgb(0 0 0 / 0.32), transparent 45%) 0 0 / 50% 100% no-repeat,
      linear-gradient(rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.75)) 100% 0 / 50% 1px no-repeat,
      linear-gradient(90deg, var(--cap-sunk) 0 49.6%, rgb(0 0 0 / 0.4) 49.6% 50.4%, var(--cap-lo) 50.4%, var(--cap-mid) 68%, var(--cap-hi) 86% 95%, var(--cap-wall) 95%);
  }
}
}

/* ---------------------------------------------------------------- part: matrix */
/* LED matrix: round LEDs on a pitch behind a smoked acrylic diffuser, set
   flush in a window cut into the plate. The dots and their bloom are drawn by
   kit/parts/matrix.mjs; the acrylic's reflection of the room's lamp is a
   fixed layer over them, so it never moves with the message. */
tui-matrix {
  --tui-matrix-led: var(--tui-amber);
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
tui-matrix[data-lamp="green"] { --tui-matrix-led: var(--tui-green); }
tui-matrix[data-lamp="red"] { --tui-matrix-led: var(--tui-red); }
tui-matrix[data-lamp="blue"] { --tui-matrix-led: var(--tui-blue); }
tui-matrix[data-lamp="white"] { --tui-matrix-led: var(--tui-white); }
/* Aurora: the lit dots take their colour from a moving field (matrix.mjs); the unlit dies stay neutral. */
tui-matrix[data-lamp="aurora"] { --tui-matrix-led: var(--tui-white); }

/* The window: black acrylic a few millimetres round the dots, in a cut in the plate. */
.tui-matrix__window {
  position: relative;
  padding: 7px;
  border-radius: var(--tui-r-m);
  background: var(--tui-vfd-bg);
  box-shadow:
    var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.8),
    inset 0 0 0 1px rgb(255 255 255 / 0.05),
    0 1px 0 var(--tui-hl),
    0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
.tui-matrix__dots {
  display: block;
  width: 100%;
  max-width: none;
  max-height: none;
  color: var(--tui-matrix-led);
}
/* The acrylic: the lamp above left, caught as a soft sheen that fades down the panel. */
.tui-matrix__window::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(164deg, rgb(255 255 255 / 0.075), rgb(255 255 255 / 0.02) 34%, transparent 52%);
}
.tui-matrix__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- part: media-bar */
/* Media bar: the control strip for an audio or video element. A primary play
   key, two small LCDs in the mono figures for the time elapsed and the length,
   the kit's fader as the scrubber, and a mute key with a volume fader and an
   optional speed key. The scrubber's floor carries two lengths: what has been
   played is filled in ink right up to the cap, and what has loaded is a thin
   ink rule along the bottom of the slot, so neither is told by colour. On a
   narrow bar the times drop under the scrubber and the keys to a row of their own. Nothing here is tinted. */
tui-media-bar { display: block; container-type: inline-size; container-name: tui-media-bar; min-width: 0; color: var(--tui-ink); text-align: left; }
tui-media-bar > :is(video, audio) { display: block; width: 100%; max-width: 100%; margin: 0 0 var(--tui-3); border-radius: var(--tui-r-m); background: var(--tui-vfd-bg); box-shadow: var(--tui-inset); }
tui-media-bar > audio { display: none; }

.tui-media-bar__bar {
  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "play scrub scrub" "play now total" "tools tools tools";
  align-items: center;
  gap: var(--tui-2) var(--tui-3);
  min-width: 0;
  padding: var(--tui-3) var(--tui-4);
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-media-bar__play { grid-area: play; align-self: center; }
.tui-media-bar__time[data-role=elapsed] { grid-area: now; justify-self: start; }
.tui-media-bar__time[data-role=total] { grid-area: total; justify-self: end; }
.tui-media-bar__scrub { grid-area: scrub; display: block; min-width: 0; --f: 0; --b: 0; }
/* The tools sit on the bar's own two edges: the mute key under the play key, the volume under the scrubber at its width, so both sliders start and end together. */
.tui-media-bar__tools { grid-area: tools; display: flex; align-items: center; gap: var(--tui-3); min-width: 0; }
.tui-media-bar__tools:empty { display: none; }
.tui-media-bar__time { justify-content: center; min-width: 0; white-space: nowrap; }
.tui-media-bar__seek, .tui-media-bar__vol { display: block; min-width: 0; }
.tui-media-bar__vol { flex: 1 1 auto; width: auto; --f: 1; }
.tui-media-bar__speed { margin-left: auto; min-width: 3.4em; font-variant-numeric: tabular-nums; }
.tui-media-bar__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The two lengths on the scrubber's floor and the volume's: the cap's centre sits 8px in from each end of the slot. */
.tui-media-bar__seek::-webkit-slider-runnable-track {
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) 0 0 / calc(8px + (100% - 16px) * var(--f)) 100% no-repeat,
    linear-gradient(var(--tui-ink-2), var(--tui-ink-2)) 0 100% / calc(8px + (100% - 16px) * var(--b)) 2px no-repeat,
    var(--tui-well-fill) var(--tui-well);
}
.tui-media-bar__seek::-moz-range-track {
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) 0 0 / calc(8px + (100% - 16px) * var(--f)) 100% no-repeat,
    linear-gradient(var(--tui-ink-2), var(--tui-ink-2)) 0 100% / calc(8px + (100% - 16px) * var(--b)) 2px no-repeat,
    var(--tui-well-fill) var(--tui-well);
}
.tui-media-bar__vol::-webkit-slider-runnable-track {
  background:
    linear-gradient(var(--tui-ink-2), var(--tui-ink-2)) 0 0 / calc(8px + (100% - 16px) * var(--f)) 100% no-repeat,
    var(--tui-well-fill) var(--tui-well);
}
.tui-media-bar__vol::-moz-range-track {
  background:
    linear-gradient(var(--tui-ink-2), var(--tui-ink-2)) 0 0 / calc(8px + (100% - 16px) * var(--f)) 100% no-repeat,
    var(--tui-well-fill) var(--tui-well);
}
tui-media-bar[data-state="error"] .tui-media-bar__bar::after {
  content: 'This recording cannot be played.';
  grid-column: 1 / -1;
  font-size: var(--tui-t-small);
  color: var(--tui-ink-2);
}

/* Wide enough, one row. */
@container tui-media-bar (min-width: 560px) {
  .tui-media-bar__bar { grid-template-columns: auto auto minmax(120px, 1fr) auto auto; grid-template-areas: "play now scrub total tools"; }
  .tui-media-bar__time[data-role=elapsed], .tui-media-bar__time[data-role=total] { justify-self: auto; }
  .tui-media-bar__tools { min-width: 150px; gap: var(--tui-2); }
  .tui-media-bar__vol { flex: none; width: 96px; }
}

@media (pointer: coarse) {
  .tui-media-bar__play.tui-key, .tui-media-bar__mute.tui-key { --h: 44px; min-width: 44px; }
  .tui-media-bar__speed.tui-key { --h: 44px; min-width: 44px; }
  .tui-media-bar__seek.tui-fader, .tui-media-bar__vol.tui-fader { height: 44px; }
  .tui-media-bar__tools { gap: var(--tui-3); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-media-bar__bar, .tui-media-bar__bar * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- part: mention-field */
/* Mention field: the kit's text well with the combobox's card hung under the
   caret. A pick is set into the text as a small raised cap, the tag input's own
   shape, so it reads as one thing and goes as one thing. Nothing here is
   coloured: the cap, the pressed line under the pointer and the heavier print
   of the matched letters are the combobox's. */
tui-mention-field { position: relative; display: block; min-width: 0; }
tui-mention-field[disabled], tui-mention-field[data-fs-disabled] { opacity: 0.45; cursor: not-allowed; }

.tui-mention-field__editor {
  display: block;
  box-sizing: border-box;
  height: auto;
  min-height: 38px;
  padding: 8px var(--tui-3);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font: 400 var(--tui-t-body)/1.6 var(--tui-sans);
  color: var(--tui-ink);
  cursor: text;
  outline: none;
  resize: none;
}
.tui-mention-field__editor--multi { min-height: 96px; }
.tui-mention-field__editor:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-mention-field__editor.is-empty::before { content: attr(data-placeholder); color: var(--tui-ink-3); pointer-events: none; }
.tui-mention-field__editor[aria-disabled="true"] { cursor: not-allowed; }
.tui-field[data-error] .tui-mention-field__editor { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

/* A pick: a raised cap in the line of text. It is one thing to the caret. */
.tui-mention-field__token {
  display: inline-block;
  box-sizing: border-box;
  margin: 0 1px;
  padding: 0 7px;
  border-radius: 6px;
  font: 600 0.92em/1.55 var(--tui-sans);
  color: var(--tui-ink);
  white-space: nowrap;
  user-select: all;
  cursor: default;
  vertical-align: baseline;
  background:
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
}
.tui-mention-field__token::selection { background: transparent; }

/* The list: the combobox's card, hung under the caret. No lamp column. */
.tui-mention-field__card { width: min(300px, calc(100vw - 16px)); min-width: 220px; }
.tui-mention-field__option { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 0 10px; }
.tui-mention-field__option::before { content: none; }
.tui-mention-field__option .tui-combobox__hint { max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.tui-combobox__card.tui-mention-field__card:not([popover]) { width: 100%; max-width: 300px; box-shadow: var(--tui-depth-float, 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 8px 18px -10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2))); }
.tui-mention-field__option.is-active { color: var(--tui-ink); }

@media (pointer: coarse) {
  .tui-mention-field__editor { min-height: 44px; }
  .tui-mention-field__editor--multi { min-height: 96px; }
  .tui-mention-field__option { min-height: 44px; }
}

/* ---------------------------------------------------------------- part: menu-drawer-key */
/* Menu drawer key: the plain menu button and its side drawer made one thing. The key is the kit's icon key at 40px;
   its two lines turn into a back arrow, a bar with an arrow pointing back, by --open, how far the drawer is open
   (0 shut, 1 open). menu-drawer-key.mjs measures the drawer's plate every frame and writes --open, so the glyph
   follows a tap, a drag on the grip and a flick the same way, and snaps with the plate under reduced motion.
   The drawer is the kit's Drawer, unchanged. Its own key rides in the plate, held still against the slide, so
   the key you tapped never moves. */
.tui-menu-drawer { display: contents; --menu-w: min(300px, calc(100vw - 56px)); --open: 0; }
.tui-menu-key { --h: 40px; color: var(--tui-ink); }
/* The page's key hands over to the one in the plate while the drawer is up (opacity, so it can still take focus back). */
.tui-menu-drawer > .tui-menu-key[aria-expanded="true"] { opacity: 0; }

/* Four strokes, 2px, in a 24px box, all one weight. The drawing is about 18px across, in the 40px key, in every state.
   Each stroke is a transform of --open, in steps that never put two strokes on the same ground (checked by
   lab/menu-drawer-key-glyph.mjs, which also writes these lines): the top bar slides left, turns upright and settles
   as the bar (0 to 0.8); the lower bar waits, then rises into the shaft (0.62 to 0.88); the head grows from its tip (0.88 to 1). */
.tui-menu-key__glyph { position: relative; display: block; width: 24px; height: 24px; flex: none; }
.tui-menu-key__glyph > i {
  position: absolute; left: 50%; top: 50%; height: 2px; margin-top: -1px; border-radius: 1px;
  background: currentColor;
}
.tui-menu-key__glyph > i:nth-child(1) {
  width: 18px; margin-left: -9px;
  transform: translate(calc(-12px * clamp(0, var(--open) / 0.3, 1) + 4px * clamp(0, (var(--open) - 0.56) / 0.24, 1)), calc(-4px + 4px * clamp(0, (var(--open) - 0.56) / 0.24, 1))) rotate(calc(90deg * clamp(0, (var(--open) - 0.3) / 0.26, 1))) scaleX(calc((18 - 2 * clamp(0, var(--open) / 0.3, 1) + 2 * clamp(0, (var(--open) - 0.56) / 0.24, 1)) / 18));
}
.tui-menu-key__glyph > i:nth-child(2) {
  width: 14px; margin-left: -7px;
  transform: translate(calc(2px + 0.5px * clamp(0, (var(--open) - 0.62) / 0.26, 1)), calc(4px - 4px * clamp(0, (var(--open) - 0.62) / 0.26, 1))) scaleX(calc((10 + 4 * clamp(0, (var(--open) - 0.62) / 0.26, 1)) / 14));
}
.tui-menu-key__glyph > i:nth-child(3), .tui-menu-key__glyph > i:nth-child(4) {
  width: 7.07px; margin-left: -3.535px;
  --grow: clamp(0, (var(--open) - 0.88) / 0.12, 1);
}
.tui-menu-key__glyph > i:nth-child(3) { transform: translate(calc(-3.5px + 2.5px * var(--grow)), calc(-2.5px * var(--grow))) rotate(-45deg) scaleX(var(--grow)); }
.tui-menu-key__glyph > i:nth-child(4) { transform: translate(calc(-3.5px + 2.5px * var(--grow)), calc(2.5px * var(--grow))) rotate(45deg) scaleX(var(--grow)); }

/* The panel: the kit's drawer from the left, at the width the key's counter-slide needs to know. Overflow stays visible so the
   key can stand outside the plate while it is still sliding in. */
.tui-drawer.tui-menu-drawer__panel { width: var(--menu-w); overflow: visible; }
.tui-menu-drawer__panel .tui-drawer__head { padding: var(--pin-y, 16px) 16px var(--pin-y, 16px) calc(var(--pin-x, 16px) + 54px); min-height: 0; }
.tui-menu-drawer__pin {
  position: absolute; z-index: 1; left: var(--pin-x, 16px); top: var(--pin-y, 16px);
  /* The plate is this far out of the window; the key goes the same far the other way and so stays put. */
  transform: translateX(calc((1 - var(--open)) * var(--menu-w)));
}
.tui-menu-drawer__nav { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.tui-menu-drawer__nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 var(--tui-3); border-radius: var(--tui-r-m);
  color: var(--tui-ink-2); font: 600 var(--tui-t-body)/1.2 var(--tui-sans); text-decoration: none;
}
.tui-menu-drawer__nav a[aria-current="page"] { color: var(--tui-ink); background: var(--tui-well-fill); box-shadow: var(--tui-inset); }
.tui-menu-drawer__nav a:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .tui-menu-drawer__nav a:hover { color: var(--tui-ink); } }

/* ---------------------------------------------------------------- part: menu */
/* Menu: a card that slides out from under its key. The key stays down while
   the card is out; the line under the finger is pressed into the card; an
   option that is on lights its lamp (green for a setting, amber for the one
   chosen from a set). Native popover; menu.mjs gives it the keyboard. */

/* The key: a printed arrow says a card comes out of it. */
.tui-menu__trigger::after {
  content: '';
  flex: none;
  width: 7px;
  height: 4px;
  margin-right: -2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0.8;
}
.tui-key.tui-menu__trigger[aria-expanded="true"][data-tip]:not([data-tip-live])::after { display: none; }
.tui-key.tui-menu__trigger[aria-expanded="true"], .tui-key.tui-menu__trigger.is-down {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}

/* The card. */
.tui-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  min-width: 212px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 5px;
  border-radius: 11px;
  font: 400 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.25),
    0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  outline: none;
  max-height: max(160px, var(--tui-room, 80vh));
  overflow-y: auto;
  scrollbar-width: thin;
}
.tui-menu:focus-visible { outline: none; }
.tui-menu:not([popover]) { position: relative; text-align: left; white-space: normal; }
/* It comes 6px from its key in 150ms and goes back toward it in 110ms. A transition, so a menu opened, shut and opened
   again turns round where it is. The individual translate property leaves the placement (left, top) alone, and a menu
   opened from the keyboard (popover.mjs sets data-key) does not travel: it fades. */
.tui-menu[popover] {
  --travel: 0 -6px;
  transition: opacity 110ms var(--tui-ease), translate 110ms var(--tui-ease), overlay 110ms allow-discrete, display 110ms allow-discrete;
}
.tui-menu[popover]:popover-open { transition-duration: 150ms; }
.tui-menu[popover][data-placed="top"] { --travel: 0 6px; }
.tui-menu[popover][data-placed="right"] { --travel: -6px 0; }
.tui-menu[popover][data-placed="left"] { --travel: 6px 0; }
.tui-menu[popover][data-key] { --travel: none; }
.tui-menu[popover]:not(:popover-open) { opacity: 0; translate: var(--travel); }
@starting-style { .tui-menu[popover]:popover-open { opacity: 0; translate: var(--travel); } }
@media (prefers-reduced-motion: reduce) { .tui-menu[popover] { --travel: none; } }

/* A line: a lamp or icon slot, the words, then a shortcut or an arrow. */
.tui-menu [role^="menuitem"] {
  appearance: none;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 0 10px 0 9px;
  border: 0;
  border-radius: 7px;
  font: 500 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink);
  text-align: left;
  text-decoration: none;
  background: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-menu [role^="menuitem"]::before { content: ''; grid-area: 1 / 1; justify-self: center; }
.tui-menu [role^="menuitem"] > svg { grid-area: 1 / 1; width: 14px; height: 14px; color: var(--tui-ink-2); }
/* Under the finger, or the keyboard: pressed into the card. */
.tui-menu [role^="menuitem"]:focus, .tui-menu [role^="menuitem"].is-hover {
  outline: none;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-menu [role^="menuitem"]:focus-visible, .tui-menu [role^="menuitem"].is-focus { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
.tui-menu [role^="menuitem"][aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-menu__item--danger { color: var(--tui-red-ink, var(--tui-red)) !important; }
.tui-menu__item--danger > svg { color: currentColor; }

/* Checkable lines carry a lamp: off until the option is on. */
.tui-menu [role="menuitemcheckbox"]::before, .tui-menu [role="menuitemradio"]::before {
  --c: var(--tui-green);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 1px 0 var(--tui-hl);
}
.tui-menu [role="menuitemradio"]::before { --c: var(--tui-amber); }
.tui-menu [aria-checked="true"]::before {
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--c);
  color: var(--c);
  box-shadow: var(--tui-glow);
}

/* Shortcuts are printed, like the legend under a key. */
.tui-menu [role^="menuitem"] > kbd {
  grid-column: 3;
  padding: 0;
  background: none;
  box-shadow: none;
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  letter-spacing: 0.06em;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
/* A line that opens another card: a printed arrow. */
.tui-menu [role="menuitem"][aria-haspopup]::after {
  content: '';
  grid-column: 3;
  width: 4px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  opacity: 0.7;
}
.tui-menu [role="menuitem"][aria-expanded="true"] { background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }

.tui-menu [role="separator"], .tui-menu hr { height: 1px; margin: 5px 8px; border: 0; background: var(--tui-rule); }
.tui-menu [role="group"] { display: grid; }
.tui-menu__label {
  display: block;
  padding: 9px 10px 5px 33px;
  font: 500 var(--tui-t-label)/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
}

/* ---------------------------------------------------------------- part: menubar */
/* Menubar: the row of menu names along the top of a document window (File,
   Edit, View, Help). A quiet bar: the names are plain printing on the page or
   the panel, with no caps. Under the pointer a name is tinted; while its
   card is out it is pressed into the surface, the way a menu key stays down.
   The cards are the menu part's (menu.css); this only draws the bar. */
.tui-menubar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
  /* Room for the focus ring, which the bar's own scrolling would otherwise cut. */
  padding: 3px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  text-align: left;
}
.tui-menubar::-webkit-scrollbar { display: none; }

.tui-menubar__item {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-s);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  white-space: nowrap;
  background: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 70ms var(--tui-ease);
}
.tui-menubar__item:hover, .tui-menubar__item.is-hover {
  background: color-mix(in oklab, var(--tui-ink) 7%, transparent);
}
/* While its card is out (or the finger is down): pressed into the surface. */
.tui-menubar__item[aria-expanded="true"], .tui-menubar__item:active, .tui-menubar__item.is-down {
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-menubar__item:focus-visible, .tui-menubar__item.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 1px; }
.tui-menubar__item:disabled, .tui-menubar__item[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; background: none; box-shadow: none; }
.tui-menubar__item[aria-disabled="true"]:focus-visible { opacity: 0.75; }

/* A rule under the bar, when it heads a panel or a window. */
.tui-menubar--ruled { padding-bottom: 4px; box-shadow: 0 1px 0 var(--tui-rule); }

@media (pointer: coarse) {
  .tui-menubar { gap: 4px; }
  .tui-menubar__item { height: 44px; min-width: 44px; justify-content: center; padding: 0 var(--tui-4); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-menubar__item { transition: none; }
}

/* ---------------------------------------------------------------- part: message-actions */
/* Message actions: the keys under a reply (Copy, Retry and a pair to rate it)
   set in the kit's toolbar slot, so they are a rack of real keys and one tab
   stop. With a fine pointer they stay out of the way until the reply is under
   the pointer or anything in it has the focus, so a long chat is not a wall of
   keys; with a finger there is no hover, so they are always there. They are
   hidden by opacity alone, never by display or visibility, which means the
   keyboard can always reach them and reaching one shows the rack. Copy is the
   kit's copy key. The rating keys latch, and press the same one again to take
   the rating back. */
.tui-message-actions { position: relative; }
.tui-message-actions-host { display: grid; gap: var(--tui-2); min-width: 0; }
.tui-message-actions .tui-key svg { width: 14px; height: 14px; flex: none; }
.tui-message-actions__retry { gap: 6px; }
/* Said aloud, never seen. */
.tui-message-actions__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .tui-message-actions { opacity: 0; transition: opacity 120ms linear; }
  :is(.tui-message-actions-host, .tui-message):is(:hover, :focus-within) .tui-message-actions,
  .tui-message-actions:is(:hover, :focus-within, .is-shown) { opacity: 1; }
}
@media (pointer: coarse) {
  .tui-message-actions-host .tui-key:not(.tui-key--flat) { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-message-actions { transition: none; }
}

/* ---------------------------------------------------------------- part: message */
/* Message: one chat message as a plate, with no chat around it. It is the
   chat's sibling and is made the same way. What you wrote is typed into a
   recess and sits to the right; what the assistant said is printed on a slip
   of paper torn along a perforation; what someone else wrote is a small raised
   plate. Along the top run the sender, printed as a legend, and the time; with
   them a lamp and a word say what has become of it (sending, sent, not sent),
   so the lamp only agrees with the word. A message that failed grows a Retry
   key under its text. The slip is paper in every finish and follows the finish
   only in its shadow and its edge. */
.tui-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  width: min(100%, 520px);
  min-width: 0;
  margin: 0;
  font-size: var(--tui-t-body);
}
.tui-message:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 4px; }
.tui-message__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--tui-3); min-height: 20px; margin: 0; }
.tui-message__who { margin-right: auto; }
.tui-message__time { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-message__body { min-width: 0; }
.tui-message__body > * { margin: 0; }
.tui-message__body > * + * { margin-top: var(--tui-2); }
.tui-message__body p { line-height: 1.55; overflow-wrap: anywhere; white-space: pre-line; }

/* State: a lamp and a word. The lamp follows data-state on the message. */
.tui-message__state { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); }
.tui-message[data-state="sending"] .tui-message__state > .tui-lamp { --c: var(--tui-amber); animation: tui-blink 1.2s steps(1) infinite; }
.tui-message[data-state="failed"] .tui-message__state > .tui-lamp { --c: var(--tui-red); }
.tui-message[data-state="failed"] .tui-message__words { color: var(--tui-red-ink, var(--tui-ink)); font-weight: 600; }
.tui-message:not([data-state]) .tui-message__state { display: none; }

/* Retry: only a failed message offers it. */
.tui-message__retry { display: none; justify-self: start; margin-left: calc(var(--tui-2) * -1); }
.tui-message[data-state="failed"] .tui-message__retry { display: inline-flex; }

/* Yours: typed into the machine, so it sits in a recess, to the right. */
.tui-message[data-from="user"] { margin-left: auto; width: min(100%, 440px); }
.tui-message[data-from="user"] .tui-message__body {
  padding: 10px 14px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  color: var(--tui-ink);
}

/* Someone else's: a small raised plate. */
.tui-message[data-from="other"] .tui-message__body { padding: 10px 14px; border-radius: var(--tui-r-m); background: var(--tui-face); box-shadow: var(--tui-raised); }

/* The assistant's: a slip. The top is torn along a perforation, the foot has the teeth of the tear-off. The paper is the ::before layer so the article can carry the shadow as a filter, which follows the torn edges. */
.tui-message[data-from="assistant"] {
  --tear: 5px;
  --bite: 3px;
  --msg-line: var(--pr-line, var(--sc-line, transparent));
  --tui-ink: var(--tui-paper-ink);
  --tui-ink-2: var(--tui-paper-ink-2);
  --tui-ink-3: color-mix(in srgb, var(--tui-paper-ink-2) 85%, var(--tui-paper));
  --tui-rule: color-mix(in srgb, var(--tui-paper-ink) 20%, transparent);
  --tui-hl: rgb(255 255 255 / 0.85);
  --tui-focus: var(--tui-paper-ink);
  position: relative;
  isolation: isolate;
  padding: 18px 18px calc(14px + var(--tear));
  color: var(--tui-paper-ink);
  filter:
    drop-shadow(0 0.5px 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)))
    drop-shadow(0 2px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)))
    drop-shadow(0 8px 10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.55)));
}
.tui-message[data-from="assistant"]::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgb(255 255 255 / 0.7), transparent 2px),
    /* In the flat finishes the paper is drawn with its edges as lines (Paper, Phosphor, E-paper, AMOLED set --msg-line). */
    linear-gradient(var(--msg-line), var(--msg-line)) 0 0 / 1px 100% no-repeat,
    linear-gradient(var(--msg-line), var(--msg-line)) 100% 0 / 1px 100% no-repeat,
    linear-gradient(var(--msg-line), var(--msg-line)) 0 calc(var(--bite) + 1px) / 100% 1px no-repeat,
    linear-gradient(var(--msg-line), var(--msg-line)) 0 calc(100% - var(--tear)) / 100% 1px no-repeat,
    /* The perforation: a row of pinholes under the torn top, each with a lit lip below it. */
    radial-gradient(ellipse 1.1px 0.8px at 50% 50%, rgb(90 76 46 / 0.4), transparent 100%) 0 calc(var(--bite) + 5px) / 6px 3px repeat-x,
    radial-gradient(ellipse 1.2px 0.5px at 50% 50%, rgb(255 255 255 / 0.55), transparent 100%) 0 calc(var(--bite) + 6.5px) / 6px 3px repeat-x,
    linear-gradient(0deg, color-mix(in srgb, var(--tui-paper-ink) 7%, transparent), transparent 26px),
    radial-gradient(130% 70% at 12% 0%, var(--tui-paper-sheen, rgb(255 255 255 / 0.4)), transparent 62%),
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  mask-image:
    radial-gradient(circle at 50% 0, transparent calc(var(--bite) - 0.4px), black calc(var(--bite) + 0.2px)),
    linear-gradient(black, black),
    conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg);
  mask-size: 8px 100%, 100% calc(100% - var(--tear)), calc(var(--tear) * 2) var(--tear);
  mask-position: 4px 0, 0 0, 0 100%;
  mask-repeat: repeat-x, no-repeat, repeat-x;
  mask-composite: intersect, add, add;
  -webkit-mask-composite: source-in, source-over, source-over;
}
.tui-message[data-from="assistant"] .tui-message__meta { padding-bottom: 6px; border-bottom: 1px dotted color-mix(in srgb, var(--tui-paper-ink) 30%, transparent); }
/* Phosphor and AMOLED paper is dark: no shadow is cast and the sheen is off. The flat finishes draw no shadow at all (their shadow strength is zero). */

@media (pointer: coarse) {
  .tui-message__retry { --h: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-message[data-state="sending"] .tui-message__state > .tui-lamp { animation: none; }
}
@media (forced-colors: active) {
  .tui-message[data-from="assistant"]::before { background: Canvas; border: 1px solid CanvasText; mask-image: none; }
}

/* ---------------------------------------------------------------- part: meter */
/* Meter: a value inside a known range, read off an LED strip. The strip is a
   native <meter>, so low, high and optimum are the browser's own: the whole lit
   length takes the colour of where the value stands (green in the good region,
   amber next to it, red past that), not the colour of the segment it reaches,
   which is what the ladder does. The printed marks under the strip say where
   the regions begin, and cut lines across the strip show the same two places.
   Words beside it say the state too, so colour is never the only sign.
   Set --lo and --hi (0 to 1) on .tui-meter to where `low` and `high` fall. */
.tui-meter { --n: 24; --lo: 0.5; --hi: 0.85; display: grid; gap: var(--tui-2); width: 100%; min-width: 0; }
.tui-meter__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--tui-1) var(--tui-3); }
.tui-meter__value { font: 600 var(--tui-t-body)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }
.tui-meter__state { display: inline-flex; align-items: center; gap: var(--tui-2); font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }

/* The strip: dark glass, its unlit segments just visible, its gaps a hair of glass. */
.tui-meter__strip {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(var(--tui-sh) / 0.7), 0 1px 0 var(--tui-hl));
  overflow: hidden;
}
.tui-meter--lg .tui-meter__strip { height: 20px; }
.tui-meter__strip::before, .tui-meter__strip::after { content: ''; position: absolute; inset: 2px; pointer-events: none; }
.tui-meter__strip::before { background: color-mix(in oklab, var(--tui-vfd) 13%, var(--tui-vfd-bg)); }
.tui-meter__strip::after {
  z-index: 1;
  background:
    linear-gradient(var(--tui-vfd), var(--tui-vfd)) calc(var(--lo) * 100%) 0 / 1px 100% no-repeat,
    linear-gradient(var(--tui-vfd), var(--tui-vfd)) calc(var(--hi) * 100%) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--n) - 2px), var(--tui-vfd-bg) calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}
.tui-meter--bare .tui-meter__strip::after {
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--n) - 2px), var(--tui-vfd-bg) calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}

/* The native element, with its own face taken off: only the lit length is left. */
.tui-meter__strip > meter {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  margin: 0;
  border: 0;
  background: none;
  vertical-align: top;
}
.tui-meter__strip > meter::-webkit-meter-inner-element { display: flex; width: 100%; height: 100%; background: none; }
.tui-meter__strip > meter::-webkit-meter-bar { height: 100%; border: 0; border-radius: 0; background: none; box-shadow: none; }
.tui-meter__strip > meter::-webkit-meter-optimum-value,
.tui-meter__strip > meter::-webkit-meter-suboptimum-value,
.tui-meter__strip > meter::-webkit-meter-even-less-good-value { height: 100%; box-shadow: 0 0 8px color-mix(in oklab, var(--c) 60%, transparent); transition: width 120ms linear; }
.tui-meter__strip > meter::-webkit-meter-optimum-value { --c: var(--tui-green); background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--c); }
.tui-meter__strip > meter::-webkit-meter-suboptimum-value { --c: var(--tui-amber); background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--c); }
.tui-meter__strip > meter::-webkit-meter-even-less-good-value { --c: var(--tui-red); background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--c); }
.tui-meter__strip > meter::-moz-meter-bar { background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--tui-green); }
.tui-meter__strip > meter:-moz-meter-sub-optimum::-moz-meter-bar { background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--tui-amber); }
.tui-meter__strip > meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--tui-red); }

/* The state the page says is the state the lit length shows: a value a page calls poor (an alarm the strip's own thresholds do not draw) is lit red, like its lamp. */
.tui-meter[data-state="poor"] > .tui-meter__strip > meter::-webkit-meter-optimum-value,
.tui-meter[data-state="poor"] > .tui-meter__strip > meter::-webkit-meter-suboptimum-value { --c: var(--tui-red); }
.tui-meter[data-state="poor"] > .tui-meter__strip > meter::-moz-meter-bar { background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--tui-red); }

/* The marks: a tick under the strip and its figure, set where the value is. A
   mark leans away from the edge it is near, so the first and last never leave
   the plate. */
/* Stale: the bar is the last value, not a live one (data-stale on it or a region around it). */
.tui-meter__strip:is([data-stale], [data-stale] *) > meter { opacity: 0.45; }
.tui-meter__marks { position: relative; height: 22px; margin: -2px 2px 0; }
.tui-meter__mark { position: absolute; top: 0; left: calc(var(--at) * 100%); width: 0; }
.tui-meter__mark::before { content: ''; position: absolute; left: 0; top: 0; width: 1px; height: 6px; margin-left: -0.5px; background: var(--tui-ink-2); }
.tui-meter__mark > span { position: absolute; top: 9px; left: 0; display: block; white-space: nowrap; transform: translateX(calc(var(--at) * -100%)); font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-meter__mark--cut > span { color: var(--tui-ink); font-weight: 700; }
.tui-meter__mark--cut::before { height: 8px; width: 1.5px; margin-left: -0.75px; background: var(--tui-ink); }

@media (prefers-reduced-motion: reduce) {
  .tui-meter__strip > meter::-webkit-meter-optimum-value, .tui-meter__strip > meter::-webkit-meter-suboptimum-value, .tui-meter__strip > meter::-webkit-meter-even-less-good-value { transition: none; }
}

/* ---------------------------------------------------------------- part: model-picker */
/* Model picker: a well showing the model in use and a card of rows that opens
   from it, as the combobox's card does. Each row is a lamp (lit on the model in
   use), the name and a line about it, and the legends the choice turns on:
   speed and cost, each a ladder of three and a word, and the size of the
   context. The ladders are the legend's picture; the word beside them is what
   is said. Native select underneath; model-picker.mjs draws and wires it. */
tui-model-picker { position: relative; display: block; min-width: 0; }
tui-model-picker:not([data-ready]) .tui-select { width: 100%; }

.tui-model-picker__trigger {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 6px 42px 6px var(--tui-3);
  border: 0;
  border-radius: calc(var(--tui-r-m) + 4px);
  font: inherit;
  text-align: left;
  color: var(--tui-ink);
  cursor: pointer;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  -webkit-tap-highlight-color: transparent;
}
.tui-model-picker__trigger:focus-visible, .tui-model-picker__trigger.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* The arrow, printed on the well's end. */
.tui-model-picker__trigger::after { content: ''; position: absolute; right: 14px; top: calc(50% - 2px); width: 8px; height: 5px; background: var(--tui-ink-2); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform 150ms var(--tui-ease); }
tui-model-picker[data-open] .tui-model-picker__trigger::after { transform: scaleY(-1); }
tui-model-picker[disabled] .tui-model-picker__trigger { opacity: 0.45; cursor: not-allowed; }
.tui-model-picker__current { display: grid; gap: 2px; min-width: 0; }
.tui-model-picker__name { font: 600 var(--tui-t-body)/1.25 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-model-picker__brief { font: 500 var(--tui-t-small)/1.25 var(--tui-sans); color: var(--tui-ink-2); }

/* The card. */
.tui-model-picker__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  width: min(460px, calc(100vw - 16px));
  max-height: min(420px, max(180px, var(--tui-room, 420px)));
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-radius: 11px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  text-align: left;
}
.tui-model-picker__card[popover]:not(:popover-open) { display: none; }
.tui-model-picker__card:popover-open { animation: tui-model-picker-out 150ms var(--tui-ease); }
@keyframes tui-model-picker-out { from { opacity: 0; transform: translateY(-6px); } }
.tui-model-picker__card:popover-open:not([data-placed]) { opacity: 0; }

.tui-model-picker__list { display: grid; gap: 2px; min-width: 0; outline: none; }
.tui-model-picker__list--inline { padding: 5px; border-radius: calc(var(--tui-r-m) + 4px); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-model-picker__list--inline:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-model-picker__row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  grid-template-areas: "lamp text" ". legends";
  align-items: start;
  column-gap: var(--tui-3);
  row-gap: 6px;
  padding: 9px 10px 10px 9px;
  border-radius: 7px;
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-model-picker__row > .tui-lamp { grid-area: lamp; width: 8px; height: 8px; margin: 5px auto 0; --c: var(--tui-green); }
.tui-model-picker__text { grid-area: text; display: grid; gap: 1px; min-width: 0; }
.tui-model-picker__use { font-weight: 500; color: var(--tui-ink-2); }
.tui-model-picker__hint { font: 400 var(--tui-t-small)/1.35 var(--tui-sans); color: var(--tui-ink-2); }
.tui-model-picker__legends { grid-area: legends; display: flex; flex-wrap: wrap; gap: 2px var(--tui-4); }
.tui-model-picker__legend { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-model-picker__legend-name { font: 600 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; }
.tui-model-picker__legend-word { color: var(--tui-ink); font-weight: 600; }
/* The ladder: three small segments, lit as far as the level goes, so it reads without colour. */
.tui-model-picker__ladder { display: inline-flex; gap: 2px; }
.tui-model-picker__ladder i { width: 8px; height: 10px; border-radius: 1.5px; background: transparent; box-shadow: inset 0 0 0 1px var(--tui-ink-2); }
.tui-model-picker__ladder i[data-on] { background: var(--tui-ink); box-shadow: none; }
.tui-model-picker__row.is-active, .tui-model-picker__row:hover { background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-model-picker__row[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-model-picker__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-model-picker__trigger { min-height: 52px; }
  .tui-model-picker__row { padding-top: 12px; padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-model-picker__card:popover-open, .tui-model-picker__trigger::after { animation: none; transition: none; }
}

/* ---------------------------------------------------------------- part: money-field */
/* Money field: an amount in the field's well, with its currency printed on the
   floor at the left, parted from the figures by an engraved line, as the input
   group prints a prefix. The figures are set right, in tabular numerals, so a
   column of amounts lines up on the decimal. With several currencies the code
   is a native select on the same floor. The well, the engraved line and the
   red lip of an error are the kit's, so every finish and both volumes are
   theirs. Without the script it is a text field with its currency beside it. */
tui-money-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.tui-money-field__well {
  --mf-h: 38px;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: var(--mf-h);
  padding: 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: clip;
  cursor: text;
}
.tui-money-field__well:has(.tui-money-field__input:focus-visible), .tui-money-field__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-money-field__well:has(.tui-money-field__input[aria-invalid="true"]) {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
.tui-money-field__well:has(.tui-money-field__input:disabled) { opacity: 0.45; cursor: not-allowed; }

/* The currency, printed on the floor. */
.tui-money-field__legend {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: stretch;
  padding: 0 10px 0 var(--tui-3);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink-2);
  white-space: nowrap;
  user-select: none;
  cursor: default;
  box-shadow: inset -1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), inset -2px 0 0 var(--tui-hl);
}
.tui-money-field__sym { color: var(--tui-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tui-money-field__sym:empty { display: none; }
.tui-money-field__code { letter-spacing: 0.04em; }
.tui-money-field__select {
  appearance: none;
  align-self: stretch;
  margin: 0 -4px 0 0;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 6px;
  font: inherit;
  letter-spacing: 0.04em;
  color: inherit;
  cursor: pointer;
  background:
    linear-gradient(45deg, transparent 50%, var(--tui-ink-2) 50%) calc(100% - 7px) 55% / 4px 4px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--tui-ink-2) 50%) calc(100% - 3px) 55% / 4px 4px no-repeat,
    transparent;
}
.tui-money-field__select:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-money-field__select:disabled { cursor: not-allowed; }
tui-money-field[data-readonly] .tui-money-field__select:disabled { opacity: 1; color: var(--tui-ink-2); cursor: default; background-image: none; padding-right: 0; margin-right: 0; }

.tui-money-field__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3) 0 var(--tui-2);
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: inherit;
  background: transparent;
  outline: none;
}
.tui-money-field__input::placeholder { color: var(--tui-ink-3); }
.tui-money-field__input:disabled { cursor: not-allowed; }
.tui-money-field__input:read-only:not(:disabled) { cursor: default; }

/* Why an amount is refused, under the well. */
.tui-money-field__error { color: var(--tui-red-ink, var(--tui-red)); }
.tui-money-field__error[hidden] { display: none; }
.tui-money-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-money-field__legend { box-shadow: inset -1px 0 0 var(--tui-quiet-line-2); }
}

@media (pointer: coarse) {
  .tui-money-field__well { --mf-h: 52px; }
  .tui-money-field__input, .tui-money-field__select, .tui-money-field__legend { font-size: 16px; }
  .tui-money-field__select { min-height: 44px; min-width: 56px; }
}

/* ---------------------------------------------------------------- part: mount-cutter */
/* Mount cutter: a picture framer's mat board laid over a picture, its
   window cut to a size and slid until it frames the crop. Two engraved
   scales (top, left) run along the board's outer edge and an index on each
   reads where the window's near corner sits; a plate below prints the crop
   in full. The window is a real button: a finger or a pointer moves it,
   arrow keys move it by a step, Alt+arrow keys (and the corner grip) resize
   it. mount-cutter.mjs builds and moves it; nothing here is a plate, rack,
   rail, slot, drawer or lamp borrowed from another part, only the
   raised/well/focus tokens every part reads. */

.tui-mountcutter {
  --mc-b: 5px; /* the bevel's width, the same on all four sides */
  position: relative;
  display: inline-grid;
  gap: var(--tui-2);
  max-width: 100%;
}

/* The board: 12px of margin on its top and left for the two scales (kept
   outside the stage so the stage's own overflow:hidden never clips a tick),
   then the stage: the picture, the mat over it, the bevel and the cutter. */
.tui-mountcutter__board {
  position: relative;
  width: calc(var(--mc-w) + 12px);
  height: calc(var(--mc-h) + 12px);
  max-width: 100%;
}
.tui-mountcutter__stage {
  position: absolute;
  left: 12px;
  top: 12px;
  width: var(--mc-w);
  height: var(--mc-h);
  border-radius: var(--tui-r-m);
  overflow: hidden;
  background: var(--tui-well-fill) var(--tui-well);
}
/* The board's well, drawn over the mat so the mat reads as seated in it. */
.tui-mountcutter__stage::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--tui-inset);
  pointer-events: none;
}

/* ---- The picture: a landscape at golden hour, fixed under the mat and
   filling all of it. Its own palette, every colour a lamp hue or the
   paper tokens mixed in oklab (finish-invariant, so the same picture sits
   on graphite and aluminium alike); the shapes are path() clips traced in
   mount-cutter.mjs, the paint is here. */
.tui-mountcutter__picture {
  --mc-ink: color-mix(in oklab, var(--tui-blue) 45%, var(--tui-paper-ink));
  --mc-sky: color-mix(in oklab, var(--tui-blue) 52%, var(--tui-paper-hi));
  --mc-pale: color-mix(in oklab, var(--tui-blue) 16%, var(--tui-paper-hi));
  --mc-warm: color-mix(in oklab, var(--tui-amber) 38%, var(--tui-paper-hi));
  --mc-gold: color-mix(in oklab, var(--tui-amber) 70%, var(--tui-paper-hi));
  --mc-sun: color-mix(in oklab, var(--tui-amber) 18%, var(--tui-paper-hi));
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 46% 38% at 70% 46%, color-mix(in oklab, var(--mc-gold) 55%, transparent), transparent 70%),
    linear-gradient(180deg,
      color-mix(in oklab, var(--mc-ink) 55%, var(--mc-sky)) 0%,
      var(--mc-sky) 22%,
      var(--mc-pale) 42%,
      var(--mc-warm) 54%,
      var(--mc-gold) 64%);
}
.tui-mountcutter__picture > i, .tui-mountcutter__lake > i { position: absolute; display: block; }
.tui-mountcutter__layer { inset: 0; }
.tui-mountcutter__sun {
  left: 70%;
  top: 44%;
  width: 7%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mc-sun) 0 52%, color-mix(in oklab, var(--mc-gold) 70%, transparent) 64%, transparent 72%);
  box-shadow: 0 0 18px 8px color-mix(in oklab, var(--mc-gold) 45%, transparent);
}
/* Long thin clouds: high ones cool against the blue, low ones lit gold by the sun. */
.tui-mountcutter__clouds {
  inset: 0;
  --mc-cool: color-mix(in oklab, var(--tui-paper-hi) 78%, transparent);
  --mc-lit: color-mix(in oklab, color-mix(in oklab, var(--tui-amber) 30%, var(--tui-paper-hi)) 90%, transparent);
  background:
    radial-gradient(ellipse 15% 2.4% at 20% 13%, var(--mc-cool), transparent),
    radial-gradient(ellipse 10% 1.8% at 29% 17%, var(--mc-cool), transparent),
    radial-gradient(ellipse 13% 2% at 88% 11%, var(--mc-cool), transparent),
    radial-gradient(ellipse 19% 2.4% at 58% 27%, var(--mc-lit), transparent),
    radial-gradient(ellipse 9% 1.6% at 47% 31%, var(--mc-lit), transparent),
    radial-gradient(ellipse 14% 1.8% at 84% 33%, var(--mc-lit), transparent),
    radial-gradient(ellipse 11% 1.5% at 14% 36%, var(--mc-lit), transparent);
}
.tui-mountcutter__birds { background: color-mix(in oklab, var(--mc-ink) 70%, var(--tui-paper-ink)); }
.tui-mountcutter__far {
  background:
    linear-gradient(90deg, transparent 35%, color-mix(in oklab, var(--mc-warm) 40%, transparent) 72%, transparent 95%),
    linear-gradient(180deg,
    color-mix(in oklab, var(--tui-blue) 30%, color-mix(in oklab, var(--tui-paper-hi) 84%, var(--tui-paper-ink))) 26%,
    color-mix(in oklab, var(--tui-blue) 22%, color-mix(in oklab, var(--tui-paper-hi) 90%, var(--tui-paper-ink))) 44%,
    var(--mc-warm) 62%);
}
.tui-mountcutter__mid {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--tui-blue) 40%, color-mix(in oklab, var(--tui-paper-hi) 58%, var(--tui-paper-ink))) 40%,
    color-mix(in oklab, var(--tui-blue) 26%, color-mix(in oklab, var(--tui-paper-hi) 72%, var(--tui-paper-ink))) 52%,
    color-mix(in oklab, var(--mc-warm) 70%, var(--tui-blue)) 62%);
}
/* The haze in the valley between the mountains and the shore. */
.tui-mountcutter__haze {
  left: 0;
  right: 0;
  top: 42%;
  height: 21%;
  background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--mc-warm) 60%, transparent) 75%, transparent);
}
.tui-mountcutter__near {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--tui-green) 26%, color-mix(in oklab, var(--tui-blue) 30%, var(--tui-paper-ink))) 46%,
    color-mix(in oklab, var(--tui-green) 22%, color-mix(in oklab, var(--tui-blue) 40%, color-mix(in oklab, var(--tui-paper-ink) 70%, var(--tui-paper-hi)))) 62%);
}
/* The lake: sky colour deepening toward the shore, the ranges mirrored in it
   (the same clip flipped at the 62% waterline), a column of sun glitter and
   fine ripple lines, all a touch soft as water is. */
.tui-mountcutter__lake {
  position: absolute;
  inset: 0;
  clip-path: inset(62% 0 0 0);
  filter: blur(0.35px);
  background: linear-gradient(180deg,
    transparent 61%,
    color-mix(in oklab, var(--mc-sun) 80%, transparent) 62%,
    color-mix(in oklab, var(--mc-warm) 85%, var(--mc-sky)) 62.8%,
    color-mix(in oklab, var(--mc-pale) 60%, var(--mc-sky)) 72%,
    color-mix(in oklab, var(--mc-sky) 60%, var(--mc-ink)) 92%);
}
.tui-mountcutter__lake::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 2.4px, color-mix(in oklab, var(--tui-paper-hi) 18%, transparent) 2.4px 3px);
  mask-image: linear-gradient(180deg, transparent 66%, var(--tui-paper-ink) 78%, var(--tui-paper-ink) 86%, transparent 92%);
}
.tui-mountcutter__reflect {
  transform: scaleY(-1);
  transform-origin: 50% 62%;
  opacity: 0.62;
  /* fades with distance from the waterline: in local (unflipped) space that is upward */
  mask-image: linear-gradient(180deg, transparent 42%, var(--tui-paper-ink) 58%);
}
.tui-mountcutter__glitter {
  left: 66%;
  width: 8%;
  top: 62%;
  height: 22%;
  background: repeating-linear-gradient(180deg, color-mix(in oklab, var(--mc-sun) 85%, transparent) 0 1.3px, transparent 1.3px 3.2px);
  mask-image: radial-gradient(ellipse 50% 100% at 50% 0, var(--tui-paper-ink), transparent);
}
.tui-mountcutter__fore {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--tui-green) 26%, color-mix(in oklab, var(--tui-blue) 14%, var(--tui-paper-ink))) 20%,
    color-mix(in oklab, var(--tui-green) 12%, var(--tui-paper-ink)) 100%);
}

/* ---- The mat: one opaque sheet of cream card over the whole picture, its
   window (the crop plus the bevel on every side) cut out of it by an
   even-odd clip, so the card is one piece with a hole, never four strips.
   Paper is paper in any finish (--tui-paper, warmed a little toward cream);
   a fine grain and a scatter of fibres make it read as card, and a faint
   fall-off from the lamp (top) keeps it from reading as flat fill. */
.tui-mountcutter__mat {
  position: absolute;
  inset: 0;
  background:
    var(--tui-noise),
    linear-gradient(170deg, color-mix(in oklab, var(--tui-paper-hi) 45%, transparent), transparent 40%, color-mix(in oklab, var(--tui-paper-ink) 7%, transparent)),
    color-mix(in oklab, var(--tui-paper) 90%, var(--tui-amber));
  clip-path: polygon(evenodd,
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    calc(var(--wx) - var(--mc-b)) calc(var(--wy) - var(--mc-b)),
    calc(var(--wx) + var(--ww) + var(--mc-b)) calc(var(--wy) - var(--mc-b)),
    calc(var(--wx) + var(--ww) + var(--mc-b)) calc(var(--wy) + var(--wh) + var(--mc-b)),
    calc(var(--wx) - var(--mc-b)) calc(var(--wy) + var(--wh) + var(--mc-b)),
    calc(var(--wx) - var(--mc-b)) calc(var(--wy) - var(--mc-b)));
  transition: clip-path 90ms var(--tui-ease);
}
.tui-mountcutter__fibres { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tui-mountcutter__fibre { fill: none; stroke: color-mix(in oklab, var(--tui-paper-ink) 9%, transparent); stroke-width: 0.35; stroke-linecap: round; }
.tui-mountcutter__fibre--pale { stroke: color-mix(in oklab, var(--tui-paper-hi) 70%, transparent); stroke-width: 0.5; }

/* ---- The bevel: the 45-degree cut through the card to its white core,
   --mc-b wide on all four sides, its four faces mitred corner to corner.
   Like the kit's own wells it is lit from above: the bottom face looks up
   at the lamp and is the brightest white, the two sides less so, and the
   top face, looking down at the picture, sits in its own shade. A hairline
   of shadow where the cut meets the picture seats the card on it. */
.tui-mountcutter__bevel {
  position: absolute;
  left: calc(var(--wx) - var(--mc-b));
  top: calc(var(--wy) - var(--mc-b));
  width: calc(var(--ww) + 2 * var(--mc-b));
  height: calc(var(--wh) + 2 * var(--mc-b));
  pointer-events: none;
  transition: left 90ms var(--tui-ease), top 90ms var(--tui-ease), width 90ms var(--tui-ease), height 90ms var(--tui-ease);
}
.tui-mountcutter__bevel::after {
  content: '';
  position: absolute;
  inset: var(--mc-b);
  box-shadow: inset 0 1px 1.5px color-mix(in oklab, var(--tui-paper-ink) 45%, transparent), inset 0 0 0 0.5px color-mix(in oklab, var(--tui-paper-ink) 25%, transparent);
}
.tui-mountcutter__bevel-face { position: absolute; inset: 0; }
.tui-mountcutter__bevel-face { --core: color-mix(in oklab, var(--tui-paper-hi) 70%, var(--tui-white)); }
.tui-mountcutter__bevel-face--bottom {
  background: linear-gradient(var(--core), color-mix(in oklab, var(--core) 80%, var(--tui-paper-hi)));
  clip-path: polygon(0 100%, 100% 100%, calc(100% - var(--mc-b)) calc(100% - var(--mc-b)), var(--mc-b) calc(100% - var(--mc-b)));
}
.tui-mountcutter__bevel-face--left {
  background: color-mix(in oklab, var(--core) 94%, var(--tui-paper-ink));
  clip-path: polygon(0 0, var(--mc-b) var(--mc-b), var(--mc-b) calc(100% - var(--mc-b)), 0 100%);
}
.tui-mountcutter__bevel-face--right {
  background: color-mix(in oklab, var(--core) 92%, var(--tui-paper-ink));
  clip-path: polygon(100% 0, 100% 100%, calc(100% - var(--mc-b)) calc(100% - var(--mc-b)), calc(100% - var(--mc-b)) var(--mc-b));
}
.tui-mountcutter__bevel-face--top {
  background: color-mix(in oklab, var(--core) 84%, var(--tui-paper-ink));
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--mc-b)) var(--mc-b), var(--mc-b) var(--mc-b));
}

/* ---- The cutter, shown only while a pointer moves or sizes the window: a
   steel straight edge standing on the mat along the cut (left of the
   window while moving it, right while sizing it, mirrored), engraved every
   10px, and the cutting head riding it with its blade on the line. */
.tui-mountcutter__rule {
  --steel-hi: color-mix(in oklab, var(--tui-white) 94%, var(--tui-paper-ink));
  --steel: color-mix(in oklab, var(--tui-white) 74%, var(--tui-paper-ink));
  --steel-lo: color-mix(in oklab, var(--tui-white) 56%, var(--tui-paper-ink));
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  left: calc(var(--wx) - var(--mc-b) - 12px);
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--steel-lo) 0 1px, transparent 1px) right 0 top 0 / 7px 50px repeat-y,
    linear-gradient(180deg, var(--steel-lo) 0 1px, transparent 1px) right 0 top 0 / 4px 10px repeat-y,
    linear-gradient(90deg, var(--steel) 0%, var(--steel-hi) 30%, var(--steel) 62%, var(--steel-hi) 86%, var(--steel-lo) 100%);
  box-shadow: inset 0 0 0 0.5px var(--steel-lo), -2px 0 4px color-mix(in oklab, var(--tui-paper-ink) 35%, transparent);
  transition: opacity 120ms var(--tui-ease);
}
.tui-mountcutter[data-dragging] .tui-mountcutter__rule, .is-down .tui-mountcutter__rule { opacity: 1; }
.tui-mountcutter[data-dragging="size"] .tui-mountcutter__rule { left: calc(var(--wx) + var(--ww) + var(--mc-b)); transform: scaleX(-1); }
.tui-mountcutter__head {
  position: absolute;
  left: -2px;
  width: 15px;
  height: 26px;
  top: calc(var(--wy) - var(--mc-b) - 6px);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 36%, var(--steel-hi) 0 2px, var(--steel-lo) 2.5px 3.5px, transparent 4px),
    linear-gradient(180deg, color-mix(in oklab, var(--tui-paper-ink) 70%, var(--tui-white)), color-mix(in oklab, var(--tui-paper-ink) 88%, var(--tui-white)));
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-white) 35%, transparent), 0 2px 4px color-mix(in oklab, var(--tui-paper-ink) 50%, transparent);
}
.tui-mountcutter[data-dragging="size"] .tui-mountcutter__head { top: calc(var(--wy) + var(--wh) - 30px); }
/* The blade: a bright steel point standing out of the head onto the cut line. */
.tui-mountcutter__blade {
  position: absolute;
  right: -5px;
  bottom: 3px;
  width: 6px;
  height: 9px;
  background: linear-gradient(90deg, var(--steel-hi), var(--steel));
  clip-path: polygon(0 0, 100% 45%, 100% 100%, 0 100%);
}

/* The two scales: fine ticks along the board's outer edge, a longer one
   every fifth, a sliding index that reads off the window's near corner. */
.tui-mountcutter__scale {
  position: absolute;
  color: var(--tui-ink-3);
}
.tui-mountcutter__scale--top { top: 1px; left: 12px; width: var(--mc-w); height: 9px; }
.tui-mountcutter__scale--left { left: 1px; top: 12px; height: var(--mc-h); width: 9px; }
.tui-mountcutter__tick {
  position: absolute;
  background: currentColor;
  opacity: 0.55;
}
.tui-mountcutter__scale--top .tui-mountcutter__tick { left: var(--at); top: 5px; width: 1px; height: 4px; }
.tui-mountcutter__scale--top .tui-mountcutter__tick--major { top: 2px; height: 7px; opacity: 0.85; }
.tui-mountcutter__scale--left .tui-mountcutter__tick { top: var(--at); left: 5px; height: 1px; width: 4px; }
.tui-mountcutter__scale--left .tui-mountcutter__tick--major { left: 2px; width: 7px; opacity: 0.85; }
.tui-mountcutter__index {
  position: absolute;
  background: var(--tui-amber);
  box-shadow: 0 0 4px 0 color-mix(in oklab, var(--tui-amber) 65%, transparent);
  border-radius: 1px;
  transition: left 90ms var(--tui-ease), top 90ms var(--tui-ease);
}
.tui-mountcutter__index--top { left: var(--at); top: 0; width: 2px; height: 9px; }
.tui-mountcutter__index--left { top: var(--at); left: 0; height: 2px; width: 9px; }

/* The window: a real button over the picture's visible part, sized and
   placed by the same numbers as the mat's cut, so pressing it never drifts
   from what is shown. Its focus ring sits just outside the bevel. */
.tui-mountcutter__window {
  position: absolute;
  left: calc(12px + var(--mc-x));
  top: calc(12px + var(--mc-y));
  width: var(--mc-ww);
  height: var(--mc-wh);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: transparent;
  cursor: move;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: left 90ms var(--tui-ease), top 90ms var(--tui-ease), width 90ms var(--tui-ease), height 90ms var(--tui-ease);
}
.tui-mountcutter__window:focus-visible, .tui-mountcutter__window.is-focus, .is-focus .tui-mountcutter__window {
  outline: 2px solid var(--tui-focus);
  outline-offset: calc(var(--mc-b) + 2px);
}
.tui-mountcutter__window:disabled { cursor: not-allowed; }
/* The size grip: a raised stud on the bevel's outer bottom-right corner. */
.tui-mountcutter__grip--size {
  position: absolute;
  right: calc(-1 * var(--mc-b) - 5px);
  bottom: calc(-1 * var(--mc-b) - 5px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
  cursor: nwse-resize;
}
.tui-mountcutter__window:disabled .tui-mountcutter__grip--size { cursor: not-allowed; }
.tui-mountcutter__window:disabled ~ .tui-mountcutter__readout { opacity: 0.6; }

/* The printed readout: the crop in full, in the same words as the live region. */
.tui-mountcutter__readout {
  justify-self: start;
  padding: 3px var(--tui-2);
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-mountcutter__digit {
  font: 600 12px/1.3 var(--tui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--tui-ink-2);
}
.tui-mountcutter__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Compact: the readout plate is dropped, for a thumbnail list or a dense table row. */
.tui-mountcutter--compact .tui-mountcutter__readout { display: none; }

/* While a pointer drags, everything tracks it one to one. */
.tui-mountcutter[data-dragging] :is(.tui-mountcutter__mat, .tui-mountcutter__bevel, .tui-mountcutter__index, .tui-mountcutter__window) { transition: none; }

@media (pointer: coarse) {
  .tui-mountcutter__grip--size { width: 16px; height: 16px; right: calc(-1 * var(--mc-b) - 8px); bottom: calc(-1 * var(--mc-b) - 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-mountcutter__index, .tui-mountcutter__mat, .tui-mountcutter__bevel, .tui-mountcutter__rule, .tui-mountcutter__window { transition: none; }
}

/* ---------------------------------------------------------------- part: multi-select */
/* Multi-select: the combobox, set to take several. Each choice is set down in
   the well as a tag, the card stays out while you choose the next, and the
   foot of the card prints how many are chosen with a key that lets them all
   go. The well, the tags, the card and the option lamps (green, one for each
   chosen) are the combobox's own, so this file repeats only the rules the
   combobox keys on its own element name, and draws the foot. */
tui-multi-select { position: relative; display: block; min-width: 0; }
tui-multi-select[data-disabled] { opacity: 0.45; cursor: not-allowed; }
tui-multi-select.is-focus .tui-combobox__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-multi-select[data-open] .tui-combobox__well::after { opacity: 1; }
tui-multi-select[data-open]:has(.tui-combobox__card[data-placed="top"]) .tui-combobox__well::after { opacity: 0; }
tui-multi-select[data-open] .tui-combobox__key { transform: translateY(1.5px); filter: brightness(0.97); box-shadow: var(--tui-pressed); color: var(--tui-ink); }
tui-multi-select[data-open] .tui-combobox__key::before { transform: scaleY(-1); }

/* Before the script it is the browser's multiple select, opened out into the same recess. */
tui-multi-select > select[multiple] { height: auto; min-height: 96px; padding: 4px; border-radius: calc(var(--tui-r-m) + 4px); background: var(--tui-well-fill) var(--tui-well); cursor: default; }
tui-multi-select > select option { padding: 7px 10px; border-radius: var(--tui-r-m); }

/* The foot: a ruled line, the count printed on the left, the key on the right. */
.tui-multi-select__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-2);
  margin-top: 4px;
  padding: 5px 2px 0 10px;
  border-top: 1px solid var(--tui-rule);
}
.tui-multi-select__count { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-multi-select__foot .tui-key[hidden] { display: none; }

@media (pointer: coarse) {
  tui-multi-select .tui-combobox__well { min-height: 52px; padding-right: 52px; }
  tui-multi-select .tui-combobox__tag { height: 44px; min-width: 44px; }
  tui-multi-select .tui-combobox__option { min-height: 44px; }
  tui-multi-select .tui-combobox__key { width: 44px; height: 44px; }
  tui-multi-select .tui-combobox__input { font-size: 16px; height: 44px; }
  .tui-multi-select__foot .tui-key { --h: 44px; }
}

/* ---------------------------------------------------------------- part: navigation-menu */
/* Navigation menu: the top of a site. A row of plain links and of keys that
   open a panel of links beneath the bar, one panel at a time. The bar is flat
   on whatever it sits on; the open key, and the page you are on, are pressed
   in; the panel is a card hung under the bar, its links pressed into it under
   the finger. A lit lamp marks the current page, as in the side rail. Narrow,
   it folds to one Menu key that opens the same links as a stacked list, each
   key opening its links in place. The part asks its own width, not the page's.
   navigation-menu.mjs gives it the hover, the keys and the panel's place. */
.tui-navmenu {
  position: relative;
  display: block;
  min-width: 0;
  container: tui-navmenu / inline-size;
  font: 400 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink);
}
.tui-navmenu__toggle { display: none; }
.tui-navmenu__list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-1); margin: 0; padding: 0; list-style: none; }
.tui-navmenu__item { display: flex; min-width: 0; margin: 0; }

/* A plain link and a key that opens a panel look alike. */
.tui-navmenu__link, .tui-navmenu__trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--tui-2);
  box-sizing: border-box;
  min-height: 36px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink-2);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-navmenu__link:hover, .tui-navmenu__trigger:hover, .tui-navmenu__link.is-hover, .tui-navmenu__trigger.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 50%, transparent); }
/* Out, or the page you are on: pressed into the bar. */
.tui-navmenu__trigger[aria-expanded="true"], .tui-navmenu__link[aria-current="page"] { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-navmenu__trigger[data-current] { color: var(--tui-ink); }
.tui-navmenu__link:focus-visible, .tui-navmenu__trigger:focus-visible, .tui-navmenu__entry:focus-visible, .tui-navmenu__link.is-focus, .tui-navmenu__trigger.is-focus, .tui-navmenu__entry.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-navmenu__link > .tui-lamp, .tui-navmenu__entry > .tui-lamp { flex: none; }

/* A printed arrow says a panel comes out of the key. */
.tui-navmenu__trigger::after, .tui-navmenu__toggle::after {
  content: '';
  flex: none;
  width: 7px;
  height: 4px;
  margin-right: -2px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0.8;
  transition: transform 120ms var(--tui-ease);
}
.tui-navmenu__trigger[aria-expanded="true"]::after, .tui-navmenu__toggle[aria-expanded="true"]::after { transform: scaleY(-1); }

/* The panel: a card under the bar, as wide as its links need. */
.tui-navmenu__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  box-sizing: border-box;
  width: min(var(--nm-w, 34rem), 100%);
  padding: 8px;
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.25),
    0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  animation: tui-navmenu-in 140ms var(--tui-ease);
}
/* Moving across from another panel it simply changes: no replay. */
.tui-navmenu__panel[data-swap] { animation: none; }
/* The gap between the key and the card is part of the card, so the pointer can cross it. */
.tui-navmenu__panel::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 8px; }
@keyframes tui-navmenu-in { from { opacity: 0; transform: translateY(-4px); } }

.tui-navmenu__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin: 0; padding: 0; list-style: none; }
.tui-navmenu__links > li { display: flex; min-width: 0; margin: 0; }
/* A featured link leads, across the whole width, with the others in columns under it. */
.tui-navmenu__links > li:has(> .tui-navmenu__entry--feature) { grid-column: 1 / -1; margin-bottom: 6px; }

/* A link in the panel: its name, and a line on where it goes. */
.tui-navmenu__entry {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  align-content: start;
  box-sizing: border-box;
  min-width: 0;
  padding: 10px 12px;
  border-radius: calc(var(--tui-r-l) - 8px);
  color: var(--tui-ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-navmenu__entry:hover, .tui-navmenu__entry:focus-visible, .tui-navmenu__entry.is-hover, .tui-navmenu__entry.is-focus { background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-navmenu__entry:focus-visible, .tui-navmenu__entry.is-focus { outline-offset: 0; }
.tui-navmenu__entry[aria-current="page"] { background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-navmenu__entry > .tui-lamp { position: absolute; top: 14px; right: 12px; }
.tui-navmenu__title { font: 600 var(--tui-t-body)/1.3 var(--tui-sans); color: var(--tui-ink); }
.tui-navmenu__entry[aria-current="page"] .tui-navmenu__title { padding-right: 16px; }
.tui-navmenu__desc { font: 400 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
/* The featured link is a key standing in the card. */
.tui-navmenu__entry--feature, .tui-navmenu__entry--feature:hover, .tui-navmenu__entry--feature:focus-visible, .tui-navmenu__entry--feature.is-hover, .tui-navmenu__entry--feature.is-focus, .tui-navmenu__entry--feature[aria-current="page"] {
  padding: 12px 14px;
  background: var(--tui-face-hi);
  box-shadow: var(--tui-raised);
}
.tui-navmenu__entry--feature:hover, .tui-navmenu__entry--feature.is-hover { filter: brightness(1.03); }
.tui-navmenu__entry--feature .tui-navmenu__title { font-size: var(--tui-t-lead); letter-spacing: -0.01em; }

/* Shown in the page's own flow (a specimen, a docs cell): the panel sits under the bar. */
.tui-navmenu--flow .tui-navmenu__item { display: contents; }
.tui-navmenu--flow .tui-navmenu__panel { position: relative; top: auto; left: auto; order: 1; flex: 0 0 100%; width: auto; margin-top: 6px; animation: none; }
.tui-navmenu--flow .tui-navmenu__panel::before { display: none; }

/* Narrow: one Menu key; the links stack, and each key opens its links in place. */
@container tui-navmenu (max-width: 440px) {
  .tui-navmenu__toggle { display: inline-flex; width: 100%; justify-content: space-between; }
  .tui-navmenu[data-ready]:not([data-open]) .tui-navmenu__list { display: none; }
  .tui-navmenu__list { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; margin-top: var(--tui-2); }
  .tui-navmenu__item, .tui-navmenu--flow .tui-navmenu__item { display: flex; flex-direction: column; }
  .tui-navmenu__item + .tui-navmenu__item { border-top: 1px solid var(--tui-rule); }
  .tui-navmenu__link, .tui-navmenu__trigger { justify-content: space-between; width: 100%; min-height: 44px; white-space: normal; text-align: left; }
  .tui-navmenu__link > .tui-lamp { order: 2; }
  .tui-navmenu__panel, .tui-navmenu--flow .tui-navmenu__panel {
    position: static;
    order: 0;
    flex: 0 1 auto;
    width: auto;
    margin: 0 0 var(--tui-2) var(--tui-3);
    padding: 0 0 0 var(--tui-2);
    border-radius: 0;
    background: none;
    box-shadow: inset 1px 0 0 var(--tui-rule);
    animation: none;
  }
  .tui-navmenu__panel::before { display: none; }
  .tui-navmenu__links { grid-template-columns: minmax(0, 1fr); }
  .tui-navmenu__links > li:has(> .tui-navmenu__entry--feature) { margin-bottom: 0; }
  .tui-navmenu__entry { min-height: 44px; }
  .tui-navmenu__entry--feature, .tui-navmenu__entry--feature:hover, .tui-navmenu__entry--feature:focus-visible { padding: 10px 12px; }
}

@media (pointer: coarse) {
  .tui-navmenu__toggle { --h: 44px; }
  .tui-navmenu__link, .tui-navmenu__trigger { min-height: 44px; }
  .tui-navmenu__entry { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-navmenu__panel { animation: none; }
  .tui-navmenu__trigger::after, .tui-navmenu__toggle::after { transition: none; }
}

/* With the slide well (slide-well.mjs) one recess travels along the bar, and one along each panel's links: a row no longer lights by itself, it only takes its ink. The well rests under the current page, else the open key. */
.tui-navmenu[data-slide] :is(.tui-navmenu__link, .tui-navmenu__trigger) { position: relative; }
.tui-navmenu[data-slide] :is(.tui-navmenu__link, .tui-navmenu__trigger):hover:not(.is-hover),
.tui-navmenu[data-slide] .tui-navmenu__trigger[aria-expanded="true"],
.tui-navmenu[data-slide] .tui-navmenu__link[aria-current="page"] { background: none; box-shadow: none; }
.tui-navmenu__panel[data-slide] .tui-navmenu__entry:not(.tui-navmenu__entry--feature):is(:hover, :focus-visible, [aria-current="page"]):not(.is-hover, .is-focus) { background: none; box-shadow: none; }
.tui-navmenu__panel[data-slide] .tui-slidewell { border-radius: calc(var(--tui-r-l) - 8px); }
@container tui-navmenu (max-width: 440px) {
  .tui-navmenu__panel[data-slide] { position: relative; }
}

/* ---------------------------------------------------------------- part: nosepiece-tabs */
/* Nosepiece tabs: a tab set worked like a microscope turret. A round, knurled
   turret holds three to five objective lenses on a real circle; the chosen
   lens swings into line above the panel, and a quiet aperture under it says
   which one is looking. Every barrel is a real tab, the turret gives them
   their circle, and the labels are turned back upright so they stay readable
   while the metal goes round. The turret is turned with the custom property
   below, which the script animates with the Web Animations API so a still can
   hold it mid-turn. Tokens only: every tone is the finish's. */
@property --tui-nosepiece-turn {
  syntax: '<angle>';
  inherits: true;
  initial-value: 0deg;
}

.tui-nosepiece {
  --np-size: clamp(150px, 44vw, 220px);
  --np-max: 220px;
  /* The smallest turret that holds together: below a 120px disc (a set 200px
     wide) the barrels and collars have no room left beside each other, however
     many lenses there are. The set never draws smaller than this; a container
     narrower than 200px lets it overflow rather than break it. */
  --np-min: 120px;
  position: relative;
  display: grid;
  align-content: start;
  width: 100%;
  min-width: calc(var(--np-min) * 1.66);
  justify-items: center;
  container-type: inline-size;
}

/* Without the script the real tablist is still a set of keys and the panels
   still honour their hidden attribute; the turret is what the script adds. */
.tui-nosepiece > [role="tablist"] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--tui-1);
}
.tui-nosepiece > [role="tablist"] > [role="tab"] {
  padding: var(--tui-2) var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
  font: 600 var(--tui-t-label)/1 var(--tui-sans);
  color: var(--tui-ink);
}
.tui-nosepiece > [role="tablist"] > [role="tab"][aria-selected="true"] { box-shadow: var(--tui-pressed); }

/* The bench the turret hangs in. The head keeps room for the lens that swings
   above the disc, the disc, and the lens that crosses it. */
.tui-nosepiece__head {
  --np-size: max(var(--np-min), min(var(--np-max), calc(100cqw / 1.66), 44vw));
  --np-pad: calc(var(--np-size) * 0.12);
  position: relative;
  width: min(100%, calc(var(--np-size) * 1.66));
  height: calc(var(--np-size) * 1.45);
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-nosepiece[data-dragging] .tui-nosepiece__head,
.tui-nosepiece[data-dragging] .tui-nosepiece__lens { cursor: grabbing; }

/* The turret: a shallow turned dome with a knurled rim round its edge, the
   ring a hand turns. The dome, its highlight and the light on the rim stand
   still, because the lamp does not move; the ridges and the boss's screw turn
   on --tui-nosepiece-turn, the same angle as every lens, so they stop dead
   when the chosen lens clicks into its detent. */
.tui-nosepiece__disc {
  position: absolute;
  left: 50%;
  top: var(--np-pad);
  z-index: 1;
  width: var(--np-size);
  height: var(--np-size);
  margin-left: calc(var(--np-size) / -2);
  border-radius: 50%;
  background:
    /* The turned step where the dome meets the rim: a dark groove all round,
       a shade deeper on the far side. */
    radial-gradient(ellipse 44% 40% at 50% 50%, transparent 0 91%, color-mix(in oklab, var(--tui-obj-dark) 46%, transparent) 97% 99.2%, transparent 100%),
    /* The lamp, fixed: a broad sheen high and to the left, and the far side
       of the dome settling into its own shadow. */
    radial-gradient(circle at 32% 23%, color-mix(in oklab, var(--tui-obj-lite) 52%, transparent), transparent 46%),
    radial-gradient(ellipse 44% 42% at 72% 78%, color-mix(in oklab, var(--tui-obj-dark) 30%, transparent), transparent 60%),
    /* The dome: a broad, nearly level crown, then a short fall to the rim,
       which reads as shallow rather than as a ball. */
    radial-gradient(circle 50% at 50% 50%,
      color-mix(in oklab, var(--tui-obj-dark) 4%, var(--tui-obj-body)) 0 34%,
      var(--tui-obj-body) 62%,
      color-mix(in oklab, var(--tui-obj-dark) 20%, var(--tui-obj-body)) 82%,
      color-mix(in oklab, var(--tui-obj-dark) 48%, var(--tui-obj-body)) 100%);
  box-shadow: var(--tui-raised);
}
/* The knurl: fine straight ridges all the way round, in the turn's own frame
   so they travel with the lenses. The mask cuts a seat in the underside of the
   dome; its ellipse is wider than it is tall, as a ring on a dome foreshortens
   toward the sides, so the rim reads as round rather than as a flat disc. */
.tui-nosepiece__disc::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from var(--tui-nosepiece-turn, 0deg) at 50% 50%,
    color-mix(in oklab, var(--tui-obj-lite) 42%, var(--tui-obj-body)) 0 0.6deg,
    var(--tui-obj-body) 0.6deg 1.5deg,
    color-mix(in oklab, var(--tui-obj-dark) 62%, var(--tui-obj-body)) 1.5deg 2.3deg,
    var(--tui-obj-body) 2.3deg 3.6deg);
  -webkit-mask: radial-gradient(ellipse 44% 40% at 50% 50%, transparent 0 99.4%, black 100%);
  mask: radial-gradient(ellipse 44% 40% at 50% 50%, transparent 0 99.4%, black 100%);
  /* A turned chamfer at the circumference, so the ridges end on a true circle
     instead of showing their teeth against the background. */
  clip-path: circle(48.8%);
}
/* The small turned boss at the centre of the dome. Its shading and turning
   marks are fixed; only the screw slot turns with the turret. */
.tui-nosepiece__hub {
  position: absolute;
  inset: 40%;
  z-index: 1;
  border-radius: 50%;
  background:
    linear-gradient(calc(var(--tui-nosepiece-turn, 0deg) + 90deg),
      transparent calc(50% - 1px),
      var(--tui-obj-dark) calc(50% - 1px) calc(50% + 1px),
      transparent calc(50% + 1px)),
    linear-gradient(var(--tui-nosepiece-turn, 0deg),
      transparent calc(50% - 1px),
      var(--tui-obj-dark) calc(50% - 1px) calc(50% + 1px),
      transparent calc(50% + 1px)),
    repeating-radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--tui-obj-lite) 20%, transparent) 0 0.5px, transparent 0.5px 2.4px),
    radial-gradient(circle at 34% 28%, color-mix(in oklab, var(--tui-obj-lite) 60%, var(--tui-obj-body)), var(--tui-obj-body) 50%, var(--tui-obj-dark));
  box-shadow: var(--tui-raised), inset 0 0 0 1px color-mix(in oklab, var(--tui-obj-lite) 30%, transparent);
}
/* The fixed light: a broad sheen from above left, a chamfer at the outer edge
   and a shadow under the far rim. It sits above the turning ridges and never
   turns with them, so the lamp stays where it is. */
.tui-nosepiece__face {
  position: absolute;
  left: 50%;
  top: var(--np-pad);
  z-index: 2;
  width: var(--np-size);
  height: var(--np-size);
  margin-left: calc(var(--np-size) / -2);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 30% 22%, color-mix(in oklab, var(--tui-obj-lite) 34%, transparent), transparent 54%);
  box-shadow:
    inset 0 1px 1px var(--tui-obj-spec),
    inset 0 0 0 2px color-mix(in oklab, var(--tui-obj-dark) 42%, transparent),
    inset 0 0 0 3px color-mix(in oklab, var(--tui-obj-lite) 36%, transparent),
    inset 0 -14px 22px -14px color-mix(in oklab, var(--tui-obj-dark) 48%, transparent);
}

/* Where the lenses hang: a zero-size point at the centre of the disc. Each
   lens turns about that point and then hangs out from it on its own radius.
   The group sits below the turret, so every barrel starts from a seat under
   the rim and the knurl passes over its top in every state. */
.tui-nosepiece__tabs {
  position: absolute;
  left: 50%;
  top: calc(var(--np-pad) + var(--np-size) / 2);
  z-index: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

/* One objective: a real tab, drawn as a tapered barrel with an engraved band
   and a dark front glass. The barrel turns with the turret; the round label
   collar is turned back so the words stay level. */
.tui-nosepiece__lens {
  --np-lens-w: max(44px, calc(var(--np-size) * 0.26));
  --np-lens-h: calc(var(--np-size) * var(--np-len, 0.38));
  --np-mount: calc(var(--np-size) * 0.42);
  --np-collar: max(38px, calc(var(--np-size) * 0.19));
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: var(--np-lens-w);
  height: var(--np-lens-h);
  margin-left: calc(var(--np-lens-w) / -2);
  padding: 0;
  border: 0;
  background: none;
  color: var(--tui-ink);
  font: inherit;
  transform-origin: 50% 0;
  transform: rotate(calc(var(--tui-nosepiece-turn, 0deg) + var(--a, 0deg))) translateY(var(--np-mount));
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-nosepiece__lens::before {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  top: 0;
  bottom: 3%;
  clip-path: polygon(6% 0, 94% 0, 100% 54%, 78% 92%, 22% 92%, 0 54%);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--tui-obj-lite) 52%, var(--tui-obj-body)) 0 7%, transparent 7% 100%),
    repeating-linear-gradient(180deg, transparent 0 9%, color-mix(in oklab, var(--tui-obj-dark) 55%, transparent) 9% 10.4%, transparent 10.4% 14%),
    linear-gradient(90deg, var(--tui-obj-dark), var(--tui-obj-body) 30%, color-mix(in oklab, var(--tui-obj-lite) 56%, var(--tui-obj-body)) 56%, var(--tui-obj-body) 78%, var(--tui-obj-dark));
  box-shadow:
    inset 1px 0 0 color-mix(in oklab, var(--tui-obj-lite) 60%, transparent),
    inset -1px 0 0 color-mix(in oklab, var(--tui-obj-dark) 65%, transparent),
    inset 0 1px 0 var(--tui-obj-spec);
}
/* The nose and its dark front glass, the end that looks at the panel. */
.tui-nosepiece__lens::after {
  content: '';
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: 0;
  height: 24%;
  border-radius: 2px 2px 7px 7px;
  background:
    radial-gradient(circle at 46% 74%, var(--tui-obj-dark) 0 26%, var(--tui-obj-body) 28% 35%, transparent 37%),
    radial-gradient(circle at 38% 62%, color-mix(in oklab, var(--tui-obj-spec) 40%, transparent) 0 10%, transparent 12%),
    linear-gradient(90deg, var(--tui-obj-dark), var(--tui-obj-body) 32%, color-mix(in oklab, var(--tui-obj-lite) 45%, var(--tui-obj-body)) 58%, var(--tui-obj-dark));
  box-shadow:
    inset 0 1px 0 var(--tui-obj-spec),
    inset 1px 0 0 color-mix(in oklab, var(--tui-obj-lite) 45%, transparent),
    inset 0 -1px 1px color-mix(in oklab, var(--tui-obj-dark) 70%, transparent);
}
/* The stamped band: a round collar let into the barrel at its middle, the
   name turned back upright so it stays readable at every angle. */
.tui-nosepiece__label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--np-collar);
  height: var(--np-collar);
  margin: calc(var(--np-collar) / -2) 0 0 calc(var(--np-collar) / -2);
  padding: 7% 5%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, color-mix(in oklab, var(--tui-obj-lite) 22%, transparent) 0 3deg, transparent 3deg 6deg),
    radial-gradient(circle at 38% 30%, var(--tui-face-hi), var(--tui-face) 62%, var(--tui-face-lo));
  box-shadow: var(--tui-inset), 0 0 0 1px color-mix(in oklab, var(--tui-obj-lite) 32%, transparent);
  color: var(--tui-ink);
  font-family: var(--tui-sans);
  font-weight: 600;
  font-size: max(8px, calc(var(--np-collar) * 0.23));
  line-height: 1.05;
  letter-spacing: -0.005em;
  text-align: center;
  white-space: nowrap;
  transform: rotate(calc(0deg - var(--tui-nosepiece-turn, 0deg) - var(--a, 0deg)));
  pointer-events: none;
}
/* A lens that cannot be chosen wears its dust cap over the front glass. */
.tui-nosepiece__cap {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 0;
  z-index: 3;
  height: 23%;
  border-radius: 3px 3px var(--tui-r-m) var(--tui-r-m);
  background: linear-gradient(180deg, var(--tui-face-hi), var(--tui-face) 38%, var(--tui-face-lo));
  box-shadow: var(--tui-raised), inset 0 0 0 1px color-mix(in oklab, var(--tui-obj-dark) 38%, transparent);
  opacity: 0;
  pointer-events: none;
}
/* A solid cover with a turned grip in its middle: a lens taken out of service. */
.tui-nosepiece__cap::after {
  content: '';
  position: absolute;
  inset: 30% 34%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--tui-face-hi), var(--tui-face) 55%, var(--tui-face-lo));
  box-shadow: var(--tui-raised);
}
.tui-nosepiece__lens[disabled] .tui-nosepiece__cap,
.tui-nosepiece__lens[aria-disabled="true"] .tui-nosepiece__cap { opacity: 1; }
.tui-nosepiece__lens[disabled],
.tui-nosepiece__lens[aria-disabled="true"] { cursor: not-allowed; opacity: 0.72; }

/* The chosen lens is the one in line: its collar takes a printed ring. */
.tui-nosepiece__lens[aria-selected="true"] { z-index: 2; }
.tui-nosepiece__lens[aria-selected="true"] .tui-nosepiece__label {
  outline: 1.5px solid var(--tui-ink);
  outline-offset: 2px;
}
.tui-nosepiece__lens:focus-visible { outline: none; }
.tui-nosepiece__lens:focus-visible .tui-nosepiece__label,
.tui-nosepiece__lens.is-focus .tui-nosepiece__label {
  outline: 2px solid var(--tui-focus);
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .tui-nosepiece__lens:not([disabled]):not([aria-disabled="true"]):hover .tui-nosepiece__label {
    box-shadow: var(--tui-raised), 0 0 0 1px var(--tui-rule);
  }
}

/* The content panel under the lens, with the small aperture cut at its top
   edge. No light, no glow: an aperture, and plain words below it. */
.tui-nosepiece__panel {
  position: relative;
  width: min(100%, 520px);
  min-width: 0;
  margin: var(--tui-2) auto 0;
  padding: min(20px, 5cqw);
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-nosepiece__aperture {
  position: absolute;
  left: 50%;
  top: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset), inset 0 0 0 1px color-mix(in oklab, var(--tui-skirt) 42%, transparent), 0 1px 0 var(--tui-hl);
}
.tui-nosepiece__panel [role="tabpanel"] { outline: none; }
.tui-nosepiece__panel [role="tabpanel"]:focus-visible {
  border-radius: var(--tui-r-s);
  outline: 2px solid var(--tui-focus);
  outline-offset: 4px;
}

/* Under the turret the current tab is also printed, for the width where the
   stamped collars are too small to read. The lens still carries its name to
   assistive tech, and every lens keeps its press area. */
.tui-nosepiece__caption {
  display: none;
  margin: var(--tui-2) 0 0;
  color: var(--tui-ink-2);
  font: 600 var(--tui-t-small) / 1.2 var(--tui-sans);
  text-align: center;
}
@container (max-width: 250px) {
  .tui-nosepiece__caption { display: block; }
  .tui-nosepiece__lens { --np-lens-w: max(30px, calc(var(--np-size) * 0.26)); --np-collar: max(22px, calc(var(--np-size) * 0.19)); }
  /* The collars stay, stamped blank; their words still name the buttons. */
  .tui-nosepiece__lens .tui-nosepiece__label { color: transparent; }
}

/* ---------------------------------------------------------------- part: notch-cards */
/* Notch cards: a list filtered with a needle. The deck is a fanned stack of
   buff index cards, each with a printed field label, a ruled face and a row of
   punched holes along its top edge. Each hole is a fact: a card that states
   the fact has that hole cut open into a notch, the others stay whole. The
   hole row above the front card is one group of real toggle buttons; pressing
   one sends the steel needle down that column, through every card, and the
   notched cards fall off it while the rest stay hanging, lifted and dimmed.
   Press it again and the needle is drawn out and the deck settles back.
   Paper is paper in every finish: the cards mix the paper tokens with the
   desk, so graphite dims the sheet but never turns it into a dark table. No
   colour of its own; the only light is the steel of the needle and the
   shadows, all tokens. kit/parts/notch-cards.mjs builds the punched rows, the
   needle and the count, and does the sorting. */
.tui-notch-cards {
  --nc-paper: color-mix(in oklab, var(--tui-paper) 88%, var(--tui-desk));
  --nc-paper-hi: color-mix(in oklab, var(--tui-paper-hi) 90%, var(--tui-desk));
  --nc-ink: var(--tui-paper-ink);
  --nc-ink-2: var(--tui-paper-ink-2);
  --nc-rule: color-mix(in oklab, var(--tui-paper-ink-2) 26%, transparent);
  --nc-shade: color-mix(in oklab, var(--tui-desk) 40%, var(--tui-ink) 60%);
  --nc-gutter: 34px;   /* the room the needle parks in, beside the deck */
  --nc-grip: 28px;     /* the knurled grip, above the deck's top edge */
  --nc-label: 34px;    /* the printed hole labels above the front card */
  --nc-col: 44px;      /* one hole's target, and the widest its column gets */
  --nc-pad: 18px;      /* from the card's edge to the first hole's column */
  --nc-drop: 24px;     /* how far a matching card falls off the needle */
  --nc-open: 42px;     /* room under a fallen card: its drop, the next card's 10px pull-up and 4px lift, and 4px of air */
  position: relative;
  display: block;
  width: 100%;
  max-width: 560px;
  padding-top: var(--nc-label);
  color: var(--nc-ink);
  font-family: var(--tui-sans);
  font-size: var(--tui-t-body);
  isolation: isolate;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
.tui-notch-cards *, .tui-notch-cards *::before, .tui-notch-cards *::after { box-sizing: border-box; }

/* ------------------------------------------------------------------ the deck */
.tui-notch-cards__bed { position: relative; padding-right: var(--nc-gutter); }

/* The deck is above the needle's shaft, so the rod is seen only where it
   passes through the paper and in the gaps the deck opens between cards. */
.tui-notch-cards__deck { position: relative; z-index: 1; display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

/* Cards overlap by 10px so every one shows its top edge and its two lines;
   later cards sit in front, as a deck fanned toward the reader. */
.tui-notch-cards__card {
  position: relative;
  display: block;
  min-width: 0;
  margin-top: -10px;
  padding: 32px var(--nc-pad) 14px;
  overflow: hidden;
  border-radius: var(--tui-r-s);
  background-color: var(--nc-paper);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 21px, var(--nc-rule) 21px 22px),
    var(--tui-noise),
    linear-gradient(var(--nc-paper-hi), var(--nc-paper));
  background-position: 0 30px, 0 0, 0 0;
  background-repeat: repeat, repeat, no-repeat;
  background-blend-mode: normal, soft-light, normal;
  box-shadow: var(--tui-raised);
  transition: transform 300ms var(--tui-ease), margin-bottom 300ms var(--tui-ease);
}
.tui-notch-cards__card:first-child { margin-top: 0; }

/* The punched row: one column per hole, drawn from the group's buttons.
   Columns share the card's width whether there are three holes or five, and
   only give way when the card is narrower than its holes. */
.tui-notch-cards__punch {
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, var(--nc-col));
  justify-content: space-between;
  height: 26px;
  padding: 0 var(--nc-pad);
  pointer-events: none;
}
.tui-notch-cards__cut { position: relative; height: 26px; }
/* A whole hole: a round punch, dark under its upper wall, its floor catching the lamp. */
.tui-notch-cards__cut::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-skirt) 62%, var(--nc-paper));
  box-shadow:
    inset 0 2px 3px -1px color-mix(in oklab, var(--nc-shade) 70%, transparent),
    inset 0 0 0 1px color-mix(in oklab, var(--nc-shade) 55%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-paper-hi) 75%, transparent);
}
/* A notched hole: cut open to the card's top edge, a clean U, its walls in shadow. */
.tui-notch-cards__cut[data-notch]::before {
  top: 0;
  height: 20px;
  border-radius: 0 0 7px 7px;
  box-shadow:
    inset 2px 0 2px -1px color-mix(in oklab, var(--nc-shade) 55%, transparent),
    inset -2px 0 2px -1px color-mix(in oklab, var(--nc-shade) 55%, transparent),
    inset 0 -2px 2px -1px color-mix(in oklab, var(--nc-shade) 60%, transparent);
}
/* Pushed in, the chosen column shows the rod where it passes through this
   card: a short bright steel segment inside the hole, a little longer where
   the hole is a notch cut open to the edge. */
.tui-notch-cards[data-needle="in"] .tui-notch-cards__cut[data-chosen]::after {
  content: '';
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 6px;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--tui-face-lo), var(--tui-face-hi) 48%, var(--tui-face-lo));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--tui-ink-3) 55%, transparent);
}
.tui-notch-cards[data-needle="in"] .tui-notch-cards__cut[data-notch][data-chosen]::after { top: 0; height: 20px; }

/* The printed field label and the two written lines. */
.tui-notch-cards__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; margin: 0; }
.tui-notch-cards__field {
  flex: none;
  font: 600 9px/1.4 var(--tui-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nc-ink-2);
}
.tui-notch-cards__title {
  min-width: 0;
  font: 600 14.5px/1.4 var(--tui-sans);
  letter-spacing: -0.003em;
  color: var(--nc-ink);
  overflow-wrap: anywhere;
}
.tui-notch-cards__detail {
  margin: 2px 0 0;
  font: 400 12px/1.45 var(--tui-sans);
  color: var(--nc-ink-2);
  overflow-wrap: anywhere;
}
.tui-notch-cards__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The needle: a thin steel rod with a knurled grip, parked beside the deck.
   The shaft sits under the deck's cards, so it is never drawn over a word;
   the grip is its own piece, above the paper, so the rod can be taken hold of. */
.tui-notch-cards__needle {
  position: absolute;
  z-index: 0;
  top: calc(-1 * var(--nc-grip));
  bottom: 0;
  left: calc(100% - var(--nc-gutter) / 2);
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(to right, var(--tui-face-lo), var(--tui-face-hi) 48%, var(--tui-face-lo));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--tui-ink-3) 55%, transparent);
  pointer-events: none;
  transition: left 340ms var(--tui-ease), transform 240ms var(--tui-ease);
}
.tui-notch-cards__grip {
  position: absolute;
  z-index: 5;
  top: calc(-1 * var(--nc-grip));
  left: calc(100% - var(--nc-gutter) / 2);
  width: 11px;
  height: var(--nc-grip);
  margin-left: -5.5px;
  border-radius: 3px 3px 2px 2px;
  background:
    repeating-linear-gradient(to bottom, color-mix(in oklab, var(--tui-face-hi) 70%, transparent) 0 1px, transparent 1px 3px),
    linear-gradient(to right, var(--tui-face-lo), var(--tui-face-hi) 45%, var(--tui-face-lo));
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--tui-ink-3) 55%, transparent),
    inset 0 1px 0 var(--tui-hl);
  pointer-events: none;
  transition: left 340ms var(--tui-ease), transform 240ms var(--tui-ease);
}
.tui-notch-cards__needle::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 3px;
  height: 7px;
  background: var(--tui-face-hi);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
/* Pushed in: the needle stands down the pressed hole's column and drops a touch. */
.tui-notch-cards[data-needle="in"] .tui-notch-cards__needle,
.tui-notch-cards[data-needle="in"] .tui-notch-cards__grip {
  left: var(--nc-x, calc(var(--nc-pad) + var(--nc-col) / 2));
  transform: translateY(3px);
}

/* --------------------------------------------------------- the hole buttons */
/* One group above the front card: each label printed over its punched hole. */
.tui-notch-cards__holes {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: var(--nc-gutter);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, var(--nc-col));
  justify-content: space-between;
  padding: 0 var(--nc-pad);
}
.tui-notch-cards__hole {
  position: relative;
  height: 54px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tui-ink-2);
  font: 600 9px/1 var(--tui-sans);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tui-notch-cards__hole-label {
  position: absolute;
  top: 8px;
  left: 50%;
  width: calc(var(--nc-col) + 6px);
  margin-left: calc((var(--nc-col) + 6px) / -2);
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The collar: a turned steel ring round the hole the needle is through. */
.tui-notch-cards__hole::after {
  content: '';
  position: absolute;
  top: 33px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-face-hi) 70%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms var(--tui-ease);
}
.tui-notch-cards__hole[aria-pressed="true"] { color: var(--tui-ink); }
.tui-notch-cards__hole[aria-pressed="true"]::after { opacity: 1; }
.tui-notch-cards__hole:focus { outline: none; }
.tui-notch-cards__hole:focus-visible .tui-notch-cards__hole-label {
  outline: 2px solid var(--tui-focus);
  outline-offset: 3px;
  border-radius: 2px;
}
.tui-notch-cards__hole:focus-visible::after { box-shadow: 0 0 0 2px var(--tui-focus); opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .tui-notch-cards__hole:hover { color: var(--tui-ink); }
  .tui-notch-cards__hole:hover::after { opacity: 0.45; }
}

/* The sorting: matching cards fall off the needle, settle forward and read
   clearly; the rest stay on it, lifted a little and dimmed under a veil of
   the desk. The veil keeps the sheet opaque, so the rod behind it is never
   seen through the paper. */
.tui-notch-cards__card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in oklab, var(--tui-desk) 32%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--tui-ease);
}
.tui-notch-cards[data-needle="in"] .tui-notch-cards__card[data-match="false"] {
  transform: translateY(-4px);
}
.tui-notch-cards[data-needle="in"] .tui-notch-cards__card[data-match="false"]::after { opacity: 1; }
/* Where a fallen card lands on a card that stays, the deck opens by its drop
   so the next card's holes and title stay in the clear; between two fallen
   cards the stack stays as it was. */
.tui-notch-cards[data-needle="in"] .tui-notch-cards__card[data-match="true"]:has(+ .tui-notch-cards__card[data-match="false"]) {
  margin-bottom: var(--nc-open);
}
/* The last card falls too, and must clear the count at the foot. */
.tui-notch-cards[data-needle="in"] .tui-notch-cards__card[data-match="true"]:last-child { margin-bottom: var(--nc-open); }
.tui-notch-cards[data-needle="in"] .tui-notch-cards__card[data-match="true"] {
  z-index: 3;
  transform: translateY(var(--nc-drop)) rotate(var(--nc-tilt, 0.4deg));
  transition-delay: calc(210ms + var(--nc-i, 0) * 40ms);
  box-shadow: var(--tui-raised);
}
.tui-notch-cards__card:nth-child(even) { --nc-tilt: -0.35deg; }

/* -------------------------------------------------------------- the count */
.tui-notch-cards__count {
  margin: 14px 0 0;
  padding-right: var(--nc-gutter);
  font: 600 10.5px/1.3 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink-2);
}

@media (max-width: 430px) {
  .tui-notch-cards { --nc-pad: 10px; --nc-gutter: 30px; --nc-label: 32px; }
  .tui-notch-cards__card { padding-top: 30px; }
  .tui-notch-cards__title { font-size: 13.5px; }
  .tui-notch-cards__detail { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  /* The mechanism only changes a state: the needle is already in the hole and
     the cards have already fallen on the same frame. */
  .tui-notch-cards__card, .tui-notch-cards__card::after, .tui-notch-cards__needle, .tui-notch-cards__grip, .tui-notch-cards__hole::after {
    transition: none;
    animation: none;
  }
}

/* ---------------------------------------------------------------- part: notifications */
/* Notifications: a key with a counter window in its cap, and a card of
   messages hung from it. Each unread message has its amber lamp lit; reading
   it puts the lamp out and the counter steps down. "Mark all read" puts the
   lamps out one after another, top to bottom. The card is a .tui-popover. */

/* The key, and the LCD window set into its cap. */
.tui-notifications__trigger { gap: 7px; }
.tui-notifications__trigger:not(.tui-key--icon) { padding: 0 6px 0 11px; }
.tui-notifications__trigger svg { width: 16px; height: 16px; }
.tui-notifications__count {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 4px 3px;
  gap: 0;
  border-radius: 3px;
  letter-spacing: 0;
}
.tui-notifications__count[data-ghost]::before { left: 4px; top: 3px; }
.tui-key.tui-notifications__trigger[aria-expanded="true"], .tui-key.tui-notifications__trigger.is-down {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}
/* An icon key with only a lamp in the corner of its cap. */
.tui-notifications__trigger > .tui-lamp { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; margin: 0; }

/* The card: a .tui-popover, wider, its list scrolling inside the room it is given. */
.tui-popover.tui-notifications { display: none; flex-direction: column; width: min(372px, calc(100vw - 16px)); max-width: none; max-height: max(220px, var(--tui-room, 80vh)); padding: 0; }
.tui-popover.tui-notifications:is(:popover-open, :not([popover])) { display: flex; }
.tui-notifications__head {
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  padding: 14px 12px 12px 18px;
  border-bottom: 1px solid var(--tui-rule);
}
.tui-notifications__head > :first-child { flex: 1; margin: 0; }
.tui-notifications__head > * { white-space: nowrap; }
.tui-notifications__list {
  display: grid;
  margin: 0;
  padding: 4px 6px;
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tui-notifications__item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  column-gap: var(--tui-3);
  row-gap: 3px;
  padding: 12px 12px 13px;
}
.tui-notifications__item + .tui-notifications__item { border-top: 1px solid var(--tui-rule); }
.tui-notifications__item > .tui-lamp { grid-row: 1; margin-top: 5px; transition: background 90ms linear, box-shadow 90ms linear; }
.tui-notifications__title { margin: 0; font: 500 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); }
.tui-notifications__item[data-unread] .tui-notifications__title { font-weight: 700; }
.tui-notifications__item time { grid-column: 3; grid-row: 1; padding-top: 1px; font-size: var(--tui-t-small); color: var(--tui-ink-2); white-space: nowrap; }
.tui-notifications__body { grid-column: 2 / 4; margin: 0; font-size: var(--tui-t-small); line-height: 1.45; color: var(--tui-ink-2); }
.tui-notifications__actions { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: var(--tui-2); margin-top: var(--tui-2); }
.tui-notifications__empty { display: none; margin: 0; padding: 28px 18px; text-align: center; color: var(--tui-ink-2); }
.tui-notifications__list:not(:has(li)) { display: none; }
.tui-notifications__list:not(:has(li)) + .tui-notifications__empty { display: block; }
.tui-notifications__foot { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--tui-rule); }

/* ---------------------------------------------------------------- part: onboarding */
/* Onboarding: stations along a groove, like the program track of a machine.
   A step that is done has its green lamp lit in its socket; the step you are
   on is a raised cap with its number; the rest are empty sockets. Ink runs
   along the groove as far as you have come. The setup checklist below it is
   check keys that stay down, a progress slot, and one key for the next task. */

/* ---------------------------------------------------------------- the steps */
.tui-onboarding__steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  container-type: inline-size;
}
.tui-onboarding__step { position: relative; display: grid; justify-items: center; align-content: start; gap: 9px; text-align: center; }
/* The groove from the station before to this one. */
.tui-onboarding__step + .tui-onboarding__step::before {
  content: '';
  position: absolute;
  top: 11px;
  left: calc(-50% + 17px);
  right: calc(50% + 17px);
  height: 5px;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl));
}
/* Ink along the groove, drawn out as far as you have come. */
.tui-onboarding__step + .tui-onboarding__step::after {
  content: '';
  position: absolute;
  top: 12.5px;
  left: calc(-50% + 18px);
  right: calc(50% + 18px);
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--tui-ease);
}
.tui-onboarding__step:is([data-state="done"], [data-state="current"])::after { transform: none; }

/* A station: a socket, a lamp in it when done, a cap on it when current. */
.tui-onboarding__station {
  position: relative;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  font: 600 11.5px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  transition: transform 180ms var(--tui-ease), box-shadow 180ms var(--tui-ease);
}
[data-state="done"] > .tui-onboarding__station { color: transparent; }
[data-state="done"] > .tui-onboarding__station::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--tui-green);
  color: var(--tui-green);
  box-shadow: var(--tui-glow);
}
[data-state="current"] > .tui-onboarding__station {
  color: var(--tui-ink);
  font-weight: 700;
  transform: translateY(-1px);
  background:
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 90%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 3px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)), 0 7px 12px -6px rgb(var(--tui-sh) / var(--tui-sh-a)));
}
.tui-onboarding__name { max-width: 16ch; font: 600 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
[data-state="current"] > .tui-onboarding__name { color: var(--tui-ink); }
.tui-onboarding__name small { display: block; margin-top: 2px; font-weight: 400; }
.tui-onboarding__state, .tui-onboarding__vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Narrow: every station stays, only the current one keeps its name. */
@container (max-width: 400px) {
  .tui-onboarding__step:not([data-state="current"]) > .tui-onboarding__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tui-onboarding__step[data-state="current"] > .tui-onboarding__name { width: max-content; max-width: 30cqi; }
}

/* ------------------------------------------------------------ the checklist */
.tui-onboarding { display: grid; gap: var(--tui-3); }
.tui-onboarding__head { display: flex; align-items: baseline; gap: var(--tui-3); flex-wrap: wrap; }
.tui-onboarding__title { flex: 1; margin: 0; font: 700 16px/1.25 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-onboarding__count { font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-onboarding__list { display: grid; margin: var(--tui-2) 0 0; padding: 0; list-style: none; }
.tui-onboarding__task {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: var(--tui-3);
  padding: var(--tui-3) 0;
  border-top: 1px solid var(--tui-rule);
}
.tui-onboarding__task > .tui-check { margin-top: 1px; }
.tui-onboarding__task > label { display: grid; gap: 2px; cursor: pointer; }
.tui-onboarding__task > label > b { font-weight: 600; color: var(--tui-ink); }
.tui-onboarding__task > label > span { font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-onboarding__task:has(> .tui-check:checked) > label > b { font-weight: 500; color: var(--tui-ink-2); }
.tui-onboarding__action { align-self: center; }
.tui-onboarding__task:not([data-next]) > .tui-onboarding__action { display: none; }

/* ---------------------------------------------------------------- part: order-summary */
/* Order summary: the slip a till prints. Priced lines in a rack, each with its
   quantity (a stepper where it can be changed) and its line total set right in
   tabular numerals, then a ruled block of totals that is the kit's spec list: the
   subtotal, any discounts as cuts, shipping, tax and a total set heavier under a
   double rule. Colour is the kit's: ink for the figures, the red ink only for a
   cut, nothing new. Without the script the items are a plain list of names. */
tui-order-summary { position: relative; display: block; min-width: 0; container-type: inline-size; color: var(--tui-ink); font: 400 var(--tui-t-body)/1.4 var(--tui-sans); }
tui-order-summary > ul:not([class]) { margin: 0; padding-left: 1.2em; }
.tui-order-summary__source { display: none; }
.tui-order-summary__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-order-summary__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tui-order-summary__lines { margin: 0; padding: 0; list-style: none; }
.tui-order-summary__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 7.5ch auto;
  grid-template-areas: "name qty sum remove" "unit qty sum remove";
  align-items: center;
  column-gap: var(--tui-4);
  row-gap: 2px;
  padding: var(--tui-3) 0;
  border-bottom: 1px solid var(--tui-rule);
}
.tui-order-summary__line:not(:has(.tui-order-summary__remove)) { grid-template-columns: minmax(0, 1fr) auto 7.5ch; grid-template-areas: "name qty sum" "unit qty sum"; }
.tui-order-summary__name { grid-area: name; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.tui-order-summary__unit { grid-area: unit; min-width: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); font-variant-numeric: tabular-nums; }
.tui-order-summary__qty { grid-area: qty; justify-self: end; font-variant-numeric: tabular-nums; }
.tui-order-summary__qty-text { color: var(--tui-ink-2); font-weight: 500; white-space: nowrap; }
.tui-order-summary__sum { grid-area: sum; justify-self: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tui-order-summary__remove { grid-area: remove; }
.tui-order-summary__stepper { gap: 2px; }
.tui-order-summary__stepper .tui-key { font-size: 15px; font-weight: 700; }
.tui-order-summary__stepper .tui-order-summary__qty-input { width: 3.2ch; min-width: 0; padding: 0; outline: none; }
.tui-order-summary__stepper .tui-key[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* The block of totals is the kit's spec list; this sets the rules between its rows. */
.tui-order-summary__totals { margin-top: var(--tui-2); }
.tui-order-summary__totals dd { white-space: nowrap; }
.tui-order-summary__totals dt { min-width: 0; }
.tui-order-summary__totals dd[data-free] { font-weight: 600; letter-spacing: 0.02em; }
.tui-order-summary__note { display: block; font-size: var(--tui-t-small); font-weight: 400; color: var(--tui-ink-2); }
.tui-order-summary__note[hidden] { display: none; }
.tui-order-summary__cut { color: var(--tui-red-ink, var(--tui-red)); }
.tui-order-summary__totals > dt.tui-order-summary__cut { color: var(--tui-ink-2); }
.tui-order-summary__totals > dt.tui-order-summary__grand, .tui-order-summary__totals > dd.tui-order-summary__grand {
  padding-top: 12px;
  border-bottom: 0;
  border-top: 3px double var(--tui-ink-2);
  color: var(--tui-ink);
  font: 700 var(--tui-t-lead)/1.3 var(--tui-sans);
  font-variant-numeric: tabular-nums;
}
.tui-order-summary__totals > :nth-last-child(-n+2) { border-bottom: 0; }

.tui-order-summary__empty { margin: 0; padding: var(--tui-5) var(--tui-3); text-align: center; color: var(--tui-ink-2); border-radius: var(--tui-r-m); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-order-summary__empty:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* In a narrow card or a phone the quantity and the Remove key drop under the name. */
@container (max-width: 420px) {
  .tui-order-summary__line, .tui-order-summary__line:not(:has(.tui-order-summary__remove)) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name sum" "unit unit" "qty remove";
    row-gap: 6px;
  }
  .tui-order-summary__line:not(:has(.tui-order-summary__remove)) { grid-template-areas: "name sum" "unit unit" "qty qty"; }
  .tui-order-summary__qty { justify-self: start; }
  .tui-order-summary__remove { justify-self: end; }
}

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-order-summary__line { border-bottom-color: var(--tui-quiet-line-2); }
}

@media (pointer: coarse) {
  .tui-order-summary__stepper .tui-key { --h: 44px; width: 44px; }
  .tui-order-summary__stepper .tui-order-summary__qty-input { width: 4ch; min-width: 44px; min-height: 44px; font-size: 16px; }
  .tui-order-summary__remove { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-order-summary__stepper .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: otp-input */
/* OTP input: a one-time code drawn as separate boxes, driven by one real
   input laid over them. The input holds the code and the focus; the boxes only
   show it, each a cut in the plate like the field's well. Without the script
   the boxes are not there and the input is a plain field in its well. */
:is(tui-otp-input, .tui-otp-input) {
  --otp-n: 6;
  --otp-w: 42px;
  --otp-h: 48px;
  position: relative;
  display: grid;
  width: min(100%, calc(var(--otp-n) * var(--otp-w) + (var(--otp-n) - 1) * var(--tui-2)));
  min-width: 0;
}
.tui-otp-input__input {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 600 var(--tui-t-body)/1 var(--tui-mono);
  letter-spacing: 0.4em;
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-otp-input__input:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-otp-input__input:disabled { opacity: 0.45; cursor: not-allowed; }
.tui-field[data-error] .tui-otp-input__input, .tui-otp-input__input[aria-invalid="true"] {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}

/* With the script: the input lies over the boxes, unseen, and takes every touch, paste and key. */
:is(tui-otp-input, .tui-otp-input)[data-wired] .tui-otp-input__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  padding: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  box-shadow: none;
  outline: none;
  cursor: text;
}
:is(tui-otp-input, .tui-otp-input)[data-wired] .tui-otp-input__input::selection { color: transparent; background: transparent; }
.tui-otp-input__boxes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--otp-n), minmax(0, 1fr));
  gap: var(--tui-2);
}
.tui-otp-input__boxes > i {
  display: grid;
  place-items: center;
  height: var(--otp-h);
  border-radius: var(--tui-r-m);
  font: 600 20px/1 var(--tui-mono);
  font-style: normal;
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-otp-input__boxes > i[data-on] { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* The caret: a bar in the box that will take the next character. */
.tui-otp-input__boxes > i[data-on]:empty::after { content: ""; width: 1.5px; height: 22px; background: var(--tui-ink); animation: tui-otp-blink 1.1s steps(1) infinite; }
@keyframes tui-otp-blink { 50% { opacity: 0; } }
.tui-field[data-error] .tui-otp-input__boxes > i, :is(tui-otp-input, .tui-otp-input)[state="error"] .tui-otp-input__boxes > i, :has(> .tui-otp-input__input[aria-invalid="true"]) > .tui-otp-input__boxes > i {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
/* Motion, only once the script has run and only where motion is allowed (it sets [data-glide]; the stills and the no-script field never have it).
   The ring is the active box's outline made one thing that glides: it is as wide as a box and steps one box plus a gap per --otp-at. */
.tui-otp-input__ring { display: none; }
:is(tui-otp-input, .tui-otp-input)[data-glide] .tui-otp-input__ring[data-show] {
  display: block;
  position: absolute;
  inset: 0 auto 0 0;
  width: calc((100% - (var(--otp-n) - 1) * var(--tui-2)) / var(--otp-n));
  border-radius: var(--tui-r-m);
  outline: 2px solid var(--tui-focus);
  outline-offset: 2px;
  pointer-events: none;
  transform: translateX(calc(var(--otp-at, 0) * (100% + var(--tui-2))));
  transition: transform 140ms var(--tui-ease);
}
:is(tui-otp-input, .tui-otp-input)[data-glide] .tui-otp-input__boxes > i[data-on] { outline: 0; }
/* Each box is a window on a drum. The boxes clip the drum, so the ring is lifted to travel over them. */
.tui-otp-input__boxes > i { position: relative; overflow: hidden; perspective: 140px; }
.tui-otp-input__ring { z-index: 1; }
/* A typed digit rolls up into the window and stops on a detent: past it, back, still. */
.tui-otp-input__glyph { display: block; transform-origin: 50% 50% -20px; animation: tui-otp-roll 300ms linear; }
@keyframes tui-otp-roll {
  0% { transform: rotateX(-95deg); opacity: 0; filter: brightness(0.4); animation-timing-function: cubic-bezier(0.3, 0.6, 0.5, 1); }
  62% { transform: rotateX(9deg); opacity: 1; filter: none; animation-timing-function: ease-in-out; }
  82% { transform: rotateX(-3deg); animation-timing-function: ease-out; }
  100% { transform: none; }
}
/* A pasted or filled-in code is set without rolling, so it can still slip on an error. */
.tui-otp-input__glyph--set { animation: none; }
/* Backspace: typing in reverse. The digit lifts past the detent, then rolls down and away; the script then empties the box.
   No 0% keyframe: it rolls out from where it stands, which the script sets when it leaves mid-slip. */
.tui-otp-input__glyph--out { animation: tui-otp-unroll 240ms ease-out forwards; }
@keyframes tui-otp-unroll {
  20% { transform: rotateX(8deg); animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4); }
  100% { transform: rotateX(-95deg); opacity: 0; filter: brightness(0.4); }
}
/* A wrong code slips every drum half a step and back, left to right. The host app sets state="error"; the script sets data-shake for its length.
   The roll stays listed so it does not play again when the slip ends. */
:is(tui-otp-input, .tui-otp-input)[data-shake] .tui-otp-input__glyph { animation: tui-otp-roll 300ms linear, tui-otp-slip 340ms ease-out calc(var(--i, 0) * 20ms) both; }
:is(tui-otp-input, .tui-otp-input)[data-shake] .tui-otp-input__glyph--set { animation: tui-otp-slip 340ms ease-out calc(var(--i, 0) * 20ms) both; }
/* A digit leaving during the slip rolls out once, and does not take the slip as well. */
:is(tui-otp-input, .tui-otp-input)[data-shake] .tui-otp-input__glyph--out { animation: tui-otp-unroll 240ms ease-out forwards; }
@keyframes tui-otp-slip {
  0% { transform: none; animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); }
  30% { transform: rotateX(48deg); filter: brightness(0.6); animation-timing-function: cubic-bezier(0.3, 0.6, 0.5, 1); }
  70% { transform: rotateX(-7deg); filter: none; animation-timing-function: ease-in-out; }
  100% { transform: none; }
}
/* A right code (state="ok") lights a lamp under each box in the kit's one lamp hue, and it stays on. The script sets data-lock while
   the lamps come on along the row, each flaring as the sweep passes, then burning steady. */
:is(tui-otp-input, .tui-otp-input)[state="ok"] .tui-otp-input__boxes > i::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 14px;
  height: 3px;
  translate: -50% 0;
  border-radius: 2px;
  color: var(--tui-green);
  background: var(--tui-green);
  box-shadow: var(--tui-glow);
}
:is(tui-otp-input, .tui-otp-input)[data-lock] .tui-otp-input__boxes > i::before { animation: tui-otp-sweep 420ms var(--tui-ease) calc(var(--i, 0) * 60ms) both; }
@keyframes tui-otp-sweep {
  0% { opacity: 0; box-shadow: none; }
  25% { opacity: 1; box-shadow: var(--tui-glow), 0 0 18px 10px color-mix(in oklab, var(--tui-green) 32%, transparent); }
}
:is(tui-otp-input, .tui-otp-input):has(.tui-otp-input__input:disabled) .tui-otp-input__boxes { opacity: 0.45; }
:is(tui-otp-input, .tui-otp-input):has(.tui-otp-input__input:disabled) .tui-otp-input__input { cursor: not-allowed; }

@media (pointer: coarse) {
  :is(tui-otp-input, .tui-otp-input) { --otp-w: 46px; --otp-h: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-otp-input__boxes > i[data-on]:empty::after { animation: none; }
  .tui-otp-input__ring, .tui-otp-input__glyph, .tui-otp-input__boxes, .tui-otp-input__boxes > i, .tui-otp-input__boxes > i::before { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- part: page-loupe */
/* Page loupe: the Loupe scroll's rail turned onto a whole page, for a corner
   beside it. The groove, its map and the glass are the Loupe scroll's own
   classes (loupe-scroll.css); this lays them out beside the page's headings,
   printed at their own height, the section being read lit. See page-loupe.mjs.
   Corners are concentric: a 5px loupe 3px inside the 8px groove. */
tui-page-loupe {
  --pl-rail: 72px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
}
/* With no script there is nothing to draw: the page keeps its own list of sections. */
tui-page-loupe:not(:defined) { display: none; }

.tui-page-loupe__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tui-page-loupe__head .tui-label { color: var(--tui-ink); }
.tui-page-loupe__at { font: 500 11px/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }

.tui-page-loupe__body { position: relative; display: grid; grid-template-columns: var(--pl-rail) minmax(0, 1fr); gap: 14px; min-height: 0; }
.tui-page-loupe__rail { height: 100%; min-height: 120px; }
/* The page's own map only: the lens's copy keeps its rule (loupe-scroll.css) for the magnified map, drawn as wide as this one and magnified about its middle, so what the page holds sits under the glass as it sits on the rail (report #101). */
.tui-page-loupe__rail > .tui-loupe-scroll__map { inset: 10px 8px; }
.tui-page-loupe__rail .tui-loupe-scroll__map--lens { left: 5px; width: calc(100% - 10px); transform-origin: 50% 0; }
.tui-page-loupe__rail .tui-loupe-scroll__loupe { top: 10px; }

/* The headings beside the groove: a tick to the map, a leader back up where a label was pushed down. */
.tui-page-loupe__marks { position: relative; min-width: 0; margin: 10px 0 0; padding: 0; list-style: none; }
.tui-page-loupe__marks li { position: absolute; left: 0; right: 0; transform: translateY(-50%); }
.tui-page-loupe__marks li::before { content: ''; position: absolute; left: -14px; top: 50%; width: 10px; height: 1px; background: var(--tui-ink-2); opacity: 0.5; }
.tui-page-loupe__marks li > i { position: absolute; left: -14px; bottom: 50%; width: 1px; background: color-mix(in oklab, var(--tui-ink-2) 50%, transparent); }
.tui-page-loupe__marks a {
  display: flex;
  align-items: center;
  gap: 8px;
  /* A 24px press area: padding past the drawn label, taken back by the margin so nothing moves. */
  --pl-pad: calc((24.1px - 1.25em) / 2);
  padding: var(--pl-pad) 0;
  margin: calc(2px - var(--pl-pad)) 0;
  font: 500 12.5px/1.25 var(--tui-sans);
  color: var(--tui-ink-2);
  text-decoration: none;
  border-radius: 3px;
}
/* A long heading wraps, never cut short: page-loupe.mjs spaces the labels by the room each one takes. */
.tui-page-loupe__marks a span { min-width: 0; overflow-wrap: anywhere; text-wrap: pretty; }
.tui-page-loupe__marks a:hover, .tui-page-loupe__marks a[aria-current] { color: var(--tui-ink); }
.tui-page-loupe__marks a:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: calc(2px - var(--pl-pad) + 2px); }
/* The section being read: a lamp lit beside its name. */
.tui-page-loupe__marks a[aria-current]::after {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tui-green);
  box-shadow: 0 0 6px 1px color-mix(in oklab, var(--tui-green) 60%, transparent);
}

@media (pointer: coarse) {
  .tui-page-loupe__marks a { position: relative; }
  .tui-page-loupe__marks a::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)) 0; }
}

/* ---------------------------------------------------------------- part: page-wheel */
/* Page wheel: pagination as a thumbwheel. A knurled cylinder stands proud of
   a recess with a window cut in its face; behind the window a paper tape
   carries the page numbers, and the neighbours roll past its edges as the
   wheel turns. A key sits either side, and they are plain links: without a
   script the keys still go to the previous and next page and the window
   still shows where you are. The wheel is the part that needs the script.
   Corners are concentric: a 5px gap round the 10px wheel is the 15px tray. */
.tui-page-wheel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px;
  border-radius: 15px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-page-wheel > .tui-key { --h: 36px; flex: none; }
.tui-page-wheel > .tui-key[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 var(--skirt) 0 var(--tui-skirt)); filter: none; }
.tui-page-wheel__of { min-width: 30px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; text-align: center; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); white-space: nowrap; }

/* The wheel itself. --pos is the turn in pages (a fraction while it is moving); the ridges travel with it. */
tui-page-wheel {
  --pw-row: 30px;
  --pos: 0;
  position: relative;
  display: block;
  flex: none;
  width: 128px;
  height: 46px;
  border-radius: 10px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background:
    linear-gradient(180deg, rgb(var(--tui-sh) / 0.5), transparent 30%, transparent 62%, rgb(var(--tui-sh) / 0.3)),
    repeating-linear-gradient(180deg, rgb(var(--tui-sh) / 0.3) 0 1px, var(--tui-hl) 1px 2px, transparent 2px 5px) 0 calc(var(--pos) * -15px) / 100% auto,
    linear-gradient(180deg, var(--tui-face-lo), var(--tui-face-hi) 42%, var(--tui-face-lo));
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.4)), 0 1.5px 0 var(--tui-skirt), 0 5px 10px -4px rgb(var(--tui-sh) / var(--tui-sh-a)));
}
tui-page-wheel:focus-visible, tui-page-wheel.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
tui-page-wheel[data-drag] { cursor: grabbing; }

/* The window: cut into the wheel's face, a paper tape behind it, shaded round like a drum. */
.tui-page-wheel__window {
  position: absolute;
  inset: 8px 34px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--tui-paper);
  box-shadow: var(--tui-depth-well, inset 0 2px 4px rgb(var(--tui-sh) / 0.55), 0 0 0 1px rgb(var(--tui-sh) / 0.5), 0 1px 0 1px var(--tui-hl));
  color: var(--tui-paper-ink);
}
.tui-page-wheel__window::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--tui-depth-floor, linear-gradient(180deg, rgb(var(--tui-sh) / 0.42), transparent 34%, transparent 66%, rgb(var(--tui-sh) / 0.42))); }
.tui-page-wheel__tape { margin: 0; padding: 0; list-style: none; will-change: transform; }
.tui-page-wheel__tape > li { height: var(--pw-row); font: 700 20px/var(--pw-row) var(--tui-sans); font-variant-numeric: tabular-nums; text-align: center; color: var(--tui-paper-ink); }
tui-page-wheel[data-live] .tui-page-wheel__tape { margin-top: calc(var(--pw-row) * -2); }


@media (prefers-reduced-motion: reduce) { .tui-page-wheel__tape { transition: none !important; } }

/* ---------------------------------------------------------------- part: pagination */
/* Pagination: numbered keys in a tray; the current page's key is latched
   below the plate. Seven slots at most, so the row keeps its width. The
   compact version is a transport: back, a track counter in an LCD, on. */
.tui-pagination {
  position: relative; /* holds the screen-reader words, which are positioned */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-3) var(--tui-5);
  font-size: var(--tui-t-small);
  color: var(--tui-ink-2);
}
.tui-pagination__keys {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-pagination__pages { display: flex; align-items: center; gap: 3px; margin: 0; padding: 0; list-style: none; }
.tui-pagination__pages > li { display: flex; }
.tui-pagination__keys .tui-key { --h: 30px; --skirt: 1.5px; min-width: 30px; padding: 0 7px; border-radius: 6px; font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; }
.tui-pagination__keys .tui-key--icon { width: 30px; padding: 0; }
.tui-pagination__keys .tui-key svg { width: 14px; height: 14px; }
/* The page you are on: latched, its printing at full ink. */
.tui-pagination__keys .tui-key[aria-current="page"] {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
  cursor: default;
}
.tui-pagination__keys .tui-key:not([aria-current]) { color: var(--tui-ink-2); }
.tui-pagination__keys .tui-key:not([aria-current]):hover, .tui-pagination__keys .tui-key.is-hover { color: var(--tui-ink); }
.tui-pagination__keys .tui-key[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 var(--skirt) 0 var(--tui-skirt)); filter: none; }
.tui-pagination__keys .tui-key[aria-disabled="true"]:focus-visible { opacity: 0.75; }
.tui-pagination__gap { width: 18px; height: 30px; overflow: hidden; color: transparent; background: radial-gradient(circle, var(--tui-ink-2) 1.1px, transparent 1.5px) 0 50% / 6px 6px repeat-x; }

.tui-pagination__range { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tui-pagination__size { display: inline-flex; align-items: center; gap: var(--tui-2); margin-left: auto; }
.tui-pagination__size .tui-select { width: auto; height: 32px; padding-left: 10px; font-size: var(--tui-t-small); }

/* Compact: a transport and a track counter. */
.tui-pagination__lcd { min-width: 0; font-size: 15px; padding: 0.4em 0.55em; }
.tui-pagination__lcd[data-ghost]::before { left: 0.55em; top: 0.4em; }
.tui-pagination--compact .tui-pagination__keys { gap: 6px; padding: 3px 4px; }

/* Words for screen readers only: the counter itself is hidden from them. */
.tui-pagination__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- part: password-field */
/* Password field: the field's well with a louvred shutter over its text and
   a peek key at the end. While the password is hidden the shutter is closed
   across the characters; the peek key slides it off, to the right, under the
   key, and the characters stand open until the key is pressed again. The key
   stays down while they show and says in words what pressing it does.
   Without the script the shutter and the key are not there, and the field is
   a plain password field in its well. */
:is(tui-password-field, .tui-password-field) {
  --pf-h: 38px;
  --pf-inset: 3px;
  --pf-key: 64px;
  position: relative;
  display: flex;
  align-items: center;
  height: var(--pf-h);
  min-width: 0;
  padding: 0 var(--pf-inset) 0 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: clip;
  cursor: text;
}
:is(tui-password-field, .tui-password-field):has(.tui-password-field__input:focus-visible), :is(tui-password-field, .tui-password-field).is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] :is(tui-password-field, .tui-password-field), :is(tui-password-field, .tui-password-field):has(.tui-password-field__input[aria-invalid="true"]) {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
:is(tui-password-field, .tui-password-field):has(.tui-password-field__input:disabled) { opacity: 0.45; cursor: not-allowed; }

.tui-password-field__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: inherit;
  background: transparent;
  outline: none;
}
.tui-password-field__input::placeholder { color: var(--tui-ink-3); }
.tui-password-field__input:disabled { cursor: not-allowed; }
/* While hidden, the dots are drawn large, so they show between the slats and the slats pass over something solid. */
.tui-password-field__input[type="password"] { font-size: 1.45em; letter-spacing: 0.14em; }
/* The browser's own reveal key would be a second key. */
.tui-password-field__input::-ms-reveal, .tui-password-field__input::-ms-clear { display: none; }

/* The shutter: slats cut in a thin plate, each a dark cut and a lit lip, with the characters showing between them. */
.tui-password-field__shutter {
  position: absolute;
  top: var(--pf-inset);
  bottom: var(--pf-inset);
  left: var(--pf-inset);
  right: calc(var(--pf-key) + var(--pf-inset));
  /* Above the field's own text: the slats cover the characters, they do not sit behind them. */
  z-index: 1;
  pointer-events: none;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  overflow: hidden;
}
/* Each slat slides on its own, 28 ms after the one above it: off to the right on Show, back bottom first on Hide.
   Transform only, so the move costs nothing but compositing. */
.tui-password-field__shutter > i {
  /* Solid, in the well's own colour, so a closed shutter really hides the characters: a dark cut and a lit lip along each slat's top. */
  background: linear-gradient(180deg, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)) 0 1px, color-mix(in oklab, var(--tui-hl) 55%, var(--tui-well)) 1px 2px, var(--tui-well) 2px 80%, transparent 80%);
  box-shadow: inset -1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)), inset -2px 0 0 var(--tui-hl);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1) calc((5 - var(--i)) * 28ms);
}
:is(tui-password-field, .tui-password-field)[data-shown] .tui-password-field__shutter > i { transform: translateX(calc(100% + var(--pf-key))); transition-delay: calc(var(--i) * 28ms); }

/* The peek key: a small cap on the floor, down while the characters show. */
.tui-password-field__key {
  appearance: none;
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
  width: var(--pf-key);
  height: calc(var(--pf-h) - 2 * var(--pf-inset));
  margin-left: auto;
  padding: 0 6px;
  border: 0;
  border-radius: calc(var(--tui-r-m) - var(--pf-inset));
  font: 600 11.5px/1 var(--tui-sans);
  color: var(--tui-ink-2);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-password-field__key svg { width: 15px; height: 15px; flex: none; }
.tui-password-field__key:hover, .tui-password-field__key.is-hover { color: var(--tui-ink); filter: brightness(1.03); }
.tui-password-field__key:active, .tui-password-field__key.is-down, :is(tui-password-field, .tui-password-field)[data-shown] .tui-password-field__key { transform: translateY(1.5px); filter: brightness(0.97); color: var(--tui-ink); box-shadow: var(--tui-pressed); }
.tui-password-field__key:focus-visible, .tui-password-field__key.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-password-field__key:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
/* The key is the element's own: it waits for the script. */
tui-password-field:not(:defined) .tui-password-field__key { display: none; }
.tui-password-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-password-field__key:active, .tui-password-field__key.is-down, [data-shown] > .tui-password-field__key { transform: translateY(1px); filter: none; background: var(--tui-quiet-key-down); }
  .tui-password-field__key:hover, .tui-password-field__key.is-hover { filter: none; background: var(--tui-quiet-key-hover); }
  /* The slats are hairlines. */
  .tui-password-field__shutter > i { background: linear-gradient(180deg, var(--tui-quiet-line-2) 0 1px, var(--tui-well) 1px 80%, transparent 80%); box-shadow: inset -1px 0 0 var(--tui-quiet-line-2); }
}

@media (pointer: coarse) {
  :is(tui-password-field, .tui-password-field) { --pf-h: 48px; --pf-inset: 2px; --pf-key: 72px; }
  .tui-password-field__input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-password-field__shutter > i, .tui-password-field__key { transition: none; }
}

/* ---------------------------------------------------------------- part: phone-field */
/* Phone field: a country key and a number in one well. The key sits on the
   floor of the well at its left and is printed with the country's ISO code and
   dial code, never a flag. It opens a card with a search box and a list, the
   combobox's own card. The number is a plain telephone input, set out in the
   country's grouping as it is typed. The well, the key and the card are the
   kit's, so every finish and both volumes are theirs. Without the script it is
   a number field in its well. */
tui-phone-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
tui-phone-field[disabled] { cursor: not-allowed; }

.tui-phone-field__well {
  --pf-h: 38px;
  --pf-inset: 5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: var(--pf-h);
  padding: 0 0 0 var(--pf-inset);
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: clip;
}
.tui-phone-field__well:has(.tui-phone-field__input:focus-visible), .tui-phone-field__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* An error is marked on the lip around the cut, as the other fields' are. */
tui-phone-field[data-error] .tui-phone-field__well, .tui-field[data-error] .tui-phone-field__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-phone-field__well:has(.tui-phone-field__input:disabled) { opacity: 0.45; }

.tui-phone-field__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: inherit;
  background: transparent;
  outline: none;
}
.tui-phone-field__input::placeholder { color: var(--tui-ink-3); }
.tui-phone-field__input:disabled { cursor: not-allowed; }
.tui-phone-field__input:read-only:not(:disabled) { color: var(--tui-ink-2); }

/* The country key: ISO code, dial code and a small arrow, all printed. */
.tui-phone-field__well > .tui-phone-field__country { --h: 28px; flex: none; gap: 6px; padding: 0 var(--tui-2) 0 var(--tui-3); }
.tui-phone-field__iso { font-weight: 700; letter-spacing: 0.04em; }
.tui-phone-field__dial { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-phone-field__country::after { content: ''; width: 8px; height: 5px; margin-left: 1px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); color: var(--tui-ink-2); transition: transform 150ms var(--tui-ease); }
.tui-phone-field__country[aria-expanded="true"]::after { transform: scaleY(-1); }
.tui-phone-field__country[data-single]::after, .tui-phone-field__country[aria-disabled="true"]::after { display: none; }
.tui-phone-field__country[data-single] { opacity: 1; cursor: default; padding-right: var(--tui-3); }
.tui-phone-field__country[aria-disabled="true"]:not([data-single]) { cursor: default; }
/* The list is built by the script: without it the key has nothing to open. */
tui-phone-field:not(:defined) .tui-phone-field__country { display: none; }

.tui-phone-field__error { margin: 0; white-space: normal; overflow-wrap: anywhere; color: var(--tui-red-ink, var(--tui-red)); }
.tui-phone-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The card. */
.tui-phone-field__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  display: none;
  min-width: 240px;
  max-width: calc(100vw - 16px);
  max-height: min(360px, max(200px, var(--tui-room, 360px)));
  padding: 5px;
  overflow: hidden;
  border-radius: 11px;
  font: 400 var(--tui-t-body)/1.2 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.25),
    0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  text-align: left;
}
.tui-phone-field__card:popover-open { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 5px; animation: tui-phone-out 150ms var(--tui-ease); }
.tui-phone-field__card:popover-open:not([data-placed]) { opacity: 0; }
@keyframes tui-phone-out { from { opacity: 0; transform: translateY(-6px); } }

.tui-phone-field__search {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 34px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: 7px;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-phone-field__search::placeholder { color: var(--tui-ink-3); }
.tui-phone-field__search::-webkit-search-cancel-button { appearance: none; }
.tui-phone-field__search:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 1px; }

.tui-phone-field__list {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tui-phone-field__option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 34px;
  padding: 0 10px 0 9px;
  border-radius: 7px;
  font: 500 var(--tui-t-body)/1.25 var(--tui-sans);
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* The lamp: off until the row is the country chosen. */
.tui-phone-field__option::before {
  --c: var(--tui-amber);
  content: '';
  justify-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 1px 0 var(--tui-hl);
}
.tui-phone-field__option[aria-selected="true"]::before { color: var(--c); background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), var(--c); box-shadow: var(--tui-glow); }
.tui-phone-field__option[aria-selected="true"] { color: var(--tui-ink); }
.tui-phone-field__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-phone-field__code { font: 400 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
/* Under the finger or the arrow keys: pressed into the card. */
.tui-phone-field__option.is-active, .tui-phone-field__option.is-hover { color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-phone-field__empty { margin: 0; padding: 10px 12px 11px; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }

@media (pointer: coarse) {
  .tui-phone-field__well { --pf-h: 52px; --pf-inset: 4px; }
  .tui-phone-field__well > .tui-phone-field__country { --h: 44px; }
  .tui-phone-field__input, .tui-phone-field__search { font-size: 16px; }
  .tui-phone-field__search { height: 44px; }
  .tui-phone-field__option { min-height: 44px; }
}
@media (max-width: 480px) {
  .tui-phone-field__card { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-phone-field__card:popover-open { animation: none; }
  .tui-phone-field__country::after, tui-phone-field .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: pipeline */
/* Pipeline: the stages of a build and a deploy as stations along a groove,
   like the program track of a machine (it is the onboarding's groove). Each
   station is a socket with a lamp in it: green for a stage that passed, red
   for one that failed, amber and breathing for the one that is running, and
   an empty socket for one that is waiting or was skipped. Under every station
   the stage's name, its state in words, how long it took and a Log key. Ink
   runs along the groove as far as the run has reached. Wide, the stages stand
   in a row; narrow, they stand in a column with the groove down the side. The
   breathing is an opacity swell on one lamp, held still off screen and under
   reduced motion, when the lamp stays lit. */
.tui-pipeline { display: grid; gap: var(--tui-3); min-width: 0; container-type: inline-size; }
.tui-pipeline__stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 0; padding: 0; list-style: none; }
.tui-pipeline__stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 0 var(--tui-1);
  text-align: center;
}
/* The groove from the station before to this one, and the ink in it. */
.tui-pipeline__stage + .tui-pipeline__stage::before {
  content: '';
  position: absolute;
  top: 11px;
  left: calc(-50% + 17px);
  right: calc(50% + 17px);
  height: 5px;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl));
}
.tui-pipeline__stage + .tui-pipeline__stage::after {
  content: '';
  position: absolute;
  top: 12.5px;
  left: calc(-50% + 18px);
  right: calc(50% + 18px);
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
  transform: scaleX(0);
  transform-origin: left;
}
.tui-pipeline__stage:is([data-state="passed"], [data-state="running"], [data-state="failed"])::after { transform: none; }

/* A station: a socket with the stage's lamp in it. */
.tui-pipeline__station { position: relative; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-pipeline__station > .tui-lamp { width: 11px; height: 11px; }
.tui-pipeline__stage[data-state="passed"] .tui-lamp { --c: var(--tui-green); }
.tui-pipeline__stage[data-state="running"] .tui-lamp { --c: var(--tui-amber); }
.tui-pipeline__stage[data-state="failed"] .tui-lamp { --c: var(--tui-red); }
/* A stage that is waiting or was skipped has a lamp that is simply out. */
.tui-pipeline__stage:is([data-state="queued"], [data-state="skipped"]) .tui-lamp { --c: var(--tui-white); }
/* The one that is running breathes: a slow swell of the lamp's own opacity, nothing else moves. */
.tui-pipeline__stage[data-state="running"] .tui-lamp { animation: tui-pipeline-breathe 2.4s ease-in-out infinite; }
@keyframes tui-pipeline-breathe { 50% { opacity: 0.3; } }
.tui-pipeline[data-paused] .tui-lamp { animation-play-state: paused; }

.tui-pipeline__name { max-width: 100%; font: 600 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-pipeline__state { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); }
.tui-pipeline__stage[data-state="failed"] .tui-pipeline__state, .tui-pipeline__stage[data-state="running"] .tui-pipeline__state { color: var(--tui-ink); font-weight: 600; }
.tui-pipeline__stage[data-state="skipped"] .tui-pipeline__name { color: var(--tui-ink-2); font-weight: 500; text-decoration: line-through 1px; }
.tui-pipeline__time:is([data-stale], [data-stale] *) { color: var(--tui-ink-3); }
.tui-pipeline__time { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-pipeline__log { justify-self: center; margin-top: 2px; }
.tui-pipeline__log[aria-disabled="true"] { cursor: not-allowed; }
/* Said aloud, never seen. */
.tui-pipeline__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-pipeline { position: relative; }

/* Narrow: a column, with the groove down the left side and the stage's words beside its station. */
@container (max-width: 520px) {
  .tui-pipeline__stages { grid-auto-flow: row; }
  .tui-pipeline__stage { grid-template-columns: 27px minmax(0, 1fr) auto; grid-template-areas: "st name log" "st state log" "st time log"; justify-items: start; align-items: center; column-gap: var(--tui-3); row-gap: 1px; padding: 0 0 var(--tui-3); text-align: left; }
  .tui-pipeline__stage:last-child { padding-bottom: 0; }
  .tui-pipeline__station { grid-area: st; align-self: start; }
  .tui-pipeline__name { grid-area: name; }
  .tui-pipeline__state { grid-area: state; }
  .tui-pipeline__time { grid-area: time; }
  .tui-pipeline__log { grid-area: log; margin: 0; align-self: center; }
  /* The groove runs from under this station to the top of the next one, drawn on the stage above. */
  .tui-pipeline__stage + .tui-pipeline__stage::before, .tui-pipeline__stage + .tui-pipeline__stage::after { content: none; }
  .tui-pipeline__stage:not(:last-child)::before { content: ''; position: absolute; top: 27px; bottom: 0; left: 11px; right: auto; width: 5px; height: auto; border-radius: 3px; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-depth-well, inset 1.5px 0 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 1px 0 0 var(--tui-hl)); }
  .tui-pipeline__stage:not(:last-child)::after { content: ''; position: absolute; top: 27px; bottom: 0; left: 12.5px; right: auto; width: 2px; height: auto; border-radius: 1px; background: var(--tui-ink); transform: scaleY(0); transform-origin: top; }
  .tui-pipeline__stage:has(+ .tui-pipeline__stage:is([data-state="passed"], [data-state="running"], [data-state="failed"]))::after { transform: none; }
}
@media (pointer: coarse) {
  .tui-pipeline__log { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-pipeline__stage[data-state="running"] .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: plan-steps */
/* Plan steps: an agent's plan as stations down a groove, the pipeline's
   stations and the onboarding's groove stood on end. Each station is a socket
   with a lamp in it: green for a step that is done, amber and breathing for the
   one running, red for one that failed, and an empty socket for one that is
   still waiting. Beside it the step in a sentence, its state in a printed word,
   and the one line of what came of it. Ink runs down the groove as far as the
   plan has got. The breathing is an opacity swell on one lamp, held still off
   screen and under reduced motion, when the lamp stays lit. */
.tui-plan { position: relative; display: grid; gap: var(--tui-3); min-width: 0; }
.tui-plan__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--tui-1) var(--tui-4); margin: 0; }
.tui-plan__count { margin: 0; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-plan__steps { margin: 0; padding: 0; list-style: none; }
.tui-plan__step {
  position: relative;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  column-gap: var(--tui-3);
  align-items: start;
  min-width: 0;
  padding: 0 0 var(--tui-4);
}
.tui-plan__step:last-child { padding-bottom: 0; }
/* The groove from under this station to the top of the next one, and the ink in it. */
.tui-plan__step:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 27px;
  bottom: 0;
  left: 11px;
  width: 5px;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 1.5px 0 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 1px 0 0 var(--tui-hl));
}
.tui-plan__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 27px;
  bottom: 0;
  left: 12.5px;
  width: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
  transform: scaleY(0);
  transform-origin: top;
}
/* The ink reaches the next station once this one is done. */
.tui-plan__step[data-state="done"]:not(:last-child)::after { transform: none; }

/* A station: a socket with the step's lamp in it. */
.tui-plan__station { position: relative; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-plan__station > .tui-lamp { width: 11px; height: 11px; }
.tui-plan__step[data-state="done"] .tui-lamp { --c: var(--tui-green); }
.tui-plan__step[data-state="running"] .tui-lamp { --c: var(--tui-amber); }
.tui-plan__step[data-state="failed"] .tui-lamp { --c: var(--tui-red); }
.tui-plan__step:is([data-state="waiting"], [data-state="stopped"]) .tui-lamp { --c: var(--tui-white); }
/* The one that is running breathes: a slow swell of the lamp's own opacity, nothing else moves. */
.tui-plan__step[data-state="running"] .tui-lamp { animation: tui-plan-breathe 2.4s ease-in-out infinite; }
@keyframes tui-plan-breathe { 50% { opacity: 0.3; } }
.tui-plan[data-paused] .tui-lamp { animation-play-state: paused; }

.tui-plan__body { display: grid; gap: 3px; min-width: 0; padding-top: 3px; }
.tui-plan__text { margin: 0; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-plan__step:is([data-state="waiting"], [data-state="stopped"]) .tui-plan__text { font-weight: 500; color: var(--tui-ink-2); }
.tui-plan__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--tui-3); margin: 0; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
/* The state, in small print: a word, so the lamp is never the only sign. */
.tui-plan__state { flex: none; font: 600 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-plan__step:is([data-state="done"], [data-state="running"], [data-state="failed"]) .tui-plan__state { color: var(--tui-ink); }
.tui-plan__outcome { flex: 1 1 14ch; min-width: 0; font-weight: 400; overflow-wrap: anywhere; }
.tui-plan__step[data-state="failed"] .tui-plan__outcome { color: var(--tui-ink); font-weight: 600; }
/* Said aloud, never seen. */
.tui-plan__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-plan__step { padding-bottom: var(--tui-5); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-plan__step[data-state="running"] .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: popconfirm */
/* Popconfirm: the popover's card with a question in it. The card, its printed
   leader, its placement and its shadow are the popover's; this sets the
   question and the two keys. A danger card puts the kit's red lamp before the
   question and the danger tone on Confirm, and nothing else changes colour. */
tui-popconfirm { display: inline-block; vertical-align: middle; }
.tui-popover.tui-popconfirm { width: max-content; max-width: min(280px, calc(100vw - 16px)); }
.tui-popconfirm__q { display: flex; align-items: flex-start; gap: var(--tui-2); margin: 0; font: 700 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); }
.tui-popconfirm__q > .tui-lamp { flex: none; margin-top: 0.3em; }
.tui-popconfirm__q > span:not(.tui-lamp) { min-width: 0; overflow-wrap: anywhere; }
.tui-popconfirm__note { margin: var(--tui-1) 0 0; color: var(--tui-ink-2); overflow-wrap: anywhere; }
.tui-popconfirm .tui-popover__actions { margin-top: var(--tui-3); }

@media (pointer: coarse) {
  tui-popconfirm > .tui-popover__trigger { --h: 44px; min-width: 44px; }
  .tui-popconfirm .tui-popover__actions .tui-key { --h: 44px; min-width: 44px; }
  .tui-popconfirm .tui-popover__actions { gap: var(--tui-3); }
}

/* ---------------------------------------------------------------- part: popover */
/* Popover: a card hung from the key that opened it. A printed leader runs
   from the card to the key and ends in a dot on it, the way a manual points
   at a part. The key stays down while its card is out. Native popover;
   popover.mjs places it and moves the leader. */
.tui-popover {
  --tui-leader: 50%;
  --gap: 14px;
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  width: max-content;
  max-width: min(300px, calc(100vw - 16px));
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow:
    var(--tui-depth-float, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)),
    0 2px 3px rgb(var(--tui-sh) / 0.25),
    0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
/* Inside a page (a specimen, a docs cell) it sits in the flow. */
.tui-popover:not([popover]) { position: relative; }
/* It hangs 6px from its key in 150ms and goes back toward it in 110ms (the menu's transition, and its keyboard rule).
   Until it is placed the side it asked for (data-side) stands in for data-placed, so it starts from the right side. */
.tui-popover[popover] {
  --travel: 0 -6px;
  transition: opacity 110ms var(--tui-ease), translate 110ms var(--tui-ease), overlay 110ms allow-discrete, display 110ms allow-discrete;
}
.tui-popover[popover]:popover-open { transition-duration: 150ms; }
.tui-popover[popover][data-side="top"]:not([data-placed]), .tui-popover[popover][data-placed="top"] { --travel: 0 6px; }
.tui-popover[popover][data-placed="right"] { --travel: -6px 0; }
.tui-popover[popover][data-placed="left"] { --travel: 6px 0; }
.tui-popover[popover][data-key] { --travel: none; }
.tui-popover[popover]:not(:popover-open) { opacity: 0; translate: var(--travel); }
@starting-style { .tui-popover[popover]:popover-open { opacity: 0; translate: var(--travel); } }
@media (prefers-reduced-motion: reduce) { .tui-popover[popover] { --travel: none; } }

/* The leader: a hairline across the gap and a dot where it touches the key. */
.tui-popover::before, .tui-popover::after {
  content: '';
  position: absolute;
  left: var(--tui-leader);
  pointer-events: none;
}
.tui-popover::before { bottom: 100%; width: 1px; height: calc(var(--gap) - 2px); margin-left: -0.5px; background: var(--tui-ink-2); }
.tui-popover::after { bottom: calc(100% + var(--gap) - 5px); width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--tui-ink); box-shadow: 0 0 0 1.5px var(--tui-face-hi); }
.tui-popover[data-placed="top"]::before { top: 100%; bottom: auto; }
.tui-popover[data-placed="top"]::after { top: calc(100% + var(--gap) - 5px); bottom: auto; }
.tui-popover[data-placed="right"]::before, .tui-popover[data-placed="left"]::before { top: var(--tui-leader); left: auto; right: 100%; width: calc(var(--gap) - 2px); height: 1px; margin: -0.5px 0 0; }
.tui-popover[data-placed="right"]::after, .tui-popover[data-placed="left"]::after { top: var(--tui-leader); left: auto; right: calc(100% + var(--gap) - 5px); bottom: auto; margin: -2.5px 0 0; }
.tui-popover[data-placed="left"]::before { right: auto; left: 100%; }
.tui-popover[data-placed="left"]::after { right: auto; left: calc(100% + var(--gap) - 5px); }
/* A card with no leader, e.g. inside a page. */
.tui-popover--plain::before, .tui-popover--plain::after { display: none; }

.tui-popover__title { margin: 0 0 var(--tui-1); font: 700 var(--tui-t-body)/1.3 var(--tui-sans); }
.tui-popover p { margin: 0; }
.tui-popover__title ~ p { color: var(--tui-ink-2); }
.tui-popover__title:has(+ .tui-field) { margin-bottom: 10px; } /* the gap the fields have between them */
.tui-popover :is(.tui-input, .tui-select, .tui-textarea) { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }
.tui-popover > .tui-label:first-child { display: block; margin-bottom: var(--tui-2); }
.tui-popover__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--tui-2); margin-top: var(--tui-4); }

/* The key holding a card out stays down, and its tip keeps out of the card's way. */
.tui-popover__trigger[aria-expanded="true"][data-tip]:not([data-tip-live])::after { display: none; }
.tui-key.tui-popover__trigger[aria-expanded="true"], .tui-key.tui-popover__trigger.is-down {
  transform: translateY(var(--skirt));
  filter: brightness(0.97);
  box-shadow: var(--tui-pressed);
}

/* Open but not yet placed (the toggle event is asynchronous): unseen for that frame, still focusable. */
.tui-popover:popover-open:not([data-placed]) { opacity: 0; }

/* Under 600px a card with a form in it opens as a bottom sheet (popover.mjs): its action row becomes the sheet's foot. */
.tui-sheet--popover .tui-popover__actions { display: contents; }
.tui-sheet--popover .tui-sheet__body > p { margin: 0 0 var(--tui-3); }
.tui-sheet--popover .tui-sheet__body :is(.tui-input, .tui-select, .tui-textarea) { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }

/* ---------------------------------------------------------------- part: preset-bank */
/* Preset bank: four (or more) chunky push buttons in a row, one down at a
   time. Each cap carries a printed number; the one that is latched in sits
   well below the others and its number lights. Choosing another one releases
   the latched cap, which springs back up past its rest height before it
   settles, the way a sprung mechanical interlock does, while the new one
   plunges straight down. Native radios underneath; no script. */
.tui-presetbank {
  display: inline-flex;
  gap: var(--tui-2);
  margin: 0;
  border: 0;
  padding: var(--tui-2);
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-presetbank__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tui-presetbank__key { position: relative; display: block; }
.tui-presetbank__key input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}
.tui-presetbank__cap {
  --skirt: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  height: 56px;
  border-radius: var(--tui-r-s);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 var(--skirt) 0 var(--tui-skirt), 0 calc(var(--skirt) + 3px) 6px rgb(var(--tui-sh) / 0.28));
  transform: translateY(0);
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tui-presetbank__digit {
  font: 700 var(--tui-t-h3)/1 var(--tui-sans);
  letter-spacing: 0;
  color: var(--tui-ink-2);
  transition: color 180ms var(--tui-ease), text-shadow 180ms var(--tui-ease);
}
.tui-presetbank__name {
  font: 500 10px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--tui-ink-2);
}
/* Pressing, before the click latches it. */
.tui-presetbank__key:active input:not(:checked) + .tui-presetbank__cap { transform: translateY(2px); transition-duration: 60ms; }
/* Latched in: sunk the full skirt, its number lit. */
.tui-presetbank__key input:checked + .tui-presetbank__cap {
  transform: translateY(var(--skirt));
  box-shadow: var(--tui-pressed);
}
.tui-presetbank__key input:checked + .tui-presetbank__cap .tui-presetbank__digit {
  color: var(--tui-amber);
  text-shadow: 0 0 8px color-mix(in oklab, var(--tui-amber) 65%, transparent);
}
.tui-presetbank__key input:checked + .tui-presetbank__cap .tui-presetbank__name { color: var(--tui-ink); }
.tui-presetbank__key input:focus-visible + .tui-presetbank__cap { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-presetbank__key:hover:not(:has(input:checked)) .tui-presetbank__cap { filter: brightness(1.03); }
.tui-presetbank__key input:disabled + .tui-presetbank__cap { opacity: 0.45; cursor: not-allowed; }

/* Fewer than four slots is still a bank; this is only the usual count. */
.tui-presetbank--compact .tui-presetbank__cap { width: 44px; height: 44px; }
.tui-presetbank--compact .tui-presetbank__digit { font-size: var(--tui-t-body); }
.tui-presetbank--compact .tui-presetbank__name { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tui-presetbank__cap, .tui-presetbank__digit { transition: none; }
}

/* ---------------------------------------------------------------- part: profile-card */
/* Profile card: a person's ID plate. Their coin (.tui-avatar) sits in a
   countersunk socket cut into the plate; the facts are a rating plate pressed
   into the face, values engraved in tabular figures; one key to act. */
.tui-profile-card {
  container: tui-profile-card / inline-size;
  display: grid;
  gap: var(--tui-5);
  width: min(100%, 360px);
}
.tui-profile-card__who { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--tui-4); }
/* The socket: a round recess a little wider than the coin, so the coin's shadow falls into it. */
.tui-profile-card__socket {
  display: grid;
  place-items: center;
  padding: 5px;
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-profile-card__name { margin: 0; font: 700 var(--tui-t-h3)/1.1 var(--tui-sans); letter-spacing: -0.015em; color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-profile-card__role { margin: 4px 0 0; font-size: var(--tui-t-body); color: var(--tui-ink-2); }
.tui-profile-card__who .tui-status { margin-top: var(--tui-2); }
/* The rating plate: a recess with its facts engraved two by two, hairlines between. */
.tui-profile-card__plate {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-profile-card__plate > div { display: grid; gap: 5px; padding: 11px 14px 12px; min-width: 0; }
.tui-profile-card__plate > div:nth-child(odd) { border-right: 1px solid var(--tui-rule); }
.tui-profile-card__plate > div:nth-child(n+3) { border-top: 1px solid var(--tui-rule); }
.tui-profile-card__plate dt { font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-profile-card__plate dd {
  margin: 0;
  font: 600 17px/1 var(--tui-sans);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink);
  /* Engraved: the cut's lower lip catches the lamp. */
  text-shadow: 0 1px 0 var(--tui-hl);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tui-profile-card__plate dd small { margin-left: 3px; font-size: 0.66em; font-weight: 500; color: var(--tui-ink-2); letter-spacing: 0; }
.tui-profile-card__actions { display: flex; gap: var(--tui-2); }
.tui-profile-card__actions > .tui-key { flex: 1; }

/* Compact: one line — coin, name and role, one small key. For lists of people and panel heads. */
.tui-profile-card--compact { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--tui-3); width: min(100%, 420px); }
.tui-profile-card--compact .tui-profile-card__who { display: contents; }
.tui-profile-card--compact .tui-profile-card__socket { padding: 3px; }
.tui-profile-card--compact .tui-profile-card__name { font-size: var(--tui-t-body); font-weight: 700; letter-spacing: 0; }
.tui-profile-card--compact .tui-profile-card__role { margin-top: 2px; font-size: var(--tui-t-small); }
.tui-profile-card--compact .tui-profile-card__actions > .tui-key { flex: none; }

/* Narrow: the coin above the name, the plate still two by two. */
@container tui-profile-card (max-width: 260px) {
  .tui-profile-card__who { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}

/* A latching key on a card lights its lamp only while it is down. */
.tui-profile-card .tui-key[aria-pressed="false"] > .tui-lamp {
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 1px 0 var(--tui-hl);
}

/* ---------------------------------------------------------------- part: progress-toast */
/* Progress toast: the toast's plate carrying a job. A lamp (amber and
   blinking while it runs, green when done, red when it failed, unlit when
   cancelled), the job in words, its keys, the kit's progress groove filling
   with ink, and a printed line under it with the count, the percent and the
   time left. A job of unknown size runs a short length of ink back and forth;
   under reduced motion that is a still, hatched groove. Nothing is tinted:
   the groove is ink, the only colour is the lamp. See progress-toast.mjs. */
.tui-progress-toasts {
  position: fixed;
  right: var(--tui-4);
  bottom: calc(var(--tui-4) + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: grid;
  gap: var(--tui-2);
  width: min(360px, calc(100vw - 2 * var(--tui-4)));
  pointer-events: none;
}
/* Stacked inside a box of your own, at its bottom right. */
.tui-progress-toasts--in { position: absolute; right: var(--tui-3); bottom: var(--tui-3); z-index: 5; width: min(360px, calc(100% - 2 * var(--tui-3))); }
.tui-progress-toasts__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tui-progress-toast {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px 12px 14px;
  border-radius: 12px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 16px 32px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  pointer-events: auto;
  animation: tui-rise 220ms var(--tui-ease);
  transition: opacity 200ms var(--tui-ease), translate 200ms var(--tui-ease);
}
.tui-progress-toast::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise);
  opacity: var(--tui-grain);
  pointer-events: none;
}
.tui-progress-toast[data-leaving] { opacity: 0; translate: 0 6px; pointer-events: none; }
/* Drawn in the flow of a page, for a specimen. */
.tui-progress-toast[data-static] { width: min(360px, 100%); animation: none; }
.tui-progress-toast[data-static] .tui-lamp[data-blink] { animation: none; }

.tui-progress-toast__head { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 28px; }
.tui-progress-toast__head > .tui-lamp { margin-top: 1px; }
.tui-progress-toast__text { flex: 1; min-width: 0; margin: 0; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-progress-toast__keys { display: flex; flex: none; align-items: center; gap: var(--tui-1); margin-right: -4px; }
.tui-progress-toast__keys:empty { display: none; }

/* The groove: the kit's progress slot. Unknown size: a short length of ink running to and fro. */
.tui-progress-toast__groove { height: 8px; }
.tui-progress-toast__groove[data-indeterminate]::after { width: calc((100% - 4px) * 0.3); animation: tui-progress-toast-run 1.3s var(--tui-ease) infinite alternate; transition: none; }
@keyframes tui-progress-toast-run { from { translate: 0 0; } to { translate: 233.33% 0; } }

.tui-progress-toast__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--tui-3); margin: 0; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-progress-toast__foot:has(> .tui-progress-toast__count:empty):not(:has(> .tui-progress-toast__eta)) { display: none; }

@media (max-width: 480px) {
  .tui-progress-toasts:not(.tui-progress-toasts--in) { left: var(--tui-2); right: var(--tui-2); bottom: calc(var(--tui-2) + env(safe-area-inset-bottom, 0px)); width: auto; }
}
@media (pointer: coarse) {
  .tui-progress-toast .tui-key { --h: 44px; min-width: 44px; }
  .tui-progress-toast__head { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-progress-toast { animation: none; transition: none; }
  .tui-progress-toast__groove[data-indeterminate]::after {
    width: calc(100% - 4px);
    translate: none;
    animation: none;
    opacity: 0.55;
    background: repeating-linear-gradient(-45deg, var(--tui-ink) 0 3px, transparent 3px 7px);
  }
}

/* ---------------------------------------------------------------- agent toasts
   The same plate with a small lit instrument at the left in place of an icon, stacked so that it fans closed:
   the newest card whole, the ones under it peeking above it, opening on hover or when focus is inside. The
   instrument sits in a recess, lit with the kit's lamps (green, amber, red) and ink; nothing else is coloured.
   See agentToast() in progress-toast.mjs. */
.tui-agent-toasts {
  position: fixed;
  right: var(--tui-4);
  bottom: calc(var(--tui-4) + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  width: min(360px, calc(100vw - 2 * var(--tui-4)));
  height: var(--at-closed, 0px);
  transition: height 220ms var(--tui-ease);
}
.tui-agent-toasts--in { position: absolute; right: var(--tui-3); bottom: var(--tui-3); z-index: 5; width: min(360px, calc(100% - 2 * var(--tui-3))); }
.tui-agent-toasts:is(:hover, :focus-within, [data-pinned]) { height: var(--at-open, 0px); }
.tui-agent-toasts__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tui-agent-toast {
  --lit: var(--tui-green);
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
  border-radius: 12px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 16px 32px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
.tui-agent-toast[data-tone="amber"] { --lit: var(--tui-amber); }
.tui-agent-toast[data-tone="red"] { --lit: var(--tui-red); }
.tui-agent-toast::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--tui-noise); opacity: var(--tui-grain); pointer-events: none; }
/* Drawn in the flow of a page, for a specimen. */
.tui-agent-toast[data-static] { width: min(360px, 100%); }
.tui-agent-toast[data-static] .tui-agent-toast__ins > [data-s="now"] { animation: none; }

/* In the stack the cards sit one on another at the bottom. Closed, each older card is as tall as the newest,
   a little higher and a little narrower, so only its top edge shows; past the third they are not drawn. */
.tui-agent-toasts > .tui-agent-toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(20 - var(--i, 0));
  height: var(--h, auto);
  transform-origin: 50% 100%;
  translate: 0 calc(var(--i, 0) * -10px);
  scale: calc(1 - var(--i, 0) * 0.04);
  animation: tui-rise 220ms var(--tui-ease);
  transition: height 220ms var(--tui-ease), translate 220ms var(--tui-ease), scale 220ms var(--tui-ease), opacity 220ms var(--tui-ease);
}
.tui-agent-toasts:not(:is(:hover, :focus-within, [data-pinned])) > .tui-agent-toast:not([data-top]) { height: var(--at-top, auto); }
.tui-agent-toasts:not(:is(:hover, :focus-within, [data-pinned])) > .tui-agent-toast[data-deep] { opacity: 0; pointer-events: none; }
.tui-agent-toasts:is(:hover, :focus-within, [data-pinned]) > .tui-agent-toast { translate: 0 calc(var(--lift, 0px) * -1); scale: 1; }
.tui-agent-toasts > .tui-agent-toast[data-leaving] { opacity: 0; pointer-events: none; transition-duration: 160ms; }

.tui-agent-toast__in { box-sizing: border-box; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 8px 10px 12px; }
.tui-agent-toast__body { flex: 1; min-width: 0; }
.tui-agent-toast__text { margin: 0; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-agent-toast__detail { margin: 0; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); overflow-wrap: anywhere; }
.tui-agent-toast__act { margin-top: var(--tui-2); }
.tui-agent-toast__keys { display: flex; flex: none; align-items: center; gap: var(--tui-1); }

/* The instrument: a recess 52 by 32 with one small lit thing in it. */
.tui-agent-toast__ins {
  box-sizing: border-box;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 32px;
  border-radius: 6px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  color: var(--lit);
}
/* Tests: one lamp per suite, four to a row. */
.tui-agent-toast__ins[data-ins="tests"] { display: grid; grid-template-columns: repeat(4, 7px); gap: 3px 6px; place-content: center; }
/* Merge: two lines join and run on. */
.tui-agent-toast__ins .b { stroke: var(--tui-ink-2); }
.tui-agent-toast__ins .t { stroke: var(--lit); }
.tui-agent-toast__ins .e { fill: var(--lit); }
/* Deploy: a chain of dots, lit up to the current step. */
.tui-agent-toast__ins[data-ins="deploy"] { position: relative; justify-content: space-between; padding: 0 7px; }
.tui-agent-toast__ins[data-ins="deploy"]::before { content: ''; position: absolute; left: 10px; right: 10px; top: calc(50% - 1px); height: 2px; background: var(--tui-ink-3); opacity: 0.6; }
.tui-agent-toast__ins[data-ins="deploy"] > i { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tui-face-lo); box-shadow: inset 0 0 0 1.5px var(--tui-ink-2); }
.tui-agent-toast__ins[data-ins="deploy"] > i[data-s="done"] { color: var(--tui-green); background: var(--tui-green); box-shadow: var(--tui-glow); }
.tui-agent-toast__ins[data-ins="deploy"] > i[data-s="now"] { color: var(--tui-amber); background: var(--tui-amber); box-shadow: var(--tui-glow); animation: tui-blink 1.2s steps(1) infinite; }
.tui-agent-toast__ins[data-ins="deploy"] > i[data-s="failed"] { color: var(--tui-red); background: var(--tui-red); box-shadow: var(--tui-glow); }
/* Build: this build above, the usual below, on one scale. */
.tui-agent-toast__ins[data-ins="build"] { display: grid; align-content: center; justify-content: stretch; gap: 6px; padding: 0 6px; }
.tui-agent-toast__ins[data-ins="build"] > i { display: block; height: 6px; width: max(3px, var(--w)); border-radius: 2px; }
.tui-agent-toast__ins[data-ins="build"] > .n { background: var(--lit); }
.tui-agent-toast__ins[data-ins="build"] > .u { background: var(--tui-ink-2); }
/* Context: an amber meter, lit to how full it is. */
.tui-agent-toast__ins[data-ins="context"] { gap: 2px; }
.tui-agent-toast__ins[data-ins="context"] > i { width: 4px; height: 14px; border-radius: 1px; background: color-mix(in oklab, var(--tui-amber) 22%, var(--tui-face-lo)); box-shadow: inset 0 1px 1px rgb(var(--tui-sh) / 0.35); }
.tui-agent-toast__ins[data-ins="context"] > i[data-on] { background: var(--tui-amber); box-shadow: none; }

@media (max-width: 480px) {
  .tui-agent-toasts:not(.tui-agent-toasts--in) { left: var(--tui-2); right: var(--tui-2); bottom: calc(var(--tui-2) + env(safe-area-inset-bottom, 0px)); width: auto; }
}
@media (pointer: coarse) {
  .tui-agent-toast .tui-key { --h: 44px; min-width: 44px; }
  .tui-agent-toast__in { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-agent-toasts, .tui-agent-toasts > .tui-agent-toast { animation: none; transition: none; }
  .tui-agent-toast__ins[data-ins="deploy"] > i[data-s="now"] { animation: none; }
}

/* ---------------------------------------------------------------- part: qr-code */
/* QR code: the code printed dark on a paper label set in the panel face, four modules of quiet zone
   kept clear, the value printed under it in mono and the kit's Copy key. The
   face, ink, corner and depth are the kit's, so every finish and the Quiet
   volume follow; the quiet zone is the face itself. Without the script the
   panel prints the value in mono, to be read and selected by hand. */
:is(tui-qr, .tui-qr) {
  position: relative;
  box-sizing: border-box;
  display: inline-grid;
  justify-items: center;
  gap: var(--tui-3);
  max-width: 100%;
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
  font: 500 var(--tui-t-small)/1.45 var(--tui-mono);
  text-align: center;
  overflow-wrap: anywhere;
}
/* The code is always dark modules on a light ground, in every finish: an inverted code (light on dark) fails many phone
   scanners. So it is printed on the kit's paper label, which keeps its colours in every finish; the SVG's own quiet zone is the label. */
.tui-qr__code {
  display: block;
  max-width: 100%;
  height: auto;
  color: var(--tui-paper-ink);
  background: var(--tui-paper);
  border-radius: var(--tui-r-s);
}
/* Phosphor and AMOLED keep a dark label for their paper, so there the code takes the label's ink as its ground and the
   paper as its modules: still dark on light, in the finish's own two colours. */
:is([data-finish="phosphor"], [data-finish="amoled"]) .tui-qr__code { color: var(--tui-paper); background: var(--tui-paper-ink); }
.tui-qr__code path { fill: currentColor; }
.tui-qr__foot {
  display: grid;
  justify-items: center;
  gap: var(--tui-2);
  width: 100%;
  min-width: 0;
}
.tui-qr__value {
  max-width: 100%;
  margin: 0;
  font: 500 var(--tui-t-small)/1.45 var(--tui-mono);
  color: var(--tui-ink);
  overflow-wrap: anywhere;
  user-select: all;
}

@media (pointer: coarse) {
  :is(tui-qr, .tui-qr) { padding: var(--tui-3); }
}
@media (max-width: 380px) {
  :is(tui-qr, .tui-qr) { padding: var(--tui-3); }
}

/* ---------------------------------------------------------------- part: radar */
/* Radar: straight-sided rings on one scale from the centre, a spoke for each
   measure, and the series laid over as lightly filled shapes. The outer ring is
   drawn firmer, because it is the scale's end. The first series is a solid edge
   with round markers; the second a dashed edge with square ones, so the two
   differ in more than their lamp. Nothing here turns or sweeps. */
.tui-radar .ring-line { fill: none; stroke: var(--tui-rule); stroke-width: 1; stroke-linejoin: round; }
.tui-radar .ring-line.edge { stroke: var(--tui-ink-3); }
.tui-radar .spoke { stroke: var(--tui-rule); stroke-width: 1; }
.tui-radar .ringval { fill: var(--tui-ink-3); font-size: 10px; paint-order: stroke; stroke: var(--tui-vfd-bg); stroke-width: 3px; }
.tui-radar .axname { fill: var(--tui-ink); font-weight: 600; }
.tui-radar .shape { fill: var(--c); fill-opacity: 0.16; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; }
.tui-radar .shape.two { stroke-dasharray: 6 4; }
.tui-radar .vtx { stroke: var(--tui-vfd-bg); stroke-width: 1.5; }
.tui-radar .vtx[data-here] { stroke: var(--tui-vfd); }
.tui-radar .here-spoke { stroke: var(--tui-ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.tui-radar .tui-chart__legend .shape-circle { border-radius: 50%; }
.tui-radar .tui-chart__swatch.s2 { background: none; box-shadow: inset 0 0 0 1.5px var(--c2); }

@media (pointer: coarse) {
  .tui-radar .tui-chart__plot { min-height: 260px; }
}
@media (max-width: 480px) {
  .tui-radar .axname { font-size: 10.5px; }
}

/* ---------------------------------------------------------------- part: range */
/* Range: two fader caps riding one slot cut into the plate. The span
   between them is printed on the slot's floor in the ink, never a colour;
   the values read on a small LCD beside the legend. Until the script runs it
   is two of the kit's faders, one under the other, each with its words.
   kit/parts/range.mjs builds and wires it. */
tui-range, .tui-range { display: block; min-width: 0; }
.tui-range__set { display: grid; gap: var(--tui-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.tui-range__set > legend { padding: 0 0 0 2px; }

/* Without the script: two faders, each with its words above. */
.tui-range__native { display: grid; gap: 2px; min-width: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* Built: the legend and the readout on one line, the slot and its scale under them. */
:is(tui-range, .tui-range)[data-ready] .tui-range__set { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--tui-3); row-gap: 6px; }
:is(tui-range, .tui-range)[data-ready] .tui-range__set > legend { float: left; }
.tui-range__body { display: contents; }
.tui-range__head { display: flex; justify-content: flex-end; min-width: 0; }
.tui-range__readout { gap: 0.3em; white-space: nowrap; }
.tui-range__readout small { margin: 0 0.15em; }

.tui-range__slot {
  --cap-w: 16px;
  grid-column: 1 / -1;
  position: relative;
  /* The caps ride between the slot's end stops, where a finish has them, never over them. */
  margin-inline: var(--tui-trim-stop-w, 0px);
  height: 32px;
  touch-action: pan-y;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The slot: cut in, dark under its upper wall, lit along its lower lip. */
.tui-range__slot::before {
  content: '';
  position: absolute;
  left: calc(var(--tui-trim-stop-w, 0px) * -1);
  right: calc(var(--tui-trim-stop-w, 0px) * -1);
  top: 13px;
  height: 6px;
  border-radius: 3px;
  border-inline: var(--tui-trim-stop-w, 0px) solid transparent;
  background: var(--tui-trim-stop, none), var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 0 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 1px 0 var(--tui-hl));
}
/* The span between the caps, printed on the slot's floor. */
.tui-range__span {
  position: absolute;
  top: 15px;
  height: 2px;
  left: calc(var(--cap-w) / 2 + (100% - var(--cap-w)) * var(--lo, 0));
  width: calc((100% - var(--cap-w)) * (var(--hi, 1) - var(--lo, 0)));
  border-radius: 1px;
  background: var(--tui-ink);
  opacity: 0.7;
  pointer-events: none;
}

/* A cap: the fader's own, with its printed line. */
.tui-range__thumb {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: calc((100% - var(--cap-w)) * var(--at, 0));
  width: var(--cap-w);
  height: 28px;
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 100% 1.5px no-repeat,
    var(--tui-trim-fader, var(--tui-depth-cap, linear-gradient(90deg, var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 4px 8px rgb(var(--tui-sh) / 0.35));
  transition: filter 70ms var(--tui-ease);
}
/* A finger's worth of reach round a small cap. */
.tui-range__thumb::after { content: ''; position: absolute; inset: -6px -10px; }
.tui-range__thumb.is-top { z-index: 2; }
.tui-range__thumb:hover, .tui-range__thumb.is-hover { filter: brightness(1.03); }
.tui-range__thumb.is-down, tui-range[data-dragging] .tui-range__thumb.is-down { cursor: grabbing; filter: brightness(0.97); }
.tui-range__thumb:focus { outline: none; }
.tui-range__thumb:focus-visible, .tui-range__thumb.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-range[data-dragging] { cursor: grabbing; user-select: none; }
tui-range[data-disabled] { opacity: 0.45; }
tui-range[data-disabled] :is(.tui-range__slot, .tui-range__thumb) { cursor: not-allowed; }

/* The scale under the slot: ticks every tenth, the ends printed. */
.tui-range__scale {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  margin: 0 calc(var(--cap-w, 16px) / 2 - 4px + var(--tui-trim-stop-w, 0px));
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  background:
    linear-gradient(90deg, var(--tui-ink-3) 1px, transparent 1px) 4px 0 / calc((100% - 8px) / 10) 5px repeat-x,
    linear-gradient(90deg, var(--tui-ink-2) 1px, transparent 1px) 4px 0 / calc(100% - 9px) 7px repeat-x;
}


@media (prefers-reduced-motion: reduce) {
  .tui-range__thumb { transition: none; }
}

/* ---------------------------------------------------------------- the rule: one value under a slide rule's carriage
   The scale engraved in a recessed channel, and a carriage riding it: a machined frame round a glass window with
   one hairline, the number read on the glass. The lamp is above left: the sheen on the glass stays where the lamp
   puts it while the carriage passes under it, and every shadow falls down and right. The unit is said once, muted
   after the label. One line under the rule says what the value means. Nothing else on the page changes. */
:is(tui-range, .tui-range)[variant="rule"] { --rule-pad: 36px; container-type: inline-size; }
.tui-range__rule { display: grid; gap: 4px; min-width: 0; text-align: start; }
.tui-range__bar { display: flex; align-items: baseline; gap: 6px; height: 24px; min-width: 0; padding-top: 4px; box-sizing: border-box; }
.tui-range__bar > .tui-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The unit, said once after the label in a quieter ink: the ticks already carry it as 5k or $50. */
.tui-range__unit { flex: none; font: 500 var(--tui-t-label)/1.25 var(--tui-sans); color: var(--tui-ink-3); white-space: nowrap; }

.tui-range__ruler {
  position: relative;
  isolation: isolate;
  height: 34px;
  touch-action: pan-y;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The channel, cut into the plate the whole height of the rule: dark under its upper wall, its lower lip catching the lamp. */
.tui-range__ruler::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: 6px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-range__ticks { position: absolute; z-index: 1; inset: 0; pointer-events: none; }
/* A tick is a cut, engraved up from the channel's floor so its upper half stays clear for the reading:
   a line in the shade with its far wall catching the lamp. */
:is(.tui-range__ticks, .tui-range__lens) > i {
  position: absolute;
  bottom: 4px;
  width: 1px;
  height: 7px;
  margin-left: -0.5px;
  background: var(--tui-ink-3);
  box-shadow: 1px 0 0 color-mix(in oklab, var(--tui-hl) 70%, transparent);
}
/* Every fifth tick stands taller. An end off that grid stays short, so it never reads as a tall one out of step. */
:is(.tui-range__ticks, .tui-range__lens) > i[data-major] { height: 13px; background: var(--tui-ink-2); }
:is(.tui-range__ticks, .tui-range__lens) > i[hidden] { display: none; }

/* The carriage: a machined frame round a glass, standing 3px proud of the channel above and below, its edge a
   real one and its shadow thrown down and right into the channel. As wide as the widest reading, never resized.
   Placed by --at from 0 to 1. Its shadow reaches 7px below it at rest and 10px held: the tick labels sit clear of both. */
.tui-range__cursor {
  --hair-lift: 0.6px; /* the hairline is under the glass, a fraction above the scale: its shadow lands this far off it */
  --zoom: 1.2; /* the glass is a lens: the scale under it, magnified about the hairline */
  --hx: calc(var(--rule-pad) + (100cqw - var(--rule-pad) * 2) * var(--at, 0)); /* the value's x on the rule */
  --lens-pad: calc(var(--rule-pad) * var(--zoom));
  position: absolute;
  z-index: 2;
  top: -3px;
  height: 40px;
  width: calc(var(--chars, 4) * 1ch + 20px);
  left: calc(var(--rule-pad) + (100% - var(--rule-pad) * 2) * var(--at, 0));
  transform: translateX(-50%);
  border-radius: 6px;
  font: 600 var(--tui-t-small)/1 var(--tui-mono);
  cursor: grab;
  touch-action: none;
  box-shadow: var(--tui-depth-key,
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)),
    1px 2px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.4)),
    2px 4px 5px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
  transition: left 120ms var(--tui-ease), filter 70ms var(--tui-ease), box-shadow 120ms var(--tui-ease);
}
/* The frame: grained metal, lit along its top edge, 3px wide all round the glass. */
.tui-range__cursor::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 3px;
  border-radius: inherit;
  background: var(--tui-noise), var(--tui-raised-fill);
  box-shadow: inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), inset 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* A hand's worth of reach round the carriage: 44px each way at the least. */
.tui-range__cursor::after { content: ''; position: absolute; inset: -4px -6px; }
.tui-range__cursor:is(:hover, .is-hover) { filter: brightness(1.03); }
:is(tui-range, .tui-range)[data-dragging] .tui-range__cursor { cursor: grabbing; filter: brightness(0.97); }
/* Held or with the keys on it: lifted off its rails a touch, its shadow longer. */
:is(tui-range, .tui-range)[data-lifted] .tui-range__cursor {
  box-shadow: var(--tui-depth-float,
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)),
    2px 3px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.3)),
    3px 6px 7px -3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)));
}
/* While a hand moves it, the carriage and the sheen follow the hand, never a beat behind it. */
:is(tui-range, .tui-range)[data-dragging] .tui-range__cursor,
:is(tui-range, .tui-range)[data-dragging] .tui-range__glass::after,
:is(tui-range, .tui-range)[data-dragging] .tui-range__lens { transition: none; }
.tui-range__cursor:focus { outline: none; }
.tui-range__cursor:is(.is-keys, .is-focus) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* The glass, 3px inside the frame: its corner is the frame's less 3px. It sits over the channel exactly (0 to 34px),
   so its floor is the channel's own, drawn here, opaque: the scale under the glass is seen only through the lens.
   Painted upward: the floor, the magnified ticks, the tint, shading and sheen, the hairline, the number. */
.tui-range__glass {
  position: absolute;
  inset: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
}
/* The lens: the same ticks, laid out on a rule zoom times as wide (its pad zoom times too), placed so the value's
   own x sits at the hairline (the glass's middle): a point x on the rule lands at the hairline + zoom × (x − the
   value's x), so the reading stays true. Magnified by layout, not by a transform, so each tick stays a crisp 1px
   cut; only their spacing and height grow, about 17px (the tall ticks' tops), never into the number. The floor,
   the number and the frame are not magnified. Clipped by the glass. */
.tui-range__lens {
  --rule-pad: var(--lens-pad);
  position: absolute;
  z-index: 0;
  top: 0;
  left: calc(50% - var(--hx) * var(--zoom));
  width: calc(100cqw * var(--zoom));
  height: 34px;
  pointer-events: none;
  transition: left 120ms var(--tui-ease);
}
.tui-range__lens > i { bottom: calc(17px - 13px * var(--zoom)); height: calc(7px * var(--zoom)); }
.tui-range__lens > i[data-major] { height: calc(13px * var(--zoom)); }
/* The lens's own short ticks, where the printed ones fall too far apart to flank the hairline in the glass:
   shorter than a short tick and about two thirds as strong under the glass, still a 1px cut. Only ever seen through it. */
.tui-range__lens > i[data-sub] { height: calc(5px * var(--zoom)); background: color-mix(in oklab, var(--tui-ink-3) 90%, transparent); box-shadow: none; }
/* The reading, on the glass above the hairline: the saved slider's floating card, made part of the object. */
.tui-range__read { position: absolute; z-index: 3; top: 3px; left: 0; right: 0; font: inherit; text-align: center; font-variant-numeric: tabular-nums; color: var(--tui-ink); white-space: nowrap; }
/* The hairline, scribed under the glass: its shadow on the scale is under a pixel away. */
.tui-range__glass::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 18px;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: var(--tui-ink);
  box-shadow: var(--hair-lift) var(--hair-lift) 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6));
}
/* The sheen: the lamp's, fixed over the rule, so it slides across the glass as the carriage passes under it.
   Laid out as wide as the rule (100cqw) and shifted back by where the glass is. */
.tui-range__glass::after {
  --lamp: var(--tui-edge-hl, var(--tui-hl));
  --gx: calc((var(--rule-pad) + (100cqw - var(--rule-pad) * 2) * var(--at, 0) - (var(--chars, 4) * 1ch + 14px) / 2) * -1);
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* The frame's inner wall shades the glass's upper left; its lower right edge catches the lamp. */
  box-shadow: inset 1px 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)), inset -1px -1px 0 color-mix(in oklab, var(--tui-edge-hl, var(--tui-hl)) 55%, transparent);
  background:
    linear-gradient(112deg, transparent 37%, color-mix(in oklab, var(--lamp) 34%, transparent) 39.5%, color-mix(in oklab, var(--lamp) 34%, transparent) 41%, transparent 43.5%) no-repeat,
    linear-gradient(105deg, color-mix(in oklab, var(--lamp) 34%, transparent), color-mix(in oklab, var(--lamp) 14%, transparent) 30%, color-mix(in oklab, var(--lamp) 5%, transparent) 60%, transparent 85%) no-repeat,
    linear-gradient(color-mix(in oklab, var(--tui-face-hi) 24%, transparent), color-mix(in oklab, var(--tui-face-hi) 24%, transparent));
  background-size: 100cqw 100%;
  background-position: var(--gx) 0, var(--gx) 0, var(--gx) 0;
  transition: background-position 120ms var(--tui-ease);
}

/* The tick labels, clear of the carriage's shadow (10px below the channel's foot, held) with a pixel to spare. */
.tui-range__marks { position: relative; height: 14px; margin-top: 10px; }
.tui-range__marks > span {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
.tui-range__marks > span[hidden] { display: none; }
.tui-range__meaning { margin: 0; min-height: 1.4em; font-size: var(--tui-t-small); line-height: 1.4; color: var(--tui-ink-2); }
/* Narrow: the meaning keeps room for two lines, so the rules under it do not jump as it wraps. */
@container (max-width: 300px) {
  .tui-range__meaning { min-height: 2.8em; }
}

@media (prefers-reduced-motion: reduce) {
  .tui-range__cursor, .tui-range__glass::after, .tui-range__lens { transition: none; }
}

/* On a touch screen the cap's reach grows to 44px by 42. */
@media (pointer: coarse) { .tui-range__thumb::after { inset: -8px -14px; } }

/* ---------------------------------------------------------------- part: rating */
/* Rating: a row of indicator lamps, each in its own round recess, lit up to
   your score. Underneath it is a native radio group (a fieldset and a legend,
   one radio to a lamp), so the arrow keys, Space, the form and the label all
   work with no script. The lamps up to the chosen one are lit; a number is
   printed under each, so the score is never told by colour alone; and the
   read-only kind is the same row drawn as an image with its score in words.
   The lamp's light is a lamp's: amber unless data-lamp says green, red, blue
   or white. */
.tui-rating {
  --c: var(--tui-amber);
  --rt-size: 22px;
  display: grid;
  gap: var(--tui-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
}
.tui-rating[data-lamp="green"] { --c: var(--tui-green); }
.tui-rating[data-lamp="red"] { --c: var(--tui-red); }
.tui-rating[data-lamp="blue"] { --c: var(--tui-blue); }
.tui-rating[data-lamp="white"] { --c: var(--tui-white); }
.tui-rating--sm { --rt-size: 16px; }
.tui-rating--lg { --rt-size: 28px; }
.tui-rating > legend { padding: 0; margin-bottom: var(--tui-2); }

.tui-rating__lamps { display: flex; align-items: flex-start; gap: 2px; flex-wrap: wrap; }
.tui-rating__out { align-self: center; margin-left: var(--tui-2); font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-rating__row { display: flex; align-items: center; flex-wrap: wrap; }

/* One lamp: the label is the target, the radio is the real control and sits under it. */
.tui-rating label { position: relative; display: grid; justify-items: center; gap: 5px; padding: 3px 4px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tui-rating input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tui-rating__n { font: 500 var(--tui-t-label)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); pointer-events: none; }
.tui-rating label:has(input:checked) .tui-rating__n { color: var(--tui-ink); font-weight: 700; }

/* The recess the lamp sits in, and the lamp. */
.tui-rating__lamp {
  position: relative;
  display: block;
  flex: none;
  width: var(--rt-size);
  height: var(--rt-size);
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  /* A bezel ring round the recess: a lamp this small needs an edge it can be seen by (3:1). */
  box-shadow: var(--tui-inset), 0 0 0 1.5px color-mix(in oklab, var(--tui-ink) 58%, transparent);
  pointer-events: none;
}
.tui-rating__lamp::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 25%, transparent), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 0 1px 0 var(--tui-hl);
  transition: background 120ms var(--tui-ease), box-shadow 120ms var(--tui-ease);
}

/* Lit: every lamp at or below the chosen one, and the lamps the pointer is on the way to. */
.tui-rating label:is(:has(input:checked), :has(~ label input:checked), .is-hover, :has(~ label.is-hover)) .tui-rating__lamp::after,
.tui-rating__lamp[data-on]::after {
  color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c);
  box-shadow: var(--tui-glow);
}
@media (hover: hover) {
  .tui-rating__lamps:has(input:not(:disabled):hover) .tui-rating__lamp::after {
    color: inherit;
    background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 25%, transparent), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
    box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 0 1px 0 var(--tui-hl);
  }
  .tui-rating__lamps label:is(:has(input:not(:disabled):hover), :has(~ label input:not(:disabled):hover)) .tui-rating__lamp::after {
    color: var(--c);
    background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c);
    box-shadow: var(--tui-glow);
  }
}

.tui-rating input:focus-visible + .tui-rating__lamp, .tui-rating label.is-focus .tui-rating__lamp { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-rating label:has(input:disabled) { cursor: not-allowed; opacity: 0.45; }
.tui-rating input:disabled { cursor: not-allowed; }

/* Read-only: the row as a picture of the score, with the score in words beside it. */
.tui-rating--readonly { display: flex; align-items: center; gap: var(--tui-2); }
.tui-rating--readonly .tui-rating__lamps { gap: 5px; flex-wrap: nowrap; }
.tui-rating--readonly .tui-rating__lamp { cursor: default; }
/* The ones past the score are cut with a dash, so the lit ones are the only ones with a lamp in them. */
.tui-rating--readonly .tui-rating__lamp:not([data-on])::before { content: ''; position: absolute; left: 50%; top: 50%; width: 36%; height: 2px; margin: -1px 0 0 -18%; border-radius: 1px; background: var(--tui-ink-2); opacity: 0.55; }

@media (pointer: coarse) {
  .tui-rating:not(.tui-rating--readonly) label { min-width: 44px; min-height: 44px; align-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-rating__lamp::after { transition: none; }
}

/* ---------------------------------------------------------------- part: reaction-picker */
/* Reaction picker: the reactions under a message as the kit's chip group, and
   a small key that opens the kit's popover card of six. The key is a key, the
   card is the popover and the chips are the chip group, so every finish and
   both volumes follow with nothing coloured here. This file places them, sets
   the emoji and lays the card's six in two rows of three, so a 44px touch key
   still fits the popover's width. */
:is(tui-reaction-picker, .tui-reaction-picker) {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-1);
  min-width: 0;
}
/* The hidden fallback and the parts the script has nothing to show for. */
:is(tui-reaction-picker, .tui-reaction-picker) > select[hidden],
:is(tui-reaction-picker, .tui-reaction-picker) > .tui-reaction-picker__chips[hidden] { display: none; }
.tui-reaction-picker__chips > label[hidden] { display: none; }

/* The card's six: three across, two rows, so the arrow keys have a grid. */
.tui-reaction-picker__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--tui-2);
}
.tui-reaction-picker__choice { font-size: 18px; line-height: 1; }
.tui-reaction-picker__emoji { font-style: normal; font-size: 15px; line-height: 1; }
.tui-reaction-picker__choice .tui-reaction-picker__emoji { font-size: 18px; }

/* Said aloud, never seen. */
.tui-reaction-picker__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-reaction-picker__key,
  .tui-reaction-picker__choice { transition: none; }
}

/* ---------------------------------------------------------------- part: reasoning */
/* Reasoning: the model's working, printed on a paper tape that feeds behind
   a smoked window. The head is one printed line: the lamp, the words, an LCD
   counting while it thinks, and the accordion's square key. Open, the window
   shows the tape: punched along its left edge like a teleprinter's, printed
   in the paper's second ink, going up under the window's top lip, which
   shades it. Chain of thought is the same tape with a lamp per step on an
   engraved rail. reasoning.mjs runs the states. */
tui-reasoning {
  position: relative;
  display: block;
  min-width: 0;
  text-align: left;
}
.tui-reasoning__head {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 22px;
  align-items: center;
  column-gap: var(--tui-2);
  min-height: 40px;
  padding: 4px 2px;
  list-style: none;
  border-radius: var(--tui-r-m);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-reasoning__head::-webkit-details-marker { display: none; }
.tui-reasoning__head::marker { content: ''; }
.tui-reasoning__head > .tui-lamp { justify-self: center; }
.tui-reasoning__head:focus-visible, tui-reasoning.is-focus .tui-reasoning__head { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-reasoning__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 var(--tui-t-body)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
tui-reasoning[data-state="thinking"] .tui-reasoning__label { font-weight: 600; color: var(--tui-ink); }
.tui-lcd.tui-reasoning__time { min-width: 50px; justify-content: center; padding: 4px 6px 3px; font-size: 11.5px; letter-spacing: 0; }
.tui-reasoning__time[hidden] { display: none; }
/* The window's key: the accordion's square cap, latched and printed − while the tape is out. */
.tui-reasoning__head::after {
  content: '';
  grid-column: 4;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 8px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2.5px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-reasoning__head:hover::after, .tui-reasoning__head.is-hover::after { filter: brightness(1.03); }
.tui-reasoning__head:active::after, .tui-reasoning__head.is-down::after, .tui-reasoning__window[open] > .tui-reasoning__head::after {
  transform: translateY(1.5px);
  filter: brightness(0.97);
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-pressed);
}

/* The window and the tape in it. The window's frame is a border, so the
   tape scrolls under it and never shows in it; the paper is the padding box,
   punched down its left edge, and scrolls with what is printed on it. The
   top lip's shade stays put. */
.tui-reasoning__tape {
  --tui-ink: var(--tui-paper-ink);
  --tui-ink-2: var(--tui-paper-ink-2);
  --tui-focus: var(--tui-paper-ink);
  --hole: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2));
  max-height: 186px;
  margin: 4px 0 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border: 5px solid transparent;
  border-radius: 10px;
  /* Lines feeding in are their own layers: clip them to the window, as the glass would. */
  clip-path: inset(0 round 10px);
  color: var(--tui-paper-ink-2);
  background:
    /* The lip's shade: the same depth in every finish, never so dark that the line under it is lost. */
    linear-gradient(rgb(var(--tui-sh) / min(calc(var(--tui-sh-a) * 1.6), 0.3)), transparent 16px) padding-box,
    radial-gradient(circle at 13px 7px, var(--hole) 1.8px, transparent 2.4px) 0 0 / 100% 14px repeat-y local padding-box,
    linear-gradient(90deg, rgb(60 52 34 / 0.07), transparent 6%, transparent 95%, rgb(60 52 34 / 0.09)) local padding-box,
    linear-gradient(var(--tui-paper-hi), var(--tui-paper)) local padding-box,
    var(--tui-well-fill) border-box var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-reasoning__tape::-webkit-scrollbar { display: none; }
/* The tape is clipped to its window, so its ring is drawn on the paper, inside the frame. */
.tui-reasoning__tape:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -7px; }
.tui-reasoning__window[open] > .tui-reasoning__tape { animation: tui-reasoning-out 200ms var(--tui-ease); }
@keyframes tui-reasoning-out { from { opacity: 0; transform: translateY(-6px); } }
.tui-reasoning__tape > * { margin: 0; padding: 0 14px 0 30px; }
.tui-reasoning__tape > :first-child { padding-top: 11px; }
.tui-reasoning__tape > :last-child { padding-bottom: 12px; }
.tui-reasoning__tape > * + * { padding-top: 8px; }
.tui-reasoning__tape p { font: 400 var(--tui-t-body)/1.6 var(--tui-sans); color: var(--tui-paper-ink-2); overflow-wrap: anywhere; }

/* Steps: an engraved rail down the tape, a lamp on it for each step. */
.tui-reasoning__steps { display: grid; gap: 0; list-style: none; }
.tui-reasoning__steps li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: center; column-gap: 10px; min-height: 26px; }
.tui-reasoning__steps li::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: rgb(60 52 34 / 0.18); box-shadow: 1px 0 0 rgb(255 255 255 / 0.7); }
.tui-reasoning__steps li:first-child::before { top: 50%; }
.tui-reasoning__steps li:last-child::before { bottom: 50%; }
.tui-reasoning__steps li:only-child::before { display: none; }
.tui-reasoning__steps .tui-lamp { position: relative; justify-self: center; box-shadow: inset 0 1px 1.5px rgb(0 0 0 / 0.45), 0 0 0 2px var(--tui-paper); }
.tui-reasoning__steps .tui-lamp[data-on] { box-shadow: var(--tui-glow), 0 0 0 2px var(--tui-paper); }
.tui-reasoning__step { font: 500 var(--tui-t-body)/1.4 var(--tui-sans); color: var(--tui-paper-ink-2); overflow-wrap: anywhere; }
.tui-reasoning__steps li[data-state="running"] .tui-reasoning__step { font-weight: 600; color: var(--tui-paper-ink); }
.tui-reasoning__steps li[data-state="failed"] .tui-reasoning__step { color: var(--tui-paper-ink); }

/* Hidden by the provider: one printed line, no window and no key. */
.tui-reasoning__hidden { display: flex; align-items: center; gap: var(--tui-2); min-height: 40px; margin: 0; padding: 0 2px; font: 500 var(--tui-t-body)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-reasoning__hidden > .tui-lamp { margin: 0 3.5px; }
.tui-reasoning__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-reasoning__window[open] > .tui-reasoning__tape { animation: none; }
}

/* Thinking: the waiting line as a small dot-matrix glyph. Real lamp domes
   behind smoked glass in the Matrix part's window: a 7×7 glyph for each step,
   its lamp colour from the kit's lamp set, a light sweep over the word and a
   step dot for each step under it. reasoning.mjs sets the state; the rhythms
   are CSS, so a frame costs the page nothing. Done holds still. */
tui-thinking {
  --tui-thinking-led: var(--tui-amber);
  /* Concentric: the housing's radius is the glyph window's radius plus the gap every dot keeps from the housing's edge. */
  --tui-thinking-gap: 8px;
  --tui-thinking-glyph-r: 6px;
  --tui-thinking-r: calc(var(--tui-thinking-glyph-r) + var(--tui-thinking-gap));
  display: block;
  min-width: 0;
  width: 100%;
  text-align: left;
}
tui-thinking[data-lamp="blue"] { --tui-thinking-led: var(--tui-blue); }
tui-thinking[data-lamp="white"] { --tui-thinking-led: var(--tui-white); }
tui-thinking[data-lamp="green"] { --tui-thinking-led: var(--tui-green); }
.tui-thinking__window {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--tui-3);
  min-height: 56px;
  box-sizing: border-box;
  padding: var(--tui-thinking-gap) var(--tui-3) var(--tui-thinking-gap) var(--tui-thinking-gap);
  border-radius: var(--tui-thinking-r);
  background: var(--tui-vfd-bg);
  box-shadow:
    var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.8),
    inset 0 0 0 1px rgb(255 255 255 / 0.05),
    0 1px 0 var(--tui-hl),
    0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
/* The smoked glass: the room's lamp caught above left, fixed over the domes. */
.tui-thinking__window::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(164deg, rgb(255 255 255 / 0.075), rgb(255 255 255 / 0.02) 34%, transparent 52%);
}
.tui-thinking__glyph {
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, 6px);
  grid-auto-rows: 6px;
  gap: 2px;
  border-radius: var(--tui-thinking-glyph-r);
}
.tui-thinking__glyph > i {
  display: block;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-vfd-bg) 88%, var(--tui-thinking-led));
  box-shadow: inset 0 0.5px 1px rgb(0 0 0 / 0.6);
  transition: background-color 120ms var(--tui-ease), box-shadow 120ms var(--tui-ease);
}
.tui-thinking__glyph > i[data-on] {
  background: radial-gradient(circle at 40% 35%, color-mix(in oklab, var(--tui-thinking-led) 55%, var(--tui-white)), var(--tui-thinking-led) 62%);
  box-shadow: 0 0 3px 0.5px color-mix(in oklab, var(--tui-thinking-led) 70%, transparent), 0 0 7px 1px color-mix(in oklab, var(--tui-thinking-led) 30%, transparent);
}
.tui-thinking__text { display: grid; gap: 7px; min-width: 0; }
.tui-thinking__label {
  --sweep: var(--tui-white);
  --rest: color-mix(in oklab, var(--tui-white) 82%, var(--tui-vfd-bg));
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 var(--tui-t-body)/1.3 var(--tui-sans);
  color: var(--rest);
}
.tui-thinking__steps { display: flex; gap: 6px; }
.tui-thinking__steps > i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--tui-vfd-bg) 82%, var(--tui-white));
  box-shadow: inset 0 0.5px 1px rgb(0 0 0 / 0.6);
  transition: background-color 120ms var(--tui-ease), box-shadow 120ms var(--tui-ease);
}
.tui-thinking__steps > i[data-lamp="amber"] { color: var(--tui-amber); }
.tui-thinking__steps > i[data-lamp="blue"] { color: var(--tui-blue); }
.tui-thinking__steps > i[data-lamp="white"] { color: var(--tui-white); }
.tui-thinking__steps > i[data-lamp="green"] { color: var(--tui-green); }
.tui-thinking__steps > i[data-at="past"] { background: color-mix(in oklab, var(--tui-vfd-bg) 45%, currentColor); }
.tui-thinking__steps > i[data-at="now"] { background: currentColor; box-shadow: 0 0 5px 1px color-mix(in oklab, currentColor 60%, transparent); }

/* The sweep: a band of light passing over the word, while it works. */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  tui-thinking:not([data-rhythm="still"]) .tui-thinking__label {
    color: transparent;
    background: linear-gradient(100deg, var(--rest) 38%, var(--sweep) 50%, var(--rest) 62%) 120% 0 / 260% 100% no-repeat var(--rest); /* the colour fills where the band runs out at either end, so no letters go missing */
    -webkit-background-clip: text;
    background-clip: text;
    animation: tui-thinking-sweep 1.8s linear infinite;
  }
}
@keyframes tui-thinking-sweep { to { background-position: -20% 0; } }

/* Rhythms for the lit domes. Each dome's --d (set by reasoning.mjs) staggers it with a negative delay, so it is moving from the first frame. */
tui-thinking[data-rhythm="breathe"] .tui-thinking__glyph > i[data-on] { animation: tui-thinking-breathe 1.6s ease-in-out infinite; }
tui-thinking[data-rhythm="wave"] .tui-thinking__glyph > i[data-on] { animation: tui-thinking-wave 1.4s ease-in-out infinite; animation-delay: calc(var(--d) * -90ms); }
tui-thinking[data-rhythm="chase"] .tui-thinking__glyph > i[data-on] { animation: tui-thinking-wave 1.2s ease-in-out infinite; animation-delay: calc(var(--d) * -24ms); }
@keyframes tui-thinking-breathe { 50% { opacity: 0.55; } }
@keyframes tui-thinking-wave { 50% { opacity: 0.3; } }

/* Reduced motion: a steady glyph and no sweep. */
@media (prefers-reduced-motion: reduce) {
  tui-thinking[data-rhythm] .tui-thinking__glyph > i[data-on], tui-thinking[data-rhythm] .tui-thinking__label { animation: none; }
  tui-thinking:not([data-rhythm="still"]) .tui-thinking__label { color: var(--rest); background: none; }
  .tui-thinking__glyph > i, .tui-thinking__steps > i { transition: none; }
}

/* ---------------------------------------------------------------- part: receipt */
/* Receipt: a slip of thermal paper, the paper of the ticket toast and the
   printer (the --tui-paper tokens, light in every finish), with a torn edge
   at its head and its foot and a faint print-head banding. The merchant at
   the top, a rubber stamp beside it that says where the payment stands, the
   facts, then the lines and the sums set in the mono face as a till prints
   them, ruled off with dashes. The only colour is the lamp on the stamp. Under
   the slip, on the page, its keys. When it prints, only the slip goes. */
tui-receipt { position: relative; display: grid; justify-items: center; gap: var(--tui-3); min-width: 0; text-align: left; }
.tui-receipt__source { display: none !important; }

/* The sheet carries the shadow; the paper carries the torn edges, which would cut a shadow off. */
.tui-receipt__sheet { position: relative; width: min(100%, 340px); min-width: 0; }
.tui-receipt__sheet::before {
  content: '';
  position: absolute;
  inset: 7px 1px;
  z-index: 0;
  border-radius: 2px;
  box-shadow: 0 1px 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)), 0 12px 20px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6));
  pointer-events: none;
}
.tui-receipt__paper {
  --tui-focus: var(--tui-paper-ink);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: 26px 22px 30px;
  color: var(--tui-paper-ink);
  background:
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--tui-paper-ink) 3%, transparent) 0 1px, transparent 1px 3px),
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  /* Torn at the head and the foot: a row of small teeth across each. */
  -webkit-mask:
    conic-gradient(from 135deg at top, transparent, black 1deg 89deg, transparent 90deg) top / 12px 6px repeat-x,
    linear-gradient(black 0 0) center / 100% calc(100% - 12px) no-repeat,
    conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) bottom / 12px 6px repeat-x;
  mask:
    conic-gradient(from 135deg at top, transparent, black 1deg 89deg, transparent 90deg) top / 12px 6px repeat-x,
    linear-gradient(black 0 0) center / 100% calc(100% - 12px) no-repeat,
    conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) bottom / 12px 6px repeat-x;
}

/* The stamp sits beside the name, or under it when the slip is too narrow for both. */
.tui-receipt__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--tui-2) var(--tui-3); }
.tui-receipt__who { flex: 1 1 10ch; min-width: 0; display: grid; gap: 2px; }
.tui-receipt__merchant { margin: 0; font: 700 16px/1.25 var(--tui-sans); letter-spacing: -0.005em; color: var(--tui-paper-ink); overflow-wrap: anywhere; }
.tui-receipt__address { margin: 0; font: 400 12px/1.4 var(--tui-mono); color: var(--tui-paper-ink-2); overflow-wrap: anywhere; }
/* The stamp: inked by hand, a little crooked, its word in capitals and a lamp beside it. */
.tui-receipt__stamp {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 8px 4px 7px;
  border: 1.5px solid color-mix(in oklab, var(--tui-paper-ink) 78%, transparent);
  border-radius: 4px;
  font: 700 11px/1 var(--tui-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tui-paper-ink);
  rotate: -4deg;
}
.tui-receipt__stamp .tui-lamp { width: 6px; height: 6px; }

.tui-receipt__facts { display: grid; gap: 3px; margin: 0; padding-top: 12px; border-top: 1px dashed color-mix(in oklab, var(--tui-paper-ink) 38%, transparent); }
.tui-receipt__facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--tui-3); min-width: 0; }
.tui-receipt__facts dt { flex: none; font: 600 10px/1.6 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-paper-ink-2); }
.tui-receipt__facts dd { min-width: 0; margin: 0; font: 400 12px/1.5 var(--tui-mono); text-align: right; color: var(--tui-paper-ink); overflow-wrap: anywhere; }
.tui-receipt__no { font-weight: 600; }

.tui-receipt__table { width: 100%; border-collapse: collapse; font: 400 12.5px/1.45 var(--tui-mono); font-variant-numeric: tabular-nums; color: var(--tui-paper-ink); }
/* Set in full here, so a table style of the page (a docs table, a states grid) never reaches the slip. */
.tui-receipt__table th, .tui-receipt__table td { padding: 3px 0; border: 0; background: none; vertical-align: top; font: inherit; letter-spacing: normal; text-transform: none; color: inherit; }
.tui-receipt__table th { padding-right: var(--tui-3); text-align: left; overflow-wrap: anywhere; }
.tui-receipt__table td { text-align: right; white-space: nowrap; }
tui-receipt[data-static] .tui-receipt__keys { pointer-events: none; }
.tui-receipt__table tbody { border-top: 1px dashed color-mix(in oklab, var(--tui-paper-ink) 38%, transparent); }
.tui-receipt__table tbody > tr:first-child > * { padding-top: 10px; }
.tui-receipt__table tbody > tr:last-child > * { padding-bottom: 8px; }
.tui-receipt__what, .tui-receipt__sub { display: block; }
.tui-receipt__sub { font-size: 11.5px; color: var(--tui-paper-ink-2); }
.tui-receipt__table .tui-receipt__within > * { color: var(--tui-paper-ink-2); }
.tui-receipt__table .tui-receipt__grand > * { font: 700 15px/1.35 var(--tui-mono); }
.tui-receipt__table .tui-receipt__sums .tui-receipt__grand > * { padding-top: 8px; }
.tui-receipt__table .tui-receipt__balance > * { font-weight: 700; }
.tui-receipt__note { margin: 0; padding-top: 12px; border-top: 1px dashed color-mix(in oklab, var(--tui-paper-ink) 38%, transparent); font: 400 11.5px/1.5 var(--tui-mono); text-align: center; color: var(--tui-paper-ink-2); }
.tui-receipt__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tui-receipt__keys { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--tui-2); }
.tui-receipt__keys .tui-copy-key { min-width: 0; }
.tui-receipt__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-receipt__keys .tui-key { --h: 44px; min-width: 44px; }
}
@media (max-width: 380px) {
  .tui-receipt__paper { padding-inline: 16px; }
}

/* Printing: only the slip, in black on white, without its shadow or its keys. */
@media print {
  html[data-tui-printing] body * { visibility: hidden !important; }
  html[data-tui-printing] tui-receipt[data-printing], html[data-tui-printing] tui-receipt[data-printing] * { visibility: visible !important; }
  html[data-tui-printing] tui-receipt[data-printing] { position: absolute; inset: 0 auto auto 0; display: block; width: 80mm; }
  tui-receipt .tui-receipt__keys, tui-receipt .tui-receipt__sheet::before { display: none !important; }
  tui-receipt .tui-receipt__sheet { width: 100%; }
  tui-receipt .tui-receipt__paper { -webkit-mask: none; mask: none; padding: 0; background: none; color: black; }
  tui-receipt .tui-receipt__paper * { color: black !important; }
}

/* ---------------------------------------------------------------- part: recorder */
/* Chart recorder: gridded paper advancing under a pen that rides a rail
   across it. The paper sits in a window cut into the plate; the upper wall
   shades its top edge, and it curls a little where it leaves at the tear
   edge. The pens and their rails stand above the paper and cast their
   shadow onto it, down and to the right. The grid, the ink and the times in
   the margin are drawn by kit/parts/recorder.mjs in the plate's own ink. */
tui-recorder {
  --tui-recorder-h: 200px;
  --tui-recorder-now: 0px;
  container-type: inline-size;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--tui-3);
  width: 100%;
  min-width: 0;
  white-space: normal;
  font-variant-numeric: tabular-nums;
}

.tui-recorder__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-4); min-width: 0; }
.tui-recorder__name { flex: 1 1 0; min-width: 10ch; }
.tui-recorder__keys { display: flex; flex-wrap: wrap; gap: var(--tui-1) var(--tui-4); }
.tui-recorder__key { display: inline-flex; align-items: center; gap: 7px; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
/* The legend: a stroke of each pen's ink. */
.tui-recorder__key::before { content: ''; width: 18px; height: 2px; border-radius: 1px; background: var(--tui-ink); }
.tui-recorder__key--2::before { height: 1.5px; background: repeating-linear-gradient(90deg, var(--tui-ink-2) 0 5px, transparent 5px 8.5px); }
.tui-recorder__lcd { font-size: 17px; }
/* Narrow: the legend takes its own line under the name and the display. */
@container (max-width: 460px) {
  .tui-recorder__keys { order: 3; flex-basis: 100%; }
}
.tui-recorder__read { display: inline-block; min-width: var(--tui-recorder-digits, 3ch); }

/* The window and the paper in it. */
.tui-recorder__deck { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-width: 0; }
.tui-recorder__window {
  position: relative;
  height: var(--tui-recorder-h);
  padding: 3px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-recorder__paper {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: var(--tui-face-hi);
}
/* Paper tooth, and the curl at the tear edge: the edge lifts toward the
   lamp, catches it along its crest and throws a soft shadow to the right. */
.tui-recorder__paper::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      transparent 6px,
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.55)) 8px,
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.2)) 11px,
      var(--tui-hl) 14px,
      transparent 18px,
      rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.16)) 23px,
      transparent 34px) 0 0 / 34px 100% no-repeat,
    var(--tui-noise);
  opacity: 0.9;
}
.tui-recorder__ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  color: var(--tui-ink);
  outline-color: var(--tui-ink-2);
}
/* The tear bar across the exit: a toothed steel strip the paper runs
   under, throwing its shadow to the right. */
.tui-recorder__window::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  z-index: 3;
  width: 7px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--tui-knob-hi), var(--tui-knob-mid) 55%, var(--tui-knob-lo)) 0 0 / 5px 100% no-repeat,
    radial-gradient(circle at 0 50%, var(--tui-knob-lo) 0 1.7px, transparent 2.1px) 5px 0 / 2px 4px repeat-y;
  filter: drop-shadow(1.2px 1px 0.8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
/* The window's upper wall shades the paper's top edge. */
.tui-recorder__window::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: 3;
  border-radius: 3px;
  pointer-events: none;
  box-shadow:
    var(--tui-depth-shade, inset 0 4px 4px -3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.9)),
    inset 3px 0 3px -3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)));
}

/* The pens, their rails, and the shadow they throw on the paper. */
.tui-recorder__rig {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(1.5px 2.5px 1.2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.5)));
}
tui-recorder[data-lifted] .tui-recorder__rig { filter: drop-shadow(3px 5px 2.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1))); }
.tui-recorder__rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--tui-recorder-now) + 13px);
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--tui-knob-hi), var(--tui-knob-mid) 45%, var(--tui-knob-lo));
}
.tui-recorder__rail--2 { left: calc(var(--tui-recorder-now) + 27px); }
/* A pen: a felt-tip stylus that comes to a point at the line (tipped in its
   ink), a lever arm back to a small carriage clipped on its rail. A tapering
   nib and a low carriage read as a pen on a bracket, not a slider thumb. */
.tui-recorder__pen {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 18px;
  margin: -9px 0 0 -4px;
  will-change: transform;
  background: linear-gradient(var(--tui-knob-lo), var(--tui-knob-lo)) 12px 8px / 5px 2px no-repeat;
}
.tui-recorder__pen--2 { width: 38px; background-size: 18px 2px; }
.tui-recorder__pen::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 1.5px;
  background: linear-gradient(90deg, var(--tui-knob-hi), var(--tui-knob-mid) 45%, var(--tui-knob-lo));
  box-shadow:
    var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl),
    inset 0 -1px 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)),
    0 0 0 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
.tui-recorder__pen--2::before { left: 29px; }
.tui-recorder__pen::after {
  --tip: var(--tui-ink);
  content: '';
  position: absolute;
  left: 4px;
  top: 4.5px;
  width: 11px;
  height: 9px;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  background: linear-gradient(90deg, var(--tip) 0 3.5px, transparent 3.5px), linear-gradient(var(--tui-knob-hi), var(--tui-knob-mid) 35%, var(--tui-knob-lo));
  transition: translate 160ms var(--tui-ease);
}
.tui-recorder__pen--2::after { --tip: var(--tui-ink-2); }
tui-recorder[data-lifted] .tui-recorder__pen::after { translate: -0.5px -1px; }

/* The scale printed on the plate beside the window, and the set-point indices. */
.tui-recorder__scale {
  position: relative;
  height: var(--tui-recorder-h);
  font: 500 10px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  color: var(--tui-ink-2);
}
.tui-recorder__scale span { position: absolute; left: 11px; translate: 0 -50%; white-space: nowrap; }
.tui-recorder__scale span::before { content: ''; position: absolute; left: -9px; top: 50%; width: 5px; height: 1px; background: var(--tui-ink-3); }
.tui-recorder__unit { font-weight: 500; color: var(--tui-ink-2); }
.tui-recorder__set {
  position: absolute;
  left: 0;
  translate: 0 -50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 3.5px 5px 3.5px 0;
  border-color: transparent var(--tui-ink) transparent transparent;
}

.tui-recorder__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-5); }
.tui-recorder__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-recorder__pen::after { transition: none; }
}

/* ---------------------------------------------------------------- part: referral */
/* Referral: the invite loop on one card. The card is the kit's panel face; the link row, the
   email field, the Send key, the counters, the bar and the list are the kit's own parts, set
   in a column. This file only spaces them. A new friend slides in 160ms; with reduced motion
   it just appears. */
:is(tui-referral, .tui-referral) {
  position: relative;
  box-sizing: border-box;
  display: grid;
  gap: var(--tui-4);
  width: 100%;
  max-width: 520px;
  min-width: 0;
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-referral__title { margin: 0; font: 600 var(--tui-t-h3)/1.25 var(--tui-sans); color: var(--tui-ink); }
.tui-referral__link { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2); min-width: 0; }
.tui-referral__url { flex: 1 1 12rem; min-width: 0; font-family: var(--tui-mono); font-size: var(--tui-t-small); text-overflow: ellipsis; }
.tui-referral__email { display: grid; gap: var(--tui-2); min-width: 0; }
.tui-referral__email tui-tag-input { display: flex; min-width: 0; }
.tui-referral__send { display: grid; justify-items: start; gap: var(--tui-2); }
.tui-referral__line { margin: 0; min-height: 1.4em; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-referral__counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--tui-3); margin: 0; }
.tui-referral__counts .tui-readout { min-width: 0; }
.tui-referral__counts dt, .tui-referral__counts dd { margin: 0; }
.tui-referral__bar { min-width: 0; }
.tui-referral__friends { min-width: 0; }
.tui-referral__empty { padding: var(--tui-3); font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-referral__friend[data-new] { animation: tui-referral-in 160ms var(--tui-ease, ease-out) 1; }
@keyframes tui-referral-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
/* Said aloud, never seen. */
.tui-referral__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .tui-referral__friend[data-new] { animation: none; }
}
/* The count sits right beside "Reward"; the state words keep the far end. */
.tui-referral__bar .tui-meter__head { column-gap: var(--tui-2); }
.tui-referral__bar .tui-meter__value { margin-right: auto; }
/* The friend rows' content starts at the card's own left edge, like the link field and the counters. */
.tui-referral__friends .tui-list__row { padding-inline: 0; }
.tui-referral__friends .tui-list__row + .tui-list__row::before { left: 0; right: 0; }

/* ---------------------------------------------------------------- part: result */
/* Result: the end of a task as one plate. A raised plate with a lens at its
   head, a bezel recessed into the plate with one lamp lit in it, then the
   verdict, one sentence, and what to do next. Green when it worked, amber when
   it worked with something to check, red when it did not. The colour is only
   the lamp's: the verdict is a sentence that says which. When it appears, focus
   moves to the verdict. */
.tui-result {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: var(--tui-3);
  width: min(100%, 440px);
  padding: var(--tui-8) var(--tui-6) var(--tui-6);
  border-radius: var(--tui-r-l);
  /* Cheeks, where a finish has them, are the side borders: nothing on the plate reaches them. */
  border-inline: var(--tui-trim-w, 0px) solid transparent;
  background: var(--tui-trim-cheek, none), var(--tui-face);
  box-shadow: var(--tui-raised);
  color: var(--tui-ink);
  text-align: center;
}
/* The same bead-blast as a panel. */
.tui-result::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise), linear-gradient(170deg, color-mix(in oklab, var(--tui-hl) 7%, transparent), transparent 40%);
  opacity: var(--tui-grain);
  pointer-events: none;
}
/* The lens: a round bezel sunk into the plate, the lamp centred in it. */
.tui-result__lens {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--tui-1);
  border-radius: 50%;
  background: var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-result__lens > .tui-lamp { width: 20px; height: 20px; }
.tui-result__title {
  margin: 0;
  max-width: 24ch;
  overflow-wrap: anywhere;
  font: 700 var(--tui-t-lead)/1.25 var(--tui-sans);
  letter-spacing: -0.01em;
  color: var(--tui-ink);
  text-wrap: balance;
  border-radius: var(--tui-r-s);
}
.tui-result__title:focus { outline: none; }
.tui-result__title:focus-visible, .tui-result__title.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 4px; }
.tui-result__text { max-width: 36ch; margin: 0; overflow-wrap: anywhere; color: var(--tui-ink-2); text-wrap: balance; }
/* What to do next: one key that matters, and perhaps one that does not. */
.tui-result__next .tui-key { max-width: 100%; height: auto; min-height: var(--h); padding-block: var(--tui-2); white-space: normal; text-align: center; line-height: 1.2; }
.tui-result__next { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--tui-2) var(--tui-4); margin-top: var(--tui-3); }
/* What was made or changed, as quiet small print under the words. */
.tui-result__detail { margin: 0; color: var(--tui-ink-2); font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; }
/* Beside the words, for a wide, short place. */
.tui-result--row { grid-template-columns: auto minmax(0, 1fr); justify-items: start; column-gap: var(--tui-5); align-items: start; width: min(100%, 560px); padding: var(--tui-6); text-align: left; }
.tui-result--row > .tui-result__lens { grid-row: 1 / span 4; margin: 0; }
.tui-result--row > :not(.tui-result__lens) { grid-column: 2; }
.tui-result--row .tui-result__next { justify-content: flex-start; }
@media (max-width: 460px) {
  .tui-result--row { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .tui-result--row > .tui-result__lens { grid-row: auto; margin-bottom: var(--tui-1); }
  .tui-result--row > :not(.tui-result__lens) { grid-column: 1; }
  .tui-result--row .tui-result__next { justify-content: center; }
}
@media (pointer: coarse) { .tui-result .tui-key, .tui-result .tui-key--sm { --h: 44px; } }

/* ---------------------------------------------------------------- part: rich-editor */
/* Rich editor: the field's well with an editing surface in it, and the kit's
   toolbar above it (a slot cut into the plate with a rack of toggle keys that
   stay down while their format is on). The well, the keys and the slot are the
   kit's own, so every finish and both volumes are theirs. Text is set in the
   sans face; only code is mono. The only colour is the red of an error and of a
   count over its limit. Without the script the starting content shows in the
   well, read only. See rich-editor.mjs. */
tui-rich-editor { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }

tui-rich-editor .tui-rich-editor__bar { width: 100%; }
.tui-rich-editor__key { flex: none; }
/* Keys that are a letter: the face is printed, not drawn. */
.tui-rich-editor__face { font: 600 var(--tui-t-small)/1 var(--tui-sans); letter-spacing: 0; }
.tui-rich-editor__face--bold, .tui-rich-editor__face--italic { font-size: 14px; }
.tui-rich-editor__face--bold { font-weight: 800; }
.tui-rich-editor__face--italic { font-style: italic; font-weight: 600; }
.tui-rich-editor__key .tui-icon { width: 16px; height: 16px; }

/* The link row: a small well with the address and two keys on its floor. */
.tui-rich-editor__link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: calc(var(--tui-r-m) + 4px);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-rich-editor__link:has(.tui-rich-editor__url:focus-visible) { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-rich-editor__url {
  appearance: none;
  flex: 1 1 120px;
  min-width: 0;
  height: 32px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
.tui-rich-editor__url::placeholder { color: var(--tui-ink-3); }
.tui-rich-editor__url[aria-invalid="true"] { text-decoration: underline wavy 1px var(--tui-red-ink, var(--tui-red)); text-underline-offset: 4px; }
.tui-rich-editor__link > .tui-key { --h: 32px; flex: none; }
.tui-rich-editor__link[hidden], .tui-rich-editor__link > [hidden] { display: none; }

/* The well and the surface. */
.tui-rich-editor__well {
  position: relative;
  min-width: 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-rich-editor__well:has(.tui-rich-editor__surface:focus-visible), tui-rich-editor.is-focus .tui-rich-editor__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* An error is marked on the lip around the cut, as the other fields do. */
:is(tui-rich-editor[aria-invalid="true"], tui-rich-editor[data-invalid], .tui-field[data-error] tui-rich-editor) .tui-rich-editor__well {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
.tui-rich-editor__surface {
  position: relative;
  box-sizing: border-box;
  min-height: var(--re-min, 132px);
  max-height: var(--re-max, 360px);
  overflow-y: auto;
  padding: 10px 12px;
  font: 400 var(--tui-t-body)/1.6 var(--tui-sans);
  color: var(--tui-ink);
  overflow-wrap: anywhere;
  outline: none;
  caret-color: var(--tui-ink);
}
.tui-rich-editor__surface[data-empty]::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  color: var(--tui-ink-3);
  pointer-events: none;
}
.tui-rich-editor__surface > :first-child { margin-top: 0; }
.tui-rich-editor__surface > :last-child { margin-bottom: 0; }
.tui-rich-editor__surface :where(p, ul, ol, blockquote, pre) { margin: 0 0 0.6em; }
.tui-rich-editor__surface :where(h2) { margin: 0.9em 0 0.4em; font: 700 var(--tui-t-h3)/1.2 var(--tui-sans); }
.tui-rich-editor__surface :where(h3) { margin: 0.8em 0 0.35em; font: 700 var(--tui-t-lead)/1.3 var(--tui-sans); }
.tui-rich-editor__surface :where(ul, ol) { padding-left: 1.5em; }
.tui-rich-editor__surface :where(ul) { list-style: disc; }
.tui-rich-editor__surface :where(ol) { list-style: decimal; }
.tui-rich-editor__surface :where(li) { margin: 0.1em 0; padding-left: 0.2em; }
.tui-rich-editor__surface :where(li)::marker { color: var(--tui-ink-2); }
.tui-rich-editor__surface :where(blockquote) { padding: 2px 0 2px var(--tui-4); border-left: 2px solid var(--tui-rule); color: var(--tui-ink-2); }
.tui-rich-editor__surface :where(blockquote > p) { margin-bottom: 0.4em; }
.tui-rich-editor__surface :where(strong, b) { font-weight: 650; }
.tui-rich-editor__surface :where(a) { color: var(--tui-ink); text-decoration: underline 1px; text-decoration-color: var(--tui-ink-3); text-underline-offset: 0.2em; cursor: text; }
.tui-rich-editor__surface :where(code, pre) { font-family: var(--tui-mono); }
.tui-rich-editor__surface :where(code) { padding: 0.08em 0.35em; border-radius: 3px; font-size: 0.9em; background: rgb(var(--tui-sh) / 0.1); }
.tui-rich-editor__surface :where(pre) { padding: 8px 10px; border-radius: var(--tui-r-s); font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; background: rgb(var(--tui-sh) / 0.1); }
.tui-rich-editor__surface :where(pre code) { padding: 0; background: none; font-size: inherit; }

/* The foot: a message that grows to fill, and the count at the end. */
.tui-rich-editor__foot { display: flex; align-items: baseline; gap: 12px; min-width: 0; min-height: 1.2em; padding: 0 2px; font-size: var(--tui-t-small); }
.tui-rich-editor__msg { flex: 1 1 auto; min-width: 0; color: var(--tui-red-ink, var(--tui-red)); }
.tui-rich-editor__count { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-rich-editor__count[data-state="near"] { color: var(--tui-ink); font-weight: 600; }
.tui-rich-editor__count[data-state="over"] { color: var(--tui-red-ink, var(--tui-red)); font-weight: 600; }
.tui-rich-editor__sr, .tui-rich-editor__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Off. */
tui-rich-editor[data-disabled] .tui-rich-editor__well { opacity: 0.55; cursor: not-allowed; }
tui-rich-editor[data-disabled] .tui-rich-editor__surface { cursor: not-allowed; }
tui-rich-editor[data-disabled] .tui-rich-editor__bar { opacity: 0.55; }
tui-rich-editor[data-readonly] .tui-rich-editor__surface { cursor: default; }
tui-rich-editor[data-readonly] .tui-rich-editor__bar { opacity: 0.7; }

/* Before the script: the starting content, read only, in the well. */
tui-rich-editor:not(:defined) { padding: 10px 12px; border-radius: var(--tui-r-m); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); font: 400 var(--tui-t-body)/1.6 var(--tui-sans); color: var(--tui-ink); }
tui-rich-editor:not(:defined) > :where(p, ul, ol, blockquote, pre) { margin: 0 0 0.6em; }
tui-rich-editor:not(:defined) > :last-child { margin-bottom: 0; }

/* A narrow screen: the toolbar scrolls inside itself and the page never does. */
@media (max-width: 560px) {
  tui-rich-editor .tui-rich-editor__bar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding-block: 5px; scrollbar-width: thin; }
  tui-rich-editor .tui-rich-editor__bar .tui-key:focus-visible { outline-offset: 1px; }
}
@media (pointer: coarse) {
  tui-rich-editor .tui-rich-editor__bar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding-block: 5px; scrollbar-width: thin; }
  tui-rich-editor .tui-rich-editor__bar .tui-key:focus-visible { outline-offset: 1px; }
  .tui-rich-editor__face { font-size: 15px; }
  .tui-rich-editor__key .tui-icon { width: 18px; height: 18px; }
  .tui-rich-editor__link { flex-wrap: wrap; }
  .tui-rich-editor__url { flex-basis: 100%; height: 44px; font-size: 16px; }
  .tui-rich-editor__link > .tui-key { --h: 44px; flex: 1 1 0; }
  .tui-rich-editor__surface { min-height: var(--re-min, 160px); padding: 12px 14px; font-size: 16px; }
  .tui-rich-editor__surface[data-empty]::before { top: 12px; left: 14px; right: 14px; }
  .tui-rich-editor__foot { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-rich-editor .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: ring */
/* Ring meter: a share shown the way a studio clock shows seconds. A ring of
   lamps behind dark glass in a spun bezel, lit clockwise from the mark at
   twelve; the value in lit digits in the middle; an optional inner ring of
   small display-lit dots. ring.mjs places the lamps and steps them round. */

tui-ring {
  --size: 180px;
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: min(var(--size), 100%);
  /* In a table cell a percentage alone would let the column crush it. */
  min-width: min(var(--size), 110px);
  container-type: inline-size;
}

/* The bezel: spun metal, its highlight fixed where the lamp puts it. */
.tui-ring__bezel {
  position: relative;
  padding: 6%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, color-mix(in oklab, var(--tui-knob-hi) 30%, transparent) 0 0.6px, color-mix(in oklab, var(--tui-knob-lo) 16%, transparent) 0.6px 1.5px),
    conic-gradient(from 0deg, var(--tui-knob-mid) 0deg, var(--tui-knob-lo) 40deg, var(--tui-knob-mid) 80deg, var(--tui-knob-hi) 135deg, var(--tui-knob-mid) 180deg, var(--tui-knob-lo) 220deg, var(--tui-knob-mid) 260deg, var(--tui-knob-hi) 315deg, var(--tui-knob-mid) 360deg);
  box-shadow:
    var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl),
    0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)),
    0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)),
    3px 8px 16px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
/* The zero mark, engraved in the bezel at twelve: where the lamps start. */
.tui-ring__mark {
  position: absolute;
  left: 50%;
  top: 1.2%;
  width: 3.6%;
  height: 3%;
  translate: -50% 0;
  background: var(--tui-ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0.8;
}

/* The glass: a dark window, set below the bezel's lip. */
.tui-ring__glass {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px),
    var(--tui-vfd-bg);
  box-shadow:
    var(--tui-depth-well, inset 0 0 0 1px rgb(0 0 0 / 0.6),
    inset 2px 4px 9px rgb(0 0 0 / 0.85));
  color: var(--tui-vfd);
  contain: layout paint;
}

.tui-ring__lamps { position: absolute; inset: 0; }
/* A lamp: a round LED. Unlit, its colour shows faintly through the glass. */
.tui-ring__lamp, .tui-ring__dot {
  --c: var(--tui-green);
  position: absolute;
  width: var(--tui-ring-d);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: color-mix(in oklab, var(--c) 16%, var(--tui-vfd-bg));
  box-shadow: inset 0 0.5px 0.5px rgb(0 0 0 / 0.7), 0 0.5px 0 rgb(255 255 255 / 0.05);
}
tui-ring[data-lamp="amber"] .tui-ring__lamp { --c: var(--tui-amber); }
tui-ring[data-lamp="red"] .tui-ring__lamp { --c: var(--tui-red); }
tui-ring[data-lamp="blue"] .tui-ring__lamp { --c: var(--tui-blue); }
tui-ring[data-lamp="white"] .tui-ring__lamp { --c: var(--tui-white); }
.tui-ring__lamp::after, .tui-ring__dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle at 40% 36%, color-mix(in oklab, var(--c) 55%, rgb(255 255 255)) 0 18%, var(--c) 62%);
  box-shadow: 0 0 5px 0.5px color-mix(in oklab, var(--c) 50%, transparent);
}
.tui-ring__lamp.is-on::after, .tui-ring__dot.is-on::after { opacity: 1; }
/* The inner ring: small dots lit in the display's own light, not a lamp colour. */
.tui-ring__dot { --c: var(--tui-vfd); width: var(--tui-ring-di); }
.tui-ring__dot::after { box-shadow: 0 0 4px 0 color-mix(in oklab, var(--c) 45%, transparent); }

/* The reading, in lit digits; the name in the glass's dimmer light. */
.tui-ring__read {
  position: absolute;
  inset: 21%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5cqw;
  text-align: center;
}
.tui-ring__value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.12em;
  font: 500 15cqw/1 var(--tui-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-shadow: 0 0 6px color-mix(in oklab, var(--tui-vfd) 55%, transparent), 0 0 18px color-mix(in oklab, var(--tui-vfd) 18%, transparent);
}
.tui-ring__unit { font: 600 0.36em/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; opacity: 0.75; }
.tui-ring__label, .tui-ring__second {
  max-width: 100%;
  overflow: hidden;
  font: 500 5cqw/1.2 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: color-mix(in oklab, var(--tui-vfd) 72%, transparent);
}
/* A long name takes two lines, never more. */
.tui-ring__label { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-wrap: balance; }
.tui-ring__second { display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap; text-overflow: ellipsis; color: color-mix(in oklab, var(--tui-vfd) 60%, transparent); }
/* The inner ring's key: one of its dots, lit, beside its words. */
.tui-ring__key { flex: none; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--tui-vfd); box-shadow: 0 0 4px color-mix(in oklab, var(--tui-vfd) 50%, transparent); }

/* The glare on the glass, from the lamp above left; it never moves. */
.tui-ring__sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 62% 40% at 30% 16%, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.03) 60%, transparent 72%),
    radial-gradient(circle closest-side, transparent 93%, rgb(255 255 255 / 0.16) 96.5%, transparent 99.5%);
  -webkit-mask: linear-gradient(135deg, #000 25%, rgb(0 0 0 / 0.15) 60%, transparent);
          mask: linear-gradient(135deg, #000 25%, rgb(0 0 0 / 0.15) 60%, transparent);
}

/* ---------------------------------------------------------------- part: scatter */
/* Scatter: points on two real scales, the nearest read by a crosshair. A point
   is the lamp with its edge drawn solid and its middle part-filled, so a dense
   cluster still shows each circle. Series differ in shape too: circle, square,
   triangle, in the plot and in the key. The crosshair is dashed, with the two
   values tagged on the axes in the display's light; the point it reads is
   ringed. */
.tui-scatter .pt { fill-opacity: 0.55; stroke: var(--c); stroke-width: 1.5; }
.tui-scatter .pt.s3 { fill: var(--c3); }
.tui-scatter .pt.s3, .tui-scatter .pt.s4 { fill-opacity: 0.55; }
.tui-scatter .pt[data-here] { fill-opacity: 0.95; }
.tui-scatter .tui-chart__grid line.v { stroke-dasharray: none; }
.tui-scatter .tui-chart__legend .shape-circle { border-radius: 50%; }
.tui-scatter .tui-chart__legend .shape-triangle { clip-path: polygon(50% 0, 100% 90%, 0 90%); }
.tui-scatter .tui-chart__legend .shape-square { border-radius: 1px; }
.tui-scatter .tui-chart__swatch { background: color-mix(in oklab, var(--c) 55%, transparent); box-shadow: inset 0 0 0 1.5px var(--c); }
.tui-scatter .tui-chart__swatch.shape-triangle { box-shadow: none; background: var(--c); }
.tui-scatter button.tui-chart__lkey[aria-pressed="false"] .tui-chart__swatch { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.tui-scatter .tui-chart__over .ring { stroke-dasharray: none; }

@media (pointer: coarse) {
  .tui-scatter .tui-chart__plot { min-height: 240px; }
}
@media (max-width: 480px) {
  .tui-scatter .pt { stroke-width: 1.25; }
}

/* ---------------------------------------------------------------- part: schedule-field */
/* Schedule field: "Run this agent every..." as one sentence in the field's well.
   The frequency is the kit's segmented control, the weekdays are its toggle keys,
   the time is its time field, the next runs are printed on its LCD; the well,
   the keys and the readout are the kit's, so every finish and both volumes are
   theirs. Without the script the markup is a plain text input holding the cron
   line. kit/parts/schedule-field.mjs builds and wires it. */
tui-schedule-field { position: relative; display: block; width: 100%; min-width: 0; container-type: inline-size; }
tui-schedule-field:not(:defined) .tui-field { width: 100%; }
.tui-schedule-field__field { --sf-gap: var(--tui-3); }
.tui-schedule-field__well {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sf-gap);
  min-width: 0;
  padding: var(--tui-3);
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-schedule-field__well [hidden] { display: none !important; }
.tui-schedule-field__field[data-error] .tui-schedule-field__well {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}

/* The frequency. */
.tui-schedule-field__every { width: 100%; }
.tui-schedule-field__when { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sf-gap); min-width: 0; }

/* The weekdays: seven equal columns, four when the field is narrow (a phone at 320). Each key carries the toggle key's own lamp, lit while it is down. */
.tui-schedule-field__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--tui-1); }
.tui-schedule-field__day { width: 100%; min-width: 0; padding: 0; flex-direction: column; gap: 3px; justify-content: center; font-size: 12px; }
.tui-schedule-field__day { --h: 38px; }
.tui-schedule-field__day .tui-lamp { margin: 0; width: 6px; height: 6px; }
@container (max-width: 280px) {
  .tui-schedule-field__days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (pointer: coarse) {
  .tui-schedule-field__day { min-width: 0; }
}

/* The frequency: four equal columns, the words centred in each. */
.tui-schedule-field__every { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tui-schedule-field__every span { justify-content: center; padding: 0 2px; }

/* The words after the days read on in a line: at 09:00, on day 31 at 09:00, at minute 15. */
.tui-schedule-field__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2); min-width: 0; }
.tui-schedule-field__on, .tui-schedule-field__at { font: 500 var(--tui-t-body)/1 var(--tui-sans); color: var(--tui-ink-2); }
.tui-schedule-field__controls tui-time-field { width: max-content; }
.tui-schedule-field__controls .tui-input { width: 72px; font-variant-numeric: tabular-nums; }
/* The time field keeps its name ("Time") for a screen reader; the word "at" in front of it is the label that is seen. */
.tui-schedule-field__time .tui-label { position: absolute; padding: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A cron line the sentence cannot say: the frequency goes quiet with nothing chosen, still readable and operable. */
.tui-schedule-field__well[data-custom] .tui-schedule-field__every { opacity: 0.6; }

/* The sentence, and the next runs under it on an LCD strip. */
.tui-schedule-field__sentence { margin: 0; font: 600 var(--tui-t-lead)/1.3 var(--tui-sans); letter-spacing: -0.01em; text-wrap: balance; }
.tui-schedule-field__runs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.3em 0.8em;
  align-items: baseline;
  margin: 0;
  padding: 0.55em max(0.8em, var(--tui-safe-s));
  list-style: none;
  font-size: 14px;
  letter-spacing: 0;
}
.tui-schedule-field__runs li { display: contents; }
.tui-schedule-field__runs .tui-schedule-field__runs-head { display: flex; flex-wrap: wrap; grid-column: 1 / -1; justify-content: space-between; gap: 0.8em; padding-bottom: 0.2em; border-bottom: 1px solid color-mix(in oklab, var(--tui-lcd-ink) 22%, transparent); }
.tui-schedule-field__runs small { font-size: 11px; white-space: nowrap; }
.tui-lcd .tui-schedule-field__tz { margin-left: auto; text-transform: none; letter-spacing: 0; text-align: right; }
.tui-schedule-field__run > span:first-child { opacity: 0.55; }
.tui-schedule-field__run > span:nth-child(3) { text-align: right; }
.tui-schedule-field__runs .tui-schedule-field__none { display: block; grid-column: 1 / -1; }
.tui-schedule-field__sr, .tui-schedule-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The cron line, typed or read. */
.tui-schedule-field__cron { display: flex; align-items: center; gap: var(--tui-2); min-width: 0; }
.tui-schedule-field__cronlabel { flex: none; font: 600 11px/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-schedule-field__cron .tui-input { flex: 1 1 auto; min-width: 0; height: 32px; font: 500 13px/1 var(--tui-mono); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tui-schedule-field__note { margin: 0; }

/* Disabled. */
.tui-schedule-field__field[data-disabled] .tui-schedule-field__well { opacity: 0.45; cursor: not-allowed; }

/* Help, and the error under it: a lamp lit red beside the words, the well ringed red. */
.tui-schedule-field__error { display: flex; align-items: baseline; gap: 7px; margin: 0; }
.tui-schedule-field__error:empty { display: none; }
.tui-schedule-field__error .tui-lamp { flex: none; width: 7px; height: 7px; transform: translateY(-1px); }
.tui-schedule-field__field[data-error] .tui-hint:not(.tui-schedule-field__error, .tui-schedule-field__note) { color: var(--tui-ink-2); }

/* A phone: the fields and keys at 44px, the text at 16px so it does not zoom. */
@media (pointer: coarse) {
  .tui-schedule-field__controls .tui-input, .tui-schedule-field__cron .tui-input { height: 44px; font-size: 16px; }
}

/* ---------------------------------------------------------------- part: scroll-area */
/* Scroll area: a region that scrolls, with its scrollbar made as a machined
   rail. The rail is a groove cut into the plate; the thumb is a fader cap
   riding in it: lit on top, a skirt below, one line printed across its
   middle. It is the browser's own scrollbar, only dressed, so the wheel,
   touch, keys, Page Up/Down, Home/End and Space scroll exactly as they do
   everywhere else. Browsers that cannot restyle the parts of a scrollbar get
   a thin one in the kit's inks (scrollbar-color), which is still a rail and a
   thumb. */
.tui-scroll-area {
  --sa-rail: 14px;
  --sa-bg: var(--tui-face);
  --sa-lit: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2));
  overflow: auto;
  overscroll-behavior: contain;
  min-width: 0;
  border-radius: var(--tui-r-m);
}
.tui-scroll-area--y { overflow-x: hidden; }
.tui-scroll-area--x { overflow-y: hidden; }
.tui-scroll-area--sm { --sa-rail: 10px; }
@media (prefers-reduced-motion: no-preference) { .tui-scroll-area { scroll-behavior: smooth; } }
/* The container is focusable so the keyboard can scroll it; it says so with a ring inside its own edge. */
.tui-scroll-area:focus-visible, .tui-scroll-area.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }

/* Cut into the plate: the same recess as a tray, for a log or a list that has its own window. */
.tui-scroll-area--well {
  --sa-bg: var(--tui-well);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  padding: var(--tui-3);
}
/* A shade at an edge only while there is more beyond it: cover-and-shadow, no script. */
.tui-scroll-area--edges {
  background:
    linear-gradient(var(--sa-bg) 30%, transparent) 0 0 / 100% 28px local no-repeat,
    linear-gradient(transparent, var(--sa-bg) 70%) 0 100% / 100% 28px local no-repeat,
    linear-gradient(rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)), transparent) 0 0 / 100% 9px scroll no-repeat,
    linear-gradient(transparent, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7))) 0 100% / 100% 9px scroll no-repeat;
  background-color: var(--sa-bg);
}

@supports selector(::-webkit-scrollbar) {
  .tui-scroll-area::-webkit-scrollbar { width: var(--sa-rail); height: var(--sa-rail); }
  .tui-scroll-area::-webkit-scrollbar-corner { background: transparent; }
  .tui-scroll-area::-webkit-scrollbar-button { display: none; }
  /* The rail: a groove, dark under its upper wall, the lower lip lit. */
  .tui-scroll-area::-webkit-scrollbar-track {
    background: var(--tui-well-fill) var(--tui-well);
    border-radius: calc(var(--sa-rail) / 2);
  }
  .tui-scroll-area::-webkit-scrollbar-track:vertical { box-shadow: var(--tui-depth-well, inset 2px 0 3px -1px var(--sa-lit), inset -1px 0 0 color-mix(in oklab, var(--tui-hl) 60%, transparent)); }
  .tui-scroll-area::-webkit-scrollbar-track:horizontal { box-shadow: var(--tui-depth-well, inset 0 2px 3px -1px var(--sa-lit), inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 60%, transparent)); }
  /* The cap: a transparent border keeps it off the walls of the groove, and its light is drawn inside. */
  .tui-scroll-area::-webkit-scrollbar-thumb {
    min-height: 32px;
    min-width: 32px;
    border: 3px solid transparent;
    border-radius: calc(var(--sa-rail) / 2 - 1px);
    background-clip: padding-box;
    box-shadow: var(--tui-depth-shade, inset 0 1px 0 var(--tui-hl), inset 0 -2px 0 var(--tui-skirt));
  }
  .tui-scroll-area::-webkit-scrollbar-thumb:vertical {
    background:
      linear-gradient(var(--tui-ink), var(--tui-ink)) center / 100% 1.5px no-repeat,
      var(--tui-depth-cap, linear-gradient(90deg, var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo)));
    background-clip: padding-box;
  }
  .tui-scroll-area::-webkit-scrollbar-thumb:horizontal {
    background:
      linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 100% no-repeat,
      var(--tui-depth-cap, linear-gradient(var(--tui-face-lo), var(--tui-face-hi) 30%, var(--tui-face-hi) 60%, var(--tui-face-lo)));
    background-clip: padding-box;
  }
  .tui-scroll-area--sm::-webkit-scrollbar-thumb { border-width: 2px; }
  .tui-scroll-area::-webkit-scrollbar-thumb:hover { filter: brightness(1.04); }
  /* Held: the cap is pressed down into the groove, its skirt gone. */
  .tui-scroll-area::-webkit-scrollbar-thumb:active { box-shadow: var(--tui-depth-shade, inset 0 3px 3px -2px var(--sa-lit)); filter: brightness(0.97); }
}
@supports not selector(::-webkit-scrollbar) {
  .tui-scroll-area { scrollbar-width: thin; scrollbar-color: var(--tui-ink-3) var(--tui-well); }
  .tui-scroll-area--sm { scrollbar-width: thin; }
}

/* ---------------------------------------------------------------- part: scrub */
/* Scrub field: a number in a well, with an engraved ruler along the well's
   floor. The ruler slides under a fixed index; the index is printed until
   you set the value, then its hairline lights amber. At min and max a
   printed stop meets the index. scrub.mjs builds the ruler and moves it. */

tui-scrub {
  position: relative;
  display: grid;
  min-width: 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  -webkit-tap-highlight-color: transparent;
}
tui-scrub:hover, tui-scrub.is-hover { filter: brightness(1.03); }

/* The numerals, typed or read, and the unit printed after them. */
.tui-scrub__row {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 2px var(--tui-3) 0;
  cursor: text;
}
.tui-scrub__input {
  flex: none;
  width: 4ch; /* as wide as its numerals, so the unit follows them (scrub.mjs where field-sizing is missing) */
  max-width: 100%;
  min-width: 1ch;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: 600 15px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--tui-ink);
}
@supports (field-sizing: content) { .tui-scrub__input { field-sizing: content; width: auto; } }
tui-scrub .tui-scrub__input:focus-visible { outline: none; }
.tui-scrub__input::selection { background: color-mix(in oklab, var(--tui-ink) 18%, transparent); }
.tui-scrub__unit { flex: none; font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); }

/* The strip: a window on the floor of the well. Its ends fall away, as a
   tape does over its drums. Drag it; the page still scrolls from anywhere else. */
.tui-scrub__window {
  position: relative;
  height: 27px;
  overflow: hidden;
  border-radius: 0 0 var(--tui-r-m) var(--tui-r-m);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-mask: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
          mask: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
}
/* The strip itself: a band of tape a shade lighter than the floor, its top
   edge just under the numerals. */
.tui-scrub__window::before {
  content: '';
  position: absolute;
  inset: 3px 0 0;
  background: linear-gradient(color-mix(in oklab, var(--tui-face-hi) 38%, transparent), color-mix(in oklab, var(--tui-face-hi) 14%, transparent));
  box-shadow: var(--tui-depth-shade, inset 0 1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
/* The printed label of the field is a grip too. */
.tui-scrub__grip { cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; }

/* The ruler: fine ticks every step, a longer one halfway, a long numbered
   one at each major. Engraved and ink-filled: each cut has its lit wall on
   the right, toward the lamp's side of the groove. */
.tui-scrub__tape {
  --pos: 0;
  position: absolute;
  top: 4px;
  bottom: 0;
  left: calc(50% - 0.5px);
  width: calc(var(--span, 0px) + 1px);
  transform: translate3d(calc(var(--pos) * -1px), 0, 0);
  transition: transform 90ms var(--tui-ease);
  background:
    linear-gradient(90deg, var(--tui-ink) 0 1px, var(--tui-hl) 1px 2px, transparent 2px) var(--o-major, 0) 0 / var(--major, 80px) 10px repeat-x,
    linear-gradient(90deg, var(--tui-ink-2) 0 1px, var(--tui-hl) 1px 2px, transparent 2px) var(--o-mid, 0) 0 / var(--mid, 40px) 7px repeat-x,
    linear-gradient(90deg, color-mix(in oklab, var(--tui-ink-2) 70%, transparent) 0 1px, color-mix(in oklab, var(--tui-hl) 70%, transparent) 1px 2px, transparent 2px) var(--o-tick, 0) 0 / var(--tick, 8px) 4px repeat-x;
}
tui-scrub[data-scrubbing]:not([data-detent]) .tui-scrub__tape { transition: none; }
tui-scrub[data-detent] .tui-scrub__tape { transition-duration: 70ms; }
/* The stops, printed past each end: a heavy bar, then hatching where the
   scale runs out. */
.tui-scrub__tape::before, .tui-scrub__tape::after {
  content: '';
  position: absolute;
  top: 0;
  width: 44px;
  height: 12px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) var(--stop-at) 0 / 2.5px 100% no-repeat,
    repeating-linear-gradient(-55deg, color-mix(in oklab, var(--tui-ink-3) 55%, transparent) 0 1px, transparent 1px 4px) 0 1px / 100% 9px no-repeat;
}
.tui-scrub__tape::before { right: 100%; --stop-at: 100%; }
.tui-scrub__tape::after { left: 100%; --stop-at: 0; }
.tui-scrub__n {
  position: absolute;
  top: 13px;
  left: var(--at);
  transform: translateX(calc(-50% + 0.5px));
  font: 500 9.5px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--tui-ink-2);
  white-space: nowrap;
}

/* The index: a hairline behind a slit, under a printed pointer. It lights
   only while the value is being set. */
.tui-scrub__needle {
  position: absolute;
  z-index: 1;
  top: 0;
  left: calc(50% - 0.75px);
  width: 1.5px;
  height: 13px;
  border-radius: 0 0 1px 1px;
  background: var(--tui-ink);
  box-shadow: 1px 0 0 var(--tui-hl);
  transition: background-color 90ms var(--tui-ease), box-shadow 90ms var(--tui-ease);
}
.tui-scrub__needle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 5px;
  transform: translateX(-50%);
  background: var(--tui-ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
tui-scrub:focus-within .tui-scrub__needle, tui-scrub[data-scrubbing] .tui-scrub__needle, tui-scrub.is-focus .tui-scrub__needle, tui-scrub.is-down .tui-scrub__needle {
  background: var(--tui-amber);
  box-shadow: 0 0 3px 0.5px color-mix(in oklab, var(--tui-amber) 75%, transparent), 0 0 9px 1px color-mix(in oklab, var(--tui-amber) 35%, transparent);
}

/* Focus rings the whole well; an error marks its lip, as on a field. */
tui-scrub:has(.tui-scrub__input:focus-visible), tui-scrub.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-scrub[data-error], .tui-field[data-error] tui-scrub {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset);
}
tui-scrub:has(.tui-scrub__input:disabled) { opacity: 0.45; filter: none; }
tui-scrub:has(.tui-scrub__input:disabled) .tui-scrub__window, .tui-field:has(tui-scrub .tui-scrub__input:disabled) .tui-scrub__grip { cursor: not-allowed; pointer-events: none; }

/* Compact: for a table cell or a dense inspector. The ruler keeps its ticks
   and drops its numbers. */
.tui-scrub--compact .tui-scrub__row { height: 26px; padding: 1px var(--tui-2) 0; }
.tui-scrub--compact .tui-scrub__input { font-size: var(--tui-t-body); }
.tui-scrub--compact .tui-scrub__window { height: 11px; }
.tui-scrub--compact .tui-scrub__tape { top: 3px; }
.tui-scrub--compact .tui-scrub__n { display: none; }
.tui-scrub--compact .tui-scrub__needle { height: 9px; }
.tui-scrub--compact .tui-scrub__needle::before { width: 7px; height: 4px; }
.tui-scrub--compact .tui-scrub__tape::before, .tui-scrub--compact .tui-scrub__tape::after { height: 10px; }

/* An inspector row: the label printed on the left, the field on the right. */
.tui-field.tui-scrub-row { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); align-items: center; gap: var(--tui-3); }
.tui-field.tui-scrub-row > .tui-label { padding-left: 0; }

/* ---------------------------------------------------------------- part: search-field */
/* Search field: a recess for a question. A glass is printed on the floor at
   the start, the text runs on, an optional count is printed at the end behind
   an engraved line, and a clear key sits in the far corner, there only while
   there is something to clear. The well is the field's own and so are its
   states; the keys are caps on its floor, as the combobox's key is. */
:is(tui-search-field, .tui-search-field) {
  --sf-h: 38px;
  --sf-inset: 3px;
  position: relative;
  display: flex;
  align-items: center;
  height: var(--sf-h);
  min-width: 0;
  padding: 0 var(--sf-inset) 0 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: text;
}
:is(tui-search-field, .tui-search-field):has(.tui-search-field__input:focus-visible), :is(tui-search-field, .tui-search-field).is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
:is(tui-search-field, .tui-search-field):has(.tui-search-field__input:disabled) { opacity: 0.45; cursor: not-allowed; }

/* The glass: printed on the floor, never pressed. */
.tui-search-field__glyph { flex: none; display: grid; place-items: center; width: 34px; align-self: stretch; color: var(--tui-ink-2); pointer-events: none; }
.tui-search-field__glyph svg { width: 16px; height: 16px; }

.tui-search-field__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3) 0 0;
  border: 0;
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: inherit;
  background: transparent;
  outline: none;
}
.tui-search-field__input::placeholder { color: var(--tui-ink-3); }
.tui-search-field__input:disabled { cursor: not-allowed; }
/* The browser's own cross would be a second clear key. */
.tui-search-field__input::-webkit-search-cancel-button, .tui-search-field__input::-webkit-search-decoration { appearance: none; display: none; }

/* The count: printed at the end behind an engraved line (a dark cut with the light on its right lip). */
.tui-search-field__count {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  align-self: stretch;
  padding: 0 var(--tui-3);
  font: 500 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  white-space: nowrap;
}
.tui-search-field__count::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: linear-gradient(90deg, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)) 0 1px, var(--tui-hl) 1px 2px);
}
.tui-search-field__count:empty { display: none; }

/* The clear key: a small cap on the floor. */
.tui-search-field__key {
  appearance: none;
  flex: none;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: calc(var(--sf-h) - 2 * var(--sf-inset));
  height: calc(var(--sf-h) - 2 * var(--sf-inset));
  padding: 0;
  border: 0;
  border-radius: calc(var(--tui-r-m) - var(--sf-inset));
  color: var(--tui-ink-2);
  cursor: pointer;
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-search-field__key svg { width: 15px; height: 15px; }
.tui-search-field__key:hover, .tui-search-field__key.is-hover { color: var(--tui-ink); filter: brightness(1.03); }
.tui-search-field__key:active, .tui-search-field__key.is-down { transform: translateY(1.5px); filter: brightness(0.97); color: var(--tui-ink); box-shadow: var(--tui-pressed); }
.tui-search-field__key:focus-visible, .tui-search-field__key.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-search-field__key:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
/* The key is the element's own: it waits for the script, and for something to clear. */
tui-search-field:not(:defined) .tui-search-field__key, :is(tui-search-field, .tui-search-field) .tui-search-field__key[hidden] { display: none; }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-search-field__count::before { background: linear-gradient(90deg, var(--tui-quiet-line-2) 0 1px, transparent 1px); }
  .tui-search-field__key:active, .tui-search-field__key.is-down { transform: translateY(1px); filter: none; background: var(--tui-quiet-key-down); }
  .tui-search-field__key:hover, .tui-search-field__key.is-hover { filter: none; background: var(--tui-quiet-key-hover); }
}

@media (pointer: coarse) {
  :is(tui-search-field, .tui-search-field) { --sf-h: 48px; --sf-inset: 2px; }
  .tui-search-field__input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-search-field__key { transition: none; }
}

/* ---------------------------------------------------------------- part: secret-field */
/* Secret field: a masked value in the field's well, with a reveal key and a
   copy key set on its floor, and under it a ladder of lamps that says how long
   the value will stay shown. Revealed, the ladder is lit end to end and puts
   its lamps out one by one until the value is masked again; masked, it is dark
   and says so. The well, the keys and the lamps are the kit's, so every finish
   and both volumes are theirs. The value is a code, so it is set in the mono
   face, as code is. Without the script it is a masked, read-only field. */
tui-secret-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.tui-secret-field__well {
  --sf-h: 38px;
  --sf-inset: 5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: var(--sf-h);
  padding: 0 var(--sf-inset) 0 0;
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: clip;
}
.tui-secret-field__well:has(.tui-secret-field__input:focus-visible), .tui-secret-field__well.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-secret-field__input {
  appearance: none;
  flex: 1 1 80px;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  font: 500 12.5px/1 var(--tui-mono);
  letter-spacing: 0.02em;
  color: inherit;
  text-overflow: ellipsis;
  background: transparent;
  outline: none;
}
.tui-secret-field__input::-ms-reveal, .tui-secret-field__input::-ms-clear { display: none; }
.tui-secret-field__input:disabled { opacity: 0.45; cursor: not-allowed; }
/* Keys on the floor of the well. */
.tui-secret-field__well > .tui-key { --h: 28px; flex: none; }
.tui-secret-field__reveal { min-width: 64px; }
/* The reveal key stays down while the value shows, as the password field's does. */
tui-secret-field[data-shown] .tui-secret-field__reveal { transform: translateY(var(--skirt)); filter: brightness(0.97); box-shadow: var(--tui-pressed); }
.tui-secret-field__well > .tui-copy-key { min-width: 76px; }
tui-secret-field:not(:defined) .tui-secret-field__reveal { display: none; }

/* How long it stays shown: a ladder of lamps and the words for it. */
.tui-secret-field__timer { display: flex; align-items: center; gap: 12px; min-height: 18px; padding-left: 2px; }
.tui-secret-field__ladder { display: inline-flex; gap: 3px; }
.tui-secret-field__ladder > .tui-lamp { width: 6px; height: 6px; }
.tui-secret-field__words { min-width: 9ch; font: 500 var(--tui-t-small)/1 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
tui-secret-field[data-shown] .tui-secret-field__words { color: var(--tui-ink); }
.tui-secret-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
tui-secret-field:not(:defined) .tui-secret-field__timer { display: none; }

@media (pointer: coarse) {
  .tui-secret-field__well { --sf-h: 52px; --sf-inset: 4px; }
  .tui-secret-field__well > .tui-key { --h: 44px; }
  .tui-secret-field__input { font-size: 16px; }
  .tui-secret-field__ladder > .tui-lamp { width: 7px; height: 7px; }
}
@media (max-width: 480px) {
  .tui-secret-field__reveal { min-width: 56px; }
  .tui-secret-field__well > .tui-copy-key { min-width: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-secret-field .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: segmented */
/* Segmented control: the selector's row of keys, promoted to its own part.
   The base .tui-seg is in core.css (the tray, the keys, the pressed one);
   this file adds what a segmented control needs on top of it: three sizes,
   a full-width row, icon-only segments, and a fieldset that reads as a
   group. Each size keeps the corners concentric: key radius + the 3px gap
   is the tray's radius. */
.tui-seg { --seg-h: 30px; }
.tui-seg span { height: var(--seg-h); }
.tui-seg--sm { --seg-h: 24px; border-radius: 8px; }
.tui-seg--sm span { padding: 0 10px; gap: 6px; font-size: 12px; border-radius: 5px; }
.tui-seg--lg { --seg-h: 38px; border-radius: 11px; }
.tui-seg--lg span { padding: 0 var(--tui-5); font-size: 13.5px; border-radius: 8px; }

/* Full width: the segments share the row equally. */
.tui-seg--block { display: flex; width: 100%; }
.tui-seg--block > label { flex: 1 1 0; min-width: 0; }
.tui-seg--block span { justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Icons in place of words: square segments, each named by its aria-label. */
.tui-seg--icon span { width: var(--seg-h); padding: 0; justify-content: center; }
.tui-seg span svg { width: 16px; height: 16px; flex: none; }
.tui-seg--sm span svg { width: 14px; height: 14px; }

/* A fieldset that is the control: its legend names the group and is not drawn. */
fieldset.tui-seg { position: relative; min-width: 0; margin: 0; border: 0; }
.tui-seg > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- part: separator */
/* Separator: an engraved rule. A fine groove cut into the plate: a hairline,
   and below it (on the lower wall, which faces the lamp) a catch of light.
   Quiet keeps only the hairline. It divides without shouting: no colour, no
   weight, nothing that asks to be read. A real <hr> is a separator to a
   screen reader; one that only decorates is a plain div with role="none";
   a vertical one needs its role and aria-orientation said, because HTML has no
   element for it. */
.tui-separator {
  --lip: var(--tui-quiet) transparent;
  display: block;
  flex: none;
  box-sizing: border-box;
  width: auto;
  height: 2px;
  margin: var(--tui-4) 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--tui-rule);
  border-bottom: 1px solid var(--lip, var(--tui-hl));
  background: none;
  color: inherit;
  overflow: visible;
}
/* Standing: the lit wall is the one that faces the lamp, to the right of the cut. */
.tui-separator--vertical {
  width: 2px;
  height: auto;
  min-height: 1em;
  align-self: stretch;
  margin: 0 var(--tui-3);
  border-top: 0;
  border-bottom: 0;
  border-left: 1px solid var(--tui-rule);
  border-right: 1px solid var(--lip, var(--tui-hl));
}
/* Flush: the rule alone, with no air round it, for a place that sets its own. */
.tui-separator--flush { margin: 0; }
/* Short: stops short of both edges, as a rule between the lines of a list does. */
.tui-separator--inset { margin-inline: var(--tui-4); }
@media (forced-colors: active) {
  .tui-separator { border-top-color: CanvasText; }
  .tui-separator--vertical { border-left-color: CanvasText; border-top-color: transparent; }
}

/* ---------------------------------------------------------------- part: settings-row */
/* Settings row: what a settings page is made of. A label, one sentence under
   it, and the control at the end, ruled like the list: a hairline between
   rows and nothing else drawn. A row that holds a switch or a check is one
   <label>, so pressing anywhere on it turns the control; a row that holds a
   key, a select or a value is a plain box, so a press means what the key
   says. It stands on whatever plate it is put on and brings none of its own.
   No script: every row is native. */
.tui-settings { display: grid; margin: 0; padding: 0; min-width: 0; border: 0; }
.tui-settings + .tui-settings { margin-top: var(--tui-3); }
/* A plain group heading in sentence case, never a small tracked caps label (no eyebrows, 24 Nov). */
.tui-settings__head { margin: 0; padding: var(--tui-4) 10px var(--tui-2); font: 600 calc(var(--tui-t-body) + 2px)/1.25 var(--tui-sans); color: var(--tui-ink); }
.tui-settings__head:first-child { padding-top: var(--tui-1); }

.tui-settings__row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-2) var(--tui-4);
  min-height: 60px;
  padding: 12px 10px;
  border-radius: var(--tui-r-m);
  font-size: var(--tui-t-body);
}
/* Hairlines between rows, inset like the list's; none under a row the pointer is on. */
.tui-settings__row + .tui-settings__row::before { content: ''; position: absolute; top: 0; left: 10px; right: 10px; border-top: 1px solid var(--tui-rule); }
.tui-settings__row:is(label:hover, .is-hover)::before, .tui-settings__row:is(label:hover, .is-hover) + .tui-settings__row::before { border-color: transparent; }
label.tui-settings__row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
label.tui-settings__row:hover, .tui-settings__row.is-hover { background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
label.tui-settings__row:has(:focus-visible), .tui-settings__row.is-focus { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-settings__row :focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
label.tui-settings__row:has(:focus-visible) :focus-visible { outline: none; }
.tui-settings__row:has(:disabled), .tui-settings__row[aria-disabled="true"] { cursor: not-allowed; }
.tui-settings__row:has(> :disabled) > .tui-settings__text, .tui-settings__row[aria-disabled="true"] > .tui-settings__text { opacity: 0.6; }

.tui-settings__text { display: grid; gap: 3px; flex: 1 1 170px; min-width: 0; }
.tui-settings__title { font-weight: 600; color: var(--tui-ink); }
.tui-settings__desc { font-size: var(--tui-t-small); line-height: 1.45; color: var(--tui-ink-2); }
/* What a row holds at its end: a printed value beside its key. */
.tui-settings__end { display: inline-flex; align-items: center; gap: var(--tui-3); flex: none; margin-left: auto; }
.tui-settings__value { font-size: var(--tui-t-small); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-settings__row > .tui-switch, .tui-settings__row > .tui-check, .tui-settings__row > .tui-radio, .tui-settings__row > .tui-key, .tui-settings__row > .tui-select { flex: none; margin-left: auto; }
.tui-settings__row > .tui-select { width: auto; min-width: 150px; }
/* A row that cannot be undone: its title and its key say so. */
.tui-settings__row--danger .tui-settings__title { color: var(--tui-red-ink, var(--tui-red)); }

@media (pointer: coarse) {
  .tui-settings__row { min-height: 64px; }
  .tui-settings__row > .tui-select { height: 44px; font-size: 16px; }
  .tui-settings__row .tui-key { --h: 44px; min-width: 44px; }
}

/* ---------------------------------------------------------------- part: setup-dial */
/* Setup dial: onboarding as the program dial on the front of an appliance.
   A fluted knob with a raised grip bar sits in a round seat; round it, one
   detent for every step, its number and name engraved beside a tick and a
   small lamp. Green is done, amber is where the dial points. The panel beside
   it shows that step's few fields, with Back and Next under them. The dial
   only turns forward as far as the first step not done. See setup-dial.mjs.
   Without the script the steps are one plain form, one after another. */
@property --sd-turn { syntax: '<angle>'; inherits: true; initial-value: -135deg; }

tui-setup-dial {
  container-type: inline-size;
  display: flex;
  flex-wrap: wrap;
  /* The dial stays where it is while the panel beside it changes height: it must not move under a hand that is turning it. */
  align-items: flex-start;
  justify-content: center;
  gap: 18px 28px;
  min-width: 0;
}
tui-setup-dial:not(:defined) { display: grid; gap: 24px; }

/* The dial alone (data-face): live, with no panel, as a card shows it. It is laid out at its full size whatever the card's width. */
tui-setup-dial[data-face] { display: grid; justify-items: center; container-type: normal; }
tui-setup-dial[data-face] .tui-setup-dial__panel { display: none; }

/* ------------------------------------------------------------------ the dial */
.tui-setup-dial__dial {
  --sd-d: 104px;       /* the knob */
  --sd-rm: 82px;       /* where the marks sit, from the middle */
  position: relative;
  flex: none;
  width: calc(var(--sd-rm) * 2 + 150px);
  max-width: 100%;
  height: calc(var(--sd-rm) * 1.42 + 42px);
}
.tui-setup-dial__marks { margin: 0; padding: 0; list-style: none; }

/* A detent: a lamp, the step's number and its name, set out from the middle along its angle. */
.tui-setup-dial__mark {
  position: absolute;
  left: calc(50% + var(--x) * var(--sd-rm));
  top: calc(50% + var(--y) * var(--sd-rm));
  display: flex;
  align-items: center;
  gap: 6px;
  translate: 0 -50%;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-setup-dial__mark[data-side="left"] { flex-direction: row-reverse; translate: -100% -50%; }
.tui-setup-dial__mark[data-side="middle"] { translate: -50% -100%; }
.tui-setup-dial__no {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font: 700 10.5px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  box-shadow: inset 0 0 0 1.2px currentColor;
}
.tui-setup-dial__word {
  font: 600 var(--tui-t-label)/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-ink);
  /* Engraved: a lit line under every stroke. */
  text-shadow: 0 1px 0 var(--tui-hl);
}
.tui-setup-dial__state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tui-setup-dial__mark[data-state="current"] .tui-setup-dial__word { font-weight: 700; }
.tui-setup-dial__mark[data-state="current"] .tui-setup-dial__no { color: var(--tui-ink); }
.tui-setup-dial__mark[data-state="locked"] { cursor: not-allowed; }
.tui-setup-dial__mark[data-state="locked"] .tui-setup-dial__word { color: var(--tui-ink-2); }
.tui-setup-dial__mark[data-state="locked"] .tui-setup-dial__no { box-shadow: inset 0 0 0 1.2px currentColor; opacity: 0.8; }
.tui-setup-dial__mark:hover .tui-setup-dial__word, .tui-setup-dial__mark.is-hover .tui-setup-dial__word { text-decoration: underline 1px; text-underline-offset: 3px; }
.tui-setup-dial__mark[data-state="locked"]:hover .tui-setup-dial__word { text-decoration: none; }

/* The seat: a round recess the knob stands in, with a tick engraved at every detent. */
.tui-setup-dial__seat {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--sd-d) + 22px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-setup-dial__tick {
  position: absolute;
  left: calc(50% - 0.75px);
  top: -9px;
  width: 1.5px;
  height: 6px;
  border-radius: 1px;
  background: var(--tui-ink-2);
  transform-origin: 50% calc(var(--sd-d) / 2 + 11px + 9px);
  rotate: var(--a);
}

/* The knob: a fluted skirt, a spun cap and a raised bar across it with the pointer at one end. The light stays where the lamp is; only --sd-turn moves. */
.tui-setup-dial__knob {
  --sd-turn: -135deg;
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
  transition: --sd-turn 260ms cubic-bezier(0.3, 1.45, 0.55, 1);
}
[data-turning] .tui-setup-dial__knob { cursor: grabbing; }
.tui-setup-dial__knob:focus-visible, .tui-setup-dial__knob.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 5px; }
.tui-setup-dial__skirt {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    linear-gradient(150deg, rgb(255 255 255 / 0.5), transparent 42%, transparent 58%, rgb(0 0 0 / 0.38)),
    repeating-conic-gradient(from var(--sd-turn), rgb(0 0 0 / 0.26) 0 3deg, rgb(255 255 255 / 0.08) 3deg 4deg, transparent 4deg 7.5deg),
    var(--tui-knob-mid);
  box-shadow: var(--tui-depth-plate, 0 1px 1.5px rgb(var(--tui-sh) / 0.5), 3px 8px 16px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
}
/* The flutes catch the lamp on the side that faces it, not evenly all round. */
.tui-setup-dial__skirt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from var(--sd-turn), transparent 0 3deg, rgb(255 255 255 / 0.48) 3deg 4deg, transparent 4deg 7.5deg);
  -webkit-mask: linear-gradient(150deg, black 15%, rgb(0 0 0 / 0.4) 45%, transparent 72%);
  mask: linear-gradient(150deg, black 15%, rgb(0 0 0 / 0.4) 45%, transparent 72%);
}
.tui-setup-dial__grip {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: var(--tui-trim-knob,
    repeating-radial-gradient(circle, rgb(255 255 255 / 0.06) 0 0.6px, rgb(0 0 0 / 0.035) 0.6px 1.5px),
    conic-gradient(from 0deg, var(--tui-knob-mid) 0deg, var(--tui-knob-lo) 40deg, var(--tui-knob-mid) 80deg, var(--tui-knob-hi) 135deg, var(--tui-knob-mid) 180deg, var(--tui-knob-lo) 220deg, var(--tui-knob-mid) 260deg, var(--tui-knob-hi) 315deg, var(--tui-knob-mid) 360deg));
  box-shadow: var(--tui-knob-cap-shadow);
  /* The bar's shadow falls down and to the right, whichever way the bar points. */
  filter: drop-shadow(1px 2.5px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
}
/* A turned wooden cap (the wood trims) carries its grain round with the knob. */
.tui-setup-dial__grip::before { content: ''; position: absolute; inset: 0; border-radius: 50%; rotate: var(--sd-turn); background: var(--tui-trim-grain, none); }
/* The grip bar: a raised rib across the cap, lit on the side toward the lamp whatever its angle. */
.tui-setup-dial__bar {
  position: absolute;
  left: calc(50% - 11%);
  top: -4%;
  width: 22%;
  height: 108%;
  border-radius: 999px;
  rotate: var(--sd-turn);
  background:
    linear-gradient(calc(150deg - var(--sd-turn)), rgb(255 255 255 / 0.55), transparent 45%, rgb(0 0 0 / 0.3)),
    linear-gradient(calc(90deg - var(--sd-turn)), var(--tui-knob-hi), var(--tui-knob-mid) 45%, var(--tui-knob-lo));
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.25);
}
/* The pointer: a line engraved along the bar's top end. */
.tui-setup-dial__bar::after {
  content: '';
  position: absolute;
  left: calc(50% - 1.25px);
  top: 9%;
  width: 2.5px;
  height: 26%;
  border-radius: 2px;
  background: var(--tui-ink);
  box-shadow: 0 0 0 0.5px rgb(255 255 255 / 0.3);
}

/* ------------------------------------------------------------------ the panel */
.tui-setup-dial__panel {
  display: grid;
  flex: 1 1 250px;
  align-content: start;
  gap: 14px;
  min-width: 0;
  max-width: 380px;
}
.tui-setup-dial__where { margin: 0; }
.tui-setup-dial__step { display: grid; gap: 12px; min-width: 0; margin: 0; }
.tui-setup-dial__step > :is(h2, h3, h4) { margin: 0; font-size: var(--tui-t-h3); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; color: var(--tui-ink); }
.tui-setup-dial__step > p { margin: 0; color: var(--tui-ink-2); max-width: 44ch; }
.tui-setup-dial__keys { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tui-setup-dial__keys .tui-key--flat:first-child { margin-left: calc(var(--tui-2) * -1); }
.tui-setup-dial__keys [data-dial="next"] { margin-left: auto; }
.tui-setup-dial__say { min-height: 1.4em; margin: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* A narrow panel: a smaller knob, its steps closer in. */
@container (max-width: 360px) {
  .tui-setup-dial__dial { --sd-d: 82px; --sd-rm: 62px; width: calc(var(--sd-rm) * 2 + 150px); }
  .tui-setup-dial__mark { gap: 5px; }
  .tui-setup-dial__word { font-size: 10px; letter-spacing: 0.04em; }
}
/* Narrower still: the numbers and lamps stay round the dial and the names are left to the panel and to a screen reader. */
@container (max-width: 280px) {
  .tui-setup-dial__dial { --sd-d: 80px; --sd-rm: 62px; width: calc(var(--sd-rm) * 2 + 60px); }
  .tui-setup-dial__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

@media (prefers-reduced-motion: reduce) {
  .tui-setup-dial__knob { transition: none; }
}

/* ---------------------------------------------------------------- part: shortcut-field */
/* Shortcut field: a keyboard shortcut set by pressing it, in the field's well. One line, the footprint of
   `.tui-input`; the caps are the kit's kbd, the lamp is the kit's lamp, the error is the field's own red ring. While
   recording, a small lamp is lit and the state reads "Press the keys"; the keys go down into the well one by one, a
   short drop and settle. Under reduced motion they simply appear. Without the script the markup is a plain text input
   holding the shortcut. kit/parts/shortcut-field.mjs builds and wires it. */
tui-shortcut-field { position: relative; display: block; width: 100%; min-width: 0; }
tui-shortcut-field:not(:defined) .tui-field { width: 100%; }
.tui-shortcut-field__well {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--tui-3);
  row-gap: 2px;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 3px var(--tui-3);
  border-radius: var(--tui-r-m);
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  cursor: pointer;
  container-type: inline-size;
}
.tui-shortcut-field__well:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-shortcut-field__well[hidden], .tui-shortcut-field__well [hidden] { display: none !important; }

/* The caps wrap inside the well when it is narrow. */
.tui-shortcut-field__caps { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 0 3px; min-width: 0; }
.tui-shortcut-field__caps .tui-kbd-combo { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
.tui-shortcut-field__none { color: var(--tui-ink-2); }

/* The state: shown while recording. */
.tui-shortcut-field__state { display: inline-flex; flex: none; align-items: center; gap: 7px; margin-left: auto; font: 500 var(--tui-t-small)/1 var(--tui-sans); color: var(--tui-ink-2); }
.tui-shortcut-field__state .tui-lamp { flex: none; width: 7px; height: 7px; margin: 0; }

/* A key going down into the well: drops a few pixels, settles. */
.tui-shortcut-field__well .tui-kbd[data-drop] { animation: tui-shortcut-drop 120ms var(--tui-ease) both; }
@keyframes tui-shortcut-drop {
  0% { transform: translateY(-7px); opacity: 0; }
  65% { transform: translateY(1px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .tui-shortcut-field__well .tui-kbd[data-drop] { animation: none; } }

/* The error, on the whole well. */
.tui-shortcut-field__field[data-error] .tui-shortcut-field__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-shortcut-field__error { margin: 0; }
.tui-shortcut-field__error:empty { display: none; }

.tui-shortcut-field__field[data-disabled] .tui-shortcut-field__well { opacity: 0.45; cursor: not-allowed; }
.tui-shortcut-field__sr, .tui-shortcut-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Narrow (a phone, or a settings row): the lamp says "recording" alone and the words stay for a screen reader, so the well never changes height. */
@container (max-width: 340px) {
  .tui-shortcut-field__words { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* In a settings row: the action name is the row's title, so the field's own label is kept for a screen reader only, and the well sits at the end at a fixed width. Under 520px the row stacks and the well is full width again. */
.tui-settings__row > tui-shortcut-field { flex: none; width: 14rem; margin-left: auto; }
.tui-settings__row > tui-shortcut-field .tui-shortcut-field__field > .tui-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The row grows to hold the error line under the well, and the action name stays level with the well itself, not with the well and its error together. */
.tui-settings__row:has(> tui-shortcut-field) { align-items: flex-start; }
.tui-settings__row:has(> tui-shortcut-field) > .tui-settings__text { min-height: 38px; align-content: center; }
@media (pointer: coarse) { .tui-settings__row:has(> tui-shortcut-field) > .tui-settings__text { min-height: 44px; } }
@media (max-width: 520px) {
  .tui-settings__row > tui-shortcut-field { width: 100%; margin-left: 0; }
  .tui-settings__row:has(> tui-shortcut-field) > .tui-settings__text { min-height: 0; }
}

/* A phone: the well at 44px. */
@media (pointer: coarse) { .tui-shortcut-field__well { min-height: 44px; } }

/* ---------------------------------------------------------------- part: sign-in */
/* Sign-in: an entry plate. The providers' marks are stamped into their key
   caps; a two-way selector re-prints the plate between signing in and making
   an account; errors sit on the field's lip with a hint that says what to do.
   kit/parts/sign-in.mjs checks the fields and runs the switch. */
.tui-sign-in { display: grid; gap: var(--tui-4); width: min(100%, 380px); padding: var(--tui-6); }
.tui-sign-in__head { display: grid; gap: var(--tui-4); }
.tui-sign-in__title { margin: 0; font: 700 var(--tui-t-h3)/1.15 var(--tui-sans); letter-spacing: -0.015em; color: var(--tui-ink); }
.tui-sign-in__lead { margin: -8px 0 0; color: var(--tui-ink-2); }
.tui-sign-in__mode { display: grid; grid-template-columns: 1fr 1fr; }
.tui-sign-in__mode span { justify-content: center; }

/* Provider keys: full width, the mark stamped into the cap — its upper edge shaded, its lower lip lit. */
.tui-sign-in__providers { display: grid; gap: var(--tui-2); }
.tui-sign-in__provider { width: 100%; gap: 10px; }
.tui-sign-in__provider svg { width: 18px; height: 18px; color: var(--tui-ink); filter: drop-shadow(0 1px 0 var(--tui-hl)) drop-shadow(0 -0.6px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2))); }

/* "or with email": printed between two hairlines. */
.tui-sign-in__or { display: flex; align-items: center; gap: var(--tui-3); margin: 0; font: 500 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-ink-2); }
.tui-sign-in__or::before, .tui-sign-in__or::after { content: ''; flex: 1; height: 1px; background: var(--tui-rule); }

.tui-sign-in__fields { display: grid; gap: var(--tui-4); }
.tui-sign-in .tui-hint:empty { display: none; }
/* The password well holds a flat Show key. */
.tui-sign-in__secret { display: flex; align-items: center; border-radius: var(--tui-r-m); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-sign-in__secret .tui-input { flex: 1; background: transparent; box-shadow: none; }
.tui-sign-in__secret .tui-input:focus-visible { outline: none; }
.tui-sign-in__secret:has(.tui-input:focus-visible), .tui-sign-in__secret.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-sign-in__secret .tui-key { margin-right: 4px; }
.tui-field[data-error] .tui-sign-in__secret { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-field[data-error] .tui-sign-in__secret .tui-input { box-shadow: none; }

.tui-sign-in__go { width: 100%; }
.tui-sign-in__go .tui-lamp { display: none; }
.tui-sign-in[aria-busy="true"] .tui-sign-in__go .tui-lamp { display: inline-block; }
.tui-sign-in[aria-busy="true"] .tui-sign-in__go { pointer-events: none; }
.tui-sign-in__foot { margin: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); text-align: center; }
.tui-sign-in__foot a, .tui-sign-in__lead a { color: var(--tui-ink); text-underline-offset: 2px; }
.tui-sign-in__status:empty { display: none; }
.tui-sign-in__status { display: flex; align-items: center; gap: var(--tui-2); margin: 0; font-size: var(--tui-t-small); color: var(--tui-ink); }

/* The switch re-prints the plate: [data-up] shows only for a new account, [data-in] only for signing in. */
.tui-sign-in [data-up] { display: none; }
.tui-sign-in:has(.tui-sign-in__mode input[value="up"]:checked) [data-up] { display: revert; }
.tui-sign-in:has(.tui-sign-in__mode input[value="up"]:checked) .tui-field[data-up] { display: grid; }
.tui-sign-in:has(.tui-sign-in__mode input[value="up"]:checked) [data-in] { display: none; }

/* ---------------------------------------------------------------- part: signature-pad */
/* Signature pad: a signature drawn on a well cut into the plate, with the typed
   fallback in a field of its own below. The well takes the finish's own well,
   inset and corner, so every finish and the Quiet volume follow; the ink is
   the finish's ink. Clear fades the ink out, and holds still under reduced
   motion. Tokens only: no colour is written here. */
:is(tui-signature-pad, .tui-signature-pad) {
  display: grid;
  gap: var(--tui-2);
  width: min(100%, 460px);
  min-width: 0;
}

.tui-signature-pad__well {
  position: relative;
  aspect-ratio: 5 / 2;
  min-height: 92px;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  overflow: hidden;
  touch-action: none;
}

.tui-signature-pad__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  color: var(--tui-ink);
  cursor: crosshair;
  touch-action: none;
}

/* The printed line a signature sits on, inside the well and never part of the
   posted image. */
.tui-signature-pad__rule {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 22%;
  height: 1px;
  background: var(--tui-rule);
  opacity: 0.7;
  pointer-events: none;
}

/* A still drawing for the docs' specimen cells: the same ink as the canvas,
   with the stroke kept at the canvas's width as the cell scales. */
.tui-signature-pad__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--tui-ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.tui-signature-pad__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-2);
  min-width: 0;
}
.tui-signature-pad__type { flex: 1 1 180px; min-width: 0; }
.tui-signature-pad__keys { display: flex; gap: var(--tui-1); margin-left: auto; }
:is(tui-signature-pad, .tui-signature-pad)[data-drawn] .tui-signature-pad__type { display: none; }

.tui-signature-pad__input {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 0 var(--tui-3);
  border: 0;
  border-radius: var(--tui-r-m);
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-signature-pad__input::placeholder { color: var(--tui-ink-3); opacity: 1; }
.tui-signature-pad__input:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-signature-pad__input:disabled { opacity: 0.45; cursor: not-allowed; }

.tui-field[data-error] .tui-signature-pad__well,
:is(tui-signature-pad, .tui-signature-pad):has(.tui-signature-pad__input[aria-invalid="true"]) .tui-signature-pad__well {
  box-shadow:
    0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent),
    0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent),
    var(--tui-inset);
}

:is(tui-signature-pad, .tui-signature-pad):has(.tui-signature-pad__input:disabled) .tui-signature-pad__well { opacity: 0.45; }
:is(tui-signature-pad, .tui-signature-pad):has(.tui-signature-pad__input:disabled) .tui-signature-pad__canvas { cursor: not-allowed; }

.tui-signature-pad__said {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Clear lets the ink go rather than vanishing: the value is already empty when
   the fade starts, and a new stroke ends it at once. */
:is(tui-signature-pad, .tui-signature-pad)[data-clearing] .tui-signature-pad__canvas {
  opacity: 0;
  transition: opacity 160ms var(--tui-ease);
}

@media (pointer: coarse) {
  .tui-signature-pad__well { min-height: 110px; }
  .tui-signature-pad__input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(tui-signature-pad, .tui-signature-pad)[data-clearing] .tui-signature-pad__canvas { transition: none; }
}

/* ---------------------------------------------------------------- part: skeleton */
/* Skeleton: the unprinted plate. The real layout, before its data arrives,
   drawn as blank engraved bars where the words will print: shallow cuts in
   the plate, dark under their upper wall and lit on their lower lip. Nothing
   sweeps, pulses or shimmers. The one thing that says "working" is a lamp:
   amber, steady, beside "Loading" in the panel's head. CSS only. */
.tui-skeleton { position: relative; min-width: 0; }
.tui-skeleton, .tui-skeleton * { animation: none !important; }
/* The bars are a picture of the layout: hidden from assistive technology, which hears the one line below. */
.tui-skeleton__line, .tui-skeleton__block, .tui-skeleton__circle {
  display: block;
  flex: none;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well,
    inset 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.9)),
    inset 0 0 0 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)),
    0 1px 0 var(--tui-hl));
}
/* A line of words: as tall as a lower-case letter, centred in exactly one line
   box of the type around it, so a stack of bars is as tall as the text it
   holds the place of. The modifiers set the type of the line they stand for. */
.tui-skeleton__line { --w: 100%; width: var(--w); max-width: 100%; height: 0.62em; margin: calc((1lh - 0.62em) / 2) 0; border-radius: 3px; }
.tui-skeleton__line--small { font-size: var(--tui-t-small); line-height: 1.55; }
.tui-skeleton__line--title { font-size: var(--tui-t-lead); line-height: 1.3; height: 0.72em; margin-block: calc((1lh - 0.72em) / 2); }
.tui-skeleton__line--label { font-size: var(--tui-t-label); line-height: 1.2; height: 0.8em; margin-block: calc((1lh - 0.8em) / 2); }
.tui-skeleton__line--figure { font-size: var(--tui-t-h2); line-height: 1; height: 0.7em; margin-block: calc((1lh - 0.7em) / 2); border-radius: 4px; }
/* A picture, a chart, a block of anything: a deeper recess. */
.tui-skeleton__block { --h: 96px; width: var(--w, 100%); height: var(--h); border-radius: var(--tui-r-m); box-shadow: var(--tui-inset); }
/* An avatar's place. */
.tui-skeleton__circle { --s: 36px; width: var(--s); height: var(--s); border-radius: 50%; box-shadow: var(--tui-inset); }
/* Rows and stacks, laid out as the real thing will be. */
.tui-skeleton__row { display: flex; align-items: center; gap: var(--tui-3); min-width: 0; }
.tui-skeleton__stack { display: grid; flex: 1; min-width: 0; }
/* The panel composition: a head with the amber lamp and "Loading", lines and a block under it. */
.tui-skeleton--panel { display: grid; gap: var(--tui-2); align-content: start; }
.tui-skeleton--panel > .tui-panel__head { margin-bottom: var(--tui-2); }
.tui-skeleton__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- part: slide-well */
/* Slide well: the one recess that travels. It is the well the rows use on their
   own (--tui-well-fill, --tui-well, --tui-inset): no glass, no colour. A host
   with data-slide has it as its first child, and its part's CSS stops lighting
   each row. slide-well.mjs sets its place; this only says how it looks and moves:
   180 ms ease-out on translate, width and height of the well alone, so a new
   target starts from where it is now. */
.tui-slidewell {
  position: absolute;
  z-index: 0; /* under its rows: they are positioned and come after it */
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: var(--tui-r-m);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms var(--tui-ease),
    width 180ms var(--tui-ease),
    height 180ms var(--tui-ease),
    opacity 120ms var(--tui-ease);
}
.tui-slidewell[data-show] { opacity: 1; }
/* Reduced motion: it moves without travelling. */
@media (prefers-reduced-motion: reduce) {
  .tui-slidewell { transition: none; }
}

/* ---------------------------------------------------------------- part: sortable */
/* Sortable list: a rack of plates in a tray. Each plate is a raised module
   with a knurled handle at its left; the tray is the recess it slides in.
   Lifted, a plate stands off the rack on a deep shadow and its lamp lights
   while the others slide aside. The positions are engraved by a counter, so
   they renumber as the plates move. Corners are concentric: a 4px inset
   makes the 4px handle in the 8px plate, and a 5px gap makes the 13px tray. */
.tui-sortable {
  position: relative;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 5px;
  list-style: none;
  counter-reset: tui-sortable;
  border-radius: 13px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-sortable__item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--tui-3);
  min-height: 52px;
  padding: 4px 14px 4px 4px;
  border-radius: 8px;
  counter-increment: tui-sortable;
  background:
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.18));
  transition: box-shadow 140ms var(--tui-ease);
}

/* The handle: a slot with knurled ridges cut across it. */
.tui-sortable__grip {
  appearance: none;
  align-self: stretch;
  width: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  background:
    repeating-linear-gradient(90deg, rgb(var(--tui-sh) / 0.34) 0 1px, var(--tui-hl) 1px 2px, transparent 2px 4px),
    var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-sortable__grip:hover, .tui-sortable__grip.is-hover { filter: brightness(1.05); }
.tui-sortable__grip:focus-visible, .tui-sortable__grip.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-sortable__grip[aria-pressed="true"] { cursor: grabbing; }

.tui-sortable__text { display: grid; gap: 1px; min-width: 0; }
.tui-sortable__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--tui-ink); }
.tui-sortable__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
/* Engraved position: printed into the plate, tabular so the numbers do not shuffle. */
.tui-sortable__pos::before {
  content: counter(tui-sortable, decimal-leading-zero);
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--tui-ink-3);
  text-shadow: 0 1px 0 var(--tui-hl);
}

/* Lifted: off the rack, on a deep shadow, lamp lit. */
.tui-sortable__item.is-lifted, .tui-sortable__item[data-picked] {
  z-index: 2;
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 2px 0 var(--tui-skirt), 0 16px 22px -10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
.tui-sortable__item[data-picked]:not(.is-lifted) { transform: translateY(-2px); }
.tui-sortable[data-dragging] { user-select: none; -webkit-user-select: none; }
.tui-sortable[data-dragging] .tui-sortable__item { transition: none; }
.tui-sortable[data-dragging] .tui-sortable__item.is-lifted { cursor: grabbing; }

/* Spoken, not seen: each move. */
.tui-sortable__live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { .tui-sortable__item { transition: none; } }

@media (pointer: coarse) {
  .tui-sortable__grip { position: relative; }
  .tui-sortable__grip::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)); }
}

/* ---------------------------------------------------------------- part: sources */
/* Sources: a card index. In the text, a citation is a small numbered index
   tab printed flat after the sentence it supports, its foot ruled where it
   meets the card; it is printing, not a key, so it never asks to be pressed.
   Resting on it hangs the hover card. At the foot of the answer the sources
   are a references plate that opens to a numbered list: the title, the site
   in the second ink, a quoted line. sources.mjs names the cites and hangs
   the cards. */
.tui-cite {
  /* Inline, not an inline box, so it breaks with the text around it and never wraps away from its word. */
  display: inline;
  margin: 0 1px 0 3px;
  padding: 2px 4.5px 1px;
  border-radius: 4px 4px 1px 1px;
  border-bottom: 1.5px solid color-mix(in oklab, var(--tui-ink) 38%, transparent);
  font: 600 10px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-decoration: none;
  color: var(--tui-ink);
  background: color-mix(in oklab, var(--tui-ink) 8%, transparent);
  vertical-align: 0.35em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-color 120ms var(--tui-ease), color 120ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-cite:hover, .tui-cite.is-hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-ink) 15%, transparent); }
.tui-cite:focus-visible, .tui-cite.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* Visited: the tab's foot rule goes quieter; the number stays readable. */
.tui-cite:visited, .tui-cite.is-visited { border-bottom-color: color-mix(in oklab, var(--tui-ink) 16%, transparent); }
.tui-cite.is-visited { border-bottom-style: dotted; }

/* The card that hangs from a cite: the hover card's plate, the tab's number on it. */
.tui-popover.tui-hover-card.tui-sources__card { width: 268px; gap: 4px; padding: 12px 14px 14px; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
.tui-sources__card > :not(.tui-sources__card-n) { grid-column: 2; }
.tui-sources__card-n { grid-row: 1 / span 3; align-self: start; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px 4px 1px 1px; border-bottom: 1.5px solid color-mix(in oklab, var(--tui-ink) 38%, transparent); font: 600 11px/1 var(--tui-sans); color: var(--tui-ink-2); background: color-mix(in oklab, var(--tui-ink) 8%, transparent); }
.tui-sources__card-title { font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-sources__card .tui-sources__quote { margin-top: 6px; }

/* The references plate. */
.tui-sources { margin-top: var(--tui-3); border-top: 1px solid var(--tui-rule); }
.tui-sources__head {
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  min-height: 38px;
  padding: 4px 2px;
  list-style: none;
  border-radius: var(--tui-r-m);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-sources__head::-webkit-details-marker { display: none; }
.tui-sources__head::marker { content: ''; }
.tui-sources__head > .tui-label { flex: 1; }
.tui-sources__head:focus-visible, .tui-sources__head.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
/* The plate's key: the accordion's square cap, small, latched while the list is out. */
.tui-sources__head::after {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 7px 1.5px no-repeat,
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 7px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2.5px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-sources__head:hover::after, .tui-sources__head.is-hover::after { filter: brightness(1.03); }
.tui-sources__head:active::after, .tui-sources__head.is-down::after, .tui-sources > details[open] > .tui-sources__head::after {
  transform: translateY(1.5px);
  filter: brightness(0.97);
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 7px 1.5px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-pressed);
}
.tui-sources__list { display: grid; gap: 2px; margin: 0; padding: 0 0 4px; list-style: none; }
.tui-sources > details[open] > .tui-sources__list { animation: tui-sources-out 180ms var(--tui-ease); }
@keyframes tui-sources-out { from { opacity: 0; transform: translateY(-5px); } }
.tui-sources__item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  padding: 7px 6px 8px 2px;
  border-radius: var(--tui-r-m);
  transition: background-color 400ms var(--tui-ease);
}
.tui-sources__item:focus { outline: none; }
.tui-sources__item:focus-visible, .tui-sources__item[data-arrived], .tui-sources__item.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 0; background: color-mix(in oklab, var(--tui-ink) 5%, transparent); }
.tui-sources__n {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  margin-top: 1px;
  border-radius: 4px 4px 1px 1px;
  border-bottom: 1.5px solid color-mix(in oklab, var(--tui-ink) 38%, transparent);
  font: 600 11px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink-2);
  background: color-mix(in oklab, var(--tui-ink) 8%, transparent);
}
.tui-sources__body { display: grid; gap: 2px; min-width: 0; }
.tui-sources__title { justify-self: start; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-sources__item[data-unreachable] .tui-sources__title { color: var(--tui-ink-2); font-weight: 500; }
.tui-sources__site { font: 500 var(--tui-t-small)/1.35 var(--tui-sans); color: var(--tui-ink-2); overflow-wrap: anywhere; }
.tui-sources__quote { display: block; margin-top: 3px; padding-left: 9px; border-left: 2px solid var(--tui-rule); font: italic 400 var(--tui-t-small)/1.5 var(--tui-sans); color: var(--tui-ink-2); quotes: '“' '”'; }
/* Back to the answer: there for the keyboard, shown when the row is reached. */
.tui-sources__back { justify-self: start; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); text-underline-offset: 3px; }
.tui-sources__item:not(:focus-within, [data-arrived], .is-focus) .tui-sources__back { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-sources > details[open] > .tui-sources__list { animation: none; }
}
/* In a chat slip the printing is laid on by a clipped background; a cite and its card draw their own ink. */
.tui-cite, .tui-sources__card { -webkit-text-fill-color: currentColor; }
/* On a chat slip the plate's key is a paper cap: lit like the slip, its skirt a shade of the paper's ink. */
.tui-chat__msg .tui-sources { --tui-face-hi: var(--tui-paper-hi); --tui-skirt: color-mix(in oklab, var(--tui-paper-ink) 28%, var(--tui-paper)); --tui-sh: 60 52 34; --tui-sh-a: 0.22; }

/* ---------------------------------------------------------------- part: sparkline */
/* Sparkline: a word-sized line for the margin of a table or a readout. It is
   an SVG that takes the size of the type around it (5.5em wide) and the ink of
   the place it sits in, so on a panel it is ink and on display glass it is the
   display's light. The last value is marked with a dot seated in a faint ring;
   give the sparkline a lamp (data-lamp) and the dot is lit that colour. The
   trend and the last value are said in words on the image's label, so the line
   is never the only carrier of the news. */
.tui-sparkline {
  --c: var(--tui-green);
  display: inline-block;
  flex: none;
  width: 5.5em;
  height: 2em;
  overflow: visible;
  vertical-align: -0.55em;
  color: var(--tui-ink);
}
.tui-sparkline .line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.tui-sparkline .area { fill: currentColor; opacity: 0.06; stroke: none; }
.tui-sparkline .seat { fill: none; stroke: currentColor; stroke-opacity: 0.28; stroke-width: 3; vector-effect: non-scaling-stroke; }
.tui-sparkline .last { fill: currentColor; stroke: none; }
.tui-sparkline[data-lamp="amber"] { --c: var(--tui-amber); }
.tui-sparkline[data-lamp="red"] { --c: var(--tui-red); }
.tui-sparkline[data-lamp="blue"] { --c: var(--tui-blue); }
.tui-sparkline[data-lamp] .last { fill: var(--c); filter: drop-shadow(0 0 2px var(--c)); }
.tui-sparkline[data-lamp] .seat { stroke: var(--c); stroke-opacity: 0.35; }
/* In a table, set it beside a figure and keep it on the line. */
.tui-table td .tui-sparkline { vertical-align: middle; }
.tui-sparkline--sm { width: 4em; height: 1.45em; }
.tui-sparkline--lg { width: 9em; height: 3.2em; }
@media (forced-colors: active) {
  .tui-sparkline .line { stroke: CanvasText; }
  .tui-sparkline .area, .tui-sparkline .seat { display: none; }
  .tui-sparkline .last { fill: Highlight; }
}

/* ---------------------------------------------------------------- part: spinner */
/* Spinner: a ring of eight lamps lit in turn, a chase round the dial. Each
   lamp is a dim cap with its light laid over it; the light fades as the chase
   passes on, so there is a short tail behind the lit one. Only the light's
   opacity moves. Amber, the lamp for work in hand, unless data-lamp says
   otherwise. Under reduced motion the chase stops and the lamp at the top
   stays lit: still one steady lamp, still busy, and the words say so (the
   ring is only drawn; role="status" and the label are what is read). */
.tui-spinner {
  /* The positioned box for the label, which is out of the flow: it must not escape a scroller. */
  position: relative;
  --sp: 24px;
  --c: var(--tui-amber);
  display: inline-flex;
  align-items: center;
  gap: var(--tui-2);
  vertical-align: middle;
  color: var(--tui-ink-2);
  font: 500 var(--tui-t-small)/1.3 var(--tui-sans);
}
.tui-spinner[data-lamp="green"] { --c: var(--tui-green); }
.tui-spinner[data-lamp="red"] { --c: var(--tui-red); }
.tui-spinner[data-lamp="blue"] { --c: var(--tui-blue); }
.tui-spinner[data-lamp="white"] { --c: var(--tui-white); }
.tui-spinner--sm { --sp: 16px; }
.tui-spinner--lg { --sp: 40px; }

.tui-spinner__ring { position: relative; display: block; flex: none; width: var(--sp); height: var(--sp); }
/* The lamps stand on a circle: each is moved out along its own direction (--x, --y, as fractions of the radius). */
.tui-spinner__ring > i {
  --d: calc(var(--sp) * 0.22);
  --r: calc((var(--sp) - var(--d)) / 2);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2);
  border-radius: 50%;
  transform: translate(calc(var(--x) * var(--r)), calc(var(--y) * var(--r)));
  background: color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 0 1px 0 var(--tui-hl);
}
.tui-spinner__ring > i::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c);
  box-shadow: var(--tui-glow);
  opacity: 0;
  animation: tui-spinner-chase 960ms linear infinite;
  animation-delay: var(--t);
}
.tui-spinner__ring > i:nth-child(1) { --x: 0; --y: -1; --t: 0ms; }
.tui-spinner__ring > i:nth-child(2) { --x: 0.7071; --y: -0.7071; --t: -840ms; }
.tui-spinner__ring > i:nth-child(3) { --x: 1; --y: 0; --t: -720ms; }
.tui-spinner__ring > i:nth-child(4) { --x: 0.7071; --y: 0.7071; --t: -600ms; }
.tui-spinner__ring > i:nth-child(5) { --x: 0; --y: 1; --t: -480ms; }
.tui-spinner__ring > i:nth-child(6) { --x: -0.7071; --y: 0.7071; --t: -360ms; }
.tui-spinner__ring > i:nth-child(7) { --x: -1; --y: 0; --t: -240ms; }
.tui-spinner__ring > i:nth-child(8) { --x: -0.7071; --y: -0.7071; --t: -120ms; }
@keyframes tui-spinner-chase { 0% { opacity: 1; } 55%, 100% { opacity: 0; } }
/* Off screen (spinner.mjs sets it) or in a pane nobody can see: nothing runs. */
.tui-spinner[data-paused] .tui-spinner__ring > i::after { animation-play-state: paused; }

/* The words: always in the page for a screen reader, drawn only when asked. */
.tui-spinner__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-spinner--labelled .tui-spinner__label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }

@media (prefers-reduced-motion: reduce) {
  .tui-spinner__ring > i::after { animation: none; }
  .tui-spinner__ring > i:nth-child(1)::after { opacity: 1; }
}

/* ---------------------------------------------------------------- part: split-button */
/* Split button: an action and the menu of its other ways, as two keys in one
   outline. The wide key is a real button with its own action; the narrow one
   beside it opens a menu. They are set flush, share the outer corners and
   have one hairline between them, but each is still its own cap and goes down
   on its own. The card is the menu part's (menu.css). */
.tui-split-button {
  --r: var(--tui-r-m);
  --split-line: color-mix(in oklab, var(--tui-ink) 24%, transparent);
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border-radius: var(--r);
  vertical-align: middle;
}
.tui-split-button--sm { --r: 6px; }
.tui-split-button:has(> .tui-key--primary) { --split-line: color-mix(in oklab, var(--tui-cap-ink) 30%, transparent); }

/* Outer corners are the key's own; the edge they share is square. */
.tui-split-button > .tui-key { border-radius: 0; }
.tui-split-button > .tui-key:first-child { border-top-left-radius: var(--r); border-bottom-left-radius: var(--r); }
.tui-split-button > .tui-key:last-child { border-top-right-radius: var(--r); border-bottom-right-radius: var(--r); }
.tui-split-button > .tui-key:only-child { border-radius: var(--r); }
.tui-split-button--sm > .tui-key { --h: 28px; --skirt: 1.5px; padding: 0 var(--tui-3); font-size: 11.5px; }

/* The narrow key: just the printed arrow, and the one hairline on its near edge. */
.tui-split-button > .tui-split-button__more { width: 32px; padding: 0; }
.tui-split-button--sm > .tui-split-button__more { width: 26px; padding: 0; }
.tui-split-button > .tui-split-button__more::after { margin: 0; }
.tui-split-button > .tui-split-button__more::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 1px;
  background: var(--split-line);
  pointer-events: none;
}
.tui-split-button > .tui-key:focus-visible { z-index: 1; outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* Flat: printed words in one outline, no caps. */
.tui-split-button--flat {
  --h: 36px;
  box-shadow: inset 0 0 0 1px var(--tui-rule);
}
.tui-split-button--flat.tui-split-button--sm { --h: 28px; }
.tui-split-button--flat > .tui-key {
  --skirt: 0px;
  height: calc(var(--h) - 2px);
  margin-block: 1px;
  background: none;
  box-shadow: none;
  color: var(--tui-ink);
}
.tui-split-button--flat > .tui-key:first-child { margin-left: 1px; border-top-left-radius: calc(var(--r) - 1px); border-bottom-left-radius: calc(var(--r) - 1px); }
.tui-split-button--flat > .tui-key:last-child { margin-right: 1px; border-top-right-radius: calc(var(--r) - 1px); border-bottom-right-radius: calc(var(--r) - 1px); }
.tui-split-button--flat > .tui-key:hover, .tui-split-button--flat > .tui-key.is-hover { filter: none; background: color-mix(in oklab, var(--tui-ink) 7%, transparent); }
.tui-split-button--flat > .tui-key:is(:active, [aria-expanded="true"], .is-down) {
  transform: none;
  filter: none;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-split-button--flat > .tui-key:disabled { background: none; box-shadow: none; }

@media (pointer: coarse) {
  .tui-split-button > .tui-key { --h: 44px; }
  .tui-split-button--flat > .tui-key { height: 42px; }
  .tui-split-button > .tui-split-button__more { width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-split-button > .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: split */
/* Split panes: two or more panes and a groove cut across the plate between
   each pair, with a knurled grip set in the groove. The grip is a small raised
   cap: lit on its top and left edges, its shadow down and to the right; held,
   it sinks below the plate. Without the script the panes sit apart at the
   share --split gives them (0 to 1, a half by default), or share the row
   equally when `panes` names more than two. kit/parts/split.mjs adds the
   dividers and moves them. */
tui-split, .tui-split {
  --gutter: 14px;
  display: grid;
  grid-template-columns: calc((100% - var(--gutter)) * var(--split, 0.5)) minmax(0, 1fr);
  column-gap: var(--gutter);
  min-width: 0;
  min-height: 0;
}
:is(tui-split, .tui-split)[orientation="vertical"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: calc((100% - var(--gutter)) * var(--split, 0.5)) minmax(0, 1fr);
  row-gap: var(--gutter);
}
:is(tui-split, .tui-split) > * { min-width: 0; min-height: 0; }
.tui-split__pane { overflow: auto; }

/* Built: the divider takes the gutter. */
:is(tui-split, .tui-split)[data-ready] {
  grid-template-columns: calc((100% - var(--gutter)) * var(--split, 0.5)) var(--gutter) minmax(0, 1fr);
  column-gap: 0;
  transition: grid-template-columns 160ms var(--tui-ease), grid-template-rows 160ms var(--tui-ease);
}
:is(tui-split, .tui-split)[data-ready][orientation="vertical"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: calc((100% - var(--gutter)) * var(--split, 0.5)) var(--gutter) minmax(0, 1fr);
  row-gap: 0;
}
/* More than two panes: one track per pane and a divider track between each
   pair. The script holds the track list; before it runs the panes share the
   row, or the column, equally. */
:is(tui-split, .tui-split)[panes]:not([data-ready]) {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  column-gap: var(--gutter);
}
:is(tui-split, .tui-split)[panes]:not([data-ready])[orientation="vertical"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: none;
  grid-auto-flow: row;
  grid-auto-rows: minmax(0, 1fr);
  column-gap: 0;
  row-gap: var(--gutter);
}
:is(tui-split, .tui-split)[data-panes] {
  grid-template-columns: var(--split-tracks);
  column-gap: 0;
}
:is(tui-split, .tui-split)[data-panes][orientation="vertical"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--split-tracks);
  row-gap: 0;
}
/* [data-ready] carries the settle, so the drag has to outweigh it or the grip trails the pointer by 160ms. */
:is(tui-split, .tui-split)[data-ready][data-dragging] { transition: none; user-select: none; }
:is(tui-split, .tui-split)[data-panes][data-dragging] { transition: none; }
/* While the grip is held the panes take no pointer, so a frame inside one cannot steal the drag. */
tui-split[data-dragging] > :not(.tui-split__divider) { pointer-events: none; }
:is(tui-split, .tui-split) > [data-collapsed] { visibility: hidden; overflow: hidden; }

.tui-split__divider {
  position: relative;
  display: grid;
  place-items: center;
  cursor: col-resize;
  touch-action: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
[orientation="vertical"] > .tui-split__divider { cursor: row-resize; }
/* The groove: a narrow cut the length of the panes, dark under its left wall, lit on its right lip. */
.tui-split__divider::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: calc(50% - 2px);
  width: 4px;
  border-radius: 2px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-depth-well, inset 1.5px 1px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)), 1px 0 0 var(--tui-hl));
}
[orientation="vertical"] > .tui-split__divider::before { top: calc(50% - 2px); bottom: auto; left: 6px; right: 6px; width: auto; height: 4px; box-shadow: var(--tui-depth-well, inset 1px 1.5px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)), 0 1px 0 var(--tui-hl)); }
/* A finger's worth of reach either side of the groove. */
.tui-split__divider::after { content: ''; position: absolute; inset: 0 -8px; }
[orientation="vertical"] > .tui-split__divider::after { inset: -8px 0; }

/* The grip: a raised cap with knurled ridges across it. */
.tui-split__grip {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 44px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(180deg, transparent 0 3px, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)) 3px 4px, var(--tui-hl) 4px 5px) 0 10px / 100% 24px no-repeat,
    var(--tui-depth-cap, linear-gradient(90deg, var(--tui-face-hi), var(--tui-face-hi) 60%, var(--tui-face-lo)));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), inset 1px 0 0 var(--tui-hl), 1.5px 1.5px 0 var(--tui-skirt), 2px 3px 5px rgb(var(--tui-sh) / 0.3));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease), filter 70ms var(--tui-ease);
}
[orientation="vertical"] > .tui-split__divider .tui-split__grip {
  width: 44px;
  height: 10px;
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)) 3px 4px, var(--tui-hl) 4px 5px) 10px 0 / 24px 100% no-repeat,
    var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), var(--tui-face-hi) 60%, var(--tui-face-lo)));
}
.tui-split__divider:hover .tui-split__grip, .tui-split__grip.is-hover { filter: brightness(1.03); }
tui-split[data-dragging] .tui-split__divider[data-active] .tui-split__grip, .tui-split__grip.is-down { transform: translate(1px, 1px); box-shadow: var(--tui-pressed); }
.tui-split__divider:focus-visible { outline: none; }
.tui-split__divider:focus-visible .tui-split__grip, .tui-split__grip.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
/* Collapsed: the grip lies against the edge it closed to. */
tui-split[data-collapsed] .tui-split__divider[data-against] .tui-split__grip { filter: brightness(0.97); }

/* remember: a seat machined where the reader keeps leaving the divider. An end cap is cut into the
   plate at each end of the divider's travel there, a grip and a half wide, deep enough that the groove's
   ends sit in them when the divider is seated, like a rail in its caps. While the grip is held, the
   channel between the caps shows: the groove's own drawing, shallower, so the reader sees where it will
   drop. A drag near it drops in with a short settle. */
tui-split[data-notch] { position: relative; }
.tui-split__seat {
  position: absolute;
  z-index: 1;
  inset-block: 0;
  left: calc((100% - var(--gutter)) * var(--notch, 0.5) + var(--gutter) / 2 - 9px);
  width: 18px;
  pointer-events: none;
}
tui-split:not([data-notch]) > .tui-split__seat { display: none; }
.tui-split__seat::before, .tui-split__seat::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 10px;
  background: var(--tui-well-fill) var(--tui-well);
}
.tui-split__seat::before { top: 0; border-radius: 0 0 9px 9px; box-shadow: inset 0 3px 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), inset 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6)), 0 1px 0 var(--tui-hl); }
.tui-split__seat::after { bottom: 0; border-radius: 9px 9px 0 0; box-shadow: inset 0 2px 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)), 0 -1px 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)); }
/* The channel: the groove's well, 6px wide and at two thirds of its depth, from cap to cap. */
.tui-split__channel {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 6px;
  border-radius: 3px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: inset 1px 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.2)), 1px 0 0 var(--tui-hl);
  opacity: 0;
  transition: opacity 140ms var(--tui-ease);
}
tui-split[data-dragging] .tui-split__channel { opacity: 1; }
tui-split[data-seated] .tui-split__channel { opacity: 0; }
/* Seated: the groove runs on into the caps. */
tui-split[data-seated] > .tui-split__divider::before { top: 2px; bottom: 2px; }
tui-split[orientation="vertical"] > .tui-split__seat { inset-block: auto; inset-inline: 0; left: 0; width: auto; top: calc((100% - var(--gutter)) * var(--notch, 0.5) + var(--gutter) / 2 - 9px); height: 18px; }
tui-split[orientation="vertical"] > .tui-split__seat::before, tui-split[orientation="vertical"] > .tui-split__seat::after { top: 0; width: 10px; height: 18px; }
tui-split[orientation="vertical"] > .tui-split__seat::before { left: 0; border-radius: 0 9px 9px 0; box-shadow: inset 3px 0 3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), inset -1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.6)), 1px 0 0 var(--tui-hl); }
tui-split[orientation="vertical"] > .tui-split__seat::after { left: auto; right: 0; bottom: auto; border-radius: 9px 0 0 9px; box-shadow: inset -2px 0 2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)), -1px 0 0 rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.7)); }
tui-split[orientation="vertical"] .tui-split__channel { top: 6px; bottom: auto; left: 6px; right: 6px; width: auto; height: 6px; }
tui-split[orientation="vertical"][data-seated] > .tui-split__divider::before { left: 2px; right: 2px; }
:is(tui-split, .tui-split)[data-ready][data-dragging][data-caught] { transition: grid-template-columns 90ms var(--tui-ease), grid-template-rows 90ms var(--tui-ease); }

@media (prefers-reduced-motion: reduce) {
  :is(tui-split, .tui-split)[data-ready], :is(tui-split, .tui-split)[data-ready][data-dragging][data-caught], .tui-split__grip, .tui-split__channel { transition: none; }
}

/* ---------------------------------------------------------------- part: stacked-bars */
/* Stacked bars: the columns are the lamps cut into series, a gap of glass
   between each so two neighbours never run into one. Stacked reads totals from
   zero, with each total printed above its column; 100 percent reads the mix.
   The total is the display's light. The segment the reader is on is ringed and
   its column lit faintly, in the same ink as everything else the reader is on. */
.tui-stacked-bars .sg { stroke: var(--tui-vfd-bg); stroke-width: 1.5; stroke-linejoin: miter; shape-rendering: crispEdges; }
.tui-stacked-bars .sg[data-here] { stroke: var(--tui-vfd); }
.tui-stacked-bars .tui-chart__tops text { text-anchor: middle; }

@media (pointer: coarse) {
  .tui-stacked-bars .tui-chart__plot { min-height: 220px; }
}
@media (max-width: 480px) {
  .tui-stacked-bars .tui-chart__legend { gap: 0 var(--tui-3); }
}

/* ---------------------------------------------------------------- part: stage-lift */
/* Stage lift: a modal dialog that arrives as a performer on a stage lift.
   The house lights dim; across the foot of the backdrop a stage floor is
   seen slightly from above, dark boards with fine seams. A trap is cut in
   it, two flaps meeting at a seam. The flaps swing down, the dialog rises
   through the gap on a lift platform with two guide rails that stay in
   view, slows, and settles at centre stage with a 2px settle; a soft pool
   of light lands on it. Closing sinks the plate and the flaps meet again
   behind it.
   The plate itself is the kit's own dialog panel (the same width, face,
   corners and shadow as the plain Dialog); only the stage around it moves.
   The floor and the trap are decoration (aria-hidden), fixed to the
   viewport inside the real dialog, so there is one control, not a drawn
   copy of one. kit/parts/stage-lift.mjs adds only what every kit dialog
   adds: the invoker works where the browser has none, and a click on the
   scrim closes it (data-lock turns that off), reusing the Drawer's own
   onScrim() check. */
dialog.tui-stage-lift {
  /* The stage, from the kit's own neutrals: dark boards in either finish,
     a plain apron at the front edge. The floor is a low band at the foot of
     the screen, little more than a tenth of it. */
  --sl-floor: clamp(84px, 12.5vh, 112px);
  --sl-trap-w: min(520px, calc(100vw - 24px));
  --sl-trap-h: clamp(24px, 3.6vh, 34px);
  --sl-front: calc((var(--sl-floor) - var(--sl-trap-h)) / 2);
  --sl-rise: clamp(270px, 42vh, 560px);
  --sl-apron: 10px;
  --sl-panel-w: min(440px, calc(100vw - 32px));
  --sl-rail-x: calc(var(--sl-panel-w) * 0.32);
  --sl-board: light-dark(color-mix(in oklab, var(--tui-skirt) 68%, var(--tui-ink)), color-mix(in oklab, var(--tui-skirt) 96%, var(--tui-paper)));
  --sl-board-1: var(--sl-board);
  /* Aluminium keeps its quiet variation; graphite's is a quarter as strong,
     so the boards read as one dark timber floor rather than rays. */
  --sl-board-2: light-dark(color-mix(in oklab, var(--sl-board) 95%, var(--tui-paper)), color-mix(in oklab, var(--sl-board) 98.75%, var(--tui-paper)));
  --sl-board-3: light-dark(color-mix(in oklab, var(--sl-board) 95%, var(--tui-skirt)), color-mix(in oklab, var(--sl-board) 98.75%, var(--tui-skirt)));
  --sl-board-4: light-dark(color-mix(in oklab, var(--sl-board) 91%, var(--tui-paper)), color-mix(in oklab, var(--sl-board) 97.75%, var(--tui-paper)));
  --sl-seam: light-dark(color-mix(in oklab, var(--tui-skirt) 45%, var(--tui-ink) 55%), color-mix(in oklab, var(--tui-skirt) 84%, var(--tui-paper) 16%));
  --sl-joint: color-mix(in oklab, var(--sl-seam) 58%, transparent);
  --sl-pool: color-mix(in oklab, var(--tui-paper) 12%, transparent);
  --sl-apron-face: light-dark(color-mix(in oklab, var(--tui-skirt) 90%, var(--tui-ink)), color-mix(in oklab, var(--tui-skirt) 92%, var(--tui-paper)));
  --sl-pit: light-dark(color-mix(in oklab, var(--tui-skirt) 38%, var(--tui-ink)), var(--tui-skirt));
  --sl-house: color-mix(in oklab, var(--tui-backdrop) 30%, var(--tui-skirt) 70%);

  /* The dialog itself is a transparent frame around the panel; the card is
     .tui-stage-lift__panel, so it can be lifted without moving the floor. */
  width: fit-content;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: none;
  box-shadow: none;
  /* Never a scroll container: the fixed stage layers would count as its
     scrollable overflow and a long card would scroll them into view. */
  overflow: visible;
  opacity: 1;
  scale: none;
  transition: overlay 520ms allow-discrete, display 520ms allow-discrete;
}
dialog.tui-stage-lift:not([open]) { opacity: 1; scale: none; }

/* A phone gets a lower band still: no more than a tenth of its height. */
@media (max-width: 600px) {
  dialog.tui-stage-lift {
    --sl-floor: clamp(74px, 10.5vh, 96px);
    --sl-trap-h: clamp(22px, 3vh, 30px);
    --sl-apron: 8px;
  }
}

/* The house lights dim: the backdrop goes a step darker than a plain
   dialog's, and settles in a short ease. */
dialog.tui-stage-lift::backdrop {
  background: var(--sl-house);
  opacity: 0;
  transition: opacity 260ms var(--tui-ease), overlay 260ms allow-discrete, display 260ms allow-discrete;
}
dialog.tui-stage-lift[open]::backdrop { opacity: 1; }
@starting-style { dialog.tui-stage-lift[open]::backdrop { opacity: 0; } }

/* The carriage: the plate and its lift, the one thing that moves. It starts
   below the floor and is slowed into place by a curve that lets it overshoot
   by about 2px and settle. */
.tui-stage-lift__carriage {
  position: relative;
  z-index: 1;
  transform: translateY(var(--sl-rise));
  transition: transform 300ms var(--tui-ease);
}
dialog.tui-stage-lift[open] .tui-stage-lift__carriage {
  transform: translateY(0);
  transition: transform 580ms var(--tui-ease) 80ms;
}
/* Decelerating, with a last 0.42% of the climb (2px at 480) as the settle. */
@supports (transition-timing-function: linear(0, 1)) {
  dialog.tui-stage-lift[open] .tui-stage-lift__carriage {
    transition-timing-function: linear(0, 0.3 14%, 0.58 28%, 0.79 42%, 0.92 56%, 0.978 70%, 1.0042 84%, 1.001 92%, 1 100%);
  }
}
@starting-style { dialog.tui-stage-lift[open] .tui-stage-lift__carriage { transform: translateY(var(--sl-rise)); } }

/* The plate: the kit's dialog panel, unchanged. It may scroll on its own;
   the platform sits on the carriage, outside that scroll box. */
.tui-stage-lift__panel {
  width: var(--sl-panel-w);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: var(--tui-6);
  border: 0;
  border-radius: 14px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float);
}

/* The lift platform: an 8px plate under the card, a shade wider, with a lit
   top edge and a darker front face. */
.tui-stage-lift__carriage::before {
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: -8px;
  height: 8px;
  border-radius: 2px;
  background:
    linear-gradient(
      to bottom,
      color-mix(in oklab, var(--tui-face-hi) 76%, var(--tui-paper)) 0,
      color-mix(in oklab, var(--tui-face-lo) 90%, var(--tui-paper)) 2px,
      var(--tui-face-lo) 3px,
      color-mix(in oklab, var(--tui-face-lo) 76%, var(--tui-skirt)) 100%
    );
  box-shadow:
    inset 0 1px 0 var(--tui-hl),
    inset 0 0 0 1px color-mix(in oklab, var(--tui-skirt) 26%, transparent),
    0 8px 12px -8px color-mix(in oklab, var(--tui-skirt) 70%, transparent);
}

/* The guide rails: two quiet steel lines from under the plate down to the
   top of the trap. They rise with the plate and stay when it has settled.
   The layer is fixed, its top at the screen's centre where the plate always
   covers it, and its bottom at the trap's top edge. */
.tui-stage-lift__floor::after {
  content: '';
  position: fixed;
  left: calc(50% - var(--sl-rail-x));
  right: calc(50% - var(--sl-rail-x));
  top: calc(50dvh + var(--sl-rise));
  bottom: calc(var(--sl-front) + var(--sl-trap-h));
  z-index: 1;
  background:
    linear-gradient(var(--tui-face-lo), var(--tui-skirt)) left top / 7px 100% no-repeat,
    linear-gradient(var(--tui-face-lo), var(--tui-skirt)) right top / 7px 100% no-repeat;
  opacity: 0;
  transition: top 300ms var(--tui-ease), opacity 140ms var(--tui-ease);
}
dialog.tui-stage-lift[open] .tui-stage-lift__floor::after {
  top: 50dvh;
  opacity: 1;
  transition: top 580ms var(--tui-ease) 80ms, opacity 180ms var(--tui-ease) 140ms;
}
@supports (transition-timing-function: linear(0, 1)) {
  dialog.tui-stage-lift[open] .tui-stage-lift__floor::after {
    transition: top 580ms linear(0, 0.3 14%, 0.58 28%, 0.79 42%, 0.92 56%, 0.978 70%, 1.0042 84%, 1.001 92%, 1 100%) 80ms, opacity 180ms var(--tui-ease) 140ms;
  }
}
@starting-style {
  dialog.tui-stage-lift[open] .tui-stage-lift__floor::after { top: calc(50dvh + var(--sl-rise)); opacity: 0; }
}

/* The boards, in one point perspective: the seams fan out from a vanishing
   point at the centre of the horizon to the front edge, the widths vary a
   little, and each board ends at its own depth. The same drawing is laid in
   the far floor and in the near strip, both the height of the whole band
   and pinned to the viewport bottom, so the seams meet across the join.
   A turbulence filter lays a faint grain over the lot. */
.tui-stage-lift__boards {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--sl-front) * -1);
  width: 100%;
  height: var(--sl-floor);
  display: block;
  isolation: isolate;
  pointer-events: none;
}
.tui-stage-lift__board--1 { fill: var(--sl-board-1); }
.tui-stage-lift__board--2 { fill: var(--sl-board-2); }
.tui-stage-lift__board--3 { fill: var(--sl-board-3); }
.tui-stage-lift__board--4 { fill: var(--sl-board-4); }
.tui-stage-lift__seam {
  stroke: var(--sl-seam);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tui-stage-lift__joint {
  stroke: var(--sl-joint);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.tui-stage-lift__grain {
  opacity: .2;
  mix-blend-mode: overlay;
}

/* The far floor, behind the plate: the boards the plate rises in front of,
   the dark trap beneath them, and the two flaps. It is fixed to the
   viewport inside the dialog, so the whole width of the stage is laid. */
.tui-stage-lift__floor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--sl-front);
  height: calc(var(--sl-floor) - var(--sl-front));
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  background-color: var(--sl-board);
}
/* The back of the stage melts into the dark house, and the lamp pools on
   the boards around the trap. */
.tui-stage-lift__floor::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 45% 80% at 50% 100%, var(--sl-pool), transparent 72%),
    linear-gradient(to bottom, var(--sl-house), transparent 46%);
}

/* The trap: a dark opening with two flaps that fold down into it. Its edge
   stays square and clear of the grain. The lower lip catches the lamp, as
   every recess in the kit does. */
.tui-stage-lift__trap {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  width: var(--sl-trap-w);
  height: var(--sl-trap-h);
  transform: translateX(-50%);
  overflow: hidden;
  /* Wider at its near edge: a hole in a floor seen at a low angle. */
  clip-path: polygon(3% 0, 97% 0, 100% 100%, 0 100%);
  /* A slightly lighter far wall at the back, darker inner sides, and a soft
     light rising from the shaft below; the edge stays a clean 1px seam. */
  background:
    linear-gradient(to right,
      color-mix(in oklab, var(--sl-pit) 72%, var(--tui-backdrop)) 0,
      transparent 14%,
      transparent 86%,
      color-mix(in oklab, var(--sl-pit) 72%, var(--tui-backdrop)) 100%),
    radial-gradient(ellipse 55% 105% at 50% 116%, color-mix(in oklab, var(--tui-paper) 30%, transparent), transparent 74%),
    linear-gradient(to bottom,
      color-mix(in oklab, var(--sl-pit) 76%, var(--tui-paper)) 0,
      color-mix(in oklab, var(--sl-pit) 92%, var(--tui-paper)) 38%,
      var(--sl-pit) 70%);
  box-shadow:
    inset 0 0 0 1px var(--sl-seam),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-paper) 22%, transparent);
}
.tui-stage-lift__door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: color-mix(in oklab, var(--sl-board) 90%, var(--tui-paper));
  transition: transform 280ms var(--tui-ease) 140ms, opacity 140ms var(--tui-ease) 140ms;
}
.tui-stage-lift__door--l { left: 0; transform-origin: 0 50%; box-shadow: inset -1px 0 0 var(--sl-seam); }
.tui-stage-lift__door--r { right: 0; transform-origin: 100% 50%; box-shadow: inset 1px 0 0 var(--sl-seam); }
/* Folded down into the pit, the flaps are out of sight; the opening is left
   with its own clean edge, never a lit band across it. */
dialog.tui-stage-lift[open] .tui-stage-lift__door {
  opacity: 0;
  transition: transform 300ms var(--tui-ease) 40ms, opacity 100ms var(--tui-ease) 240ms;
}
dialog.tui-stage-lift[open] .tui-stage-lift__door--l { transform: perspective(420px) rotateY(-82deg); }
dialog.tui-stage-lift[open] .tui-stage-lift__door--r { transform: perspective(420px) rotateY(82deg); }

/* The near floor, in front of the plate: it hides the part of the card
   still below the stage, so the card is seen to come up through the trap.
   Its boards are the front slice of the same drawing, so the seams carry
   straight across. Its front edge is the apron, with no line at the screen
   edge. */
.tui-stage-lift__front {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sl-front);
  z-index: 3;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  background-color: var(--sl-board);
}
.tui-stage-lift__front > .tui-stage-lift__boards { bottom: 0; }
.tui-stage-lift__front::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: var(--sl-apron);
  background: linear-gradient(to bottom, color-mix(in oklab, var(--sl-apron-face) 84%, var(--tui-paper)), var(--sl-apron-face));
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-paper) 26%, transparent);
}

/* The pool of light from above, landing on the plate once it has settled. */
.tui-stage-lift__spot {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 360px 240px at 50% 45%, color-mix(in oklab, var(--tui-paper) 24%, transparent), transparent 70%),
    radial-gradient(ellipse 240px 130px at 50% 86%, color-mix(in oklab, var(--tui-paper) 16%, transparent), transparent 72%);
  mix-blend-mode: screen;
  transition: opacity 140ms var(--tui-ease);
}
dialog.tui-stage-lift[open] .tui-stage-lift__spot { opacity: 1; transition: opacity 320ms var(--tui-ease) 440ms; }

/* A dialog drawn in place, for a specimen: the plate without the top layer,
   on a short strip of the same floor. */
dialog.tui-stage-lift.tui-stage-lift--static {
  position: relative;
  display: block;
  width: min(440px, 100%);
  margin: 0;
  overflow: visible;
  opacity: 1;
  scale: none;
  transition: none;
}
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__carriage {
  transform: none;
  opacity: 1;
  transition: none;
}
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__panel { width: min(440px, 100%); }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__floor {
  position: absolute;
  left: -18px;
  right: -18px;
  bottom: -30px;
  height: 38px;
  transform: none;
}
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__boards { bottom: 0; height: 38px; }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__front .tui-stage-lift__boards { display: none; }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__trap { height: 12px; bottom: 7px; width: 72%; }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__front {
  position: absolute;
  left: -18px;
  right: -18px;
  bottom: -8px;
  height: 8px;
}
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__front::after { height: 5px; }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__spot { display: none; }
dialog.tui-stage-lift.tui-stage-lift--static .tui-stage-lift__floor::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  /* No climb and no flaps: the trap already open and the plate already up
     the moment it shows, the plate fading over the floor and fading out. */
  .tui-stage-lift__carriage {
    transform: none;
    opacity: 0;
    transition: opacity 160ms var(--tui-ease) !important;
  }
  dialog.tui-stage-lift[open] .tui-stage-lift__carriage {
    transform: none;
    opacity: 1;
    transition: opacity 200ms var(--tui-ease) !important;
  }
  @starting-style { dialog.tui-stage-lift[open] .tui-stage-lift__carriage { opacity: 0; } }
  .tui-stage-lift__door { transition: none; }
  .tui-stage-lift__door--l { transform: perspective(420px) rotateY(-82deg); }
  .tui-stage-lift__door--r { transform: perspective(420px) rotateY(82deg); }
  .tui-stage-lift__floor::after { transition: none !important; }
  .tui-stage-lift__spot { transition: opacity 200ms var(--tui-ease) !important; }
  dialog.tui-stage-lift[open] .tui-stage-lift__spot { transition: opacity 200ms var(--tui-ease) !important; }
}

/* ---------------------------------------------------------------- part: stat-tile */
/* Stat tile: the readout on a plate. A printed label, the figure in tabular
   numerals, the change against another period as an arrow, its size and words,
   and (given readings) the sparkline beside the figure. The plate is the
   panel's face and nothing on it is tinted: a lamp and a word ("Better",
   "Worse") are added only when the page says which way is better, and they
   are the kit's own lamps. Loading is the skeleton with the amber lamp; empty
   is two plain lines. */
tui-stat-tile {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  display: block;
  min-width: 0;
  padding: var(--tui-4) var(--tui-5);
  border-radius: var(--tui-r-l);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
  color: var(--tui-ink);
  text-align: left;
}
tui-stat-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--tui-noise);
  opacity: var(--tui-grain);
  pointer-events: none;
}
.tui-stat-tile__inner { display: grid; gap: var(--tui-3); align-content: start; min-width: 0; }
.tui-stat-tile__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tui-1) var(--tui-3); min-width: 0; }
.tui-stat-tile__head > .tui-label { min-width: 0; overflow-wrap: anywhere; }
.tui-stat-tile__body { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--tui-3); min-width: 0; }
.tui-stat-tile__value { margin: 0; flex: none; white-space: nowrap; }
.tui-stat-tile__spark { flex: 0 1 9em; min-width: 4.5em; margin-bottom: 2px; color: var(--tui-ink-2); }
.tui-stat-tile__change { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-1) var(--tui-2); margin: 0; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); }
.tui-stat-tile__change > b { font-weight: 700; color: var(--tui-ink); }
.tui-stat-tile__change > .tui-icon { flex: none; color: var(--tui-ink); }
.tui-stat-tile__empty { display: grid; gap: var(--tui-1); margin: 0; }
.tui-stat-tile__none { font: 600 var(--tui-t-lead)/1.2 var(--tui-sans); color: var(--tui-ink); }
.tui-stat-tile__why { font-size: var(--tui-t-small); color: var(--tui-ink-2); overflow-wrap: anywhere; }
.tui-stat-tile__skeleton { display: grid; gap: var(--tui-3); }
tui-stat-tile[aria-busy="true"] { min-height: 7.5rem; }
@media (prefers-reduced-motion: reduce) {
  tui-stat-tile, tui-stat-tile * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- part: status-sweep */
/* Status sweep: a card whose words change through a sweep of dots. The card is the kit's panel face;
   the dots are drawn on a canvas in the card's own ink (its computed colour), so this file holds no
   colour. The canvas and the old words lie over the new words for the length of the sweep and are
   hidden the rest of the time. */
:is(tui-status-sweep, .tui-status-sweep) {
  position: relative;
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 520px;
  min-width: 0;
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
  overflow: hidden;
}
tui-status-sweep[data-sweeping] { overflow: hidden; }
.tui-status-sweep__body { display: grid; gap: var(--tui-3); min-width: 0; }
.tui-status-sweep__title { margin: 0; font: 600 var(--tui-t-h3)/1.25 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-status-sweep__line { margin: 0; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-status-sweep__value { margin: 0; font: 700 var(--tui-t-h1)/1 var(--tui-mono); color: var(--tui-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tui-status-sweep__figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tui-1) var(--tui-3); min-width: 0; }
.tui-status-sweep__aside { margin: 0; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-status-sweep__key { justify-self: start; }
/* The rows' own side padding is cancelled so their words line up with the title. */
:is(tui-status-sweep, .tui-status-sweep) .tui-settings { margin-inline: calc(var(--tui-2) * -1); }
/* Each row stays one line, name at the start and value at the end, so a swap never changes the card's height. */
:is(tui-status-sweep, .tui-status-sweep) .tui-settings__row { flex-wrap: nowrap; }
:is(tui-status-sweep, .tui-status-sweep) .tui-settings__text { flex: 0 1 auto; }
:is(tui-status-sweep, .tui-status-sweep) .tui-settings__end { text-align: right; }
.tui-status-sweep__old { position: absolute; display: grid; gap: var(--tui-3); min-width: 0; pointer-events: none; }
.tui-status-sweep__old[hidden], .tui-status-sweep__dots[hidden] { display: none; }
.tui-status-sweep__dots { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Said aloud, never seen. */
.tui-status-sweep__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }

/* ---------------------------------------------------------------- part: suggestion-chips */
/* Suggestion chips: starter prompts as small plates set out under the
   composer. Each is a real key (the kit's cap on its skirt, so the finish, the
   volume and the press are the key's) that is allowed to be a line or two of
   words instead of one word, left-aligned, the way a printed legend is. A
   label above says what they are. Pressing one writes its words into the
   composer and leaves the sending to you. */
.tui-suggestions { display: grid; gap: var(--tui-2); min-width: 0; }
.tui-suggestions__label { margin: 0; padding-left: 2px; }
.tui-suggestions__list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--tui-2); margin: 0; padding: 0; list-style: none; }
.tui-suggestions__list > li { display: contents; }
.tui-suggestion.tui-key {
  height: auto;
  min-height: var(--h);
  max-width: 100%;
  padding-block: 7px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Said aloud, never seen. */
.tui-suggestions__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-suggestions { position: relative; }
@media (pointer: coarse) {
  .tui-suggestion.tui-key { --h: 44px; padding-block: 10px; }
  .tui-suggestions__list { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-suggestion.tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: survey-card */
/* Survey card: a Panel with one question, Check keys, a Field that shows only
   for "other", a primary Key, and a flat icon Key to close. Only the
   arrangement is here; every part inside is the kit's own, unchanged. It is not
   fixed to the window: the page puts it where it wants it. */
.tui-surveycard {
  position: relative;
  display: grid;
  gap: var(--tui-3);
  width: min(100%, 340px);
  min-width: 0;
  padding: var(--tui-4);
}
.tui-surveycard[data-state="closed"], .tui-surveycard [hidden] { display: none; }
.tui-surveycard__form { display: grid; gap: var(--tui-3); min-width: 0; }
.tui-surveycard__set { display: grid; gap: var(--tui-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.tui-surveycard__q { padding: 0 var(--tui-6) 0 0; margin-bottom: var(--tui-1); text-wrap: balance; }
.tui-surveycard .tui-choice { min-height: 28px; }
.tui-surveycard .tui-key--primary { justify-self: start; }
.tui-surveycard__thanks { margin: 0; color: var(--tui-ink-2); }
.tui-surveycard[data-state="thanks"] .tui-surveycard__form { display: none; }
.tui-surveycard__close { position: absolute; top: var(--tui-2); right: var(--tui-2); }
@media (pointer: coarse) {
  .tui-surveycard .tui-choice { min-height: 44px; }
}

/* ---------------------------------------------------------------- part: swatch-fan */
/* Swatch fan: a dropdown drawn as a paint swatch fan pinned on a rivet. The
   rivet is a real key; the one blade it shows closed is the current choice,
   its tone and its printed name set once, nowhere else. Pressing it swings
   the rest of the blades open from that same rivet: every blade is hinged on
   the one point inside its round end, so the deck turns around a single pin,
   each blade stopped at its own angle far enough from the next that its
   swatch and its whole printed name clear both neighbours. The pin is a
   turned rivet, the blades the kit's raised face, all token-only so every
   finish and both volumes are theirs. The five named tones below are the
   kit's own lamp colours, borrowed as printed ink the way the charts already
   share them for a series, never set as hex of their own.
   kit/parts/swatch-fan.mjs builds and wires it. Without the script a plain
   select stands in its place. */
tui-swatch-fan {
  --sf-w: 56px;     /* the blade's width */
  --sf-rivet: 28px; /* from the blade's top edge to the rivet: half the width, so the end is a round cap the deck turns inside */
  --sf-neck: 46px;  /* from the rivet to the paint: past where a neighbour's edge can reach */
  position: relative;
  display: inline-flex;
}
tui-swatch-fan:not(:defined) { min-width: 120px; }

/* One blade, closed (the rivet's own key) or open: one size, one cap, one face, so the closed blade is literally the deck's middle blade. */
.tui-swatch-fan__trigger.tui-key,
.tui-swatch-fan__blade {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: var(--sf-w, 56px);
  height: auto;
  padding: calc(var(--sf-rivet, 28px) + var(--sf-neck, 46px)) 4px 8px;
  border-radius: calc(var(--sf-w, 56px) / 2) calc(var(--sf-w, 56px) / 2) var(--tui-r-m) var(--tui-r-m) / var(--sf-rivet, 28px) var(--sf-rivet, 28px) var(--tui-r-m) var(--tui-r-m);
  gap: 5px;
  background: var(--tui-face);
}

/* The rivet pinning every blade of the deck to the one point, set in the rounded end. */
.tui-swatch-fan__pin {
  position: absolute;
  left: 50%;
  top: calc(var(--sf-rivet, 28px) - 3.5px);
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--tui-face-hi), var(--tui-face-lo) 72%);
  box-shadow: var(--tui-inset);
  z-index: 2;
  pointer-events: none;
}

.tui-swatch-fan__chip { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

/* The paint itself: filled from --sw, a kit tone below, never a literal colour here. */
.tui-swatch-fan__swatch {
  width: 100%;
  height: 30px;
  border-radius: calc(var(--tui-r-m) - 4px);
  background: var(--sw, var(--tui-ink-3));
  box-shadow: var(--tui-inset);
}

.tui-swatch-fan__chip-name, .tui-swatch-fan__label {
  width: 100%;
  overflow: hidden;
  font: 600 10.5px/1.15 var(--tui-sans);
  color: var(--tui-ink);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Named tones: the kit's own signal colours printed as paint, the charts' own trick for telling several things apart. */
[data-tone="clay"] { --sw: var(--tui-red); }
[data-tone="brass"] { --sw: var(--tui-amber); }
[data-tone="moss"] { --sw: var(--tui-green); }
[data-tone="sea"] { --sw: var(--tui-blue); }
[data-tone="mist"] { --sw: var(--tui-vfd); }

/* The fan: a zero-size anchor at the closed blade's top centre, placed by script; every blade is hinged on the rivet inside its own round end, so one deck turns about one point and nothing else has to size or clip it. */
.tui-swatch-fan__fan {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 0;
  width: 0;
  height: 0;
  overflow: visible;
  background: none;
  outline: none;
}
.tui-swatch-fan__fan:not(:popover-open) { display: none; }
/* The rivet always sits over the deck it pins, whichever blade is raised. */
.tui-swatch-fan__fan > .tui-swatch-fan__pin { z-index: 6; }

.tui-swatch-fan__blade {
  position: absolute;
  top: 0;
  left: 0;
  box-shadow: var(--tui-raised);
  transform: translateX(-50%) rotate(var(--ang, 0deg));
  transform-origin: 50% var(--sf-rivet, 28px);
  cursor: pointer;
}
/* Opening: the deck starts furled and every blade swings out to its own stop; the fan only ever shows mid-swing. */
@keyframes tui-swatch-fan-swing {
  from { transform: translateX(-50%) rotate(0deg); }
}
/* Open, every blade swings out to its own stop; the hidden fan never shows the level stack. */
.tui-swatch-fan__fan:popover-open .tui-swatch-fan__blade { transform: translateX(-50%) rotate(var(--ang, 0deg)); animation: tui-swatch-fan-swing 280ms var(--tui-ease); }
.tui-swatch-fan__blade[aria-selected="true"] { z-index: 2; outline: 2px solid var(--tui-ink-3); outline-offset: -2px; }
.tui-swatch-fan__blade[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.tui-swatch-fan__blade.is-active { z-index: 3; }
.tui-swatch-fan__fan:focus-visible .tui-swatch-fan__blade.is-active { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  /* The blade under the pointer comes up over the rest of the deck, the active one included. */
  .tui-swatch-fan__blade:not([aria-disabled="true"]):hover { z-index: 5; filter: brightness(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  /* The mechanism only ever changes a state: the fan snaps open and shut, it never swings. */
  .tui-swatch-fan__fan:popover-open .tui-swatch-fan__blade { animation: none; }
}

/* ---------------------------------------------------------------- part: sync-status */
/* Sync status: a small legend that says whether your work is safe. Three words
   (Saving, Saved, Offline) and a lamp that matches: amber and blinking while it
   saves, green when it has, red when it cannot. The words are the state; the
   lamp only agrees with them. Set data-state on the legend and change its text;
   because it is a polite status region, a screen reader says the new words
   without taking the focus. The blink stops under reduced motion and the lamp
   stays lit. */
.tui-sync {
  --sync: var(--tui-green);
  display: inline-flex;
  align-items: center;
  gap: var(--tui-2);
  min-height: 22px;
  font: 500 var(--tui-t-small)/1.3 var(--tui-sans);
  color: var(--tui-ink-2);
}
.tui-sync[data-state="saving"] { --sync: var(--tui-amber); }
.tui-sync[data-state="offline"] { --sync: var(--tui-red); }
/* The lamp in the legend takes the legend's colour, so only data-state changes. */
.tui-sync > .tui-lamp { --c: var(--sync); }
.tui-sync__text { color: var(--tui-ink); font-weight: 600; }
.tui-sync__detail { color: var(--tui-ink-2); font-variant-numeric: tabular-nums; }
.tui-sync[data-state="saving"] > .tui-lamp { animation: tui-blink 1.2s steps(1) infinite; }
/* Off screen (sync-status.mjs sets it): nothing blinks that nobody can see. */
.tui-sync[data-paused] > .tui-lamp { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .tui-sync[data-state="saving"] > .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: tab-bar */
/* Tab bar: a mobile app's bottom navigation, a <nav> of 3 to 5 links, each an icon over a one-word label. The iOS anatomy
   (Apple HIG, Tab bars: "A tab bar floats above content at the bottom of the screen"): one capsule tray floating above
   the content, inset from the sides and lifted off the foot above the safe area, the content passing under it and
   still seen beside and below it. Tactile has no glass: the tray is solid metal, and it floats by its thickness (a lit
   top face, a shaded skirt) and a real shadow cast on the content. One piece moves: a pill inside the tray, concentric
   with it, that slides to the current tab (kit.mjs wireTabBar). The current icon and label carry the lit colour; there
   is no lamp per tab. The kit's tray-with-one-key-down (.tui-seg) is the same mechanism with one key that travels.
   Without script it still works: the links are links, and the current one wears the pill itself. */
.tui-tab-bar {
  --tabs-pad: 5px;
  --tabs-item: 52px;
  --tabs-inset: 14px;
  --tabs-lift: 12px;
  position: fixed;
  left: var(--tabs-inset);
  right: var(--tabs-inset);
  bottom: calc(var(--tabs-lift) + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  isolation: isolate;
  box-sizing: border-box;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 0;
  padding: var(--tabs-pad);
  border-radius: 999px;
  /* The top face turned up to the light, the foot turned away: faces, not a line. */
  background: linear-gradient(to bottom, color-mix(in oklab, var(--tui-face-hi) 70%, transparent), transparent 38%, color-mix(in oklab, rgb(var(--tui-sh)) 10%, transparent)), var(--tui-face);
  /* Its thickness (the skirt under it), then the shadow it throws on the content, near and far. */
  box-shadow: var(--tui-depth-plate, 0 1.5px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 6px 10px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), 0 18px 34px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6)));
}
.tui-tab-bar::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--tui-noise); opacity: var(--tui-grain); pointer-events: none; }
/* Inside a phone-sized frame (a docs demo, a device mock) it floats at the foot of that frame instead of the window. */
.tui-tab-bar--in, .tui-tab-dock--in { position: absolute; }

.tui-tab-bar__item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: var(--tabs-item);
  padding: 4px 2px;
  border-radius: 999px;
  font: 600 10.5px/12px var(--tui-sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--tui-ink-2);
  text-decoration: none;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tui-tab-bar__icon { position: relative; display: block; width: 22px; height: 22px; flex: none; transition: transform 90ms var(--tui-ease); }
.tui-tab-bar__icon svg { display: block; width: 22px; height: 22px; }
.tui-tab-bar__label { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tui-tab-bar__item:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
/* The press answers on the way down, before the tab is chosen. */
.tui-tab-bar__item:active .tui-tab-bar__icon, .tui-tab-bar__item.is-down .tui-tab-bar__icon { transform: scale(0.9); }

/* The lit tab: the lamp's green (held dark enough to read) in its icon and label. The light travels with the pill:
   live, it is on whichever tab the pill is over (.is-lit, set by the script as the pill moves); without script, on
   the current link. */
.tui-tab-bar:not(.is-live) .tui-tab-bar__item:is([aria-current], .is-current), .tui-tab-bar.is-live .tui-tab-bar__item.is-lit {
  color: color-mix(in oklab, var(--tui-green) var(--tabs-lit, 50%), var(--tui-ink));
}
.tui-tab-bar:not(.is-live) .tui-tab-bar__item:is([aria-current], .is-current) .tui-tab-bar__icon, .tui-tab-bar.is-live .tui-tab-bar__item.is-lit .tui-tab-bar__icon { filter: drop-shadow(0 0 5px color-mix(in oklab, var(--tui-green) 45%, transparent)); }

.tui-tab-bar__pill {
  position: absolute;
  z-index: 0;
  top: var(--tabs-pad);
  bottom: var(--tabs-pad);
  left: 0;
  width: 0;
  /* Concentric with the tray: both are fully round, so the pill's radius is the tray's less its inset. */
  border-radius: 999px;
  pointer-events: none;
  will-change: transform, width;
}
.tui-tab-bar__pill.is-fade { animation: tui-tb-fade 160ms var(--tui-ease); }
@keyframes tui-tb-fade { from { opacity: 0; } }

/* The pill (the default, chosen 17 Nov): a pocket milled into the tray, the lit tab sitting in it. Faces, no outline: a flat floor one
   step darker than the tray, a short crisp shadow cast down from the upper wall, the lower face a step lighter. */
.tui-tab-bar__pill, .tui-tab-bar:not(.is-live) .tui-tab-bar__item:is([aria-current], .is-current) {
  background: var(--tabs-well-faces, linear-gradient(to bottom, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), rgb(var(--tui-sh) / 0) 5px, transparent calc(100% - 4px), color-mix(in oklab, var(--tui-face-hi) 70%, transparent))), var(--tabs-well-floor, color-mix(in oklab, var(--tui-face), rgb(var(--tui-sh)) 9%));
  box-shadow: var(--tabs-well-depth, inset 0 1.5px 2px -0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)));
}
.tui-tab-bar:not(.tui-tab-bar--cap) .tui-tab-bar__item.is-lit, .tui-tab-bar:not(.tui-tab-bar--cap, .is-live) .tui-tab-bar__item:is([aria-current], .is-current) { transform: translateY(1px); }

/* .tui-tab-bar--cap: the pill as a raised cap that slides along the tray, its top face lit and its foot shaded. After the
   default, so it wins where the selectors weigh the same. */
.tui-tab-bar--cap .tui-tab-bar__pill, .tui-tab-bar--cap:not(.is-live) .tui-tab-bar__item:is([aria-current], .is-current) {
  background: linear-gradient(to bottom, color-mix(in oklab, var(--tui-face-hi) 85%, transparent), transparent 45%, color-mix(in oklab, rgb(var(--tui-sh)) 10%, transparent)), var(--tabs-cap-fill, var(--tui-raised-fill));
  box-shadow: var(--tui-depth-key, 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 4px 8px -3px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)));
}

/* A count: a small cap on the icon's corner, printed and spoken. A dot with no count is one small lit lamp. */
.tui-tab-bar__count {
  position: absolute;
  top: -5px;
  left: 100%;
  margin-left: -9px;
  display: block;
  min-width: 17px;
  box-sizing: border-box;
  padding: 0 4.5px;
  border-radius: 999px;
  font: 700 11px/17px var(--tui-sans);
  text-align: center;
  color: #fff;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0.18), transparent 50%), color-mix(in oklab, var(--tui-red) 88%, #000);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}
.tui-tab-bar__dot { position: absolute; top: -1px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--tui-red); box-shadow: 0 0 5px 1px color-mix(in oklab, var(--tui-red) 60%, transparent); }
.tui-tab-bar__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Version C: a dock holding the tray and a round button split off beside it (search, as iOS 26 does), each its own
   island with a gap between, so the content shows through the gap at full strength. */
.tui-tab-dock {
  position: fixed;
  left: var(--tabs-inset, 14px);
  right: var(--tabs-inset, 14px);
  bottom: calc(var(--tabs-lift, 12px) + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tui-tab-dock > .tui-tab-bar { position: relative; left: auto; right: auto; bottom: auto; flex: 1 1 auto; min-width: 0; }
.tui-tab-dock__button {
  flex: none;
  display: grid;
  place-items: center;
  width: calc(var(--tabs-item, 52px) + 10px);
  height: calc(var(--tabs-item, 52px) + 10px);
  border: 0;
  border-radius: 50%;
  color: var(--tui-ink);
  cursor: pointer;
  background: linear-gradient(to bottom, color-mix(in oklab, var(--tui-face-hi) 70%, transparent), transparent 38%, color-mix(in oklab, rgb(var(--tui-sh)) 10%, transparent)), var(--tui-face);
  box-shadow: var(--tui-depth-plate, 0 1.5px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)), 0 6px 10px -4px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)), 0 18px 34px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6)));
  -webkit-tap-highlight-color: transparent;
}
.tui-tab-dock__button svg { width: 22px; height: 22px; transition: transform 90ms var(--tui-ease); }
.tui-tab-dock__button:active svg { transform: scale(0.9); }
.tui-tab-dock__button:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .tui-tab-bar__icon, .tui-tab-dock__button svg { transition: none; }
}

/* On graphite the cap is lifted toward the plate's light so it reads against the tray; the well's lower face stays a
   step lighter than the floor, nowhere near white. */
[data-finish="graphite"] .tui-tab-bar {
  --tabs-lit: 62%;
  --tabs-cap-fill: color-mix(in oklab, var(--tui-face), #fff 9%);
  /* Graphite keeps the deeper lit well (Fable, 17 Nov: the best of the set): the floor is the kit's well. */
  --tabs-well-faces: linear-gradient(to bottom, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.4)), transparent 42%, transparent 72%, color-mix(in oklab, var(--tui-face-hi) 28%, transparent));
  --tabs-well-floor: var(--tui-well-fill);
  --tabs-well-depth: inset 0 3px 5px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.6));
}
/* Quiet: the pill is a tonal fill a step off the tray, with no stroke and no shadow (in both versions). */
[data-volume="quiet"] .tui-tab-bar__pill, [data-volume="quiet"] .tui-tab-bar:not(.is-live) .tui-tab-bar__item:is([aria-current], .is-current) {
  background: color-mix(in oklab, var(--tui-face), var(--tui-ink) 8%);
  box-shadow: none;
}

/* ---------------------------------------------------------------- part: table-toolbar */
/* Table toolbar: the strip over a table. The search well and the filter keys
   stand on the left; the column key opens a small card of check keys; the
   count of rows in view is printed at the far end, the way the data table
   prints its own. Nothing here is decoration: it is the controls a working
   table needs, set out on one line and wrapping on a narrow screen. It is the
   kit's own search well, toggle keys and check keys. */
tui-table-toolbar, .tui-table-toolbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-3); min-width: 0; }
tui-table-toolbar > tui-search-field { flex: 1 1 220px; max-width: 340px; min-width: 0; }
.tui-table-toolbar__flags { display: flex; flex-wrap: wrap; gap: var(--tui-2); }
.tui-table-toolbar__columns { position: relative; }
.tui-table-toolbar__cols-key { gap: 6px; }
.tui-table-toolbar__cols-key svg { width: 14px; height: 14px; flex: none; }
.tui-table-toolbar__cols-key[aria-expanded="true"] { transform: translateY(var(--skirt)); filter: brightness(0.97); box-shadow: var(--tui-pressed); }
.tui-table-toolbar__tail { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-2) var(--tui-3); margin-left: auto; min-width: 0; }
.tui-table-toolbar__reset[hidden] { display: none; }
.tui-table-toolbar__count { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); white-space: nowrap; }
/* Said aloud, never seen. */
.tui-table-toolbar__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The card of columns. */
.tui-table-toolbar__card {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  display: grid;
  gap: 2px;
  min-width: 200px;
  max-width: min(300px, calc(100vw - 16px));
  max-height: max(160px, var(--tui-room, 80vh));
  overflow-y: auto;
  padding: 6px;
  border-radius: 11px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
}
.tui-table-toolbar__card:not(:popover-open) { display: none; }
.tui-table-toolbar__card:popover-open { animation: tui-table-toolbar-out 150ms var(--tui-ease); }
@keyframes tui-table-toolbar-out { from { opacity: 0; transform: translateY(-5px); } }
.tui-table-toolbar__card > .tui-label { padding: 4px 6px 6px; }
.tui-table-toolbar__col { display: flex; align-items: center; gap: var(--tui-3); min-height: 34px; padding: 0 6px; border-radius: 6px; font: 500 var(--tui-t-body)/1.2 var(--tui-sans); color: var(--tui-ink); cursor: pointer; }
.tui-table-toolbar__col:hover { background: color-mix(in oklab, var(--tui-face-hi) 55%, transparent); }
.tui-table-toolbar__col:has(:disabled) { cursor: not-allowed; color: var(--tui-ink-2); }

@media (pointer: coarse) {
  tui-table-toolbar > tui-search-field { flex-basis: 100%; max-width: none; }
  .tui-table-toolbar__flags .tui-key, .tui-table-toolbar__cols-key, .tui-table-toolbar__reset { --h: 44px; min-width: 44px; }
  .tui-table-toolbar__col { min-height: 44px; }
}
@media (max-width: 560px) {
  tui-table-toolbar > tui-search-field { flex-basis: 100%; max-width: none; }
  .tui-table-toolbar__tail { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-table-toolbar__card:popover-open { animation: none; }
}

/* ---------------------------------------------------------------- part: tag-input */
/* Tag input: a well that turns what you type into printed tags. The tags are
   small raised caps set in the recess beside the cursor, each one a key that
   takes itself away; the input is the open end of the row. The corners are
   concentric: 4px of well round a 7px tag makes the well's 11px. */
tui-tag-input, .tui-tag-input {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 38px;
  padding: 4px;
  border-radius: calc(var(--tui-r-m) + 4px);
  cursor: text;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
tui-tag-input:has(.tui-tag-input__entry:focus-visible), .tui-tag-input.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-tag-input[disabled], .tui-tag-input.is-disabled { opacity: 0.45; cursor: not-allowed; }
.tui-field[data-error] :is(tui-tag-input, .tui-tag-input) { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

.tui-tag-input__tag {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 30px;
  padding: 0 9px 0 11px;
  border: 0;
  border-radius: var(--tui-r-m);
  font: 600 var(--tui-t-small)/1 var(--tui-sans);
  color: var(--tui-ink);
  cursor: pointer;
  user-select: none;
  background:
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
  -webkit-tap-highlight-color: transparent;
}
.tui-tag-input__tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The cross that says pressing it removes the tag. */
.tui-tag-input__tag::after {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  background: currentColor;
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.2 1.2l5.6 5.6M6.8 1.2 1.2 6.8' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.2 1.2l5.6 5.6M6.8 1.2 1.2 6.8' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tui-tag-input__tag:hover, .tui-tag-input__tag.is-hover { filter: brightness(1.03); }
.tui-tag-input__tag:hover::after, .tui-tag-input__tag:focus-visible::after, .tui-tag-input__tag.is-hover::after { opacity: 1; }
.tui-tag-input__tag:active, .tui-tag-input__tag.is-down { transform: translateY(1.5px); filter: brightness(0.97); box-shadow: var(--tui-pressed); }
.tui-tag-input__tag:focus-visible, .tui-tag-input__tag.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-tag-input__tag:disabled { cursor: not-allowed; }
/* Typing a tag that is already there nudges the one that is. */
.tui-tag-input__tag[data-nudge] { animation: tui-tag-nudge 240ms var(--tui-ease); }
@keyframes tui-tag-nudge { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

.tui-tag-input__entry {
  appearance: none;
  flex: 1 1 96px;
  min-width: 96px;
  height: 30px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: var(--tui-r-s);
  font: 400 var(--tui-t-body)/1 var(--tui-sans);
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
.tui-tag-input__entry::placeholder { color: var(--tui-ink-3); }
/* Spoken, not seen: what was added, removed or refused. */
.tui-tag-input__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .tui-tag-input__tag[data-nudge] { animation: none; box-shadow: var(--tui-pressed); } }

/* A finger needs 44px (kit/src/core.css, a fingertip's reach): a tag keeps its 30px face (its ::after is the cross) and
   takes a press area 44 tall but no wider, so tags in a row never take each other's press. The combobox's tags are these. */
@media (pointer: coarse) {
  .tui-tag-input__tag { position: relative; }
  .tui-tag-input__tag::before { content: ''; position: absolute; inset: min(0px, calc((100% - 44px) / 2)) 0; }
}

/* ---------------------------------------------------------------- part: tap-ripple */
/* Tap ripple: the plate the light of a press is drawn on. One canvas per
   pressed surface, laid over its box by tap-ripple.mjs (fixed, the surface's
   own corner radius), that takes no pointer events and has no size in any
   layout. It has no colour of its own: the script draws the dent and the rings
   in the finish's light and shadow (--tui-hl, --tui-sh), so it is lit by the
   same lamp as every part. Quiet runs it at half strength (the script reads
   --tui-tap-quiet); reduced motion keeps only the dent's shading, still. */

/* Empty in Tactile; 1 in Quiet and the plain finishes (the kit's volume switch). */
:root, [data-finish], [data-volume] { --tui-tap-quiet: var(--tui-quiet) 1; }

.tui-tap {
  position: fixed;
  z-index: 2147483000;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
  contain: strict;
}
.tui-tap[hidden] { display: none; }

/* ---------------------------------------------------------------- part: tear-off-day */
/* Tear-off day: a block calendar as a date picker. A thick pad bound at the
   top, one thin newsprint sheet a day, torn off along its perforation as the
   date moves forward and laid back on when it goes back. The small printed
   month at the foot is the picker: a roving grid of real date buttons with a
   pencil ring on the chosen day. Paper comes from the kit's paper tokens, so
   a dark finish gives a dimmed warm sheet rather than a dark one. The second
   ink (Sundays and days flagged by the page) is the kit's red borrowed as
   printed ink, the way the charts borrow the lamp colours for a series.
   kit/parts/tear-off-day.mjs builds and wires it. Never a literal colour. */
tui-tear-off-day {
  --td-paper: var(--tui-paper);
  --td-paper-hi: var(--tui-paper-hi);
  --td-ink: var(--tui-paper-ink);
  --td-ink-2: color-mix(in oklab, var(--tui-paper-ink) 70%, var(--tui-red) 30%);
  --td-rule: color-mix(in oklab, var(--tui-paper-ink) 20%, transparent);
  --td-cell: 32px;
  --td-pad: 14px;
  container: tui-tear-off-day / inline-size;
  position: relative;
  display: block;
  width: min(100%, 392px);
  color: var(--td-ink);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}

/* Paper is paper in a dark finish too, only dimmed, never turned into a dark sheet. */
[data-tone="dark"] tui-tear-off-day,
tui-tear-off-day[data-tone="dark"] {
  --td-paper: color-mix(in oklab, var(--tui-paper) 86%, var(--tui-paper-ink) 14%);
  --td-paper-hi: color-mix(in oklab, var(--tui-paper-hi) 88%, var(--tui-paper-ink) 12%);
}

.tui-tear-off-day__rig { position: relative; display: block; padding: 0 22px 12px; }

/* The block: the pad's thick body sits over the stack of pages below it. */
.tui-tear-off-day__block { position: relative; }
/* The pages under the top sheet: the same sheet as the pad, six more of it, each
   one stepped the same 1px across and 2px down, so every one has the pad's own
   size and corners. Their edges show as lines along the foot and the right-hand
   side and meet in a true rounded corner. Light and dark sheets alternate so the
   leaves read as separate; the last shadow is the pad's cast. */
.tui-tear-off-day__stack {
  --td-leaf: var(--td-paper);
  --td-leaf-edge: color-mix(in oklab, var(--td-paper) 74%, var(--td-ink));
  position: absolute;
  inset: 0;
  border-radius: 9px 9px 8px 8px;
  background: var(--td-paper);
  box-shadow:
    1px 2px 0 0 var(--td-leaf-edge),
    2px 4px 0 0 var(--td-leaf),
    3px 6px 0 0 var(--td-leaf-edge),
    4px 8px 0 0 var(--td-leaf),
    5px 10px 0 0 var(--td-leaf-edge),
    6px 12px 0 0 var(--td-leaf),
    var(--tui-depth-plate, 0 14px 24px -18px color-mix(in oklab, var(--td-ink) 45%, transparent));
}

.tui-tear-off-day__pad {
  position: relative;
  z-index: 1;
  border-radius: 9px 9px 8px 8px;
  background: var(--td-paper);
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--td-ink) 18%, transparent),
    var(--tui-raised);
}

/* The binding strip: a printed band with the year, a metal bar and two staples. */
.tui-tear-off-day__bind {
  position: relative;
  display: grid;
  place-items: center;
  height: 54px;
  border-radius: 9px 9px 0 0;
  background: var(--td-ink);
  color: var(--td-paper);
}
.tui-tear-off-day__bar {
  position: absolute;
  top: 5px;
  left: 16%;
  right: 16%;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(var(--tui-obj-lite), var(--tui-obj-body) 58%, var(--tui-obj-dark));
  box-shadow: var(--tui-raised);
}
.tui-tear-off-day__staple {
  position: absolute;
  top: 1px;
  width: 7px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(var(--tui-obj-lite), var(--tui-obj-body) 55%, var(--tui-obj-dark));
  box-shadow: var(--tui-raised), 0 0 0 1px color-mix(in oklab, var(--td-ink) 45%, transparent);
}
.tui-tear-off-day__staple--l { left: 24%; }
.tui-tear-off-day__staple--r { right: 24%; }
.tui-tear-off-day__year {
  margin-top: 13px;
  font: 700 17px/1 var(--tui-sans);
  letter-spacing: 0.2em;
}

/* The perforation: a row of punched holes right under the binding. */
.tui-tear-off-day__perf {
  height: 13px;
  background:
    radial-gradient(circle at 50% 45%,
      color-mix(in oklab, var(--td-paper) 20%, var(--td-ink)) 0 1.8px,
      transparent 2.1px) 0 50% / 13px 13px repeat-x,
    linear-gradient(to bottom, var(--td-paper), var(--td-paper)) 0 0 / 100% 100% no-repeat;
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--td-ink) 14%, transparent);
}

/* The sheet: thin paper with its grain, one very large figure. */
.tui-tear-off-day__sheets { position: relative; }
.tui-tear-off-day__sheet {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  padding: 16px var(--td-pad) 12px;
  border-radius: 0 0 7px 7px;
  background: var(--td-paper);
  text-align: center;
  transform-origin: 82% 0;
}
.tui-tear-off-day__sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image: var(--tui-grain);
  opacity: 0.35;
  pointer-events: none;
}
.tui-tear-off-day__weekday {
  margin: 2px 0 0;
  font: 600 11px/1 var(--tui-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--td-ink);
}
.tui-tear-off-day__day {
  margin: 2px 0 0;
  font: 700 clamp(66px, 19vw, 104px)/0.88 var(--tui-sans);
  letter-spacing: -0.06em;
  color: var(--td-ink);
}
.tui-tear-off-day__month {
  margin: 2px 0 0;
  font: 600 18px/1.2 var(--tui-sans);
  letter-spacing: 0.01em;
  color: var(--td-ink);
}
.tui-tear-off-day__sheet.is-second-ink .tui-tear-off-day__day { color: var(--td-ink-2); }
/* The printed day is the sheet's face: a press on it tears this one sheet off. */
tui-tear-off-day:not([data-static]) :is(.tui-tear-off-day__weekday, .tui-tear-off-day__day, .tui-tear-off-day__month) { cursor: pointer; }
tui-tear-off-day[data-busy] :is(.tui-tear-off-day__weekday, .tui-tear-off-day__day, .tui-tear-off-day__month) { cursor: default; }

/* The month at the foot: the picker. */
.tui-tear-off-day__planner {
  justify-self: stretch;
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--td-rule);
}
.tui-tear-off-day__monthbar {
  display: grid;
  grid-template-columns: var(--td-mkey, 30px) minmax(0, 1fr) var(--td-mkey, 30px);
  align-items: center;
  gap: 4px;
}
.tui-tear-off-day__monthlabel {
  font: 600 11px/1 var(--tui-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--td-ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tui-tear-off-day__mkey {
  display: grid;
  place-items: center;
  width: var(--td-mkey, 30px);
  height: var(--td-mkey, 30px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--td-ink);
  cursor: pointer;
}
.tui-tear-off-day__mkey svg { width: 13px; height: 13px; }
.tui-tear-off-day__mkey:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) {
  .tui-tear-off-day__mkey:not(:disabled):hover { background: color-mix(in oklab, var(--td-ink) 10%, transparent); }
}
.tui-tear-off-day__mkey:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 1px; }

.tui-tear-off-day__grid { display: grid; gap: 1px; justify-content: center; }
.tui-tear-off-day__head,
.tui-tear-off-day__week {
  display: grid;
  grid-template-columns: repeat(7, var(--td-cell));
  gap: 1px;
}
.tui-tear-off-day__head span {
  display: grid;
  place-items: center;
  height: 18px;
  font: 600 9px/1 var(--tui-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--td-ink) 68%, transparent);
}
.tui-tear-off-day__blank { width: var(--td-cell); height: var(--td-cell); }
[role="gridcell"] { display: grid; place-items: center; }

/* Every date is a real button. The chosen day carries a pencil ring. */
.tui-tear-off-day__date {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--td-cell);
  height: var(--td-cell);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--td-ink);
  font: 500 12px/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.tui-tear-off-day__date.is-second-ink { color: var(--td-ink-2); }
.tui-tear-off-day__date.is-today { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--td-ink) 45%, transparent); }
.tui-tear-off-day__date.is-chosen::after {
  content: '';
  position: absolute;
  inset: 3px 2px;
  border: 1.4px solid color-mix(in oklab, var(--td-ink) 72%, transparent);
  border-radius: 48% 52% 44% 56% / 54% 46% 56% 44%;
  transform: rotate(-7deg);
  pointer-events: none;
}
.tui-tear-off-day__date:disabled,
.tui-tear-off-day__date.is-off {
  opacity: 0.38;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: not-allowed;
}
@media (hover: hover) {
  .tui-tear-off-day__date:not(:disabled):hover { background: color-mix(in oklab, var(--td-ink) 9%, transparent); }
}
.tui-tear-off-day__date:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 1px; }

/* The previous and next day keys sit on the pad's edges, like tabs on the block. */
.tui-tear-off-day__nav {
  --h: 42px;
  position: absolute;
  top: 30%;
  z-index: 5;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  transform: translateY(-50%);
}
.tui-tear-off-day__nav[data-day="-1"] { left: 0; }
.tui-tear-off-day__nav[data-day="1"] { right: 0; }
.tui-tear-off-day__nav svg { width: 15px; height: 15px; }
.tui-tear-off-day__nav:active { transform: translateY(calc(-50% + var(--skirt, 2px))); }

/* The tear. A copy of the sheet lifts from one corner on its perforation,
   turns in three dimensions and falls away; a shadow passes under the curl.
   The sheet below is the new day. The stub is the torn edge left for a moment. */
.tui-tear-off-day__tears,
.tui-tear-off-day__tear,
.tui-tear-off-day__shade,
.tui-tear-off-day__stub { position: absolute; pointer-events: none; }
.tui-tear-off-day__tears { inset: 0; z-index: 3; }
/* The shadow of the sheet coming away lives on this wrapper: the sheet's own
   clip-path would cut a box-shadow, and a drop-shadow follows the torn shape
   as it turns. Tight and dark by the edge, soft and wide further off. */
.tui-tear-off-day__tear {
  inset: 0;
  filter:
    drop-shadow(0 1px 1px color-mix(in oklab, var(--td-ink) 38%, transparent))
    drop-shadow(0 4px 6px color-mix(in oklab, var(--td-ink) 28%, transparent))
    drop-shadow(0 14px 20px color-mix(in oklab, var(--td-ink) 22%, transparent));
}
.tui-tear-off-day__shade {
  inset: 0;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(ellipse 62% 52% at 78% 2%,
    color-mix(in oklab, var(--td-ink) 30%, transparent),
    transparent 68%);
  filter: blur(5px);
}
.tui-tear-off-day__shade.is-on { animation: tui-tear-off-day-shade var(--tear-dur, 600ms) var(--tui-ease) both; }
.tui-tear-off-day__sheet--tear {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--td-paper);
  animation: tui-tear-off-day-tear var(--tear-dur, 600ms) var(--tui-ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  backface-visibility: hidden;
  will-change: transform, opacity;
  /* The ragged edge left by the perforation. */
  clip-path: polygon(0 1.5%, 3% 0.4%, 6% 1.8%, 9% 0.3%, 12% 1.6%, 15% 0.2%, 18% 1.7%, 21% 0.5%, 24% 1.9%, 27% 0.3%, 30% 1.4%, 33% 0.2%, 36% 1.8%, 39% 0.5%, 42% 1.6%, 45% 0.3%, 48% 1.9%, 51% 0.4%, 54% 1.5%, 57% 0.2%, 60% 1.8%, 63% 0.4%, 66% 1.6%, 69% 0.3%, 72% 1.8%, 75% 0.5%, 78% 1.6%, 81% 0.2%, 84% 1.9%, 87% 0.4%, 90% 1.5%, 93% 0.3%, 96% 1.8%, 100% 0.5%, 100% 100%, 0 100%);
}
/* The lifted sheet turns away from the lamp: a shade toward its free edge. */
.tui-tear-off-day__sheet--tear::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(214deg,
      transparent 34%,
      color-mix(in oklab, var(--td-ink) 16%, transparent) 94%),
    /* A soft bend crossing the sheet as it flexes. */
    linear-gradient(120deg,
      transparent 38%,
      color-mix(in oklab, var(--td-ink) 13%, transparent) 47%,
      color-mix(in oklab, var(--td-paper) 70%, white) 52%,
      color-mix(in oklab, var(--td-ink) 9%, transparent) 58%,
      transparent 66%);
  background-size: 100% 100%, 260% 260%;
  background-position: 0 0, 100% 100%;
  animation: tui-tear-off-day-bend var(--tear-dur, 600ms) var(--tui-ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  pointer-events: none;
}
.tui-tear-off-day__sheet--lay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--td-paper);
  animation: tui-tear-off-day-lay 460ms var(--tui-ease) both;
}
.tui-tear-off-day__stub {
  left: 0;
  right: 0;
  top: 0;
  z-index: 4;
  height: 5px;
  opacity: 0;
  background: var(--td-paper);
  clip-path: polygon(0 0, 100% 0, 100% 42%, 94% 78%, 87% 46%, 79% 82%, 71% 50%, 63% 76%, 55% 48%, 47% 84%, 39% 54%, 31% 78%, 23% 46%, 15% 82%, 8% 52%, 0 76%);
  transition: opacity 140ms linear;
}
.tui-tear-off-day__stub.is-on { opacity: 1; }

@keyframes tui-tear-off-day-tear {
  /* Paper gives: the skews swing back and forth while it turns, so the sheet flexes on the way off instead of leaving as a board. */
  0% { transform: perspective(900px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) translate3d(0, 0, 0) skewX(0deg) skewY(0deg); opacity: 1; }
  14% { transform: perspective(900px) rotateX(-10deg) rotateY(8deg) rotateZ(-2deg) translate3d(1%, -1.5%, 0) skewX(-2.5deg) skewY(1.5deg); opacity: 1; }
  34% { transform: perspective(900px) rotateX(-18deg) rotateY(22deg) rotateZ(-6deg) translate3d(4%, -5%, 20px) skewX(3.5deg) skewY(-2.5deg); opacity: 1; }
  52% { transform: perspective(900px) rotateX(-15deg) rotateY(33deg) rotateZ(-8deg) translate3d(8%, -7%, 40px) skewX(-3deg) skewY(2.5deg); opacity: 1; }
  74% { transform: perspective(900px) rotateX(-24deg) rotateY(47deg) rotateZ(-12deg) translate3d(14%, 6%, 70px) skewX(2.5deg) skewY(-1.5deg); opacity: 1; }
  100% { transform: perspective(900px) rotateX(-28deg) rotateY(64deg) rotateZ(-16deg) translate3d(24%, 34%, 100px) skewX(-1deg) skewY(1deg); opacity: 0; }
}
@keyframes tui-tear-off-day-bend {
  from { background-position: 0 0, 100% 100%; }
  to { background-position: 0 0, 0% 0%; }
}
@keyframes tui-tear-off-day-lay {
  0% { transform: perspective(900px) translate3d(0, -13%, 24px) rotateX(-17deg); opacity: 0.55; }
  100% { transform: perspective(900px) translate3d(0, 0, 0) rotateX(0deg); opacity: 1; }
}
@keyframes tui-tear-off-day-shade {
  0%, 100% { opacity: 0; }
  18% { opacity: 0.5; transform: translate3d(4%, -2%, 0) rotate(-5deg); }
  64% { opacity: 0.62; transform: translate3d(-8%, 9%, 0) rotate(4deg); }
}

/* Screen readers hear the new day here; the picture is for everyone else. */
.tui-tear-off-day__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A phone: every date keeps a 44px target. The pad takes the bay's full width,
   or the printed month cannot hold seven 44px cells. */
@container tui-tear-off-day (max-width: 340px) {
  .tui-tear-off-day__rig { --td-cell: 44px; --td-mkey: 44px; --td-pad: 9px; padding: 0 0 12px; }
  .tui-tear-off-day__block { margin-inline: -20px; }
  .tui-tear-off-day__nav { --h: 44px; width: 44px; height: 44px; }
  .tui-tear-off-day__nav[data-day="-1"] { left: -6px; }
  .tui-tear-off-day__nav[data-day="1"] { right: -6px; }
  .tui-tear-off-day__sheet { padding-top: 12px; }
  .tui-tear-off-day__day { font-size: clamp(60px, 22vw, 84px); }
  .tui-tear-off-day__monthbar { gap: 0; }
  .tui-tear-off-day__grid,
  .tui-tear-off-day__head,
  .tui-tear-off-day__week { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tui-tear-off-day__sheet--tear,
  .tui-tear-off-day__sheet--lay,
  .tui-tear-off-day__shade.is-on { animation: none; }
  .tui-tear-off-day__sheet--tear,
  .tui-tear-off-day__sheet--lay { display: none; }
  .tui-tear-off-day__stub { display: none; }
}

/* Quiet repaints the sheet's paper a shade darker in graphite, so the small weekday heads need a firmer ink to keep 4.5:1. Tactile is untouched. */
@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-tear-off-day__head span { color: color-mix(in oklab, var(--td-ink) 80%, transparent); }
}

/* ---------------------------------------------------------------- part: terminal */
/* Terminal: a command prompt on dark glass. It is a display, not a shell: it
   prints what the page appends, line by line, and keeps a scrollback to read
   back through. A bar along the top names it and carries one lamp (white while
   it waits, amber while lines are still arriving); under it the lines, each
   with a mark in its margin that says what kind it is (a command, a success, a
   warning, a failure) so the kind is never the lamp's colour alone, and at the
   foot a prompt with a block cursor that does nothing. The glass, its ink and
   its focus light are .tui-glass's, in every finish and volume. */
tui-terminal { display: block; min-width: 0; }
.tui-glass.tui-terminal { --tt-h: 260px; --tt-mark: 4ch; padding: 0; overflow: hidden; }

.tui-terminal__bar { display: flex; align-items: center; gap: var(--tui-2); min-height: 36px; padding: 0 14px; border-bottom: 1px solid var(--tui-rule); }
.tui-terminal__title { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 12px/1 var(--tui-mono); color: var(--tui-ink-2); }
/* Idle, the lamp is the cold white of a unit that is on and waiting; while lines are still arriving it is the amber one, blinking. */
tui-terminal[data-busy] .tui-terminal__bar .tui-lamp { --c: var(--tui-amber); animation: tui-blink 1.2s steps(1) infinite; }

/* The screen: the log, and a stop of its own so the keyboard can scroll the scrollback. */
.tui-terminal__screen {
  height: var(--tt-h);
  padding: 10px 0 12px;
  overflow: auto;
  overscroll-behavior: contain;
  font: 400 12.5px/1.6 var(--tui-mono);
  color: var(--tui-ink);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--tui-ink) 35%, transparent) transparent;
}
.tui-terminal__screen:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -3px; }

.tui-terminal__line, .tui-terminal__prompt { position: relative; display: grid; grid-template-columns: var(--tt-mark) minmax(0, 1fr); padding-right: 14px; }
.tui-terminal__mark { padding-right: 1ch; text-align: right; color: var(--tui-ink-2); user-select: none; }
.tui-terminal__text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* The kinds: a mark, a weight and a lit edge, so none of them is only a colour. */
.tui-terminal__line[data-kind="cmd"] .tui-terminal__text { font-weight: 600; }
.tui-terminal__line[data-kind="cmd"] .tui-terminal__mark { color: var(--tui-ink); }
.tui-terminal__line[data-kind="ok"] { box-shadow: inset 2px 0 0 var(--tui-green); }
.tui-terminal__line[data-kind="warn"] { box-shadow: inset 2px 0 0 var(--tui-amber); }
.tui-terminal__line[data-kind="err"] { box-shadow: inset 2px 0 0 var(--tui-red); }
.tui-terminal__line:is([data-kind="ok"], [data-kind="warn"], [data-kind="err"]) .tui-terminal__mark { color: var(--tui-ink); font-weight: 600; }
.tui-terminal__line[data-kind="err"] .tui-terminal__text { font-weight: 600; }
/* Said aloud ("Error: "), never seen. */
.tui-terminal__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A line is printed a step at a time: wiped in from the left in whole steps, after the lines before it. */
.tui-terminal__line[data-feed] { animation: tui-terminal-feed var(--dur, 120ms) steps(var(--steps, 8), end) var(--delay, 0ms) backwards; }
@keyframes tui-terminal-feed { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

/* The prompt: where the next command would go. It does nothing. */
.tui-terminal__prompt { margin-top: 2px; }
.tui-terminal__cwd { min-width: 0; color: var(--tui-ink-2); }
.tui-terminal__cursor { display: inline-block; width: 0.62em; height: 1.15em; margin-left: 0.5ch; vertical-align: -0.2em; background: var(--tui-ink); animation: tui-terminal-cursor 1.1s steps(1) infinite; }
@keyframes tui-terminal-cursor { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tui-terminal__line[data-feed] { animation: none; }
  .tui-terminal__cursor { animation: none; }
  tui-terminal[data-busy] .tui-terminal__bar .tui-lamp { animation: none; }
}
@media (max-width: 480px) {
  .tui-glass.tui-terminal { --tt-mark: 3ch; }
  .tui-terminal__screen { font-size: 12px; }
}

/* ---------------------------------------------------------------- part: ticket-punch */
/* Ticket punch: a checkbox drawn as a train conductor's ticket punch. Every
   option is a card ticket, printed on paper that is paper in every finish
   (the --tui-paper tokens, mixed with the desk so a dark finish dims it and
   the wood warms it): a serial, its words and a printed box, with a slight
   curl and a soft shadow. One steel punch stands over the group, its jaws
   straddling the box, and moves to the ticket in use. Checked, the face is
   masked so the hole is a real cut through the paper, the dark backing showing
   through it, and the chip that was inside falls away. The steel is drawn
   from the paper's light mixed with the desk, so it stays metal in every
   finish. kit/parts/ticket-punch.mjs builds the punch and wires it; without
   the script a checked ticket still shows a round hole at once. */
.tui-ticket-punch {
  --tp-w: 66px;      /* the punch's width; its jaw gap is centred on the box, the hinge hangs 6px past the ticket's edge */
  --tp-arm: 40px;    /* the sprung handle, above the head */
  --tp-jaw: 13px;    /* one jaw's height */
  --tp-gap: 36px;    /* the mouth: the box is 30px, so it sits inside with air */
  --tp-hole-size: 30px 30px;
  --tp-hole-at: right 14px bottom 22px;
  --tp-paper: color-mix(in oklab, var(--tui-paper) 95%, var(--tui-desk));
  --tp-paper-hi: color-mix(in oklab, var(--tui-paper-hi) 96%, var(--tui-desk));
  --tp-ink: var(--tui-paper-ink);
  --tp-ink-2: var(--tui-paper-ink-2);
  --tp-rule: color-mix(in oklab, var(--tui-paper-ink-2) 30%, transparent);
  --tp-steel-hi: color-mix(in oklab, var(--tui-paper-hi) 90%, var(--tui-paper-ink));
  --tp-steel: color-mix(in oklab, var(--tui-paper) 74%, var(--tui-paper-ink));
  --tp-steel-lo: color-mix(in oklab, var(--tui-paper) 46%, var(--tui-paper-ink));
  position: relative;
  display: block;
  width: 100%;
  max-width: 460px;
  min-inline-size: 0;
  margin: 0;
  padding: 22px 0 0;
  border: 0;
  color: var(--tui-ink);
  text-align: left;
  white-space: normal;
  isolation: isolate;
}
.tui-ticket-punch *, .tui-ticket-punch *::before, .tui-ticket-punch *::after { box-sizing: border-box; }

.tui-ticket-punch > .tui-label,
.tui-ticket-punch > legend {
  display: block;
  margin: 0 0 20px;
  padding: 0;
}

/* The bed the tickets sit in: the punch's own origin, inside it. */
.tui-ticket-punch__tickets { position: relative; display: grid; gap: 22px; }

/* A ticket. The label is the whole hit area; the input stays in the markup,
   focusable, so a form, the name, the value and required are the browser's. */
.tui-ticket-punch__option {
  position: relative;
  display: block;
  min-height: 44px;
  min-width: 0;
  cursor: pointer;
  rotate: -0.3deg;
  -webkit-tap-highlight-color: transparent;
}
.tui-ticket-punch__option:nth-of-type(even) { rotate: 0.35deg; }
.tui-ticket-punch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tui-ticket-punch__option:has(> .tui-ticket-punch__input:disabled) { cursor: not-allowed; opacity: 0.45; }

/* The wrapper carries the shadow and the curl; the face carries the paper and
   the cut, because a mask would cut a shadow off with it. Dark behind the
   face, so a hole reads on a light finish too. */
.tui-ticket-punch__paper {
  position: relative;
  display: block;
  border-radius: 3px;
  background: color-mix(in oklab, var(--tui-skirt) 90%, black);
  box-shadow: var(--tui-raised);
  transform-origin: 50% 100%;
}
.tui-ticket-punch__paper[data-old] {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.tui-ticket-punch__face {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  min-height: 84px;
  padding: 13px 58px 13px 15px;
  border-radius: inherit;
  background:
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--tui-paper-ink) 3.5%, transparent) 0 1px, transparent 1px 3px),
    linear-gradient(var(--tp-paper-hi), var(--tp-paper));
  box-shadow:
    inset 0 0 0 1px var(--tp-rule),
    inset 0 -12px 14px -12px color-mix(in oklab, var(--tui-paper-ink) 13%, transparent);
  color: var(--tp-ink);
}

/* The hole: the paper is cut through, so what lies under the ticket shows. The
   full layer keeps the paper; the shape layer is excluded from it. Without the
   script a checked ticket gets the round die at once. */
.tui-ticket-punch__paper[data-punched] .tui-ticket-punch__face,
.tui-ticket-punch:not([data-built]) .tui-ticket-punch__option:has(> .tui-ticket-punch__input:checked) .tui-ticket-punch__face {
  -webkit-mask-image: linear-gradient(black, black), var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  mask-image: linear-gradient(black, black), var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  -webkit-mask-size: 100% 100%, var(--tp-hole-size);
  mask-size: 100% 100%, var(--tp-hole-size);
  -webkit-mask-position: 0 0, var(--tp-hole-at);
  mask-position: 0 0, var(--tp-hole-at);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  /* The paper's own edge, seen in the cut: a hairline shade on the hole's top lip. */
  filter: drop-shadow(0 1px 0.6px color-mix(in oklab, var(--tui-paper-ink) 42%, transparent));
}

.tui-ticket-punch__serial {
  font: 600 9.5px/1 var(--tui-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--tp-ink-2);
}
.tui-ticket-punch__label {
  font: 700 16px/1.25 var(--tui-sans);
  letter-spacing: -0.005em;
  color: var(--tp-ink);
  overflow-wrap: anywhere;
}

/* The printed box, where the die goes. Punched, its rule goes with the hole. */
.tui-ticket-punch__box {
  position: absolute;
  inset-inline-end: 14px;
  inset-block-end: 22px;
  width: 30px;
  height: 30px;
  border: 1px dashed var(--tp-rule);
  border-radius: 2px;
}
.tui-ticket-punch__paper[data-punched] .tui-ticket-punch__box { border-color: transparent; }
.tui-ticket-punch__option[data-half] .tui-ticket-punch__box::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 7px;
  right: 7px;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--tp-ink-2);
}

/* The chip the punch took out: the same shape as the hole, in paper, falling
   out of the cut and turning as it goes. */
.tui-ticket-punch__chip {
  position: absolute;
  z-index: 3;
  inset-inline-end: 18px;
  inset-block-end: 26px;
  width: 22px;
  height: 22px;
  opacity: 0;
  background: linear-gradient(var(--tp-paper-hi), var(--tp-paper));
  -webkit-mask-image: var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  mask-image: var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  pointer-events: none;
}

/* The punch: a sprung handle, a hinge pin and a head of two jaws joined at the
   back, turned a little in perspective so it reads as one solid object. It is
   held as a hand holds a ticket to it: the hinge is out past the ticket's edge
   on the right and the jaws open to the left, over the box. It is drawn in two
   layers that move as one, so the ticket sits between the jaws: the handle,
   hinge and upper jaw ride over the paper, and the lower jaw (__under) rides
   beneath the papers, showing only where it sticks out past the ticket. */
.tui-ticket-punch__punch,
.tui-ticket-punch__under {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--tp-w);
  height: calc(var(--tp-arm) + var(--tp-jaw) * 2 + var(--tp-gap));
  pointer-events: none;
  transition: transform 260ms var(--tui-ease);
}
.tui-ticket-punch__punch { z-index: 3; }
/* Behind every paper (the group is its own stacking context). Seen a little
   from above, the far jaw sits a touch lower and further out than the near one. */
.tui-ticket-punch__under { z-index: -1; translate: 3px 5px; }
.tui-ticket-punch__object {
  position: absolute;
  inset: 0;
  translate: 0 0;
  transform: perspective(300px) rotateX(10deg) rotateZ(-3deg);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 4px color-mix(in oklab, var(--tui-paper-ink) 22%, transparent));
}

.tui-ticket-punch__handle {
  position: absolute;
  left: 24px;
  right: 6px;
  top: 0;
  height: var(--tp-arm);
  border: 7px solid var(--tp-steel);
  border-bottom: 0;
  border-radius: 17px 17px 0 0 / 23px 23px 0 0;
  filter: drop-shadow(0 -1px 0 var(--tp-steel-hi)) drop-shadow(0 1px 0 color-mix(in oklab, var(--tui-desk) 45%, transparent));
}
.tui-ticket-punch__spring {
  position: absolute;
  right: 16px;
  top: calc(var(--tp-arm) - 9px);
  width: 26px;
  height: 12px;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--tp-steel-lo) 0 2px, var(--tp-steel-hi) 2px 4px);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--tui-desk) 40%, transparent);
}
.tui-ticket-punch__pin {
  position: absolute;
  right: 2px;
  top: calc(var(--tp-arm) - 5px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--tp-steel-hi), var(--tp-steel-lo) 75%);
  box-shadow: var(--tui-inset);
}

.tui-ticket-punch__head {
  position: absolute;
  left: 0;
  top: var(--tp-arm);
  width: 100%;
  height: calc(var(--tp-jaw) * 2 + var(--tp-gap));
}
/* The back of the head. It shortens as the jaw rises, so the closed head is
   one block rather than a jaw on a post. */
.tui-ticket-punch__spine {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 13px;
  transform-origin: 50% 0;
  transform: scaleY(calc(1 - var(--tp-close, 0) * 0.55));
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--tp-steel-hi), var(--tp-steel) 62%, var(--tp-steel-lo));
  box-shadow: inset 0 1px 0 var(--tp-steel-hi);
}
.tui-ticket-punch__jaw {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--tp-jaw);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--tp-steel-hi), var(--tp-steel) 52%, var(--tp-steel-lo));
  box-shadow: var(--tui-depth-plate,
    0 0 0 1px color-mix(in oklab, var(--tui-paper-ink) 34%, transparent),
    0 2px 2px -1px color-mix(in oklab, var(--tui-paper-ink) 24%, transparent),
    0 5px 8px -4px color-mix(in oklab, var(--tui-desk) 50%, transparent));
}
.tui-ticket-punch__jaw--top { top: 0; }
/* Resting on a half-chosen ticket, the jaw sits half closed. */
.tui-ticket-punch__jaw--bottom {
  bottom: 0;
  transform: translateY(calc(-1 * var(--tp-close, 0) * (var(--tp-gap) - 2px)));
}
/* The die, stamped into the lower jaw's face: the shape the punch leaves. */
.tui-ticket-punch__die {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 20px;
  height: 7px;
  translate: -50% 0;
  background: color-mix(in oklab, var(--tp-steel-lo) 62%, var(--tui-ink-3));
  -webkit-mask-image: var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  mask-image: var(--tp-hole, radial-gradient(circle at 50% 50%, black 0 44%, transparent 46%));
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.tui-ticket-punch__punch[data-half],
.tui-ticket-punch__under[data-half] { --tp-close: 0.5; }

/* A focus ring on the ticket, not on the hidden input. */
.tui-ticket-punch__option:has(> .tui-ticket-punch__input:focus-visible) .tui-ticket-punch__paper {
  outline: 2px solid var(--tui-focus);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .tui-ticket-punch__option:not(:has(> .tui-ticket-punch__input:disabled)):hover .tui-ticket-punch__face { filter: brightness(1.015); }
}

@media (prefers-reduced-motion: reduce) {
  /* The hole is simply there: no squeeze, no chip, no slide. */
  .tui-ticket-punch__punch,
  .tui-ticket-punch__under { transition: none; }
  .tui-ticket-punch__option:not(:has(> .tui-ticket-punch__input:disabled)):hover .tui-ticket-punch__face { filter: none; }
}

/* ---------------------------------------------------------------- part: ticket-qr */
/* Ticket QR: a paper ticket with a perforated stub, whose code prints itself. The paper is the kit's paper in
   every finish (--tui-paper tokens mixed with the desk, as the ticket punch does), so the code is always dark on
   light, which scanners need. The stub is cut from the top by two round notches and a dashed perforation. While
   the ticket issues the plate holds a canvas of loose dots; issued, the QR code part's SVG replaces them. Without
   the script the element prints its code as plain text on the paper. */
:is(tui-ticket-qr, .tui-ticket-qr) {
  --tq-paper: color-mix(in oklab, var(--tui-paper) 95%, var(--tui-desk));
  --tq-paper-hi: color-mix(in oklab, var(--tui-paper-hi) 96%, var(--tui-desk));
  --tq-rule: color-mix(in oklab, var(--tui-paper-ink-2) 45%, transparent);
  --tq-notch: 9px;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 360px;
  min-inline-size: 0;
  color: var(--tui-paper-ink);
  font: 500 var(--tui-t-small)/1.45 var(--tui-sans);
}
:is(tui-ticket-qr, .tui-ticket-qr) *, :is(tui-ticket-qr, .tui-ticket-qr) *::before, :is(tui-ticket-qr, .tui-ticket-qr) *::after { box-sizing: border-box; }
tui-ticket-qr:not([data-ready]) {
  padding: var(--tui-4);
  border-radius: var(--tui-r-m);
  background: var(--tq-paper);
  font-family: var(--tui-mono);
  overflow-wrap: anywhere;
}

.tui-ticket-qr__ticket {
  display: grid;
  filter: drop-shadow(0 1px 1px color-mix(in oklab, var(--tui-paper-ink) 22%, transparent)) drop-shadow(0 6px 10px color-mix(in oklab, var(--tui-paper-ink) 14%, transparent));
}
.tui-ticket-qr__top, .tui-ticket-qr__stub {
  position: relative;
  min-width: 0;
  background: linear-gradient(var(--tq-paper-hi), var(--tq-paper));
}
.tui-ticket-qr__top {
  padding: var(--tui-5) var(--tui-5) var(--tui-4);
  border-radius: var(--tui-r-l) var(--tui-r-l) 0 0;
  -webkit-mask: radial-gradient(circle var(--tq-notch) at 0 100%, transparent 98%, black) left / 51% 100% no-repeat, radial-gradient(circle var(--tq-notch) at 100% 100%, transparent 98%, black) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--tq-notch) at 0 100%, transparent 98%, black) left / 51% 100% no-repeat, radial-gradient(circle var(--tq-notch) at 100% 100%, transparent 98%, black) right / 51% 100% no-repeat;
}
.tui-ticket-qr__stub {
  display: grid;
  justify-items: center;
  gap: var(--tui-3);
  padding: var(--tui-5);
  border-radius: 0 0 var(--tui-r-l) var(--tui-r-l);
  background: var(--tq-paper);
  -webkit-mask: radial-gradient(circle var(--tq-notch) at 0 0, transparent 98%, black) left / 51% 100% no-repeat, radial-gradient(circle var(--tq-notch) at 100% 0, transparent 98%, black) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--tq-notch) at 0 0, transparent 98%, black) left / 51% 100% no-repeat, radial-gradient(circle var(--tq-notch) at 100% 0, transparent 98%, black) right / 51% 100% no-repeat;
}
/* The perforation, between the notches. */
.tui-ticket-qr__stub::before {
  content: '';
  position: absolute;
  top: 0;
  left: calc(var(--tq-notch) + 6px);
  right: calc(var(--tq-notch) + 6px);
  border-top: 2px dashed var(--tq-rule);
}

.tui-ticket-qr__title {
  margin: 0;
  font: 700 var(--tui-t-h3)/1.2 var(--tui-sans);
  letter-spacing: -0.01em;
  color: var(--tui-paper-ink);
  overflow-wrap: anywhere;
}
.tui-ticket-qr__facts {
  margin: var(--tui-2) 0 0;
  font: 500 var(--tui-t-small)/1.45 var(--tui-sans);
  color: var(--tui-paper-ink-2);
  overflow-wrap: anywhere;
}

/* A separator stays with the fact after it. */
.tui-ticket-qr__fact { white-space: nowrap; }

/* The plate keeps its square whatever the state, so the ticket never changes size. */
.tui-ticket-qr__plate {
  position: relative;
  width: min(100%, 220px);
  aspect-ratio: 1;
  color: var(--tui-paper-ink);
}
/* A finish whose paper is darker than its ink (Phosphor, AMOLED) would print the code light on dark, which many
   scanners refuse; the script sets data-invert there and the plate is turned back to dark on light. */
.tui-ticket-qr__plate[data-invert] { background: var(--tq-paper); filter: invert(1) hue-rotate(180deg); }
.tui-ticket-qr__cloud, .tui-ticket-qr__plate > svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: none;
  border-radius: 0;
}
.tui-ticket-qr__cloud { opacity: 1; transition: opacity 120ms var(--tui-ease); }
.tui-ticket-qr__plate > svg { opacity: 0; visibility: hidden; transition: opacity 120ms var(--tui-ease), visibility 0s 120ms; }
:is(tui-ticket-qr, .tui-ticket-qr)[data-settled] .tui-ticket-qr__plate > svg { opacity: 1; visibility: visible; transition: opacity 120ms var(--tui-ease); }
:is(tui-ticket-qr, .tui-ticket-qr)[data-settled] .tui-ticket-qr__cloud { opacity: 0; }

.tui-ticket-qr__status {
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  min-height: 20px;
  margin: 0;
  color: var(--tui-paper-ink-2);
  font: 500 var(--tui-t-small)/1.45 var(--tui-sans);
}
.tui-ticket-qr__check {
  display: inline-grid;
  width: 16px;
  height: 16px;
  color: color-mix(in oklab, var(--tui-green) 38%, var(--tui-paper-ink));
  display: none;
}
.tui-ticket-qr__check svg { width: 16px; height: 16px; stroke-width: 2; }
:is(tui-ticket-qr, .tui-ticket-qr)[data-settled] .tui-ticket-qr__check { display: inline-grid; }
.tui-ticket-qr__code {
  max-width: 100%;
  margin: 0;
  font: 500 var(--tui-t-small)/1.45 var(--tui-mono);
  color: var(--tui-paper-ink);
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}
:is(tui-ticket-qr, .tui-ticket-qr):not([data-settled]) .tui-ticket-qr__code { visibility: hidden; }

@media (max-width: 380px) {
  .tui-ticket-qr__top { padding: var(--tui-4) var(--tui-4) var(--tui-3); }
  .tui-ticket-qr__stub { padding: var(--tui-4); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-ticket-qr__cloud, .tui-ticket-qr__plate > svg { transition: none; }
}

/* ---------------------------------------------------------------- part: ticket-toast */
/* Ticket toast: a numbered slip of thermal paper issued from a dispenser slot
   at the edge of the screen. The slot is two pieces, a dark mouth behind and
   a raised lip in front, with the tickets between them, so a ticket comes out
   of the mouth and goes back into it. The paper is paper in either finish
   (the --tui-paper tokens); the stub is set off by a perforation; the bottom
   edge is torn. The only colour is the lamp on the stub. See ticket-toast.mjs.
   The newest ticket sits at the slot and the older ones lean away from it,
   each the other way, pivoting on their lower edge. */
.tui-ticket-toasts {
  position: fixed;
  right: var(--tui-4);
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 50;
  display: flex;
  flex-direction: column-reverse;
  width: min(320px, calc(100vw - var(--tui-8)));
  pointer-events: none;
}
/* Dispensing into a box of your own: it stands on the bottom edge of the box, which clips it. */
.tui-ticket-toasts--in { position: absolute; right: var(--tui-3); bottom: 0; z-index: 5; width: min(320px, calc(100% - var(--tui-6))); }
/* Dispensing in the flow of a page, for a layout of your own. */
.tui-ticket-toasts--flow { position: relative; right: auto; bottom: auto; z-index: 0; }

/* The slot. It has no box of its own: its two halves are drawn round the tickets. */
.tui-ticket-toasts__slot { position: relative; flex: none; height: 26px; }
.tui-ticket-toasts__slot::before, .tui-ticket-toasts__slot::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  translate: 0 110%;
  transition: translate 260ms var(--tui-ease);
}
/* Behind the tickets: the dark mouth. */
.tui-ticket-toasts__slot::before {
  z-index: 1;
  top: 0;
  height: 18px;
  border-radius: 8px 8px 0 0;
  background: var(--tui-rocker-bezel);
  box-shadow: var(--tui-depth-well, inset 0 2px 3px rgb(0 0 0 / 0.7), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.5)));
}
/* In front of them: the lip the paper goes under. */
.tui-ticket-toasts__slot::after {
  z-index: 20;
  top: 9px;
  bottom: 0;
  border-radius: 9px 9px 0 0;
  background: var(--tui-depth-cap, linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 90%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-raised);
}
.tui-ticket-toasts[data-open] .tui-ticket-toasts__slot::before, .tui-ticket-toasts[data-open] .tui-ticket-toasts__slot::after { translate: 0 0; }

/* A ticket. The wrapper carries the shadow and the lean; the paper carries the torn edge, which would clip a shadow. */
.tui-ticket-toast {
  --tui-focus: var(--tui-paper-ink);
  position: relative;
  z-index: calc(10 - var(--i, 0));
  margin: 6px 12px 0;
  color: var(--tui-paper-ink);
  cursor: grab;
  pointer-events: auto;
  touch-action: pan-y;
  transform-origin: 50% 100%;
  rotate: calc(var(--i, 0) * var(--s, 1) * 0.9deg);
  translate: calc(var(--i, 0) * var(--s, 1) * -3px) 0;
  filter: drop-shadow(0 1px 0.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1))) drop-shadow(0 8px 10px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9)));
}
.tui-ticket-toast[data-leaving] { pointer-events: none; }
/* The newest one goes a little way into the slot, so its torn edge is out of sight. */
.tui-ticket-toasts__slot + .tui-ticket-toast { margin-bottom: -14px; }
/* Thermal stock: a warm slip with a faint print-head banding. */
.tui-ticket-toast__paper {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  min-height: 74px;
  padding-bottom: 6px;
  border-radius: 3px 3px 0 0;
  background:
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--tui-paper-ink) 3.5%, transparent) 0 1px, transparent 1px 3px),
    linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  -webkit-mask: linear-gradient(black 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) bottom / 12px 6px repeat-x;
  mask: linear-gradient(black 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) bottom / 12px 6px repeat-x;
}
/* The stub: its number, and the lamp that says how it went. A perforation runs down its edge. */
.tui-ticket-toast__stub {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 10px 0;
  border-right: 1.5px dashed color-mix(in oklab, var(--tui-paper-ink) 34%, transparent);
}
.tui-ticket-toast__label { font: 500 var(--tui-t-label)/1 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; color: var(--tui-paper-ink-2); }
.tui-ticket-toast__no { font: 700 22px/1 var(--tui-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--tui-paper-ink); }
.tui-ticket-toast__stub .tui-lamp { margin-top: 3px; }
.tui-ticket-toast__main { position: relative; display: grid; align-content: center; gap: 8px; min-width: 0; padding: 10px 40px 8px 12px; }
.tui-ticket-toast__text { margin: 0; font-size: var(--tui-t-body); line-height: 1.4; color: var(--tui-paper-ink); overflow-wrap: anywhere; }
.tui-ticket-toast__keys { display: flex; flex-wrap: wrap; gap: var(--tui-2); }
/* The words for a screen reader that the lamp says in colour: "Error.", "Warning.". */
.tui-ticket-toast__tone { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tui-ticket-toast__tear { position: absolute; top: 5px; right: 5px; }
/* Keys sit on paper, which is light in both finishes, so their printing has to be paper's. */
.tui-ticket-toast .tui-key--flat { color: var(--tui-paper-ink-2); }
.tui-ticket-toast .tui-key--flat:hover, .tui-ticket-toast .tui-key--flat:active { color: var(--tui-paper-ink); }

@media (prefers-reduced-motion: reduce) {
  .tui-ticket-toasts__slot::before, .tui-ticket-toasts__slot::after { transition: none; }
}

/* ---------------------------------------------------------------- part: tide-table */
/* Tide table: a printed tide table on a sheet of warm paper, read with a
   brass reading ruler laid across the selected row. kit/parts/tide-table.mjs
   reads a light-DOM `table.tui-table` and builds the printed heading, the
   tide curve and the ruler round it; the table itself is never changed beyond
   the row state it already carries (`tr[aria-selected]`, the kit's own
   pattern). The ruler is a horizontal frame: a brass rail top and bottom with
   a clear window between, so the selected row reads straight through it. It
   glides to the row and presses down two pixels as it settles. Everything is
   drawn from kit tokens and color-mix() of them: paper and brass stay paper
   and brass, and on a dark finish of the metal, wood, material and light
   families the sheet is a dimmed warm sheet, never a dark table. */
tui-tide-table {
  display: block;
  width: min(100%, 460px);
  min-width: 0;
}
tui-tide-table:not(:defined) { overflow: hidden; }

/* The sheet: warm stock in every finish (dimmed, not darkened, on a dark
   one), a faint feTurbulence grain, and the paper's own ink for its shadow. */
.tui-tide-table__sheet {
  --tt-paper: light-dark(var(--tui-paper), color-mix(in oklab, var(--tui-paper) 86%, var(--tui-paper-ink)));
  --tt-paper-hi: light-dark(var(--tui-paper-hi), color-mix(in oklab, var(--tui-paper-hi) 92%, var(--tui-paper-ink)));
  --tt-ink: var(--tui-paper-ink);
  --tt-ink-2: var(--tui-paper-ink-2);
  --tt-rule: color-mix(in oklab, var(--tui-paper-ink) 26%, transparent);
  --tt-rule-soft: color-mix(in oklab, var(--tui-paper-ink) 12%, transparent);
  --tt-brass-hi: color-mix(in oklab, var(--tui-amber) 26%, var(--tui-paper-hi));
  --tt-brass: color-mix(in oklab, var(--tui-amber) 46%, var(--tui-paper));
  --tt-brass-lo: color-mix(in oklab, var(--tui-amber) 34%, var(--tui-paper-ink-2));
  --tt-engrave: color-mix(in oklab, var(--tui-paper-ink) 70%, transparent);
  --tt-engrave-hi: color-mix(in oklab, var(--tui-paper-hi) 82%, transparent);
  --tt-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.34 0 0 0 0 0.29 0 0 0 0 0.20 0 0 0 0.055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  position: relative;
  display: grid;
  gap: var(--tui-3);
  padding: 17px 19px 15px;
  color: var(--tt-ink);
  background:
    var(--tt-grain) 0 0 / 180px 180px,
    linear-gradient(var(--tt-paper-hi), var(--tt-paper));
  border-radius: 2px;
  box-shadow:
    0 1px 1px color-mix(in oklab, var(--tt-ink) 10%, transparent),
    0 10px 22px -10px color-mix(in oklab, var(--tt-ink) 30%, transparent),
    inset 0 0 0 1px color-mix(in oklab, var(--tt-ink) 7%, transparent);
}

/* The printed heading: harbour and date in small caps over a thin double rule. */
.tui-tide-table__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding-bottom: 7px;
  border-bottom: 3px double var(--tt-rule);
}
.tui-tide-table__place, .tui-tide-table__date { margin: 0; }
.tui-tide-table__place {
  font: 600 10.5px/1.25 var(--tui-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tt-ink);
}
.tui-tide-table__date {
  font: 500 10px/1.25 var(--tui-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tt-ink-2);
}

/* The tide curve: time of day across, height up, drawn from the rows. */
.tui-tide-table__curve { position: relative; height: 32px; color: var(--tt-ink); }
.tui-tide-table__curve-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tui-tide-table__curve-wash { fill: color-mix(in oklab, var(--tt-ink) 7%, transparent); }
.tui-tide-table__curve-line { fill: none; stroke: var(--tt-ink-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tui-tide-table__curve-rule, .tui-tide-table__curve-tick { stroke: var(--tt-rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tui-tide-table__curve-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent 0 11px, var(--tt-ink-2) 11px 29px, transparent 29px);
  transition: left 190ms var(--tui-ease);
}
.tui-tide-table__curve-time {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font: 500 9px/1 var(--tui-mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--tt-ink-2);
}
.tui-tide-table__curve-mark[data-edge="start"] .tui-tide-table__curve-time { left: 0; transform: none; }
.tui-tide-table__curve-mark[data-edge="end"] .tui-tide-table__curve-time { left: auto; right: 0; transform: none; }
.tui-tide-table__curve-dot {
  position: absolute;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--tt-ink);
  box-shadow: 0 0 0 1.5px var(--tt-paper-hi);
  transition: top 190ms var(--tui-ease);
}

/* The page under the ruler carries the table and nothing else. */
.tui-tide-table__body { position: relative; min-width: 0; }
.tui-tide-table__wrap { width: 100%; }

/* Printing on paper: the table's own ink and rules are the paper's, never the
   finish's, so a dimmed sheet on graphite still reads as a printed page. */
.tui-tide-table__sheet .tui-table {
  --tui-ink: var(--tt-ink);
  --tui-ink-2: var(--tt-ink-2);
  --tui-rule: var(--tt-rule);
  --tui-focus: var(--tt-ink);
  --tui-face-hi: var(--tt-paper-hi);
  color: var(--tt-ink);
  font-variant-numeric: tabular-nums;
}
.tui-tide-table__sheet .tui-table th {
  padding: 0 9px 6px;
  font: 600 9.5px/1.2 var(--tui-sans);
  letter-spacing: 0.14em;
  color: var(--tt-ink-2);
  border-bottom: 1px solid var(--tt-ink);
}
.tui-tide-table__sheet .tui-table td { padding: 10px 9px; border-bottom: 1px solid var(--tt-rule-soft); }
.tui-tide-table__sheet .tui-table tbody tr:last-child td { border-bottom: 1px solid var(--tt-rule); }
.tui-tide-table__sheet .tui-table :is(th, td) + :is(th, td) { border-left: 1px solid var(--tt-rule-soft); }
/* A printed table alternates its rows faintly; the chosen one is a faint brass band. */
.tui-tide-table__sheet .tui-table tbody tr:nth-child(even) td { background: color-mix(in oklab, var(--tt-ink) 4%, transparent); }
.tui-tide-table__sheet .tui-table tbody tr[aria-selected="true"] td {
  background: color-mix(in oklab, var(--tt-brass) 16%, transparent);
  color: var(--tt-ink);
  box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
  .tui-tide-table__sheet .tui-table tbody tr:not([aria-selected="true"]):hover td { background: color-mix(in oklab, var(--tt-ink) 5%, transparent); }
}
/* The figures: tabular, set tight, in the kit's printed mono face. */
.tui-tide-table__sheet .tui-table tbody td:first-child,
.tui-tide-table__sheet .tui-table .is-num {
  font-family: var(--tui-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.tui-tide-table__row { cursor: pointer; }
.tui-tide-table__row:focus-visible { outline: 2px solid var(--tt-ink); outline-offset: -2px; }

/* The brass ruler: a frame across the page, its top rail engraved, the window
   between open so the row reads through it. It is decoration for the eye and
   pointer: the rows own the focus and the events. */
.tui-tide-table__ruler {
  position: absolute;
  z-index: 2;
  top: 0;
  left: -10px;
  right: -10px;
  height: var(--ruler-h, 38px);
  transform: translateY(var(--ruler-y, 0px));
  transition: transform 190ms var(--tui-ease);
  pointer-events: none;
}
.tui-tide-table__ruler-face {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background:
    /* engraved ticks: a long one every fifth, a short one between, each cut with a lit edge below */
    repeating-linear-gradient(90deg, var(--tt-engrave) 0 1px, transparent 1px 25px) 0 0 / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--tt-engrave-hi) 0 1px, transparent 1px 25px) 0 1px / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--tt-engrave) 0 1px, transparent 1px 6.25px) 0 0 / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--tt-engrave-hi) 0 1px, transparent 1px 6.25px) 0 1px / 100% 5px no-repeat,
    /* brushed along the length of the top rail */
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--tt-brass-hi) 34%, transparent) 0 1px, transparent 1px 2px) 0 0 / 100% 11px no-repeat,
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--tt-brass-lo) 20%, transparent) 0 1px, transparent 1px 3px) 0 0 / 100% 11px no-repeat,
    /* the brass itself: a top rail, a thin bottom rail, and the two side caps */
    linear-gradient(180deg, var(--tt-brass-hi), var(--tt-brass) 45%, var(--tt-brass-lo)) 0 0 / 100% 11px no-repeat,
    linear-gradient(180deg, var(--tt-brass-hi), var(--tt-brass) 55%, var(--tt-brass-lo)) 0 100% / 100% 4px no-repeat,
    linear-gradient(90deg, var(--tt-brass-hi), var(--tt-brass) 55%, var(--tt-brass-lo)) 0 0 / 3px 100% no-repeat,
    linear-gradient(270deg, var(--tt-brass-hi), var(--tt-brass) 55%, var(--tt-brass-lo)) 100% 0 / 3px 100% no-repeat;
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--tt-brass-hi) 80%, transparent),
    inset 0 -1px 0 color-mix(in oklab, var(--tt-brass-lo) 75%, transparent);
  filter:
    drop-shadow(0 1px 1px color-mix(in oklab, var(--tt-ink) 26%, transparent))
    drop-shadow(0 5px 7px color-mix(in oklab, var(--tt-ink) 22%, transparent));
}
/* The glide ends with a 2px press into place: a short, late animation, restarted on every move. */
.tui-tide-table__ruler.is-settling .tui-tide-table__ruler-face { animation: tui-tide-settle 110ms var(--tui-ease) 180ms; }
@keyframes tui-tide-settle { from { translate: 0 2px; } to { translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  /* The mechanism only ever changes which row carries the ruler: it never plays the glide or the settle. */
  .tui-tide-table__ruler, .tui-tide-table__ruler-face,
  .tui-tide-table__curve-mark, .tui-tide-table__curve-dot { transition: none; }
  .tui-tide-table__ruler.is-settling .tui-tide-table__ruler-face { animation: none; }
}

/* The plate: the selected row's own cells, said once, for a screen reader; nowhere else repeats it. */
.tui-tide-table__plate {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- part: time-field */
/* Time field: a time of day in the field's well, as hours, minutes and (on a
   12 hour clock) AM or PM, each a segment you can type into or step with the
   arrow keys, and a key at the right that opens a plain list of times. The
   well, the key and the plate the list sits on are the kit's, so every finish
   and both volumes are theirs; the figures are set in the sans face with
   tabular numerals. Without the script the markup is a native time input.
   kit/parts/time-field.mjs builds and wires it. */
tui-time-field { position: relative; display: block; width: min(100%, 300px); min-width: 0; }
tui-time-field:not(:defined) .tui-field { width: 100%; }
.tui-time-field__field { --tf-h: 38px; --tf-pad: 4px; }
.tui-time-field__well {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  min-height: var(--tf-h);
  padding: 0 var(--tf-pad) 0 var(--tui-2);
  border-radius: var(--tui-r-m);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
.tui-time-field__well:has(.tui-time-field__seg:focus-visible, .tui-time-field__open:focus-visible), .tui-time-field__well.is-focus, tui-time-field[data-show-focus] .tui-time-field__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
tui-time-field[data-show-focus] .tui-time-field__seg[data-seg="hour"] { background: color-mix(in oklab, var(--tui-ink) 11%, transparent); }

/* A segment is a real input, drawn as plain figures. */
.tui-time-field__seg {
  appearance: none;
  flex: none;
  box-sizing: content-box;
  width: 2ch;
  height: 28px;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: calc(var(--tui-r-m) - var(--tf-pad));
  font: 500 var(--tui-t-body)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: inherit;
  caret-color: transparent;
  background: transparent;
  outline: none;
  cursor: text;
}
.tui-time-field__seg[data-seg="period"] { width: calc(var(--tf-ch, 2.6) * 1ch); margin-left: var(--tui-1); }
.tui-time-field__seg[hidden] { display: none; }
.tui-time-field__seg::placeholder { color: var(--tui-ink-3); opacity: 1; }
.tui-time-field__seg:focus-visible { background: color-mix(in oklab, var(--tui-ink) 11%, transparent); }
.tui-time-field__seg::selection { background: transparent; }
.tui-time-field__seg:disabled { cursor: not-allowed; }
.tui-time-field__sep { flex: none; padding: 0 1px; font: 500 var(--tui-t-body)/1 var(--tui-sans); color: var(--tui-ink-2); user-select: none; }

/* The list key, at the right of the well. */
.tui-time-field__open { --h: 30px; flex: none; margin-left: auto; }
.tui-time-field__open[hidden] { display: none; }
.tui-time-field__open[aria-expanded="true"] { transform: translateY(var(--skirt)); box-shadow: var(--tui-pressed); }
.tui-time-field__open:disabled { opacity: 0.45; cursor: not-allowed; }
.tui-time-field__open .tui-icon, .tui-time-field__open svg { width: 16px; height: 16px; }

/* Disabled and read only. */
.tui-time-field__field[data-disabled] .tui-time-field__well { opacity: 0.45; cursor: not-allowed; }
.tui-time-field__well[data-readonly] .tui-time-field__seg { cursor: default; }

/* Help, and the error under it: a lamp lit red beside the words, the well ringed red. */
.tui-time-field__help[hidden] { display: none; }
.tui-time-field__error { display: flex; align-items: baseline; gap: 7px; margin: 0; }
.tui-time-field__error:empty { display: none; }
.tui-time-field__error .tui-lamp { flex: none; width: 7px; height: 7px; transform: translateY(-1px); }
.tui-time-field__field[data-error] .tui-hint:not(.tui-time-field__error) { color: var(--tui-ink-2); }
.tui-time-field__field[data-error] .tui-time-field__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }
.tui-time-field__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The list: a plate in the top layer (a popover), placed by the script. */
.tui-time-field__list:not(:popover-open) { display: none; }
.tui-time-field__list {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  display: grid;
  align-content: start;
  gap: 1px;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 0;
  border-radius: var(--tui-r-l);
  font: 400 var(--tui-t-body)/1.25 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.3), 0 24px 48px -18px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2.2)));
  outline: none;
}
.tui-time-field__list:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-time-field__option {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--tui-3);
  border-radius: calc(var(--tui-r-l) - 4px);
  font-weight: 500;
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-time-field__option:hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 40%, transparent); }
/* The time that is set: a cap let down into the plate, and bolder, so it never relies on colour. */
.tui-time-field__option[aria-selected="true"] { font-weight: 600; color: var(--tui-ink); background: var(--tui-raised-fill); box-shadow: var(--tui-pressed); filter: brightness(0.97); }
.tui-time-field__list:focus-visible > .is-active { outline: 2px solid var(--tui-focus); outline-offset: -2px; }
.tui-time-field__none { padding: var(--tui-3); font-size: var(--tui-t-small); color: var(--tui-ink-2); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-time-field__option[aria-selected="true"] { filter: none; background: var(--tui-quiet-key-down); }
}

@media (pointer: coarse) {
  .tui-time-field__field { --tf-h: 52px; --tf-pad: 4px; }
  .tui-time-field__seg { height: 44px; font-size: 16px; padding: 0 4px; }
  .tui-time-field__sep { font-size: 16px; }
  .tui-time-field__open { --h: 44px; }
  .tui-time-field__option { min-height: 44px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  tui-time-field .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: timeline */
/* Timeline: an event log like the roll of a chart recorder. The rail is an
   engraved groove running down the roll; each event is a tick stamped across
   it, with its time in tabular figures on the left and its words on the right.
   A lamp set into the rail says how an event went, and is the only colour.
   The "now" marker is the pen: everything above it is what the roll has
   recorded, everything below it is still to come, and that part of the rail
   is only dotted in. */
.tui-timeline {
  --tl-time: 52px;
  --tl-rail: 22px;
  --tl-tick: 11px; /* how far down each event its tick is stamped */
  --tl-bg: var(--tui-face); /* the plate the roll sits on: the pen's halo matches it */
  margin: 0;
  padding: 0;
  list-style: none;
}
.tui-timeline__event, .tui-timeline__now {
  position: relative;
  display: grid;
  grid-template-columns: var(--tl-time) var(--tl-rail) minmax(0, 1fr);
  column-gap: var(--tui-2);
  min-width: 0;
}
.tui-timeline__event { padding-bottom: var(--tui-5); }
.tui-timeline__time { justify-self: end; padding-top: 2px; font: 600 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: var(--tui-ink-2); white-space: nowrap; }

/* The rail: cut into the plate, its lower lip catching the light. Each event draws its own length of it. */
.tui-timeline__event::before, .tui-timeline__now::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--tl-time) + var(--tui-2) + var(--tl-rail) / 2 - 1px);
  width: 2px;
  border-radius: 1px;
  background: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6));
  box-shadow: 1px 0 0 var(--tui-hl);
}
.tui-timeline > :first-child::before { top: calc(var(--tl-tick) + 1px); }
.tui-timeline > :last-child::before { bottom: auto; height: calc(var(--tl-tick) + 2px); }
.tui-timeline > :first-child:last-child::before { height: 0; }
/* The rail after the pen is not yet cut: dotted in. */
.tui-timeline__now ~ * { color: var(--tui-ink-2); }
.tui-timeline__now ~ *::before { background: repeating-linear-gradient(180deg, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)) 0 3px, transparent 3px 7px); box-shadow: none; }

/* The tick: stamped across the rail, a dark bar with the lamp-side edge lit. */
.tui-timeline__tick { position: relative; display: block; height: 100%; }
.tui-timeline__tick::before {
  content: '';
  position: absolute;
  top: calc(var(--tl-tick) - 1px);
  left: 50%;
  width: 14px;
  height: 3px;
  margin-left: -7px;
  border-radius: 1px;
  background: var(--tui-ink-2);
  box-shadow: 0 1px 0 var(--tui-hl);
}
.tui-timeline__now ~ * .tui-timeline__tick::before { background: var(--tui-ink-3); width: 10px; margin-left: -5px; }
/* With a lamp the tick is the lamp, set into the rail. */
.tui-timeline__tick > .tui-lamp { position: absolute; top: calc(var(--tl-tick) - 4px); left: 50%; width: 9px; height: 9px; margin-left: -4.5px; }
.tui-timeline__tick:has(> .tui-lamp)::before { display: none; }

.tui-timeline__body { min-width: 0; }
.tui-timeline__title { margin: 0; font: 600 var(--tui-t-body)/1.35 var(--tui-sans); letter-spacing: -0.005em; color: var(--tui-ink); }
.tui-timeline__text { margin: 2px 0 0; font-size: var(--tui-t-body); line-height: 1.45; color: var(--tui-ink-2); overflow-wrap: anywhere; }

/* Now: the pen. A dark cap on the time side, a diamond on the rail, and a rule across. */
.tui-timeline__now { align-items: center; padding-block: var(--tui-1) var(--tui-5); }
.tui-timeline__now > .tui-timeline__time {
  justify-self: end;
  padding: 3px 7px;
  border-radius: 4px;
  font: 700 10px/1 var(--tui-sans);
  letter-spacing: var(--tui-track);
  text-transform: uppercase;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: inset 0 1px 0 var(--tui-cap-hl), 0 1.5px 0 var(--tui-cap-skirt);
}
.tui-timeline__now > .tui-timeline__tick { height: 14px; }
.tui-timeline__now > .tui-timeline__tick::before { top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 1px; background: var(--tui-ink); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--tl-bg); }
.tui-timeline__now > .tui-timeline__body { display: flex; align-items: center; gap: var(--tui-3); font-size: var(--tui-t-small); color: var(--tui-ink-2); font-variant-numeric: tabular-nums; }
.tui-timeline__now > .tui-timeline__body::before { content: ''; flex: 1 1 auto; order: 2; height: 1px; background: var(--tui-rule); }

/* A new event is stamped: the tick lands, a little proud, and settles. */
.tui-timeline__event[data-new] .tui-timeline__tick::before, .tui-timeline__event[data-new] .tui-timeline__tick > .tui-lamp { animation: tui-timeline-stamp 260ms var(--tui-ease) both; }
@keyframes tui-timeline-stamp { from { transform: scale(1.9); opacity: 0.2; } to { transform: none; opacity: 1; } }
.tui-timeline__event[data-new] .tui-timeline__body, .tui-timeline__event[data-new] .tui-timeline__time { animation: tui-timeline-in 260ms var(--tui-ease) both; }
@keyframes tui-timeline-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Compact: the same roll at a tighter pitch, for a card or a side panel. */
.tui-timeline--sm { --tl-time: 44px; --tl-rail: 18px; --tl-tick: 9px; }
.tui-timeline--sm .tui-timeline__event { padding-bottom: var(--tui-3); }
.tui-timeline--sm .tui-timeline__title, .tui-timeline--sm .tui-timeline__text { font-size: var(--tui-t-small); }

@media (prefers-reduced-motion: reduce) {
  .tui-timeline__event[data-new] .tui-timeline__tick::before, .tui-timeline__event[data-new] .tui-timeline__tick > .tui-lamp, .tui-timeline__event[data-new] .tui-timeline__body, .tui-timeline__event[data-new] .tui-timeline__time { animation: none; }
}

/* ---------------------------------------------------------------- part: toggle-group */
/* Toggle group: the segmented control's keys, each latching on its own.
   Every key is a checkbox, so any number can be down at once (bold and
   italic, the columns a table shows, the filters on a log) and each one
   posts with the form. A lone toggle is a group of one: a single latching
   key in its slot. The base drawing is .tui-seg's (core.css and
   segmented.css): tray, caps, the pressed key below the plate, the amber
   lamp of a latched key unless --plain. This file adds what toggles need on
   top: rows that wrap, a column, and a parting line between clusters (an
   <i>, so the segmented key's span rules leave it alone). */
tui-toggle-group, .tui-toggle-group { flex-wrap: wrap; width: fit-content; max-width: 100%; justify-self: start; vertical-align: middle; }
.tui-toggle-group--vertical { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.tui-toggle-group--vertical span { justify-content: flex-start; }

/* A parting line between clusters of keys: an engraved cut in the tray's floor, lit on its right lip. */
.tui-toggle-group__rule {
  flex: none;
  align-self: stretch;
  width: 2px;
  margin: 4px 3px;
  border-radius: 1px;
  background: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9));
  box-shadow: 1px 0 0 var(--tui-hl);
}
.tui-toggle-group--vertical .tui-toggle-group__rule { width: auto; height: 2px; margin: 3px 4px; box-shadow: 0 1px 0 var(--tui-hl); }

/* The checkbox is the key; a disabled one stays where it is. */
.tui-toggle-group input:disabled + span { transform: none; }
.tui-toggle-group input:checked:disabled + span { transform: translateY(1.5px); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  /* The same box as in Tactile; only the drawing turns to a hairline. */
  .tui-toggle-group__rule { background: none; box-shadow: inset 1px 0 0 var(--tui-quiet-line-2); }
  .tui-toggle-group--vertical .tui-toggle-group__rule { box-shadow: inset 0 1px 0 var(--tui-quiet-line-2); }
}

@media (prefers-reduced-motion: reduce) {
  .tui-toggle-group span { transition: none; }
}

/* ---------------------------------------------------------------- part: toggle-key */
/* Toggle key: one key that latches below the plate and stays down. It is the
   kit's own key (a cap on a skirt), so the latched drawing is the key's:
   aria-pressed="true" takes the skirt away and puts the plate's edge over the
   cap, in every finish and both volumes. This file adds what a latching key
   needs on top: a lamp that lights while it is down, a latched key that
   stays down when it is disabled, and a cap large enough to hit on a phone. */
.tui-toggle-key:disabled[aria-pressed="true"], .tui-toggle-key[aria-disabled="true"][aria-pressed="true"] { transform: translateY(var(--skirt)); }
/* The lamp is the key's own, set in the cap: dark while the key is up, lit while it is down. */
.tui-toggle-key[aria-pressed="true"] .tui-lamp {
  color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c);
  box-shadow: var(--tui-glow);
}
@media (pointer: coarse) {
  .tui-toggle-key { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-toggle-key { transition: none; }
}

/* ---------------------------------------------------------------- part: toggletip */
/* Toggletip: a small round key beside a label, and the note it hangs out
   when pressed. The note is printed on the tooltip's label plate grown to a
   sentence or two: the contrast colours, a printed rule just inside its edge
   and a short tab that points at the key. The key stays down while the note
   is out. toggletip.mjs puts the plate in the top layer and places it;
   without the script the note is printed in place, small, after the label. */
tui-toggletip { position: relative; display: inline-flex; vertical-align: middle; }
/* Without the script: the words themselves, as a printed note (data-static="note" draws it so, for a specimen). */
tui-toggletip:not([data-wired], [data-static]), tui-toggletip[data-static="note"] {
  display: inline;
  margin-inline-start: var(--tui-1);
  font: 400 var(--tui-t-small)/1.5 var(--tui-sans);
  letter-spacing: 0;
  text-transform: none;
  color: var(--tui-ink-2);
}

.tui-toggletip__key.tui-key { --h: 22px; --skirt: 1.5px; color: var(--tui-ink-2); }
.tui-toggletip__key.tui-key:hover, .tui-toggletip__key.tui-key[aria-expanded="true"] { color: var(--tui-ink); }
.tui-toggletip__key svg { width: 13px; height: 13px; }
/* The key is drawn small so it sits beside a label, but it takes a 44px press. */
.tui-toggletip__key::after { content: ''; position: absolute; inset: -11px; border-radius: 50%; }

.tui-toggletip__card {
  --tui-leader: 50%;
  --tab: 6px;
  position: fixed;
  inset: auto;
  z-index: 60;
  box-sizing: border-box;
  display: block;
  width: max-content;
  max-width: min(264px, calc(100vw - 16px));
  margin: 0;
  border: 0;
  overflow: visible;
  padding: 9px 12px 10px;
  border-radius: 6px;
  font: 500 12.5px/1.45 var(--tui-sans);
  letter-spacing: 0.005em;
  text-align: left;
  text-transform: none;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: var(--tui-depth-float, 0 1px 2px rgb(var(--tui-sh) / 0.3), 0 8px 18px -8px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
  /* The printed rule round the plate, a hair inside its edge. */
  outline: 1px solid color-mix(in oklab, var(--tui-cap-ink) 24%, transparent);
  outline-offset: -3px;
}
.tui-toggletip__card[popover]:not(:popover-open) { display: none; }
/* Open but not yet placed: never shown in the wrong spot. */
.tui-toggletip__card[popover]:popover-open:not([data-placed]) { visibility: hidden; }
.tui-toggletip__card[data-placed] { animation: tui-toggletip-in 140ms var(--tui-ease); }
@keyframes tui-toggletip-in { from { opacity: 0; } }
.tui-toggletip__text { display: block; overflow-wrap: anywhere; }

/* The tab: a short point of the plate itself, aimed at the key's centre. */
.tui-toggletip__card::after {
  content: '';
  position: absolute;
  left: var(--tui-leader);
  top: 100%;
  width: calc(var(--tab) * 2);
  height: var(--tab);
  margin-left: calc(var(--tab) * -1);
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}
.tui-toggletip__card:is([data-placed="bottom"], [data-static="bottom"])::after { top: auto; bottom: 100%; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tui-toggletip__card:is([data-placed="left"], [data-placed="right"], [data-static="left"], [data-static="right"])::after { top: var(--tui-leader); left: 100%; width: var(--tab); height: calc(var(--tab) * 2); margin: calc(var(--tab) * -1) 0 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tui-toggletip__card:is([data-placed="right"], [data-static="right"])::after { left: auto; right: 100%; clip-path: polygon(100% 0, 100% 100%, 0 50%); }

/* Drawn open inside a page, for a specimen: the plate where the script would hang it, centred on its key. */
tui-toggletip[data-static]:not([data-static="note"]) { display: inline-flex; }
.tui-toggletip__card[data-static] { position: absolute; z-index: 1; left: 50%; bottom: calc(100% + 9px); translate: -50% 0; width: max-content; max-width: 200px; }
.tui-toggletip__card[data-static="bottom"] { top: calc(100% + 9px); bottom: auto; }
.tui-toggletip__card:is([data-static="right"], [data-static="left"]) { top: 50%; bottom: auto; translate: 0 -50%; --tui-leader: 50%; }
.tui-toggletip__card[data-static="right"] { left: calc(100% + 9px); }
.tui-toggletip__card[data-static="left"] { left: auto; right: calc(100% + 9px); }
tui-toggletip[data-static] .tui-toggletip__key { pointer-events: none; }

/* What a screen reader hears; nothing to see. */
.tui-toggletip__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-toggletip__card { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-toggletip__card[data-placed] { animation: none; }
}

/* ---------------------------------------------------------------- part: token-meter */
/* Token meter: how much of a model's context is used, read off an LED ladder
   with the limit printed at its end. It is the meter's strip (dark glass, the
   unlit segments just visible, a hair of glass between segments) and the
   ladder's segments. The whole lit length takes the colour of where the count
   stands, as the meter does: green while there is room, amber from the printed
   cut line near the limit, red once the limit is passed. The words under it say
   the same in a sentence, so colour is never the only sign. A dark LCD above
   carries the figures. Set --v (0 to 1) on .tui-token-meter; tokenMeterHTML()
   and setTokenMeter() do it from the counts. */
.tui-token-meter { position: relative; --n: 24; --v: 0; --near: 0.85; --c: var(--tui-green); display: grid; gap: var(--tui-2); width: 100%; min-width: 0; margin: 0; }
.tui-token-meter[data-state="near"] { --c: var(--tui-amber); }
.tui-token-meter:is([data-state="full"], [data-state="over"]) { --c: var(--tui-red); }
.tui-token-meter__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tui-1) var(--tui-3); margin: 0; }

/* The strip: dark glass with the segments in it. */
.tui-token-meter__strip {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 1px 2px rgb(var(--tui-sh) / 0.7), 0 1px 0 var(--tui-hl));
  overflow: hidden;
}
.tui-token-meter__strip::before, .tui-token-meter__strip::after {
  content: '';
  position: absolute;
  inset: 2px;
  -webkit-mask: repeating-linear-gradient(90deg, rgb(0 0 0) 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
          mask: repeating-linear-gradient(90deg, rgb(0 0 0) 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}
/* The unlit segments, just visible. */
.tui-token-meter__strip::before { background: color-mix(in oklab, var(--tui-vfd) 13%, var(--tui-vfd-bg)); }
/* The lit ones, as far as the count has reached. */
.tui-token-meter__strip::after {
  background: linear-gradient(color-mix(in oklab, white 28%, transparent), transparent 55%), var(--c);
  clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0);
  transition: clip-path 120ms linear;
}
/* The cut line where "near" begins, across the strip. */
.tui-token-meter__cut { position: absolute; z-index: 1; top: 0; bottom: 0; left: calc(2px + (100% - 4px) * var(--near)); width: 1px; background: var(--tui-vfd); pointer-events: none; }

/* The printed ends of the scale. */
.tui-token-meter__marks { display: flex; justify-content: space-between; gap: var(--tui-3); margin: 0 2px; font: 500 var(--tui-t-label)/1.2 var(--tui-sans); letter-spacing: var(--tui-track); text-transform: uppercase; font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-token-meter__marks > span:last-child { font-weight: 700; color: var(--tui-ink); }

.tui-token-meter__words { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tui-1) var(--tui-3); margin: 0; font: 500 var(--tui-t-body)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }
.tui-token-meter__words .tui-status { color: var(--tui-ink); }
.tui-token-meter[data-state="ok"] .tui-token-meter__note { display: none; }
.tui-token-meter__note { font-size: var(--tui-t-small); font-weight: 600; color: var(--tui-ink-2); }
.tui-token-meter:is([data-state="full"], [data-state="over"]) .tui-token-meter__note { color: var(--tui-ink); }
/* Said aloud, never seen. */
.tui-token-meter__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .tui-token-meter__strip { height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-token-meter__strip::after { transition: none; }
}

/* ---------------------------------------------------------------- part: tool-call */
/* Tool call: a job ticket clipped to the answer. A small plate with a stub on
   its left, set off by a perforation, where the lamp sits; the tool's name
   printed across it as a legend; the state in words and the time on a small
   LCD. The input and the output sit on display glass behind a hinge that
   opens like the accordion's, its square key latching while it is open.
   When the tool needs a person's say, two keys stand at the ticket's foot.
   Several calls are one pad of tickets, torn along the perforations between
   them, with the count printed on top. tool-call.mjs runs the states. */
tui-tool-call {
  --tc-stub: 34px;
  position: relative;
  isolation: isolate;
  display: grid;
  min-width: 0;
  border-radius: 10px;
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
  text-align: left;
}
/* The perforation: small punched holes running down from the stub's head. */
tui-tool-call::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 6px;
  bottom: 6px;
  left: var(--tc-stub);
  width: 2px;
  margin-left: -1px;
  background: radial-gradient(circle, rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)) 0.9px, transparent 1.3px) 0 0 / 2px 5px repeat-y;
  pointer-events: none;
}

.tui-tool-call__ticket { min-width: 0; container-type: inline-size; }
.tui-tool-call__head {
  display: grid;
  grid-template-columns: var(--tc-stub) minmax(0, 1fr) auto auto 22px;
  align-items: center;
  column-gap: var(--tui-2);
  min-height: 46px;
  padding: 6px 12px 6px 0;
  list-style: none;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-tool-call__head::-webkit-details-marker { display: none; }
.tui-tool-call__head::marker { content: ''; }
.tui-tool-call__head:focus-visible, .tui-tool-call__head.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-tool-call__stub { display: grid; place-items: center; align-self: stretch; }
.tui-tool-call__stub .tui-lamp { width: 8px; height: 8px; }
/* The legend: the tool's name as it is spelled, printed in the sans. */
.tui-tool-call__name {
  min-width: 0;
  padding-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 var(--tui-t-body)/1.2 var(--tui-sans);
  letter-spacing: 0.01em;
  color: var(--tui-ink);
}
.tui-tool-call__state { font: 500 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }
/* The time: a small liquid-crystal window. */
.tui-lcd.tui-tool-call__time {
  justify-self: end;
  min-width: 46px;
  justify-content: center;
  padding: 4px 6px 3px;
  font-size: 11.5px;
  letter-spacing: 0;
  white-space: nowrap;
}
.tui-tool-call__time[hidden] { display: none; }
/* The hinge's key: the accordion's square cap, printed +; latched and printed − while open. */
.tui-tool-call__head::after {
  content: '';
  grid-column: 5;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 1.5px 8px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-hl), 0 1.5px 0 var(--tui-skirt), 0 2.5px 3px rgb(var(--tui-sh) / 0.25));
  transition: transform 70ms var(--tui-ease), box-shadow 70ms var(--tui-ease);
}
.tui-tool-call__head:hover::after, .tui-tool-call__head.is-hover::after { filter: brightness(1.03); }
.tui-tool-call__head:active::after, .tui-tool-call__head.is-down::after, .tui-tool-call__ticket[open] > .tui-tool-call__head::after {
  transform: translateY(1.5px);
  filter: brightness(0.97);
  background:
    linear-gradient(var(--tui-ink), var(--tui-ink)) center / 8px 1.5px no-repeat,
    var(--tui-depth-cap, radial-gradient(120% 90% at 50% 0%, var(--tui-sheen, var(--tui-hl)), transparent 60%),
    linear-gradient(var(--tui-face-hi), color-mix(in oklab, var(--tui-face-hi) 92%, rgb(var(--tui-sh)))));
  box-shadow: var(--tui-pressed);
}

/* Behind the hinge: input, output or the error, each on its own glass. */
.tui-tool-call__io { display: grid; gap: var(--tui-2); padding: 2px 12px 12px calc(var(--tc-stub) + 6px); }
.tui-tool-call__ticket[open] > .tui-tool-call__io { animation: tui-tool-call-out 180ms var(--tui-ease); }
@keyframes tui-tool-call-out { from { opacity: 0; transform: translateY(-5px); } }
.tui-tool-call__glass { display: grid; gap: 6px; min-width: 0; padding: 10px 12px 11px; }
.tui-tool-call__glass > .tui-label { font-size: 10px; }
.tui-tool-call__glass pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font: 400 12px/1.55 var(--tui-mono);
  white-space: pre;
  scrollbar-width: thin;
}
/* The ring in the display's light, so it sits on the glass, not on the plate round it. */
.tui-tool-call__glass:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: -4px; }
/* An error says what happened in words first, in the sans; the raw text follows in the mono. */
.tui-tool-call__why { margin: 0; font: 500 var(--tui-t-body)/1.45 var(--tui-sans); color: var(--tui-ink); overflow-wrap: anywhere; }
.tui-tool-call__glass[data-io="error"] pre { color: var(--tui-ink-2); }
.tui-tool-call__none { margin: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }

/* The foot: the question, then Deny and Approve (a commit key), right-aligned.
   A failed call that may run again has the same foot with one Retry key. */
.tui-tool-call__ask, .tui-tool-call__again {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tui-2) var(--tui-3);
  margin: 0 12px 0 calc(var(--tc-stub) + 6px);
  padding: 10px 0 12px;
  border-top: 1px solid var(--tui-rule);
}
.tui-tool-call__question { flex: 1 1 180px; margin: 0; font-size: var(--tui-t-body); line-height: 1.4; color: var(--tui-ink); }
.tui-tool-call__keys { display: flex; align-items: flex-start; gap: var(--tui-2); }
.tui-tool-call__keys tui-commit .tui-commit__said, .tui-tool-call__keys tui-commit .tui-commit__note { position: absolute; }
/* Deny with ask-reason: the question and the keys make way for one line to type in, then Back and Deny. */
.tui-tool-call__ask[data-reason] > .tui-tool-call__question, .tui-tool-call__ask[data-reason] > .tui-tool-call__keys { display: none; }
.tui-tool-call__reason { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: flex-end; gap: var(--tui-2) var(--tui-3); min-width: 0; margin: 0; }
.tui-tool-call__reason .tui-field { flex: 1 1 180px; min-width: 0; margin: 0; }
.tui-tool-call__reason .tui-input { width: 100%; }
.tui-tool-call__reason .tui-tool-call__keys { margin-left: auto; }
.tui-tool-call__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The pad: tickets torn from one block. One plate, the perforation between each. */
.tui-tool-calls {
  display: grid;
  min-width: 0;
  border-radius: 12px;
  background: var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-tool-calls > tui-tool-call { border-radius: 0; background: none; box-shadow: none; }
.tui-tool-calls > tui-tool-call + tui-tool-call { border-top: 1.5px dashed var(--tui-rule); }
.tui-tool-calls > tui-tool-call:last-child, .tui-tool-calls > tui-tool-call:last-child .tui-tool-call__head { border-radius: 0 0 12px 12px; }
.tui-tool-calls__summary {
  display: flex;
  align-items: center;
  gap: var(--tui-2);
  margin: 0;
  padding: 11px 14px 10px 13px;
  border-bottom: 1px solid var(--tui-rule);
}
.tui-tool-calls__summary .tui-lamp { margin-right: 3px; }

/* A narrow ticket prints the state and the time on a second line under the name, so the name is never cut short. */
@container (max-width: 300px) {
  .tui-tool-call__head { grid-template-columns: var(--tc-stub) auto minmax(0, 1fr) 22px; grid-template-rows: auto auto; row-gap: 2px; padding-block: 7px; }
  .tui-tool-call__stub { grid-area: 1 / 1 / 3 / 2; }
  .tui-tool-call__name { grid-area: 1 / 2 / 2 / 4; }
  .tui-tool-call__state { grid-area: 2 / 2; padding-left: 6px; }
  .tui-lcd.tui-tool-call__time { grid-area: 2 / 3; justify-self: start; min-width: 0; padding: 2px 5px 1px; font-size: 10.5px; }
  .tui-tool-call__head::after { grid-area: 1 / 4 / 3 / 5; }
}

@media (prefers-reduced-motion: reduce) {
  .tui-tool-call__ticket[open] > .tui-tool-call__io { animation: none; }
}

/* ---------------------------------------------------------------- part: toolbar */
/* Toolbar: a rack of keys in one slot cut into the plate, under one tab
   stop. Each key is still its own cap on its own skirt (a plain key, a
   toggle key, a copy key, a menu key); the slot is the key group's, with the
   same 3px of floor round them, so the keys' corners sit concentric with the
   slot's. Clusters are parted by an engraved line cut in the floor and lit
   on its far lip. The row wraps rather than scrolls, so a narrow screen
   gets a second row and never a sideways page. */
:is(tui-toolbar, .tui-toolbar) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  /* End stops, where a finish has them, are the slot's end borders: a key, pressed or not, only ever
     sits on the floor between them, and the floor meets a stop square, as a recess meets a block. */
  border-inline: var(--tui-trim-stop-w, 0px) solid transparent;
  border-radius: calc(var(--tui-r-m) + 3px);
  background: var(--tui-trim-stop, none), var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  vertical-align: middle;
}
:is(tui-toolbar, .tui-toolbar) .tui-key:not(.tui-key--flat) { --h: 32px; --skirt: 1.5px; }
:is(tui-toolbar, .tui-toolbar) .tui-key--icon { width: var(--h); }
/* Keys sit on the slot's floor with the short shadow the segmented control's keys cast, not a lone key's long one: a long one would reach the lit lip under the slot and wash out its edge. Down and held keys keep the pressed drawing. */
:is(tui-toolbar, .tui-toolbar) .tui-key:not(.tui-key--flat, .tui-key--primary) {
  box-shadow: var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 var(--skirt) 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2));
}
:is(tui-toolbar, .tui-toolbar) .tui-key:not(.tui-key--flat, .tui-key--primary):is(:hover, .is-hover) {
  box-shadow: var(--tui-depth-key-hover, var(--tui-depth-key, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), 0 var(--skirt) 0 var(--tui-skirt), 0 2px 4px rgb(var(--tui-sh) / 0.2)));
}
:is(tui-toolbar, .tui-toolbar) .tui-key:not(.tui-key--flat, .tui-key--primary):is(:active, [aria-pressed="true"], [aria-expanded="true"], .is-down) { box-shadow: var(--tui-pressed); }
:is(tui-toolbar, .tui-toolbar) .tui-key:focus-visible, :is(tui-toolbar, .tui-toolbar) .tui-key.is-focus { position: relative; z-index: 1; outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* A column of keys: the arrows go up and down. */
:is(tui-toolbar, .tui-toolbar)[aria-orientation="vertical"] { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
:is(tui-toolbar, .tui-toolbar)[aria-orientation="vertical"] .tui-key { justify-content: flex-start; }

/* A parting line between clusters: a dark cut with the light on its right lip. */
.tui-toolbar__rule {
  flex: none;
  align-self: stretch;
  width: 2px;
  margin: 4px 3px;
  border-radius: 1px;
  background: rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.9));
  box-shadow: 1px 0 0 var(--tui-hl);
}
[aria-orientation="vertical"] > .tui-toolbar__rule { width: auto; height: 2px; margin: 3px 4px; box-shadow: 0 1px 0 var(--tui-hl); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  /* The same box as in Tactile; only the drawing turns to a hairline. */
  .tui-toolbar__rule { background: none; box-shadow: inset 1px 0 0 var(--tui-quiet-line-2); }
  [aria-orientation="vertical"] > .tui-toolbar__rule { box-shadow: inset 0 1px 0 var(--tui-quiet-line-2); }
}

@media (pointer: coarse) {
  :is(tui-toolbar, .tui-toolbar) .tui-key:not(.tui-key--flat) { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(tui-toolbar, .tui-toolbar) .tui-key { transition: none; }
}

/* ---------------------------------------------------------------- part: tooltip */
/* Tooltip: a one-line name on a small label plate, the kind riveted beside a
   control on a rack: the contrast colours, a printed rule just inside the
   edge, and a short tab that points at its key. Flat print, no glass. It
   hangs on the side it is asked for and flips or slides to stay on screen,
   never over its key. tooltip.mjs makes it a role="tooltip" element in the
   top layer; without the script the same plate is drawn from data-tip. */
.tui-tooltip {
  --tui-leader: 50%;
  --tab: 5px;
  position: fixed;
  inset: auto;
  z-index: 60;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(240px, calc(100vw - 16px));
  margin: 0;
  border: 0;
  overflow: visible;
  padding: 5px 9px 6px;
  border-radius: 4px;
  font: 600 13px/1.3 var(--tui-sans);
  letter-spacing: 0.02em;
  text-align: left;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: var(--tui-depth-float, 0 1px 2px rgb(var(--tui-sh) / 0.3), 0 6px 14px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
  /* The printed rule round the plate, a hair inside its edge. */
  outline: 1px solid color-mix(in oklab, var(--tui-cap-ink) 24%, transparent);
  outline-offset: -3px;
  pointer-events: auto;
  user-select: none;
}
.tui-tooltip[popover]:not(:popover-open), .tui-tooltip[hidden] { display: none; }
/* Open but not yet placed: never shown in the wrong spot. */
.tui-tooltip[popover]:popover-open:not([data-placed]) { visibility: hidden; }
.tui-tooltip[data-placed] { animation: tui-tooltip-in 120ms var(--tui-ease); }
@keyframes tui-tooltip-in { from { opacity: 0; } }
/* A tip that follows another while the pointer sweeps along (kit/parts/tooltip.mjs) is there at once. */
.tui-tooltip[data-placed][data-instant] { animation: none; }
/* A plate drawn inside a page, for a specimen. */
.tui-tooltip[data-static] { position: relative; display: inline-flex; animation: none; }

/* The tab: a short point of the plate itself, aimed at the key's centre. */
.tui-tooltip::after {
  content: '';
  position: absolute;
  left: var(--tui-leader);
  top: 100%;
  width: calc(var(--tab) * 2);
  height: var(--tab);
  margin-left: calc(var(--tab) * -1);
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}
.tui-tooltip[data-placed="bottom"]::after, .tui-tooltip[data-static="bottom"]::after { top: auto; bottom: 100%; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tui-tooltip:is([data-placed="left"], [data-placed="right"], [data-static="left"], [data-static="right"])::after { top: var(--tui-leader); left: 100%; width: var(--tab); height: calc(var(--tab) * 2); margin: calc(var(--tab) * -1) 0 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tui-tooltip:is([data-placed="right"], [data-static="right"])::after { left: auto; right: 100%; clip-path: polygon(100% 0, 100% 100%, 0 50%); }

.tui-tooltip__text { min-width: 0; overflow-wrap: anywhere; }
/* A shortcut, printed after the words as outlined caps: printed, not raised. */
.tui-tooltip__kbd { display: inline-flex; gap: 3px; flex: none; }
.tui-tooltip__kbd > span {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 3px;
  font: 500 10px/1 var(--tui-sans);
  letter-spacing: 0.02em;
  color: var(--tui-cap-ink);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tui-cap-ink) 45%, transparent);
}
.tui-tooltip__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tui-tooltip[data-placed] { animation: none; }
}

/* Without the script: the same plate from data-tip, above, on hover and focus.
   Once tooltip.mjs has the trigger (data-tip-live) this stands down. */
[data-tip] { position: relative; }
[data-tip]:not([data-tip-live]):is(:hover, :focus-visible)::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 9px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font: 600 13px/1.3 var(--tui-sans);
  letter-spacing: 0.02em;
  color: var(--tui-cap-ink);
  background: var(--tui-cap);
  box-shadow: var(--tui-depth-float, 0 1px 2px rgb(var(--tui-sh) / 0.3), 0 6px 14px -6px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)));
  outline: 1px solid color-mix(in oklab, var(--tui-cap-ink) 24%, transparent);
  outline-offset: -3px;
  pointer-events: none;
  z-index: 10;
  transition: opacity 120ms var(--tui-ease);
}
/* A pointer that rests on a key gets its plate after a beat; one passing over gets nothing. Focus shows it at once. */
[data-tip]:not([data-tip-live]):hover::after { transition-delay: 300ms; }
@starting-style { [data-tip]:not([data-tip-live]):is(:hover, :focus-visible)::after { opacity: 0; } }

/* ---------------------------------------------------------------- part: tour */
/* Tour: the page dimmed, one element left lit, and a small card beside it.
   The whole thing is one native modal <dialog> laid over the window with no
   fill of its own. The cut-out is a single box with a very wide shadow
   spread (no blur), which paints the dim everywhere except inside itself, so
   the target stays as bright as it is on the page. The card is a plate like a
   popover's. tour.mjs sets the cut-out's and the card's place with left, top,
   width and height, as the page scrolls and resizes. */
dialog.tui-tour {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--tui-ink);
  background: transparent;
  outline: none;
}
dialog.tui-tour::backdrop { background: transparent; }

.tui-tour__spot {
  position: absolute;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.55), 0 0 0 100vmax var(--tui-backdrop);
}

.tui-tour__card {
  position: absolute;
  width: min(340px, calc(100vw - 16px));
  grid-template-columns: minmax(0, 1fr);
  white-space: normal;
  max-height: calc(100dvh - 16px);
  overflow: auto;
  display: grid;
  gap: var(--tui-2);
  padding: var(--tui-4);
  border-radius: var(--tui-r-l);
  font: 400 var(--tui-t-body)/1.5 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-face);
  box-shadow: var(--tui-depth-float, inset 0 1px 0 var(--tui-hl), 0 0 0 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.35)), 0 2px 3px rgb(var(--tui-sh) / 0.25), 0 18px 36px -14px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 2)));
  animation: tui-tour-in 140ms var(--tui-ease);
}
@keyframes tui-tour-in { from { opacity: 0; } }

.tui-tour__head { display: flex; align-items: center; justify-content: space-between; gap: var(--tui-3); }
.tui-tour__count { margin: 0; font-variant-numeric: tabular-nums; }
.tui-tour__title { margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-tour__body { margin: 0; color: var(--tui-ink-2); }
.tui-tour__note { margin: 0; font-size: var(--tui-t-small); color: var(--tui-ink-2); }
.tui-tour__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--tui-2); margin-top: var(--tui-2); }
/* Skip is flat: its words, not its box, sit on the card's left edge, in line with the count and the title above it. */
.tui-tour__skip { margin-inline: calc(var(--tui-2) * -1) auto; }
.tui-tour__card .tui-key:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }

/* Progress: a dot for each step, a longer one for the step you are on. Ink, not colour. */
.tui-tour__marks { display: flex; align-items: center; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tui-tour__marks > li { width: 6px; height: 6px; border-radius: 3px; background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }
.tui-tour__marks > li[data-state="done"] { background: var(--tui-ink-2); box-shadow: none; }
.tui-tour__marks > li[data-state="current"] { width: 16px; background: var(--tui-ink); box-shadow: none; }

/* Said, not shown. */
.tui-tour__live { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A card with no target is in the middle; a narrow window docks it along the bottom edge. */
dialog.tui-tour[data-dock] .tui-tour__card {
  left: 8px;
  right: 8px;
  top: auto;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  width: auto;
}

/* Not a dialog (a specimen in a page, a docs cell): a small stage with the cut-out and the card at the sizes they are given. */
.tui-tour:not(dialog) { position: relative; overflow: hidden; border-radius: var(--tui-r-l); color: var(--tui-ink); background: var(--tui-face); box-shadow: var(--tui-inset); }
.tui-tour:not(dialog) .tui-tour__card { animation: none; }

@media (pointer: coarse) {
  .tui-tour__card .tui-key { --h: 44px; min-width: 44px; padding-inline: var(--tui-5, 20px); }
  .tui-tour__actions { gap: var(--tui-3); }
  .tui-tour__skip { margin-inline-start: calc(var(--tui-5, 20px) * -1); }
}
@media (prefers-reduced-motion: reduce) {
  .tui-tour__card { animation: none; }
}

/* ---------------------------------------------------------------- part: tree-select */
/* Tree select: the combobox's well and card holding the file tree's rows. The
   field shows the picks as the tag input's tokens; the card is a tree whose
   folders open as their chevron turns, whose boxes are the kit's check keys
   (sunk half way, with a bar across, when only some of a folder is picked), and
   whose single pick is set in a recess with its lamp lit, as the file tree's.
   The row under the arrow keys carries the focus ring. Nothing is coloured. */
tui-tree-select { position: relative; display: block; min-width: 0; --ts-row: 34px; }
tui-tree-select[disabled], tui-tree-select[data-fs-disabled] { opacity: 0.45; cursor: not-allowed; }
.tui-tree-select__well { cursor: pointer; }
.tui-tree-select__well:has(.tui-tree-select__input:focus-visible), tui-tree-select.is-focus .tui-tree-select__well { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-tree-select__well::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -5px; height: 3px; border-radius: 2px; background: var(--tui-rocker-bezel); box-shadow: var(--tui-depth-well, inset 0 1px 1px rgb(var(--tui-sh) / 0.6), 0 1px 0 var(--tui-hl)); opacity: 0; transition: opacity 120ms var(--tui-ease); pointer-events: none; }
tui-tree-select[data-open] .tui-tree-select__well::after { opacity: 1; }
tui-tree-select[data-open]:has(.tui-tree-select__card[data-placed="top"]) .tui-tree-select__well::after { opacity: 0; }
.tui-tree-select__input { cursor: pointer; text-overflow: ellipsis; }
.tui-tree-select__input:disabled { cursor: not-allowed; }
.tui-tree-select__token { height: 30px; }
tui-tree-select[data-open] .tui-combobox__key { transform: translateY(1.5px); filter: brightness(0.97); box-shadow: var(--tui-pressed); color: var(--tui-ink); }
tui-tree-select[data-open] .tui-combobox__key::before { transform: scaleY(-1); }
.tui-field[data-error] .tui-tree-select__well { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

/* The tree in the card. */
.tui-tree-select__card { padding: 5px; }
.tui-tree-select__tree, .tui-tree-select__tree ul { margin: 0; padding: 0; list-style: none; }
.tui-tree-select__tree { font-size: var(--tui-t-body); }
.tui-tree-select__tree [role="group"] { position: relative; margin-left: 13px; padding-left: 10px; }
.tui-tree-select__tree [role="treeitem"] { position: relative; }
.tui-tree-select__tree [role="group"] > [role="treeitem"]::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--tui-trace, color-mix(in oklab, var(--tui-ink-3) 55%, transparent));
}
.tui-tree-select__tree [role="group"] > [role="treeitem"]:last-child::before { bottom: auto; height: calc(var(--ts-row) / 2); }
.tui-tree-select__tree [role="group"] > [role="treeitem"] > .tui-tree-select__row::after {
  content: '';
  position: absolute;
  left: -10px;
  top: calc(var(--ts-row) / 2);
  width: 8px;
  border-top: 1px solid var(--tui-trace, color-mix(in oklab, var(--tui-ink-3) 55%, transparent));
}
.tui-tree-select__row { height: var(--ts-row); gap: 8px; }
.tui-tree-select__row.is-active { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 70%, transparent); outline: 2px solid var(--tui-focus); outline-offset: -2px; }
[role="treeitem"][aria-selected="true"] > .tui-tree-select__row.is-active { background: var(--tui-well-fill) var(--tui-well); }
.tui-tree-select__row > .tui-file-tree__name { text-align: left; }
.tui-tree-select__box { width: 16px; height: 16px; }
.tui-tree-select__box:checked::after { left: 5px; top: 2px; width: 4px; height: 8px; }
/* Some of a folder: the key sunk half way, with a bar across it. */
.tui-tree-select__box[data-mixed] {
  transform: translateY(0.75px);
  box-shadow: var(--tui-depth-pressed, inset 0 1px 0 var(--tui-edge-hl, var(--tui-hl)), inset 0 3px 3px -2px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.6)), 0 0.75px 0 var(--tui-skirt), 0 1px 2px rgb(var(--tui-sh) / 0.2));
}
.tui-tree-select__box[data-mixed]::after { content: ''; position: absolute; left: 3.5px; right: 3.5px; top: calc(50% - 1px); height: 2px; border-radius: 1px; background: var(--tui-ink); }
.tui-tree-select__card .tui-file-tree__meta { white-space: nowrap; }
/* A leaf under a folder lines up with the folder's own name. */
.tui-tree-select__tree [role="treeitem"]:not(.is-folder) > .tui-tree-select__row { padding-left: 24px; }

@media (pointer: coarse) {
  tui-tree-select { --ts-row: 44px; }
  .tui-tree-select__token { height: 44px; }
  .tui-tree-select__well { min-height: 52px; }
  .tui-tree-select__well .tui-combobox__input { height: 44px; }
  .tui-tree-select__well .tui-combobox__key { width: 44px; height: 44px; top: 4px; right: 4px; }
  .tui-tree-select__well { padding-right: 52px; }
  .tui-tree-select__tree .tui-file-tree__chevron { width: 16px; height: 16px; }
  .tui-tree-select__box { width: 20px; height: 20px; }
  .tui-tree-select__box:checked::after { left: 7px; top: 3px; width: 5px; height: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-tree-select__tree .tui-file-tree__chevron, .tui-tree-select__well::after { transition: none; }
}

/* ---------------------------------------------------------------- part: treemap */
/* Treemap: shares of a whole as rectangles sized by value, one level at a
   time. A cell is a wash of the blue lamp over the glass with the name printed
   in the display's light, and a cell that opens has a dog-ear in its corner,
   which is a shape and not a colour. The crumb above is plain text keys: the
   level you are in is a word, the ones above it are buttons. A label shows
   only where the cell can hold it. */
.tui-treemap .tcell .cfill { fill: color-mix(in oklab, var(--tui-blue) 40%, var(--tui-vfd-bg)); stroke: none; shape-rendering: crispEdges; }
.tui-treemap .tcell.has .cfill { fill: color-mix(in oklab, var(--tui-blue) 52%, var(--tui-vfd-bg)); }
.tui-treemap .tcell[data-here] .cfill { fill: color-mix(in oklab, var(--tui-blue) 72%, var(--tui-vfd-bg)); }
.tui-treemap .tcell .dog { fill: var(--tui-vfd); }
.tui-treemap .tcell .cname { fill: var(--tui-vfd); font-weight: 600; font-size: 12px; }
.tui-treemap .tcell .cfig { fill: var(--tui-ink-2); font-size: 11px; }
.tui-treemap .tui-chart__over .ring { fill: none; stroke: var(--tui-vfd); stroke-width: 2; }
.tui-treemap__crumb { min-width: 0; }
.tui-treemap__crumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin: 0; padding: 0; list-style: none; font: 500 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink); }
.tui-treemap__crumb li + li::before { content: '/'; margin: 0 6px; color: var(--tui-ink-3); }
.tui-treemap__crumb button { padding: 4px 2px; border: 0; border-radius: var(--tui-r-s); background: none; font: inherit; color: var(--tui-ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tui-treemap__crumb button:hover { color: var(--tui-ink); }
.tui-treemap__crumb button:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-treemap__crumb [aria-current] { font-weight: 700; }

@media (pointer: coarse) {
  .tui-treemap__crumb button, .tui-treemap__crumb [aria-current] { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
  .tui-treemap .tui-chart__plot { min-height: 240px; }
}
@media (max-width: 480px) {
  .tui-treemap .tcell .cname { font-size: 11.5px; }
}

/* ---------------------------------------------------------------- part: tumbler */
/* Tumbler lock: a code on a row of number wheels behind a window cut into
   the plate — chrome in aluminium, black anodised in graphite. Each wheel is
   an eleven-flat drum (a blank, then 0–9) turning on detents; the light on it
   is fixed in the room, so the figures roll through the reflection and it
   never turns with them. A locking bar rests on the wheels; when the code is
   right it drops into their aligned notches and the wheels settle under it.
   tumbler.mjs builds the drums, turns them and runs the states. */

tui-tumbler {
  --tt-w: 36px;          /* a wheel */
  --tt-h: 52px;          /* the window: the read line and most of a flat either side */
  --tt-r: 38px;          /* the drum, from its axle to the middle of a flat */
  --tt-facet: 32.7273deg;/* eleven flats (tumbler.mjs sets it) */
  --tt-face: calc(2 * var(--tt-r) * tan(var(--tt-facet) / 2));
  --tt-size: 21px;
  --tt-drop: 4px;        /* how far the bar falls into the notches */
  position: relative;
  display: inline-grid;
  justify-items: start;
  gap: var(--tui-2);
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
}
.tui-tumbler--lg { --tt-w: 46px; --tt-h: 66px; --tt-r: 48px; --tt-size: 27px; --tt-drop: 5px; }

/* The case: a slot cut into the plate. The wheels stand in it, the bar lies
   along its top, and its walls are drawn over both (the ::after), so the
   upper wall shades them and the lower lip catches the lamp. */
.tui-tumbler__case {
  position: relative;
  display: flex;
  /* Narrower than its wheels at their least (--tt-floor, from tumbler.mjs) it never gets: it gives up width down to that, then holds. */
  min-width: calc(var(--tt-floor, 0px) + 12px);
  max-width: 100%;
  padding: 12px 5px 9px;
  border-radius: 10px;
  background: var(--tui-well-fill) var(--tui-well);
  transition: box-shadow 120ms var(--tui-ease);
}
.tui-tumbler--lg .tui-tumbler__case { padding: 14px 6px 11px; border-radius: 12px; }
.tui-tumbler__case::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: var(--tui-inset);
  pointer-events: none;
}
.tui-tumbler__bank { display: flex; gap: 3px; min-width: 0; }

/* A wheel: its drum seen through the window, with a notch that only lines
   up under the bar on the right code. */
.tui-tumbler__wheel {
  position: relative;
  flex: 0 1 auto;
  width: var(--tt-w);
  min-width: 24px; /* in a narrow container the wheels give up width, down to this */
  height: var(--tt-h);
}
/* 3 · 3 and 4 · 4: a wider rib with a printed dash between the groups. */
.tui-tumbler__wheel--gap { margin-left: 9px; }
.tui-tumbler__wheel--gap::before {
  content: '';
  position: absolute;
  top: calc(50% - 1px);
  left: -8.5px;
  width: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink-2);
  box-shadow: 0 1px 0 var(--tui-hl);
}
.tui-tumbler__drum {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--tui-knob-mid);
  container-type: inline-size;
}
.tui-tumbler__roll { position: absolute; inset: 0; }

/* A flat: its figure printed on it, the edge to the next flat drawn along its
   top. Placed by its angle from the read line (--a, set by the script): up
   the drum by sin, foreshortened by cos. */
.tui-tumbler__face {
  --a: 0deg;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--tt-face);
  margin-top: calc(var(--tt-face) / -2);
  display: grid;
  place-items: center;
  border-top: 1px solid rgb(var(--tui-sh) / 0.34);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--tui-hl) 45%, transparent);
  font: 700 min(var(--tt-size), 62cqi)/1 var(--tui-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--tui-ink);
  text-shadow: 0 1px 0 color-mix(in oklab, var(--tui-hl) 55%, transparent);
  transform: translateY(calc(sin(var(--a)) * var(--tt-r))) scaleY(cos(var(--a)));
  -webkit-user-select: none;
  user-select: none;
}
/* The blank flat: a short printed dash, the way an empty code is written. */
.tui-tumbler__face.is-blank::before {
  content: '';
  width: 34%;
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--tui-hl) 55%, transparent);
}

/* The light on the drum, which does not turn: occlusion under the case's
   walls, a band of the room's brightness above the read line, the horizon
   and the dark floor below it — the way chrome, or anodised black more
   softly, reflects a room lit from above. The wheel's cheeks catch the lamp
   on the left and fall off to the right. */
.tui-tumbler__drum::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgb(var(--tui-sh) / 0.66) 0%,
      rgb(var(--tui-sh) / 0.3) 7%,
      color-mix(in oklab, var(--tui-hl) 78%, transparent) 17%,
      color-mix(in oklab, var(--tui-hl) 44%, transparent) 27%,
      color-mix(in oklab, var(--tui-hl) 16%, transparent) 36%,
      transparent 47%,
      rgb(var(--tui-sh) / 0.07) 58%,
      rgb(var(--tui-sh) / 0.3) 66%,
      rgb(var(--tui-sh) / 0.5) 80%,
      rgb(var(--tui-sh) / 0.78) 100%);
  box-shadow: inset 1px 0 0 color-mix(in oklab, var(--tui-hl) 70%, transparent), inset -1px 0 0 rgb(var(--tui-sh) / 0.35), inset 0 0 0 0.5px rgb(var(--tui-sh) / 0.3);
}
/* The notch in the wheel's rim, in line under the bar only when the code is right. */
.tui-tumbler__drum::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  left: calc(33% - 2px);
  width: calc(34% + 4px);
  height: calc(var(--tt-drop) + 3px);
  border-radius: 0 0 2px 2px;
  background: rgb(var(--tui-sh) / 0.7);
  box-shadow: inset 0 -1px 0 color-mix(in oklab, var(--tui-hl) 50%, transparent);
  opacity: 0;
  transition: opacity 90ms var(--tui-ease);
}

/* The locking bar, lying along the top of the slot, and a tooth over each
   wheel resting on its rim. Steel, lit on its top edge. */
.tui-tumbler__pawl, .tui-tumbler__tooth {
  position: absolute;
  z-index: 2;
  background: linear-gradient(var(--tui-knob-hi), var(--tui-knob-mid) 55%, var(--tui-knob-lo));
  box-shadow: var(--tui-depth-plate, inset 0 1px 0 var(--tui-hl), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8)));
  transition: transform 120ms var(--tui-ease);
  pointer-events: none;
}
.tui-tumbler__pawl { top: 4px; left: 6px; right: 6px; height: 4px; border-radius: 2px; }
.tui-tumbler--lg .tui-tumbler__pawl { top: 5px; height: 5px; }
.tui-tumbler__tooth { top: -6px; left: 33%; width: 34%; height: 7px; border-radius: 0 0 2px 2px; box-shadow: var(--tui-depth-plate, inset 1px 0 0 var(--tui-hl), 0 1px 1.5px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8))); }
.tui-tumbler--lg .tui-tumbler__tooth { top: -7px; height: 8px; }

/* The cursor's wheel, while the lock has focus: a printed bar under it. */
.tui-tumbler__wheel::after {
  content: '';
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: -6px;
  height: 2px;
  border-radius: 1px;
  background: var(--tui-ink);
  opacity: 0;
  transition: opacity 70ms var(--tui-ease);
}
.tui-tumbler__wheel.is-at::after { opacity: 1; }

/* The real input, laid over the wheels: it takes the typing, the paste, the
   autofill and the focus; its own text and caret are never drawn. */
.tui-tumbler__input {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  outline: none;
  background: transparent;
  font: 16px/1 var(--tui-sans); /* 16px, so a phone does not zoom in */
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  cursor: default;
  touch-action: pan-x;
  /* Autofill paints its own background; hold it off indefinitely. */
  transition: background-color 600000s 0s, color 600000s 0s;
}
.tui-tumbler__input::selection { background: transparent; }
tui-tumbler .tui-tumbler__input:focus-visible { outline: none; }

/* The words beside the lock's lamp: how many to type, then what happened. */
.tui-tumbler__status { display: flex; align-items: flex-start; gap: var(--tui-2); min-height: 18px; padding-left: 2px; font-size: var(--tui-t-small); line-height: 1.3; color: var(--tui-ink-2); }
.tui-tumbler__status .tui-lamp { margin-top: 4.3px; }
.tui-tumbler__said { color: var(--tui-ink); }
.tui-tumbler__said:empty { display: none; }
.tui-tumbler__status:has(.tui-tumbler__said:not(:empty)) .tui-tumbler__rest { display: none; }

/* Focus rings the whole slot; hover brightens the wheels a touch. */
tui-tumbler:has(.tui-tumbler__input:focus-visible) .tui-tumbler__case, tui-tumbler.is-focus .tui-tumbler__case { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-tumbler__case:hover .tui-tumbler__bank, tui-tumbler.is-hover .tui-tumbler__bank { filter: brightness(1.03); }

/* Right: the bar drops into the notches, and the wheels settle under it. */
tui-tumbler[data-state="right"] :is(.tui-tumbler__pawl, .tui-tumbler__tooth) { transform: translateY(var(--tt-drop)); }
tui-tumbler[data-state="right"] .tui-tumbler__drum::before { opacity: 1; transition-duration: 0ms; }
tui-tumbler[data-state="right"] .tui-tumbler__roll { animation: tui-tumbler-settle 200ms var(--tui-ease) 90ms both; }
@keyframes tui-tumbler-settle { 45% { transform: translateY(1.5px); } }

/* Wrong: a shake with the code still showing (tumbler.mjs then unwinds it),
   and the slot's lip marked, as a field's is. Failed to check: marked only. */
tui-tumbler[data-state="wrong"] .tui-tumbler__bank { animation: tui-tumbler-shake 300ms linear; }
@keyframes tui-tumbler-shake {
  15% { transform: translateX(-3px); }
  35% { transform: translateX(3px); }
  55% { transform: translateX(-2px); }
  75% { transform: translateX(1.5px); }
}
tui-tumbler:is([data-state="wrong"], [data-state="error"]) .tui-tumbler__case {
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent);
}

/* Disabled: 45% and still. */
/* Part by part, so the words under the wheels keep full ink and read at 4.5:1 (they were dimmed with the rest). */
tui-tumbler:has(.tui-tumbler__input:disabled) > .tui-tumbler__case, tui-tumbler:has(.tui-tumbler__input:disabled) .tui-tumbler__status > :not(.tui-tumbler__rest) { opacity: 0.45; }
tui-tumbler:has(.tui-tumbler__input:disabled) .tui-tumbler__case { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  /* No shake, no settle, no travel: the bar is simply down, every state still shows. */
  tui-tumbler .tui-tumbler__bank, tui-tumbler .tui-tumbler__roll { animation: none !important; }
  .tui-tumbler__pawl, .tui-tumbler__tooth, .tui-tumbler__drum::before, .tui-tumbler__wheel::after { transition: none !important; }
}

/* ---------------------------------------------------------------- part: upgrade-card */
/* Upgrade card: the limit reached, then the upgrade, on one plate. The kit's panel
   holds the token meter, the segmented control (Monthly / Yearly), the kit's keys and
   a short receipt on the receipt's paper. Both faces sit in one grid cell, so the card
   is as tall as the taller of the two and nothing moves when it turns into the new
   plan. The face that is not shown is inert and invisible; the swap is a short fade
   (out faster than in), and none at all under reduced motion. Nothing here is
   coloured: ink, paper and lamp tokens only. See upgrade-card.mjs. */
:is(tui-upgrade-card, .tui-upgrade-card) { display: block; box-sizing: border-box; width: 100%; max-width: 440px; min-width: min(17rem, calc(100vw - 2 * var(--tui-4))); text-align: left; }
/* Concentric: the keys and the receipt sit one gap (the padding) in from the card's edge with the key radius,
   so the card's corner is that radius plus the gap. */
.tui-upgrade-card__card { display: grid; box-sizing: border-box; min-width: 0; padding: var(--tui-4); border-radius: calc(var(--tui-r-m) + var(--tui-4)); }
.tui-upgrade-card__face { grid-area: 1 / 1; display: flex; flex-direction: column; gap: var(--tui-3); min-width: 0; opacity: 0; visibility: hidden; transition: opacity 90ms var(--tui-ease), visibility 0s linear 90ms; }
.tui-upgrade-card__face[data-on] { opacity: 1; visibility: visible; transition: opacity 140ms var(--tui-ease) 60ms, visibility 0s; }
.tui-upgrade-card__title { margin: 0; font: 700 var(--tui-t-lead)/1.25 var(--tui-sans); color: var(--tui-ink); }
.tui-upgrade-card__title:focus-visible { outline: 2px solid var(--tui-focus); outline-offset: 2px; border-radius: 2px; }

/* The meter: status on the left in the kit's sans, the count on the right in the numeric face. */
.tui-upgrade-card__meter { gap: var(--tui-3); }
.tui-upgrade-card__meter .tui-status { font-weight: 600; color: var(--tui-ink); }
.tui-upgrade-card__count { font: 400 var(--tui-t-small)/1.3 var(--tui-sans); color: var(--tui-ink-2); white-space: nowrap; }
.tui-upgrade-card__fig { font: 500 var(--tui-t-small)/1.3 var(--tui-mono); font-variant-numeric: tabular-nums; color: var(--tui-ink); }

/* The offer: the price, what the plan adds and the keys are one group. */
.tui-upgrade-card__offer { display: grid; gap: var(--tui-1); }
.tui-upgrade-card__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--tui-3); margin: 0; }
.tui-upgrade-card__price strong { font: 700 var(--tui-t-h2)/1.25 var(--tui-sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--tui-ink); }
.tui-upgrade-card__saving { font: 600 var(--tui-t-small)/1.25 var(--tui-sans); color: var(--tui-ink); }
.tui-upgrade-card__note { margin: 0; font-size: var(--tui-t-small); line-height: 1.4; color: var(--tui-ink-2); }
.tui-upgrade-card__note[data-error] { font-weight: 600; color: var(--tui-red-ink); }

.tui-upgrade-card__keys { display: flex; justify-content: flex-end; margin-top: var(--tui-3); gap: var(--tui-2); }
.tui-upgrade-card__keys .tui-key { min-width: 0; border-radius: var(--tui-r-m); }
.tui-upgrade-card__go { min-width: 7.5rem; }
.tui-upgrade-card__go .tui-lamp { display: none; }
.tui-upgrade-card__go[aria-busy="true"] .tui-lamp { display: inline-block; animation: tui-blink 1.2s steps(1) infinite; }
.tui-upgrade-card__go[aria-disabled="true"], .tui-upgrade-card__later[aria-disabled="true"] { pointer-events: none; }
.tui-upgrade-card__later[aria-disabled="true"] { opacity: 0.55; }

/* The receipt: the receipt's own table rows on a slip of its paper. */
.tui-upgrade-card__slip { padding: var(--tui-2); border-radius: var(--tui-r-m); color: var(--tui-paper-ink); background: linear-gradient(var(--tui-paper-hi), var(--tui-paper)); box-shadow: 0 1px 1px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.1)); }
.tui-upgrade-card__receipt tbody { border-top: 0; }
/* A row never wraps, so the card is as tall for yearly as for monthly, at 320px too. */
.tui-upgrade-card__receipt th { white-space: nowrap; font: 400 var(--tui-t-label)/1.45 var(--tui-sans); }
.tui-upgrade-card__receipt td { font: 500 12.5px/1.45 var(--tui-mono); font-variant-numeric: tabular-nums; }
.tui-upgrade-card__receipt .tui-receipt__grand > * { font-weight: 700; }
.tui-upgrade-card__receipt .tui-receipt__grand > th { font-family: var(--tui-sans); }
.tui-upgrade-card__receipt tbody > tr:first-child > * { padding-top: 3px; }
.tui-upgrade-card__receipt tbody > tr:last-child > * { padding-bottom: 3px; }

/* Said aloud, never seen. */
.tui-upgrade-card__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
tui-upgrade-card { position: relative; }

@media (pointer: coarse) {
  .tui-upgrade-card__keys .tui-key { --h: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-upgrade-card__face, .tui-upgrade-card__face[data-on] { transition: none; }
  .tui-upgrade-card__go[aria-busy="true"] .tui-lamp { animation: none; }
}

/* ---------------------------------------------------------------- part: uptime-strip */
/* Uptime strip: a row of ticks, one for each day or hour, each a lamp in its
   own slot on a strip of dark glass, with the percentage on an LCD above it.
   A lit green lamp is a period that was up; amber, lit in the lower half only,
   is one that was degraded; red, lit across but cut by a slit, is one that was
   down; a lamp that is out is a period with no reading. The shape says it too,
   so no state is only a colour, and every tick has its date and its state in
   words (for a screen reader in the list, for everyone in the readout under
   the strip). The lamps are the kit's, so each finish draws them its own way. */
/* The spoken words are absolute, so the figure holds them: they cannot widen a page from outside a scroller. */
.tui-uptime { position: relative; display: grid; gap: var(--tui-3); min-width: 0; margin: 0; }
.tui-uptime__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tui-2) var(--tui-4); }
.tui-uptime__title { margin: 0; }
.tui-uptime__lcd { flex: none; }

.tui-uptime__strip {
  --up-h: 30px;
  box-sizing: border-box;
  display: flex;
  gap: 3px;
  height: calc(var(--up-h) + 14px);
  margin: 0;
  padding: 7px;
  list-style: none;
  border-radius: calc(var(--tui-r-s) + 3px);
  background: var(--tui-vfd-bg);
  box-shadow: var(--tui-depth-well, inset 0 2px 6px rgb(0 0 0 / 0.7), inset 0 0 0 1px rgb(255 255 255 / 0.05), 0 1px 0 var(--tui-hl));
  touch-action: pan-y;
}
/* A long run packs its ticks closer, so ninety of them fit a phone. */
.tui-uptime__strip:has(> li:nth-child(46)) { gap: 1px; }
.tui-uptime__tick { position: relative; display: flex; align-items: stretch; flex: 1 1 0; min-width: 0; max-width: 14px; border-radius: 2px; outline: none; }
.tui-uptime__tick:focus-visible, .tui-uptime__tick.is-focus { outline: 2px solid var(--tui-vfd, var(--tui-focus)); outline-offset: 2px; z-index: 1; }
.tui-uptime .tui-uptime__tick > .tui-lamp { position: relative; flex: 1 1 auto; width: 100%; height: 100%; border-radius: 2px; }
.tui-uptime__tick[data-state="up"] > .tui-lamp { --c: var(--tui-green); }
.tui-uptime__tick[data-state="degraded"] > .tui-lamp { --c: var(--tui-amber); height: 52%; align-self: flex-end; }
.tui-uptime__tick[data-state="down"] > .tui-lamp { --c: var(--tui-red); }
/* Down is cut across by a slit; degraded is half height; no reading is a dark socket. */
.tui-uptime__tick[data-state="down"] > .tui-lamp::after { content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--tui-vfd-bg); }
/* A lit tick glows a little, so its neighbours do not blur into one band. */
.tui-uptime .tui-lamp { --tui-glow: 0 0 0 1px rgb(0 0 0 / 0.25), 0 0 4px 0 color-mix(in oklab, currentColor 60%, transparent); }
/* The one the reader is on: a lit cap above it. */
.tui-uptime__tick[data-here]::before { content: ''; position: absolute; left: 50%; top: -6px; width: 5px; height: 2px; margin-left: -2.5px; background: var(--tui-vfd); }
/* Said aloud, never seen. */
/* Stale: the record is as of the last reading (data-stale on it or a region around it). */
.tui-uptime__strip:is([data-stale], [data-stale] *) { opacity: 0.55; }
.tui-uptime__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The readout: the tick the reader is on, or the whole run. */
.tui-uptime__read { min-height: 1.5em; margin: 0; font: 500 var(--tui-t-small)/1.5 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink); }
.tui-uptime__read[data-idle] { color: var(--tui-ink-2); }

/* The legend: the same lamps, with their words. */
.tui-uptime__legend { display: flex; flex-wrap: wrap; gap: 4px var(--tui-4); margin: 0; padding: 0; list-style: none; font: 500 var(--tui-t-small)/1.4 var(--tui-sans); color: var(--tui-ink-2); }
.tui-uptime__legend > li { display: inline-flex; align-items: center; gap: 7px; }
.tui-uptime__key { position: relative; display: inline-flex; flex: none; width: 6px; height: 14px; padding: 0; border-radius: 2px; background: var(--tui-vfd-bg); box-shadow: var(--tui-depth-well, inset 0 1px 1px rgb(0 0 0 / 0.5)); }
.tui-uptime .tui-uptime__key > .tui-lamp { position: relative; flex: 1 1 auto; width: 100%; height: 100%; border-radius: 2px; }
.tui-uptime__key[data-state="degraded"] > .tui-lamp { height: 52%; align-self: flex-end; --c: var(--tui-amber); }
.tui-uptime__key[data-state="up"] > .tui-lamp { --c: var(--tui-green); }
.tui-uptime__key[data-state="down"] > .tui-lamp { --c: var(--tui-red); }
.tui-uptime__key[data-state="down"] > .tui-lamp::after { content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 0.5px); height: 1.5px; background: var(--tui-vfd-bg); }

@media (pointer: coarse) {
  .tui-uptime__strip { --up-h: 38px; }
}
@media (max-width: 480px) {
  .tui-uptime__strip { gap: 2px; padding: 7px 6px; }
}

/* ---------------------------------------------------------------- part: validate */
/* Form validation: what is wrong, said twice. Under each field a line with a
   red lamp lit beside the words, the field's well ringed red (the kit's own
   field error); at the top of the form the alert's window with its legend
   lit red, a count and a list that links to each field. Nothing else changes
   colour. kit/parts/validate.mjs wires it to the browser's own checks. */
tui-validate { display: block; min-width: 0; }
.tui-validate__form { display: grid; gap: var(--tui-4); min-width: 0; }

.tui-validate__summary { animation: tui-rise 220ms var(--tui-ease); }
.tui-validate__summary:focus { outline: none; }
.tui-validate__summary:focus-visible, .tui-validate__summary.is-focus { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
.tui-validate__head { margin: 0 0 var(--tui-1); color: var(--tui-ink); }
.tui-validate__list { display: grid; gap: 4px; margin: 0; padding: 0 0 0 1.1em; }
.tui-validate__list li::marker { color: var(--tui-ink-3); }
.tui-validate__list a { color: var(--tui-ink); }

/* The error under a field: a lamp lit red and the words that say how to put it right. */
.tui-validate__error { display: flex; align-items: baseline; gap: 7px; margin: 0; }
.tui-validate__error .tui-lamp { flex: none; width: 7px; height: 7px; transform: translateY(-1px); }
/* The field's own hint keeps its ink beside an error: only the error is red. */
tui-validate .tui-field[data-error] .tui-hint:not(.tui-validate__error) { color: var(--tui-ink-2); }
tui-validate .tui-hint { margin: 0; }
/* A group of options in error: the same red ring round the tray its keys sit in. */
tui-validate fieldset[data-invalid] :is(.tui-seg, .tui-tray) { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

@media (prefers-reduced-motion: reduce) {
  .tui-validate__summary { animation: none; }
}

/* ---------------------------------------------------------------- part: virtual-list */
/* Virtual list: a long list let into the plate as a recess, drawing only the
   rows in view. The recess, the lamps and the sunk row are the listbox's, so a
   list of ten rows and a list of ten thousand read as the same part. Rows are
   placed by transform inside one tall spacer, in one native scroll container;
   nothing here animates. */
tui-virtual-list { --rows: 8; --vl-row: 44px; position: relative; display: block; min-width: 0; }
tui-virtual-list[data-disabled] { cursor: not-allowed; }
/* Disabled is 45% and still, part by part: the readout under the list keeps full ink so it reads at 4.5:1 (it was dimmed with the rest). */
tui-virtual-list[data-disabled] > :not(.tui-virtual-list__readout) { opacity: 0.45; }
tui-virtual-list[data-disabled] .tui-virtual-list__cap { cursor: not-allowed; }

.tui-virtual-list__frame { position: relative; }

/* The recess. Its padding is the 4px the script counts from; the row corners are the recess's less that padding. */
.tui-virtual-list__list {
  height: calc(var(--rows) * var(--vl-row) + 8px);
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  contain: layout style;
  border-radius: calc(var(--tui-r-m) + 4px);
  font: 400 var(--tui-t-body)/1.25 var(--tui-sans);
  color: var(--tui-ink);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  outline: none;
}
.tui-virtual-list__list:focus-visible, tui-virtual-list.is-focus .tui-virtual-list__list { outline: 2px solid var(--tui-focus); outline-offset: 2px; }
.tui-field[data-error] .tui-virtual-list__list, tui-virtual-list[data-invalid] .tui-virtual-list__list { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--tui-red) 85%, transparent), 0 0 8px -2px color-mix(in oklab, var(--tui-red) 45%, transparent), var(--tui-inset); }

.tui-virtual-list__space { position: relative; width: 100%; }

/* A row is a slot one pixel taller than its cap each side, so two chosen rows never touch. */
.tui-virtual-list__row { position: absolute; top: 0; left: 0; right: 0; box-sizing: border-box; padding-block: 1px; }
tui-virtual-list[data-fixed] .tui-virtual-list__row { height: var(--vl-row); }

.tui-virtual-list__cap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  box-sizing: border-box;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--tui-r-m);
  font-weight: 500;
  color: var(--tui-ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
tui-virtual-list[data-fixed] .tui-virtual-list__cap { height: 100%; min-height: 0; padding-block: 0; overflow: hidden; }
tui-virtual-list[data-selectable] .tui-virtual-list__cap { grid-template-columns: 14px minmax(0, 1fr); padding-left: 9px; }
.tui-virtual-list__cell { min-width: 0; }
.tui-virtual-list__text { display: block; min-width: 0; overflow-wrap: anywhere; }
tui-virtual-list[data-fixed] .tui-virtual-list__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The lamp: dark until the row is chosen; amber for one choice, green for several, as the listbox's are. */
tui-virtual-list:not([data-selectable]) .tui-virtual-list__cap::before { content: none; }
.tui-virtual-list__cap::before {
  --c: var(--tui-amber);
  content: '';
  justify-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 25%, transparent), transparent 55%), color-mix(in oklab, var(--c) 22%, var(--tui-face-lo));
  box-shadow: inset 0 1px 1.5px rgb(var(--tui-sh) / 0.45), 0 1px 0 var(--tui-hl);
}
tui-virtual-list[data-selectable="multiple"] .tui-virtual-list__cap::before { --c: var(--tui-green); }

/* What a row may hold: a first line, a second, and a figure at the end. */
.tui-virtual-list__primary { display: block; color: var(--tui-ink); font-weight: 500; }
.tui-virtual-list__secondary { display: block; font: 400 var(--tui-t-small)/1.35 var(--tui-sans); color: var(--tui-ink-2); }
.tui-virtual-list__line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.tui-virtual-list__line > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tui-virtual-list__figure { flex: none; font: 400 var(--tui-t-small)/1.2 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); white-space: nowrap; }

@media (hover: hover) {
  tui-virtual-list:not([data-disabled]) .tui-virtual-list__cap:hover { color: var(--tui-ink); background: color-mix(in oklab, var(--tui-face-hi) 40%, transparent); }
}

/* Chosen: a cap let down into the floor, the plate's edge shading its top. */
.tui-virtual-list__row[aria-selected="true"] > .tui-virtual-list__cap {
  color: var(--tui-ink);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-pressed);
  filter: brightness(0.97);
}
.tui-virtual-list__row[aria-selected="true"] > .tui-virtual-list__cap::before { background: radial-gradient(circle at 35% 30%, color-mix(in oklab, white 85%, transparent), transparent 45%), var(--c); box-shadow: var(--tui-glow); }
.tui-virtual-list__row[aria-selected="true"] .tui-virtual-list__primary, .tui-virtual-list__row[aria-selected="true"] .tui-virtual-list__text { font-weight: 600; }
/* Under the arrow keys: the ring is on the row while the list holds the focus. */
.tui-virtual-list__list:focus-visible .tui-virtual-list__row.is-active > .tui-virtual-list__cap, tui-virtual-list.is-focus .tui-virtual-list__row.is-active > .tui-virtual-list__cap { outline: 2px solid var(--tui-focus); outline-offset: -2px; }

.tui-virtual-list__empty { position: absolute; inset: 4px; display: grid; place-content: center; margin: 0; padding: 16px; text-align: center; font: 400 var(--tui-t-body)/1.4 var(--tui-sans); color: var(--tui-ink-2); pointer-events: none; }
.tui-virtual-list__empty[hidden] { display: none; }

/* Plain text under the list. */
.tui-virtual-list__readout { margin: 6px 0 0; padding-left: 2px; font: 400 var(--tui-t-small)/1.3 var(--tui-sans); font-variant-numeric: tabular-nums; color: var(--tui-ink-2); }
.tui-virtual-list__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Before the script: a plain list of the items, scrolling in the recess. */
tui-virtual-list:not(:defined) > :is(ul, ol) { max-height: calc(var(--rows) * 36px); margin: 0; padding: 8px 12px 8px 28px; overflow-y: auto; border-radius: calc(var(--tui-r-m) + 4px); color: var(--tui-ink); background: var(--tui-well-fill) var(--tui-well); box-shadow: var(--tui-inset); }

@scope ([data-volume="quiet"], [data-finish="chalk"], [data-finish="carbon"]) to ([data-volume="tactile"], [data-finish]:not([data-finish="chalk"], [data-finish="carbon"], [data-volume="quiet"], [data-volume="quiet"] *)) {
  .tui-virtual-list__row[aria-selected="true"] > .tui-virtual-list__cap { filter: none; background: var(--tui-quiet-key-down); }
}

@media (pointer: coarse) {
  .tui-virtual-list__cap { min-height: 42px; }
  .tui-virtual-list__list { font-size: 16px; }
  .tui-virtual-list__secondary, .tui-virtual-list__figure { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .tui-virtual-list__list { scroll-behavior: auto; }
  .tui-virtual-list__cap { transition: none; }
}

/* ---------------------------------------------------------------- part: voice-note */
/* Voice note: kit parts in a recess. look="row" is a composer's height; look="card" a plate of its own. The level is
   the kit's LED matrix, the time its LCD, the keys its keys; this file only sets them out and holds no colour. */
tui-voice-note { position: relative; display: block; min-width: 0; }
.tui-voice-note__face {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
}
tui-voice-note[data-state="denied"] .tui-voice-note__time { display: none; }
tui-voice-note:not([data-state="denied"]) .tui-voice-note__words { white-space: nowrap; }
/* The blocked line wraps inside the recess, even in a container that keeps its text on one line. */
tui-voice-note[data-state="denied"] .tui-voice-note__words { white-space: normal; text-align: start; }
.tui-voice-note__state { display: inline-flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; font: 500 var(--tui-t-small)/1.2 var(--tui-sans); color: var(--tui-ink-2); }
.tui-voice-note__level { position: relative; display: block; flex: 1 1 auto; min-width: 0; }
.tui-voice-note__level > tui-matrix { display: block; width: 100%; }
/* Playing: what is still to come sits under more of the window's own smoked acrylic; what has been heard is lit. */
.tui-voice-note__dim { position: absolute; inset: 0 0 0 calc(var(--played, 1) * 100%); background: color-mix(in oklab, var(--tui-vfd-bg) 55%, transparent); pointer-events: none; border-radius: inherit; }
tui-voice-note:not([data-state="playing"]) .tui-voice-note__dim { display: none; }
/* Kept places: an empty slot the size of its key, so the keys never move under a second press. */
.tui-voice-note__keys [data-kept] { visibility: hidden; }
/* Stop, Play and Pause share one place: one width for the three, so nothing shifts when one becomes the next. */
.tui-voice-note__keys :is([data-act="stop"], [data-act="play"]) { min-width: 5.6em; }
.tui-voice-note__time { flex: none; min-width: 4.2ch; padding: 4px 7px; border-radius: 5px; font: 600 13px/1 var(--tui-mono); text-align: center; font-variant-numeric: tabular-nums; }
.tui-voice-note__keys { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Said aloud, never seen. */
.tui-voice-note__said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Row: one line, a composer's height. The words give way to the level while there is one to show. */
/* Short of room (a phone, three keys), the keys go under the recess instead of squeezing the level. */
tui-voice-note[look="row"] { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
tui-voice-note[look="row"] .tui-voice-note__face { flex: 1 1 15rem; min-height: 44px; padding-block: 5px; box-sizing: border-box; }
tui-voice-note[look="row"] .tui-voice-note__level { border-radius: 6px; overflow: hidden; }
tui-voice-note[look="row"] .tui-voice-note__keys { flex-wrap: nowrap; }
tui-voice-note[look="row"]:is([data-state="recording"], [data-state="review"], [data-state="playing"]) .tui-voice-note__words { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* No take yet, or none to show: no level, and the words (the blocked line too) take the whole recess. */
tui-voice-note[look="row"]:not(:is([data-state="recording"], [data-state="review"], [data-state="playing"])) .tui-voice-note__level { display: none; }
tui-voice-note[look="row"] .tui-voice-note__state { flex: 1 1 auto; }
tui-voice-note[look="row"]:is([data-state="recording"], [data-state="review"], [data-state="playing"]) .tui-voice-note__state { flex: none; }

/* Card: the state and the time over the level, the keys under it. */
tui-voice-note[look="card"] { display: grid; gap: 12px; }
tui-voice-note[look="card"] .tui-voice-note__face { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px; }
tui-voice-note[look="card"] .tui-voice-note__level { grid-column: 1 / -1; grid-row: 2; }
/* The state measures its own room: too little for its words beside the time, the words give way (as in the row) and
   the lamp and the time keep one line. */
tui-voice-note[look="card"] .tui-voice-note__state { container-type: inline-size; }
@container (max-width: 96px) {
  tui-voice-note[look="card"]:is([data-state="recording"], [data-state="review"], [data-state="playing"]) .tui-voice-note__words { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* Three keys short of room. In the row they go under the field and fill its width in their places, so their edges
   line up with the field's; on the card Send takes a row of its own at full width. The field takes the spare room
   on a line it shares with the keys, so there they keep their own size. */
tui-voice-note[look="row"] .tui-voice-note__face { flex-grow: 1000; }
tui-voice-note[look="row"] .tui-voice-note__keys { flex: 1 1 auto; justify-content: flex-end; max-width: 100%; }
tui-voice-note:is([data-state="recording"], [data-state="review"], [data-state="playing"]) .tui-voice-note__keys > .tui-key { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- part: waterfall */
/* Waterfall: a gain is a solid green bar with a plus above it; a loss is a
   hatched red bar with a minus below it; a start or a total is the display's
   own light, standing on the zero line. Direction is told by fill and by sign
   as well as by lamp, so it holds in greyscale. The dashed steps between bars
   sit at the running figure. */
.tui-waterfall .mbar { stroke: none; shape-rendering: crispEdges; }
.tui-waterfall .mbar.gain { fill: var(--tui-green); }
.tui-waterfall .mbar.total { fill: var(--tui-vfd); }
.tui-waterfall .loss-ground { fill: var(--tui-red); }
.tui-waterfall .loss-ink { fill: var(--tui-vfd-bg); }
.tui-waterfall .mbar.loss { stroke: var(--tui-red); stroke-width: 1.5; }
.tui-waterfall .steps line { stroke: var(--tui-ink-3); stroke-width: 1; stroke-dasharray: 2 3; shape-rendering: crispEdges; }
.tui-waterfall .cfig { fill: var(--tui-ink); font-weight: 600; }
.tui-waterfall .mbar[data-here] { stroke: var(--tui-vfd); stroke-width: 1.5; }
.tui-waterfall .tui-chart__swatch.k-gain { background: var(--tui-green); }
.tui-waterfall .tui-chart__swatch.k-loss { background: repeating-linear-gradient(135deg, var(--tui-vfd-bg) 0 1.6px, var(--tui-red) 1.6px 4.2px); box-shadow: inset 0 0 0 1.5px var(--tui-red); }
.tui-waterfall .tui-chart__swatch.k-total { background: var(--tui-vfd); }

@media (pointer: coarse) {
  .tui-waterfall .tui-chart__plot { min-height: 240px; }
}
@media (max-width: 480px) {
  .tui-waterfall .cfig { font-size: 10.5px; }
}

/* ---------------------------------------------------------------- part: wax-tablet */
/* Wax tablet: a wooden tablet with a bed of wax, a steel stylus resting in a
   tray in its bottom rail, and one raking lamp from the top left. The wax is
   the lamp amber folded into the finish's own face, so aluminium gets a pale
   beeswax and graphite a dark wax; the wood is the same amber and red folded
   into the shadow colour, so it is walnut on both. The groove is five copies
   of one SVG path, each pushed a little toward or away from the lamp: the
   lit near lip, the shadow past the far lip, the dark cut, its lit far wall
   and its deepest line. Tokens only: no colour is written here. */

.tui-waxtablet {
  --wt-f: 12px;           /* the frame's side and top rails */
  --wt-fb: 30px;          /* the bottom rail, which holds the stylus tray */
  --wt-pl: min(132px, calc(var(--wt-w) * 0.7));
  /* darker on a darker finish: graphite's deeper shadow (--tui-sh-a) sinks its wax toward black wax */
  --wt-wax: color-mix(in oklab, color-mix(in oklab, var(--tui-amber) 42%, var(--tui-face)), rgb(var(--tui-sh)) max(0%, (var(--tui-sh-a) - 0.24) * 80%));
  --wt-wax-hi: color-mix(in oklab, var(--wt-wax) 62%, color-mix(in oklab, var(--tui-amber) 45%, var(--tui-white)));
  --wt-wax-lo: color-mix(in oklab, var(--wt-wax) 72%, rgb(var(--tui-sh)));
  --wt-cut: color-mix(in oklab, color-mix(in oklab, var(--wt-wax) 70%, var(--tui-amber)) 55%, rgb(var(--tui-sh)));
  --wt-wall: color-mix(in oklab, var(--wt-wax-hi) 70%, var(--tui-white));
  --wt-wood: color-mix(in oklab, color-mix(in oklab, var(--tui-amber) 70%, var(--tui-red)) 44%, rgb(var(--tui-sh)));
  --wt-wood-hi: color-mix(in oklab, var(--wt-wood) 80%, var(--tui-white));
  --wt-wood-lo: color-mix(in oklab, var(--wt-wood) 55%, rgb(var(--tui-sh)));
  --wt-steel-hi: color-mix(in oklab, var(--tui-white) 94%, rgb(var(--tui-sh)));
  --wt-steel: color-mix(in oklab, var(--tui-white) 58%, rgb(var(--tui-sh)));
  --wt-steel-lo: color-mix(in oklab, var(--tui-white) 26%, rgb(var(--tui-sh)));
  --wt-dir: 0deg;
  --wt-curl: 0.4;
  position: relative;
  display: inline-grid;
  justify-items: start;
  gap: var(--tui-3);
  max-width: 100%;
}

/* The tablet: walnut, straight grain, its outer edge caught by the lamp. */
.tui-waxtablet__stage {
  position: relative;
  width: calc(var(--wt-w) + var(--wt-f) * 2);
  height: calc(var(--wt-h) + var(--wt-f) + var(--wt-fb));
  max-width: 100%;
  border-radius: 9px;
  background:
    radial-gradient(130% 150% at 0% 0%, color-mix(in oklab, var(--tui-white) 16%, transparent), transparent 55%),
    radial-gradient(38% 9% at 78% 8%, color-mix(in oklab, var(--wt-wood-lo) 55%, transparent), transparent),
    radial-gradient(30% 7% at 22% 93%, color-mix(in oklab, var(--wt-wood-lo) 50%, transparent), transparent),
    radial-gradient(5% 20% at 2.5% 55%, color-mix(in oklab, var(--wt-wood-lo) 45%, transparent), transparent),
    repeating-linear-gradient(177.2deg, transparent 0 3px, color-mix(in oklab, var(--wt-wood-lo) 50%, transparent) 3px 4px, transparent 4px 9px),
    repeating-linear-gradient(182.4deg, transparent 0 8px, color-mix(in oklab, var(--wt-wood-hi) 22%, transparent) 8px 10px, transparent 10px 19px),
    repeating-linear-gradient(179.4deg, transparent 0 23px, color-mix(in oklab, var(--wt-wood-lo) 45%, transparent) 23px 27px, transparent 27px 41px),
    linear-gradient(to bottom, var(--wt-wood-hi), var(--wt-wood) 30%, var(--wt-wood-lo));
  box-shadow:
    inset 1px 1px 0 color-mix(in oklab, var(--tui-white) 34%, transparent),
    inset -1px -1px 0 rgb(var(--tui-sh) / 0.5),
    0 3px 0 color-mix(in oklab, var(--wt-wood-lo) 80%, rgb(var(--tui-sh))),
    0 4px 1px rgb(var(--tui-sh) / 0.4),
    0 6px 10px -2px rgb(var(--tui-sh) / 0.35),
    0 16px 28px -12px rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 1.8));
  touch-action: none;
}

/* Grain fibre over the wood, and the stylus tray cut into the bottom rail. */
.tui-waxtablet__stage::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--tui-noise);
  background-size: 180px 60px;
  mix-blend-mode: overlay;
  opacity: 0.55;
  pointer-events: none;
}
.tui-waxtablet__stage::after {
  content: '';
  position: absolute;
  left: calc(var(--wt-f) + 8px);
  bottom: 10px;
  width: calc(var(--wt-pl) + 10px);
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to bottom, var(--wt-wood-lo), color-mix(in oklab, var(--wt-wood) 70%, rgb(var(--tui-sh))));
  box-shadow:
    inset 0 2px 3px rgb(var(--tui-sh) / 0.75),
    inset 0 -1px 0 color-mix(in oklab, var(--tui-white) 10%, transparent),
    0 1px 0 color-mix(in oklab, var(--tui-white) 22%, transparent);
}

/* The wax: set into the frame, the lamp pooled at the top left, a raking glint
   across it, faint marks from the last smoothing, and fine grain over all. */
.tui-waxtablet__bed {
  position: absolute;
  left: var(--wt-f);
  top: var(--wt-f);
  width: calc(100% - var(--wt-f) * 2);
  height: var(--wt-h);
  border-radius: 3px;
  overflow: hidden;
  background:
    linear-gradient(118deg, transparent 22%, color-mix(in oklab, var(--tui-white) 22%, transparent) 33%, color-mix(in oklab, var(--tui-white) 8%, transparent) 40%, transparent 50%),
    radial-gradient(90% 120% at 4% 0%, color-mix(in oklab, var(--wt-wax-hi) 85%, transparent), transparent 72%),
    radial-gradient(70% 90% at 100% 100%, color-mix(in oklab, var(--tui-amber) 16%, transparent), transparent 70%),
    linear-gradient(160deg, var(--wt-wax-hi), var(--wt-wax) 42%, var(--wt-wax-lo));
  box-shadow:
    inset 3px 3px 5px rgb(var(--tui-sh) / 0.5),
    inset -4px -4px 12px color-mix(in oklab, var(--tui-amber) 14%, transparent),
    inset 1px 1px 1px rgb(var(--tui-sh) / 0.45),
    inset -1px -1px 0 color-mix(in oklab, var(--wt-wax-hi) 60%, transparent),
    0 0 0 1px rgb(var(--tui-sh) / 0.35),
    1px 1px 0 1px color-mix(in oklab, var(--tui-white) 18%, transparent);
}
.tui-waxtablet__bed::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tui-noise);
  mix-blend-mode: soft-light;
  opacity: 0.45;
  pointer-events: none;
}

.tui-waxtablet__wax { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* The cut. Widths in the stage's own pixels. */
.tui-waxtablet__cut path { stroke-linecap: round; stroke-linejoin: round; }
/* The light reads from the inside of the cut, never from a halo round it:
   the near wall (top left) falls into shadow, the far wall (bottom right)
   faces the lamp and is lit right up to the edge; outside, only a faint glint
   on the wax pushed up beside the near wall and a hair of shade past the far
   one, the burr a stylus leaves. */
.tui-waxtablet__lip-sh { stroke: rgb(var(--tui-sh) / 0.14); stroke-width: 5.6px; translate: 1.4px 1.6px; filter: blur(0.7px); }
.tui-waxtablet__lip-hl { stroke: color-mix(in oklab, var(--wt-wax-hi) 50%, var(--tui-white)); stroke-width: 5.2px; translate: -1.2px -1.3px; opacity: 0.38; filter: blur(0.5px); }
.tui-waxtablet__groove { stroke: var(--wt-cut); stroke-width: 4.6px; }
.tui-waxtablet__floor { stroke: color-mix(in oklab, var(--wt-cut) 35%, rgb(var(--tui-sh))); stroke-width: 2.6px; translate: -0.75px -0.85px; filter: blur(0.3px); }
.tui-waxtablet__wall { stroke: var(--wt-wall); stroke-width: 1.5px; translate: 1.15px 1.25px; filter: blur(0.15px); }

/* The flat edge that smooths the wax on Clear: steel, a roll of wax pushed
   ahead of it, fresh glossy wax left behind. Only seen while it sweeps. */
.tui-waxtablet__blade {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  margin-left: -7px;
  background: linear-gradient(to right, var(--wt-steel-lo), var(--wt-steel-hi) 35%, var(--wt-steel) 60%, var(--wt-steel-lo));
  box-shadow: 2px 0 3px rgb(var(--tui-sh) / 0.45);
  opacity: 0;
  pointer-events: none;
}
.tui-waxtablet__blade::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: 56px;
  background: linear-gradient(to left, color-mix(in oklab, var(--tui-white) 26%, transparent), transparent);
}
.tui-waxtablet__blade::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(100% + 1px);
  width: 5px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(to right, var(--wt-wax-hi), var(--wt-wax) 60%, var(--wt-wax-lo));
  box-shadow: 1px 0 2px rgb(var(--tui-sh) / 0.4);
}
.tui-waxtablet[data-sweep] .tui-waxtablet__blade { opacity: 1; }

/* The stylus: one steel rod, a point at one end and the flat blade Romans
   smoothed wax with at the other. At rest it lies in the tray; held, it
   stands up from the wax, foreshortened, its tip on the pointer. Its shadow
   pivots on the tip, so it meets the pen when the tip is down and parts from
   it when the pen is lifted. */
.tui-waxtablet__pen,
.tui-waxtablet__shadow {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--wt-pl);
  height: 10px;
  margin-top: -5px;
  transform-origin: 0 50%;
  pointer-events: none;
  clip-path: polygon(0 50%, 15% 28%, 71% 26%, 72.5% 18%, 75.5% 18%, 77% 30%, 84% 34%, 100% 6%, 100% 94%, 84% 66%, 77% 70%, 75.5% 82%, 72.5% 82%, 71% 74%, 15% 72%);
}
.tui-waxtablet__pen {
  z-index: 3;
  background:
    linear-gradient(to right, rgb(var(--tui-sh) / 0.35), transparent 14%, transparent 71%, rgb(var(--tui-sh) / 0.2) 72%, transparent 76%),
    linear-gradient(to bottom, var(--wt-steel-lo) 4%, var(--wt-steel-hi) 26%, var(--wt-steel) 44%, var(--wt-steel-lo) 74%, var(--wt-steel) 92%);
}
.tui-waxtablet__shadow {
  z-index: 2;
  background: rgb(var(--tui-sh) / 0.5);
  filter: blur(1.4px);
}

.tui-waxtablet[data-pen='rest'] .tui-waxtablet__pen {
  transform: translate(calc(var(--wt-f) + 13px), calc(var(--wt-h) + var(--wt-f) + var(--wt-fb) - 15px)) rotate(0deg) scaleX(1);
}
.tui-waxtablet[data-pen='rest'] .tui-waxtablet__shadow {
  transform: translate(calc(var(--wt-f) + 14px), calc(var(--wt-h) + var(--wt-f) + var(--wt-fb) - 13px)) rotate(0deg) scaleX(1);
  opacity: 0.7;
}
.tui-waxtablet[data-pen='hover'] .tui-waxtablet__pen,
.tui-waxtablet[data-pen='down'] .tui-waxtablet__pen {
  transform: translate(calc(var(--wt-f) + var(--wt-px)), calc(var(--wt-f) + var(--wt-py))) rotate(-50deg) scaleX(0.66);
}
.tui-waxtablet[data-pen='hover'] .tui-waxtablet__shadow {
  transform: translate(calc(var(--wt-f) + var(--wt-px) + 7px), calc(var(--wt-f) + var(--wt-py) + 8px)) rotate(-29deg) scaleX(0.74);
  opacity: 0.55;
}
.tui-waxtablet[data-pen='down'] .tui-waxtablet__shadow {
  transform: translate(calc(var(--wt-f) + var(--wt-px) + 0.5px), calc(var(--wt-f) + var(--wt-py) + 0.5px)) rotate(-29deg) scaleX(0.76);
}
.tui-waxtablet[data-glide] :is(.tui-waxtablet__pen, .tui-waxtablet__shadow) {
  transition: transform 240ms var(--tui-ease), opacity 240ms var(--tui-ease);
}

/* The curl of wax lifting off the tip as it cuts: a shaving that turns with
   the stroke and grows as the stroke goes on. */
.tui-waxtablet__nib {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 10px;
  height: 10px;
  margin: -5px;
  border: 2.4px solid var(--wt-wall);
  border-left-color: transparent;
  border-bottom-color: var(--wt-wax-hi);
  border-radius: 50%;
  filter: drop-shadow(0.8px 1px 0.6px rgb(var(--tui-sh) / 0.55));
  transform: translate(calc(var(--wt-f) + var(--wt-px)), calc(var(--wt-f) + var(--wt-py))) rotate(var(--wt-dir)) translate(-4px, 4.5px) rotate(-30deg) scale(var(--wt-curl));
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms var(--tui-ease);
}
.tui-waxtablet__nib::after {
  content: '';
  position: absolute;
  inset: 1.2px;
  border: 1.4px solid var(--wt-wax);
  border-top-color: transparent;
  border-radius: 50%;
}
.tui-waxtablet__nib[data-down] { opacity: 1; }

/* The stylus control: a transparent button laid exactly over the wax, so a
   pointer or a finger can draw anywhere on it. Once the script has the pen
   in hand, the pen's own tip is the pointer, so the arrow is hidden. */
.tui-waxtablet__stylus {
  position: absolute;
  left: var(--wt-f);
  top: var(--wt-f);
  width: min(var(--wt-w), 100% - var(--wt-f) * 2);
  height: var(--wt-h);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: crosshair;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.tui-waxtablet:is([data-pen='hover'], [data-pen='down']) .tui-waxtablet__stylus { cursor: none; }
.tui-waxtablet__stylus:focus-visible {
  outline: 2px solid var(--tui-focus);
  outline-offset: 3px;
}
.tui-waxtablet__stylus:disabled { cursor: not-allowed; }
.tui-waxtablet:has(.tui-waxtablet__stylus:disabled) .tui-waxtablet__bed { filter: saturate(0.6); opacity: 0.8; }

.tui-waxtablet__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tui-2);
  justify-content: space-between;
  width: 100%;
  contain: inline-size; /* the tablet sets the width; a longer readout wraps, never widens the part */
}
.tui-waxtablet__keys { display: flex; gap: var(--tui-1); margin-left: auto; }

.tui-waxtablet__plate {
  padding: 3px var(--tui-2);
  border-radius: var(--tui-r-s);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-waxtablet__digit {
  font: 600 11px/1.3 var(--tui-mono);
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--tui-ink-2);
}

.tui-waxtablet__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Compact: the readout and the keys are dropped, for a thumbnail or a dense row. */
.tui-waxtablet--compact .tui-waxtablet__foot { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tui-waxtablet__nib,
  .tui-waxtablet[data-glide] :is(.tui-waxtablet__pen, .tui-waxtablet__shadow) { transition: none; }
}

/* ---------------------------------------------------------------- part: workspace-switcher */
/* Workspace switcher: a row of key switches on a console plate. Each
   workspace is a lock cylinder with its own key standing in the plug; choose
   one and its key turns a quarter-turn from the off mark to the on mark and
   the lamp above it lights, while the key that had been on turns back. The
   engraved plate under the cylinders names whichever desk is now on, matched
   to the turned key in CSS alone, by position. Native radios underneath; no
   script. The key carries no lettering, so nothing reads sideways once it
   turns. */
.tui-wkspswitch {
  display: inline-flex;
  flex-direction: column;
  gap: var(--tui-4);
  margin: 0;
  border: 0;
  padding: var(--tui-4) var(--tui-5) var(--tui-4);
  border-radius: var(--tui-r-l);
  background: var(--tui-raised-fill);
  box-shadow: var(--tui-raised);
}
.tui-wkspswitch__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tui-wkspswitch__keys { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--tui-4) var(--tui-5); }
.tui-wkspswitch__key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--tui-2);
  min-width: 64px;
  cursor: pointer;
}
.tui-wkspswitch__key input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
/* The lamp over each cylinder, dark until its key is on. */
.tui-wkspswitch__key::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  color: var(--tui-amber);
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--tui-white) 25%, transparent), transparent 55%), color-mix(in oklab, var(--tui-amber) 22%, var(--tui-face-lo));
  box-shadow: var(--tui-inset);
  transition: background 140ms var(--tui-ease), box-shadow 140ms var(--tui-ease);
}
/* The cylinder: a turned bezel with its two marks engraved, off at twelve o'clock and on at three. */
.tui-wkspswitch__slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--tui-skirt) 0 60%, transparent 61%),
    repeating-conic-gradient(from 0deg, var(--tui-face-hi) 0 2deg, var(--tui-face) 2deg 4deg),
    var(--tui-face);
  box-shadow: var(--tui-raised);
}
.tui-wkspswitch__slot::before,
.tui-wkspswitch__slot::after {
  content: '';
  position: absolute;
  border-radius: 1px;
  background: var(--tui-ink-3);
}
.tui-wkspswitch__slot::before { top: 3px; left: calc(50% - 1px); width: 2px; height: 5px; }
.tui-wkspswitch__slot::after { right: 3px; top: calc(50% - 1px); width: 5px; height: 2px; background: var(--tui-amber); opacity: 0.55; }
/* The plug and its key turn together. */
.tui-wkspswitch__blade {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, var(--tui-face), var(--tui-face-lo) 70%, var(--tui-skirt));
  box-shadow: var(--tui-inset);
  transform: rotate(0deg);
  transition: transform 420ms var(--tui-ease);
}
/* The key's head, standing out of the plug: a steel paddle with a ring hole, shading across its width, its shadow on the plug. */
.tui-wkspswitch__bow {
  position: relative;
  width: 14px;
  height: 46px;
  border-radius: 7px;
  font-size: 0;
  color: transparent;
  background: linear-gradient(90deg, var(--tui-skirt), var(--tui-face-hi) 35%, var(--tui-face) 62%, var(--tui-face-lo) 85%, var(--tui-skirt));
  box-shadow: var(--tui-raised);
}
.tui-wkspswitch__bow::after {
  content: '';
  position: absolute;
  top: 5px;
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tui-skirt);
  box-shadow: var(--tui-inset);
}
.tui-wkspswitch__shaft, .tui-wkspswitch__bit { display: none; }
.tui-wkspswitch__name {
  font: 600 10px/1 var(--tui-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tui-ink-3);
}
/* On: the key turned to the on mark, the lamp lit, its name printed dark. */
.tui-wkspswitch__key:has(input:checked)::before {
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--tui-white) 85%, transparent), transparent 45%), var(--tui-amber);
  box-shadow: var(--tui-glow);
}
.tui-wkspswitch__key input:checked ~ .tui-wkspswitch__slot .tui-wkspswitch__blade { transform: rotate(90deg); }
.tui-wkspswitch__key input:checked ~ .tui-wkspswitch__slot::after { opacity: 1; }
.tui-wkspswitch__key input:checked ~ .tui-wkspswitch__name { color: var(--tui-ink); }
.tui-wkspswitch__key input:focus-visible ~ .tui-wkspswitch__slot { outline: 2px solid var(--tui-focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  /* A hand on a key that is off: it gives a few degrees, ready to turn. */
  .tui-wkspswitch__key:hover input:not(:checked) ~ .tui-wkspswitch__slot .tui-wkspswitch__blade { transform: rotate(8deg); }
}
.tui-wkspswitch__key input:disabled ~ .tui-wkspswitch__slot { opacity: 0.45; cursor: not-allowed; }

/* The desk plate: an engraved strip screwed to the console, one name per
   workspace, only the one whose key is on shown, matched by position alone. */
.tui-wkspswitch__desk {
  position: relative;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) 7px;
  align-items: center;
  gap: var(--tui-3);
  min-height: 1.4em;
  padding: var(--tui-2) var(--tui-2);
  border-radius: var(--tui-r-s);
  background: var(--tui-well-fill) var(--tui-well);
  box-shadow: var(--tui-inset);
  font: 500 12px/1.3 var(--tui-mono);
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--tui-ink);
}
.tui-wkspswitch__desk::before,
.tui-wkspswitch__desk::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, transparent 42%, var(--tui-skirt) 42% 58%, transparent 58%), radial-gradient(circle at 35% 30%, var(--tui-face-hi), var(--tui-face-lo));
  box-shadow: var(--tui-raised);
}
.tui-wkspswitch__desk::after { grid-column: 3; }
.tui-wkspswitch__desk-face { display: none; grid-column: 2; margin: 0; }
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(1) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(1),
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(2) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(2),
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(3) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(3),
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(4) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(4),
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(5) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(5),
.tui-wkspswitch__keys:has(.tui-wkspswitch__key:nth-of-type(6) input:checked) + .tui-wkspswitch__desk .tui-wkspswitch__desk-face:nth-of-type(6) {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .tui-wkspswitch__blade, .tui-wkspswitch__key::before { transition: none; }
}
