/* The faceplate kit (src/ui/kit.ts; docs/ui-pass/DIRECTION.md, "The kit" and "The shell"): every control and the panel
   shell, scoped under .kit. Materials are the tokens in instrument-tokens.css (--note-key…, --note-window,
   --note-lamp). No ink is written here: kit.ts dealKit() puts the page's deal on a kit root as --deal-<role> and
   --deal-<role>-pair, and a part with its own ink (a strip, a pattern, the click) sets --kit-ink and --kit-ink-pair on
   itself (inked()). Lit is solid: a block of the ink, its letters in the ink's pair.

   Flat everywhere: no gradient, shadow, glow, bevel or blur. One face, weights 400/500, sizes 12/14/18/44, sentence
   case. State is a flat colour swap; a key drops 1 px when pressed; the plate glides on the house ease (not under
   reduced motion: the glide token is 0 there). Focus: a 2 px outline in the deal's on ink, 2 px off; important, because
   release.css rings every :focus-visible in 1 px of paper (and hides rings after a press) with important rules, and the
   kit's ring is its own. A control whose ring sits on a part (a knob's dial, a fader's cap, a row) takes off its own. */
.kit {
  --kit-ink: var(--deal-on);
  --kit-ink-pair: var(--deal-on-pair);
  color: var(--note-text);
  font-family: var(--note-font);
  font-size: var(--note-text-sm);
  font-weight: var(--note-weight-text);
  line-height: 18px;
  font-variant-numeric: var(--note-numeric);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
.kit *, .kit *::before, .kit *::after { box-sizing: border-box; }
.kit [hidden] { display: none !important; }   /* a part a control or the shell hides (the kit's displays set their own) */
/* Lit faces, from the element's own ink (inherited, or set on a strip or a pattern key): flat mixes, no gradients. */
.kit, .kit * {
  --kit-lit-hover: color-mix(in srgb, var(--kit-ink) 84%, white);
  --kit-lit-press: color-mix(in srgb, var(--kit-ink) 85%, var(--note-casing));
}
.kit button { font: inherit; color: inherit; margin: 0; border: 0; background: none; padding: 0; cursor: pointer; }
.kit canvas.kit-mx { display: block; pointer-events: none; }
.kit .kit-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Key ---------- */
.kit .kit-key {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; min-width: 36px; padding: 0 16px; border-radius: 6px;
  background: var(--note-key); color: var(--note-text); font-size: var(--note-text-sm); line-height: 18px; font-weight: var(--note-weight-label); white-space: nowrap;
  transition: background 80ms var(--note-ease), translate 80ms var(--note-ease);
}
.kit .kit-key.compact { height: 28px; min-width: 28px; padding: 0 12px; }
.kit .kit-key.icon { padding: 0; width: 36px; }
.kit .kit-key.icon.compact { width: 28px; }
.kit .kit-key:hover { background: var(--note-key-hover); }
.kit .kit-key:active { background: var(--note-key-press); translate: 0 1px; transition: none; }
.kit .kit-key:focus-visible { outline: 2px solid var(--deal-on) !important; outline-offset: 2px; }
.kit .kit-key:focus:not(:focus-visible) { outline: none; }
.kit .kit-key.lit { background: var(--kit-ink); color: var(--kit-ink-pair); }
.kit .kit-key.lit:hover { background: var(--kit-lit-hover); }
.kit .kit-key.lit:active { background: var(--kit-lit-press); }
.kit .kit-key.primary { background: var(--kit-ink); color: var(--kit-ink-pair); }
.kit .kit-key.primary:hover { background: var(--kit-lit-hover); }
.kit .kit-key.primary:active { background: var(--kit-lit-press); }
.kit .kit-key.danger { color: var(--note-danger); }
.kit .kit-key:disabled { background: var(--note-key-off); color: var(--note-text-disabled); cursor: default; translate: none; }
.kit .kit-key .kit-mx { flex: none; }

/* ---------- Latch: a key with a lamp; lit when on ---------- */
.kit .lamp { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--note-lamp); }
.kit .latch { justify-content: flex-start; gap: 8px; padding: 0 14px 0 12px; }
.kit .latch.compact { padding: 0 10px; }
.kit .latch.lit .lamp { background: var(--kit-ink-pair); }
.kit .latch:disabled .lamp { background: var(--note-key-hover); }

/* ---------- Selector: keys in a group; the lit plate glides to the chosen one ---------- */
.kit .kit-sel { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 2px; width: max-content; }
.kit .kit-sel.fill { width: 100%; grid-auto-columns: minmax(0, 1fr); }
/* A selector's words stay on one line; a key too narrow for them takes its option's shorter form (kit.ts selector). */
.kit .kit-sel > .kit-key { min-width: 0; }
.kit .kit-sel > .kit-key > .kit-label { white-space: nowrap; }
.kit .kit-sel.even { grid-auto-columns: 1fr; }   /* equal keys at the widest label's width (page selectors) */
.kit .kit-sel > .kit-key { border-radius: 2px; padding: 0 14px; color: var(--note-text-muted); }
.kit .kit-sel > .kit-key.compact { padding: 0 12px; }
.kit .kit-sel > .kit-key:first-of-type { border-radius: 6px 2px 2px 6px; }
.kit .kit-sel > .kit-key:last-of-type { border-radius: 2px 6px 6px 2px; }
.kit .kit-sel > .kit-key:only-of-type { border-radius: 6px; }
.kit :is(.kit-sel, .kit-oct) > .kit-key > .kit-label { position: relative; z-index: 2; }
.kit .kit-sel > .kit-key.inked { color: var(--kit-ink); }
.kit :is(.kit-sel, .kit-oct) > .kit-key.chosen { color: var(--kit-ink-pair); }
.kit .kit-sel > .kit-key:disabled { background: var(--note-key-off); color: var(--note-text-disabled); }
/* The plate: one per group, over the faces and under the labels, gliding on the house ease. */
.kit :is(.kit-sel, .kit-oct) > .plate {
  position: absolute; z-index: 1; left: 0; top: 0; width: 0; height: 0; pointer-events: none; background: var(--kit-ink);
  transition: left var(--note-dur-glide) var(--note-ease), top var(--note-dur-glide) var(--note-ease), width var(--note-dur-glide) var(--note-ease),
    height var(--note-dur-glide) var(--note-ease), border-radius var(--note-dur-glide) var(--note-ease), translate 80ms var(--note-ease);
}
.kit :is(.kit-sel, .kit-oct) > .plate[hidden] { display: none; }
.kit :is(.kit-sel, .kit-oct) > .kit-key.chosen:active { translate: none; }   /* the plate drops instead, under the label */
.kit :is(.kit-sel, .kit-oct) > .plate.pressed { background: var(--kit-lit-press); translate: 0 1px; }
.kit .kit-sel.stack { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; width: 100%; }
.kit .kit-sel.stack > .kit-key { justify-content: flex-start; }
.kit .kit-sel.stack > .kit-key:first-of-type { border-radius: 6px 6px 2px 2px; }
.kit .kit-sel.stack > .kit-key:last-of-type { border-radius: 2px 2px 6px 6px; }
.kit .kit-sel.wrap { grid-auto-flow: row; grid-auto-columns: auto; width: 100%; }
/* Disabled: the faces sink, the labels go dark; the chosen one keeps a plain plate so it stays legible. */
.kit :is(.kit-sel, .kit-oct).off > .kit-key { background: var(--note-key-off); color: var(--note-text-disabled); cursor: default; translate: none; }
.kit :is(.kit-sel, .kit-oct).off > .kit-key.chosen { color: var(--note-text-faint); }
.kit :is(.kit-sel, .kit-oct).off > .plate { background: var(--note-key-hover); }

/* ---------- Octave: a selector laid out as one octave ---------- */
.kit .kit-oct { position: relative; display: grid; grid-template-columns: repeat(14, 18px); grid-template-rows: 28px 28px; gap: 2px; width: max-content; }
.kit .kit-oct > .kit-key { height: 28px; min-width: 0; padding: 0; border-radius: 2px; color: var(--note-text-muted); }
.kit .kit-oct > .kit-key.sharp { grid-row: 1; }
.kit .kit-oct > .kit-key.natural { grid-row: 2; }
.kit .kit-oct > .kit-key.c { border-radius: 2px 2px 2px 6px; }
.kit .kit-oct > .kit-key.b { border-radius: 2px 2px 6px 2px; }
.kit .kit-oct > .kit-key.cs { border-radius: 6px 2px 2px 2px; }
.kit .kit-oct > .kit-key.as { border-radius: 2px 6px 2px 2px; }
/* The large setting (Play): naturals 48 × 56, sharps 48 × 40 above and between, names at the foot. */
.kit .kit-oct.large { grid-template-columns: repeat(14, 23px); grid-template-rows: 40px 56px; }
.kit .kit-oct.large > .kit-key { height: auto; align-items: flex-end; padding-bottom: 7px; }

/* ---------- Window: shows a value; matrix figures, unit in 12 muted; minus and plus keys attached ---------- */
.kit .kit-win-group { display: inline-flex; gap: 2px; align-items: stretch; }
.kit .kit-win {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 6px;
  background: var(--note-window); color: var(--note-text-muted);
}
.kit .kit-win .unit { font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); }
.kit .kit-win.compact { height: 28px; padding: 0 10px; }
.kit .kit-win.settable { cursor: ns-resize; }
.kit .kit-win.readout { cursor: default; }
.kit .kit-win.hero { height: 74px; padding: 0 16px 15px 20px; gap: 10px; align-items: flex-end; }
.kit .kit-win.hero .unit { line-height: 12px; }
.kit .kit-win.settable:hover { outline: 1px solid var(--note-rule); outline-offset: -1px; }
.kit .kit-win.editing { outline: 1px solid var(--kit-ink); outline-offset: -1px; }
.kit .kit-win:focus-visible { outline: 2px solid var(--deal-on) !important; outline-offset: 2px; }
.kit .kit-win:focus:not(:focus-visible) { outline: none; }
.kit .kit-win.off { cursor: default; }
.kit .kit-win.off .unit { color: var(--note-text-disabled); }
/* Typing: a transparent field over the window; the window prints what it holds. */
.kit .kit-win > .kit-entry { outline: none !important; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: text; }
.kit .kit-win-group > .kit-win:not(:last-child) { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.kit .kit-win-group > .steps { display: grid; grid-template-rows: 1fr 1fr; gap: 2px; }
.kit .kit-win-group > .steps > .kit-key { height: auto; width: 36px; border-radius: 2px; }
.kit .kit-win-group > .steps > .kit-key:first-child { border-top-right-radius: 6px; }
.kit .kit-win-group > .steps > .kit-key:last-child { border-bottom-right-radius: 6px; }
.kit .kit-win-group > .kit-key.icon { height: auto; border-radius: 2px 6px 6px 2px; }
.kit .kit-win-group > .kit-key.icon.lead { border-radius: 6px 2px 2px 6px; }
.kit .kit-win-group > .kit-key.lead ~ .kit-win { border-radius: 2px; }

/* ---------- Picker: a key showing the current value with a matrix chevron ---------- */
.kit .picker { justify-content: space-between; gap: 12px; padding: 0 12px 0 14px; font-weight: var(--note-weight-text); }
.kit .picker > .v { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Knob: track ring, ink arc, pointer; label above and value below, or compact ---------- */
.kit .kit-knob { display: inline-grid; justify-items: center; row-gap: 4px; min-width: max-content; border-radius: 6px; cursor: ns-resize; touch-action: none; }
.kit .kit-knob .lab { font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); }
.kit .kit-knob .val { font-size: var(--note-text-sm); line-height: 18px; color: var(--note-text); }
.kit .kit-knob .dial { display: block; width: 36px; height: 36px; border-radius: 50%; }
.kit .kit-knob .dial .face { fill: var(--note-key); transition: fill 80ms var(--note-ease); }
.kit .kit-knob .dial .ring { stroke: var(--note-lamp); }
.kit .kit-knob .dial .arc { stroke: var(--kit-ink); }
.kit .kit-knob .dial .ptr { stroke: var(--note-text); }
.kit .kit-knob:hover .face { fill: var(--note-key-hover); }
.kit .kit-knob.turning .val { color: var(--kit-ink); }
.kit .kit-knob.turning .face { fill: var(--note-key-hover); }
.kit .kit-knob:focus { outline: none !important; }
.kit .kit-knob:focus-visible .dial { outline: 2px solid var(--deal-on); outline-offset: 2px; }
.kit .kit-knob.off { cursor: default; }
.kit .kit-knob.off :is(.lab, .val) { color: var(--note-text-disabled); }
.kit .kit-knob.off .dial :is(.arc, .ptr) { stroke: var(--note-text-disabled); }
.kit .kit-knob.off .face { fill: var(--note-key-off); }
.kit .kit-knob.locked .arc { stroke: var(--note-text-faint); }
.kit .kit-knob .kit-entry { width: 64px; height: 18px; padding: 0 4px; border: 0; border-radius: 2px; background: var(--note-window); color: var(--note-text);
  font: inherit; text-align: center; outline: 1px solid var(--kit-ink) !important; outline-offset: 0; }
.kit .kit-knob.compact { grid-template-columns: 36px auto; justify-items: start; align-items: center; column-gap: 8px; row-gap: 0; }
.kit .kit-knob.compact > .txt { display: grid; row-gap: 0; }

/* ---------- Fader: flat track, key-faced cap with an ink stripe, meter beside it, level in a window ---------- */
.kit .kit-fader { display: inline-grid; grid-template-rows: auto auto; row-gap: 10px; justify-items: stretch; }
.kit .kit-fader.fills { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.kit .kit-fader > .track { display: flex; justify-content: center; gap: 6px; min-height: 0; cursor: ns-resize; border-radius: 6px; touch-action: none; }   /* a finger drags it; the page does not scroll */
.kit .kit-fader > .track:focus { outline: none !important; }
.kit .kit-fader > .track > .lane { position: relative; width: 36px; flex: none; }
.kit .kit-fader .slot { position: absolute; left: 17px; top: 10px; bottom: 10px; width: 2px; background: var(--note-lamp); }
.kit .kit-fader .tick { position: absolute; left: 4px; width: 7px; height: 1px; background: var(--note-lamp); }
.kit .kit-fader .tick.r { left: auto; right: 4px; }
.kit .kit-fader .tick.zero { left: 0; width: 11px; background: var(--note-text-faint); }
.kit .kit-fader .tick.zero.r { left: auto; right: 0; }
.kit .kit-fader .cap {
  position: absolute; left: 0; width: 36px; height: 20px; margin-top: -10px; border-radius: 6px; background: var(--note-key);
  transition: background 80ms var(--note-ease);
}
.kit .kit-fader .cap::after { content: ''; position: absolute; left: 7px; right: 7px; top: 9px; height: 2px; background: var(--kit-ink); }
.kit .kit-fader > .track:hover .cap { background: var(--note-key-hover); }
.kit .kit-fader.dragging .cap { background: var(--note-key-press); translate: 0 1px; }
.kit .kit-fader > .track:focus-visible .cap { outline: 2px solid var(--deal-on); outline-offset: 2px; }
.kit .kit-fader.off > .track { cursor: default; }
.kit .kit-fader.off .cap { background: var(--note-key-off); }
.kit .kit-fader.off .cap::after { background: var(--note-text-disabled); }
/* The meter: a narrow window, a channel or two in the part's ink, a held peak over each. */
.kit .kit-fader > .track > .meter { position: relative; width: 10px; border-radius: 2px; background: var(--note-window); }
.kit .kit-fader > .track > .meter > i { position: absolute; width: 3px; background: var(--kit-ink); }
.kit .kit-fader > .track > .meter > b { position: absolute; width: 3px; height: 2px; background: var(--kit-ink); }
.kit .kit-fader > .track > .meter > [hidden] { display: none; }
.kit .kit-fader > .kit-win { justify-self: stretch; justify-content: flex-end; height: 28px; padding: 0 8px; gap: 6px; }

/* ---------- Field: window face with a hairline edge, search icon, faint placeholder ---------- */
.kit .kit-field { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 6px; background: var(--note-window);
  outline: 1px solid var(--note-rule); outline-offset: -1px; cursor: text; }
.kit .kit-field > input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--note-text);
  font: inherit; outline: none !important; user-select: text; }
.kit .kit-field > input::placeholder { color: var(--note-text-faint); }
.kit .kit-field > input::-webkit-search-cancel-button { appearance: none; }
.kit .kit-field:hover { outline-color: color-mix(in srgb, var(--note-text) 22%, transparent); }
.kit .kit-field:focus-within { outline: 2px solid var(--deal-on); outline-offset: 2px; }
.kit .kit-field.off { outline-color: color-mix(in srgb, var(--note-text) 6%, transparent); cursor: default; }
.kit .kit-field.off > input, .kit .kit-field.off > input::placeholder { color: var(--note-text-disabled); }

/* ---------- Row: an item in a list ---------- */
.kit .kit-row { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 6px 0 0; border-radius: 6px; color: var(--note-text); }
.kit .kit-row > .main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; height: 100%; padding-left: 14px; text-align: left; border-radius: 6px; }
.kit .kit-row > .main:focus { outline: none !important; }
.kit .kit-row:has(> .main:focus-visible) { outline: 2px solid var(--deal-on); outline-offset: 2px; }
.kit .kit-row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit .kit-row .meta { flex: none; font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); }
/* The row's own keys: on the lit row and the row under the pointer or focus; quiet rows keep their room. */
.kit .kit-row > .row-keys { flex: none; display: flex; gap: 2px; }
.kit .kit-row > .row-keys:empty { display: none; }
.kit .kit-row:not(.lit):not(:hover):not(:focus-within) > .row-keys { visibility: hidden; }
.kit .kit-row:hover { background: var(--note-key); }
.kit .kit-row:hover > .row-keys > .kit-key:not(.lit):not(:hover) { background: var(--note-key-hover); }
.kit .kit-row:has(> button.main:active) { background: var(--note-key-press); }
/* The lit row: the plate stays the key face; lamp, name and meta take the ink. */
.kit .kit-row.lit { background: var(--note-key); color: var(--kit-ink); }
.kit .kit-row.lit .lamp { background: var(--kit-ink); }
.kit .kit-row.lit .name { font-weight: var(--note-weight-label); }
.kit .kit-row.lit .meta { color: var(--kit-ink); }
.kit .kit-row.lit > .row-keys > .kit-key:not(.lit) { background: var(--note-key-hover); }
.kit .kit-row.lit > .row-keys > .kit-key.lit { background: var(--note-key-press); color: var(--kit-ink); }
.kit .kit-row.off { color: var(--note-text-disabled); }
.kit .kit-row.off .meta { color: var(--note-text-disabled); }
.kit .kit-list { display: grid; row-gap: 2px; }
.kit .list-empty { display: flex; align-items: center; min-height: 40px; padding: 4px 0; font-size: var(--note-text-sm); line-height: 18px; color: var(--note-text-muted); }

/* ---------- Menu: a key-face sheet; rows 32; shortcut right; lamp on the checked item; danger last ---------- */
.kit .menu:focus { outline: none !important; }
.kit .menu { display: grid; padding: 4px; border-radius: 10px; background: var(--note-key); min-width: 220px; width: max-content; outline: none; }
.kit .menu.two { grid-template-columns: repeat(2, minmax(200px, auto)); column-gap: 4px; }
.kit .menu-group { display: grid; align-content: start; }
.kit .menu-title { display: block; padding: 8px 12px 4px 26px; font-size: var(--note-text-xs); line-height: 16px; font-weight: var(--note-weight-label); color: var(--note-text-muted); }
.kit .menu-row { display: grid; grid-template-columns: 6px 1fr auto; align-items: center; column-gap: 10px; height: 32px; padding: 0 12px 0 10px; border-radius: 6px; white-space: nowrap; cursor: default; outline: none; }
.kit .menu-row .lamp { background: transparent; }
.kit .menu-row .lamp.on { background: var(--kit-ink); }
.kit .menu-row > .sc { font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); padding-left: 24px; }
.kit .menu-row:focus { background: var(--note-key-hover); }
.kit .menu-row:focus-visible { outline: 2px solid var(--deal-on) !important; outline-offset: -2px; }
.kit .menu-row:active { background: var(--note-key-press); }
.kit .menu-row.danger { color: var(--note-danger); }
.kit .menu-row[aria-disabled="true"] { color: var(--note-text-disabled); }
.kit .menu-row[aria-disabled="true"] > .sc { color: var(--note-text-disabled); }
.kit .menu-rule { height: 1px; margin: 4px 0; background: var(--note-rule); }
.kit .menu.two > .menu-rule { grid-column: 1 / -1; }
/* The Menu in the top layer: the UA's popover box taken off; a hairline edge over the panel. */
.kit.kit-pop { position: fixed; inset: auto; left: 0; top: 0; margin: 0; padding: 0; border: 0; background: none; overflow: visible; color: var(--note-text); }
.kit.kit-pop > .menu { outline: 1px solid var(--note-rule); outline-offset: -1px; }

/* ---------- Reading and Path: values NOTE shows and you cannot set. No face, so never pressable. ---------- */
.kit .kit-reading { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; font-size: var(--note-text-sm); line-height: 18px; color: var(--note-text); white-space: nowrap; }
.kit .kit-reading .lamp.on { background: var(--kit-ink); }
.kit .kit-path { display: block; min-width: 0; min-height: 18px; font-size: var(--note-text-sm); line-height: 18px; color: var(--note-text); white-space: nowrap; overflow: hidden; }

/* ---------- Setting: one line of Settings. Its label and one line of help at the left, exactly one control at the right
   (DIRECTION.md, The kit); under 560 px of body the control goes under its words (short: under 448); short, the help steps out (the
   control's own hint says it in the display when touched). ---------- */
.kit .kit-setting { display: grid; grid-template-columns: fit-content(50%) minmax(0, 1fr); column-gap: 24px; align-items: center; min-height: 36px; min-width: 0; }
.kit .kit-setting.fill-help { grid-template-columns: minmax(0, 1fr) auto; }
.kit .kit-setting > .txt { display: grid; row-gap: 2px; min-width: 0; }
.kit .kit-setting > .txt > .lab { font-size: var(--note-text-sm); line-height: 18px; color: var(--note-text); }
.kit .kit-setting > .txt > .help { font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); min-width: 0; }
.kit .kit-setting > .ctl { justify-self: end; display: flex; justify-content: flex-end; min-width: 0; max-width: 100%; }
.kit .kit-setting > .ctl > * { max-width: 100%; }
@container kit-body (max-width: 559px) {
  .kit.kit-shell:not(.short) .kit-setting { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .kit.kit-shell:not(.short) .kit-setting > .ctl { justify-self: start; justify-content: flex-start; }
}
@container kit-body (max-width: 447px) {
  .kit .kit-setting { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .kit .kit-setting > .ctl { justify-self: start; justify-content: flex-start; }
}
/* A control that does not fit beside its words (the shell's measure, kit.ts fitSettings) stacks under them, the row's
   width; a selector's keys wrap when even that is too narrow. A control never runs past its row. */
.kit .kit-setting.stack { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
.kit .kit-setting.stack > .ctl { justify-self: stretch; justify-content: flex-start; }
.kit .kit-setting.stack > .ctl > .kit-sel { display: flex; flex-wrap: wrap; width: auto; max-width: 100%; }
.kit.kit-shell.short .kit-setting > .txt > .help { display: none; }
.kit.kit-shell.short .kit-setting { min-height: 32px; }

/* ---------- Section, control labels, columns ---------- */
.kit .kit-section { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 16px; align-content: start; min-width: 0; }   /* one column the section's width: a wide control narrows, never pushes it out */
.kit .kit-section > :is(.kit-key, .latch) { justify-self: start; }   /* a key keeps its own width */
.kit .kit-section > .sh { font-size: var(--note-text-xs); line-height: 16px; font-weight: var(--note-weight-label); color: var(--note-text-muted); padding-bottom: 8px; border-bottom: 1px solid var(--note-rule); }
.kit .kit-ctl { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 8px; align-content: start; justify-items: start; min-width: 0; }
.kit .kit-ctl > .lab { font-size: var(--note-text-xs); line-height: 16px; color: var(--note-text-muted); }
.kit .kit-cols { display: grid; grid-template-columns: 1fr; row-gap: 28px; }
.kit .kit-cols > .col-rule { display: none; }
/* columns(): its box is the container its query reads (kit.ts writes the two-column rule for each min). */
.kit .kit-cols-box { container: kit-cols / inline-size; min-width: 0; }
.kit .kit-cols > .kit-section { align-self: start; min-width: 0; }

/* ---------- The shell: head 56, a scrolling body with a flat 2 px thumb, foot 36 (the status line) ---------- */
.kit.kit-shell { position: absolute; inset: 0; display: grid; grid-template-rows: 56px minmax(0, 1fr) 36px; background: var(--note-casing); overflow: hidden; border-radius: inherit; }
.kit.kit-shell > .head { display: flex; align-items: center; gap: 16px; padding: 0 14px 0 24px; border-bottom: 1px solid var(--note-rule); min-width: 0; }
.kit.kit-shell > .head > .title { flex: none; margin: 0 8px 0 0; font-size: var(--note-text-md); line-height: 24px; font-weight: var(--note-weight-label); color: var(--note-text); }
.kit.kit-shell > .head > .spacer { flex: 1 1 auto; }
.kit.kit-shell > .head > .kit-sel { flex: none; }
.kit.kit-shell > .head > .tools { display: flex; gap: 2px; flex: none; }
/* The narrow head: when the title, pages and keys cannot share a line, the pages take their own line under the title. */
.kit.kit-shell.narrow { grid-template-rows: auto minmax(0, 1fr) 36px; }
.kit.kit-shell.narrow > .head { flex-wrap: wrap; row-gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.kit.kit-shell.narrow > .head > .title { height: 28px; display: flex; align-items: center; }
.kit.kit-shell.narrow > .head > .kit-sel { order: 5; width: 100%; grid-auto-columns: 1fr; }
.kit.kit-shell.narrow > .head > .kit-sel > .kit-key { padding: 0 8px; }
/* On their own line the pages share it, each at least its own word (a narrow window never cuts "General"). */
.kit.kit-shell.narrow > .head > .kit-sel.even { grid-auto-columns: minmax(max-content, 1fr); }
/* The head measured (kit.ts shell, the head's room): every item at its own width, none shrinking. */
.kit.kit-shell > .head.measure, .kit.kit-shell > .head.measure * { flex-shrink: 0 !important; }
/* Put back: its word; in a tight head, its icon key (pop out's mirror), the size of pop out. */
.kit .kit-key.put-back > .kit-mx { display: none; }
.kit .kit-key.put-back.iconic { width: 28px; padding: 0; }
.kit .kit-key.put-back.iconic > .kit-mx { display: block; }
.kit .kit-key.put-back.iconic > .kit-label { display: none; }
.kit.kit-shell > .body { position: relative; min-height: 0; }
.kit.kit-shell > .body > .scroll { position: absolute; inset: 0; overflow: auto; scrollbar-width: none; container: kit-body / inline-size; }
.kit.kit-shell > .body > .scroll::-webkit-scrollbar { display: none; }
.kit.kit-shell > .body > .thumb { position: absolute; z-index: 3; background: var(--note-text-muted); pointer-events: none; }
.kit.kit-shell > .body > .thumb.v { right: 3px; width: 2px; }
.kit.kit-shell > .body > .thumb.h { bottom: 3px; height: 2px; }
.kit.kit-shell > .body > .thumb[hidden] { display: none; }

/* ---------- The scroll cue (kit.ts scrollCue): a box that scrolls says so at a glance. Flat: the thumb (muted ink) on a
   track the length of the view (the key face); while there is more below, a hairline across the view's foot with a
   small key-faced tab on it (a dot chevron and "More"; a press shows the next view's worth), in the 20 px the view
   keeps under itself; once scrolled, a hairline across its head. ---------- */
.kit :is(.kit-shell > .body, .kit-scroller) > .track { position: absolute; z-index: 2; top: 0; right: 3px; width: 2px; background: var(--note-key); pointer-events: none; }
.kit :is(.kit-shell > .body, .kit-scroller) > .track[hidden] { display: none; }
.kit .kit-more { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 20px; border-top: 1px solid var(--note-rule); display: flex; justify-content: center; cursor: pointer; }
.kit .kit-more[hidden] { display: none; }
.kit .kit-more > .tab { display: inline-flex; align-items: center; gap: 6px; height: 18px; margin-top: -1px; padding: 0 10px 0 8px; border-radius: 0 0 6px 6px; background: var(--note-key);
  font-size: var(--note-text-xs); line-height: 16px; font-weight: var(--note-weight-label); color: var(--note-text-muted); }
.kit .kit-more:hover > .tab { background: var(--note-key-hover); color: var(--note-text); }
.kit .kit-more > .tab > .kit-icon { display: inline-flex; }
.kit.kit-shell > .body.scrolled::before, .kit .kit-scroller.scrolled::before { content: ''; position: absolute; z-index: 3; left: 0; right: 0; top: 0; height: 1px; background: var(--note-rule); pointer-events: none; }
.kit.kit-shell > .body.scrolled::before { left: 24px; right: 24px; }
.kit.kit-shell > .body > .kit-more { left: 24px; right: 24px; }

/* ---------- Short (kit.ts shell; DIRECTION.md, Short panels): the body is lower than its page needs tall. The display
   row tightens (16 / 24 to 8 / 12; the display keeps its one-line 52); a page's gaps tighten; rows take the dense 32;
   a page's sections take their label at their left, on the line of their first control, when the body is at least
   448 wide (else above, without its rule); hero controls take the key height (each panel's own rule). With room to
   spare, the gaps and rows grow back toward their tall sizes by --air (0 to 1, kit.ts shell) before the display's
   graphic takes any of it. ---------- */
.kit.kit-shell.short > .display-row { padding: 8px 24px 12px; }
.kit.kit-shell.short .pg { row-gap: calc(10px + 18px * var(--air, 0)); padding-top: calc(8px + 12px * var(--air, 0)); padding-bottom: calc(8px + 16px * var(--air, 0)); }
.kit.kit-shell.short .kit-row { height: calc(32px + 8px * var(--air, 0)); }
.kit.kit-shell.short .pg > .kit-section { row-gap: calc(8px + 8px * var(--air, 0)); }
.kit.kit-shell.short .pg > .kit-section > .sh { padding-bottom: 0; border-bottom: 0; }
@container kit-body (min-width: 448px) {
  .kit.kit-shell.short .pg > .kit-section { position: relative; padding-left: 120px; }
  .kit.kit-shell.short .pg > .kit-section > .sh { position: absolute; left: 0; top: 10px; width: 104px; white-space: nowrap; overflow: hidden; }
}
.kit.kit-shell > .foot { display: block; line-height: 35px; padding: 0 24px; border-top: 1px solid var(--note-rule); font-size: var(--note-text-xs); color: var(--note-text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Screens (DIRECTION.md, "Screens"): what the machine says, dot matrix on the window colour ---------- */
.kit .kit-screen { position: relative; background: var(--note-window); border-radius: 10px; }
/* The panel's display (the foot pass): pinned to the panel's foot with the kit's 24 px inset, under the body, which
   scrolls above it. One line (52) high; a panel that gives it a graphic lets it grow into the height the controls
   leave, up to 256 (kit.ts shell sets its height). */
.kit.kit-shell.with-display { grid-template-rows: 56px minmax(0, 1fr) auto; }
.kit.kit-shell.with-display.narrow { grid-template-rows: auto minmax(0, 1fr) auto; }
.kit.kit-shell > .display-row { padding: 16px 24px 24px; min-width: 0; }
/* Each row in its place, so a display row a panel hides leaves the body its own (side-panel.ts). */
.kit.kit-shell.with-display > .head { grid-row: 1; }
.kit.kit-shell.with-display > .body { grid-row: 2; }
.kit.kit-shell.with-display > .display-row { grid-row: 3; }
.kit .kit-display { height: 52px; overflow: hidden; }
.kit .kit-display > canvas { position: absolute; left: 0; top: 0; }
/* A matrix readout: bare on the line of its label, or in a small window. */
.kit .kit-readout { display: inline-flex; align-items: center; }
.kit .kit-readout.in-win { height: 28px; padding: 2px 10px 0; border-radius: 6px; background: var(--note-window); }
.kit .kit-knob.compact > .txt > .kit-readout { height: 18px; align-items: flex-start; padding-top: 2px; }
/* A picker's screen form: one button, the value in a window and the chevron key attached at its right. */
.kit .kit-picker { display: inline-flex; align-items: stretch; gap: 2px; height: 36px; padding: 0; border-radius: 6px; min-width: 0; }
.kit .kit-picker.compact { height: 28px; }
.kit .kit-picker > .picker-win { flex: 1 1 auto; min-width: 0; height: auto; justify-content: flex-start; padding: 2px 12px 0; border-radius: 6px 2px 2px 6px; overflow: hidden; }
.kit .kit-picker > .chev { flex: none; width: 36px; height: auto; padding: 0; border-radius: 2px 6px 6px 2px; }
.kit .kit-picker.compact > .chev { width: 28px; }
.kit .kit-picker:hover > .chev { background: var(--note-key-hover); }
.kit .kit-picker:hover > .picker-win { outline: 1px solid var(--note-rule); outline-offset: -1px; }
/* A picker's lamp: after its value, lit (its ink) when the value changed since it was kept (the drum kit). */
.kit .kit-picker > .picker-win > .picker-lamp { margin-left: auto; }
.kit .kit-picker > .picker-win:has(> .picker-lamp) > .kit-readout { margin-right: 8px; }
.kit .kit-picker > .picker-win > .picker-lamp.on { background: var(--kit-ink); }
.kit .kit-picker:active > .chev { background: var(--note-key-press); translate: 0 1px; transition: none; }
.kit .kit-picker.lit > .chev { background: var(--kit-ink); color: var(--kit-ink-pair); }
.kit .kit-picker:focus-visible { outline: 2px solid var(--deal-on) !important; outline-offset: 2px; }
.kit .kit-picker:focus:not(:focus-visible) { outline: none; }
.kit .kit-picker:disabled { cursor: default; }
.kit .kit-picker:disabled > .chev { background: var(--note-key-off); translate: none; }
/* A Menu's screen form: rows of the small face 28 high, the pointed row an inverse plate of the on ink. */
.kit .menu.menu-screen { min-width: 0; padding: 6px; background: var(--note-window); }
.kit .menu-screen .menu-row { display: flex; align-items: center; height: 28px; padding: 0 10px; }
.kit .menu-screen .menu-row:focus { background: var(--deal-on); }
.kit .menu-screen .menu-row:active { background: var(--kit-lit-press); }
.kit .menu-screen .menu-row:focus-visible { outline-color: var(--deal-on-pair) !important; }
.kit .menu-screen .menu-rule { display: flex; align-items: center; height: 12px; margin: 0; padding: 0 10px; background: none; }
.kit .menu-screen .menu-title-dots { display: block; padding: 8px 10px 4px 22px; }

/* ---------- Scroller: a box that scrolls, with the shell's flat thumbs (kit.ts scroller) ---------- */
.kit .kit-scroller { position: relative; min-height: 0; overflow: hidden; }
.kit .kit-scroller > .scroll { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: auto; scrollbar-width: none; }
.kit .kit-scroller > .scroll::-webkit-scrollbar { display: none; }
.kit .kit-scroller > .thumb { position: absolute; z-index: 3; background: var(--note-text-muted); pointer-events: none; }
.kit .kit-scroller > .thumb.v { right: 3px; width: 2px; }
.kit .kit-scroller > .thumb.h { height: 2px; }

/* Reduced motion: nothing glides or fades (over every rule above, so important). */
@media (prefers-reduced-motion: reduce) { .kit, .kit * { transition: none !important; } }

/* ---------- Keycap: a key's legend printed on a key face, for reference (never pressable) ---------- */
.kit .kit-keycap { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 7px;
  border-radius: 6px; background: var(--note-key); color: var(--note-text); font: inherit; font-size: var(--note-text-xs);
  font-weight: var(--note-weight-label); line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default; user-select: none; }
