:root {
  color-scheme: light dark;

  --backdrop: light-dark(#dcdcd8, #070707);
  --body: light-dark(#c4c5c4, #151515);
  --body-hi: light-dark(#e4e5e4, #2c2c2c);
  --body-edge: light-dark(#9d9e9d, #000000);
  --silk: light-dark(#2a2a2a, #9b9b9b);
  --silk-dim: light-dark(#5f6060, #5d5d5d);
  --bracket: light-dark(#ff5b1a, #575757);

  --glass: light-dark(#0b0b0c, #000000);
  --glass-hi: light-dark(#2e2e30, #1c1c1c);
  --disp-text: light-dark(#f1f1ef, #ededed);
  --disp-dim: light-dark(#7d7d7d, #6e6e6e);
  --disp-orange: light-dark(#ff5b1a, #ededed);
  --disp-sky: light-dark(#5cc6ff, #ededed);
  --seg-time: light-dark(#ff5b1a, transparent);
  --seg-time-line: light-dark(transparent, #ededed);
  --seg-white: light-dark(#f1f1ef, transparent);
  --seg-white-line: light-dark(transparent, #ededed);
  --seg-sky: light-dark(#5cc6ff, transparent);
  --seg-sky-line: light-dark(transparent, #ededed);
  --seg-off: light-dark(rgba(255, 255, 255, 0.06), transparent);
  --seg-off-line: light-dark(transparent, rgba(255, 255, 255, 0.05));
  --seg-rev: light-dark(#0b0b0c, transparent);
  --seg-rev-line: light-dark(transparent, #000000);
  --bulb-off: light-dark(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.06));
  --bulb-rim: light-dark(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.2));
  --bulb-on: var(--disp-orange);
  --bulb-halo: light-dark(rgba(255, 91, 26, 0.55), rgba(237, 237, 237, 0.42));
  --frame: light-dark(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.26));

  --pad-cap-0: light-dark(#1c1c1d, #f3f3f1);
  --pad-cap-1: light-dark(#1c1c1d, #cdcdcb);
  --pad-cap-2: light-dark(#1c1c1d, #a8a8a6);
  --pad-cap-3: light-dark(#1c1c1d, #868684);
  --pad-ink: light-dark(#ececea, #171717);
  --pad-ink-dim: light-dark(#868686, #4c4c4c);
  --step-cap: light-dark(#f2f2f0, #2b2b2c);
  --step-ink: light-dark(#1b1b1b, #d8d8d8);
  --step-ink-dim: light-dark(#8c8c8a, #7a7a7a);
  --mid-cap: light-dark(#8d8e8f, #3b3b3c);
  --mid-ink: light-dark(#121212, #e2e2e2);
  --mid-ink-dim: light-dark(#3c3c3c, #8c8c8c);
  --hero: light-dark(#ff5b1a, #ff5b1a);
  --hero-ink: light-dark(#ffffff, #111111);
  --strip: light-dark(#e8e8e5, #c2c2c0);
  --strip-ink: light-dark(#585858, #2a2a2a);
  --cap-light: light-dark(#f2f2f0, #f3f3f1);
  --cap-light-ink: light-dark(#1b1b1b, #171717);
  --cap-hi: light-dark(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22));
  --cap-shadow: light-dark(rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.85));
  --wall-tint: light-dark(#2a2722, #000000);
  --cap-drop: light-dark(rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.75));
  --ring: light-dark(#151515, #f1f1f1);
  --tour-ring: light-dark(#ff5b1a, #ededed);
  --lamp-edge: light-dark(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
  --step-lamp-edge: light-dark(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
  --lamp-alt: light-dark(#2fa8f0, #ffffff);
  --meter-off: light-dark(rgba(0, 0, 0, 0.18), rgba(255, 255, 255, 0.12));

  --knob-x-base: light-dark(#ff5b1a, #2e2e2e);
  --knob-x-cap: light-dark(#ff6a2c, #e9e9e7);
  --knob-x-tick: light-dark(#ffffff, #1a1a1a);
  --knob-y-base: light-dark(#2a2a2b, #2e2e2e);
  --knob-y-cap: light-dark(#161617, #6f6f6e);
  --knob-y-tick: light-dark(#ffffff, #ffffff);
  --badge-x: light-dark(#ff5b1a, #e9e9e7);
  --badge-x-ink: light-dark(#ffffff, #111111);
  --badge-y: light-dark(#1a1a1b, #4a4a4a);
  --badge-y-ink: light-dark(#ffffff, #ffffff);

  --p1: light-dark(#1e78ff, #3d8eff);
  --p2: light-dark(#17a34a, #34c759);
  --p3: light-dark(#ffc300, #ffd60a);
  --p4: light-dark(#ffffff, #ffffff);
  --error: light-dark(#ff3b30, #ff453a);

  --type: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
}

:root[data-theme="silver"] { color-scheme: light; }
:root[data-theme="black"] { color-scheme: dark; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--backdrop);
  font-family: var(--type);
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 900px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

#plate { padding: 32px 0; }

.hidden { visibility: hidden; }

/* The plate is sized by one unit, --u: as large as the window's width allows (14.5 units and the
   margins across) and as its height allows (the plate is 9.92 units plus 98 px tall, with its 32 px
   above and below), between 60 and 76 px. Below 60 px a unit the window scrolls. */
.device {
  --u: clamp(60px, min(calc((100vw - 56px) / 14.5), calc((100vh - 100px) / 9.92)), 76px);
  /* The display row: two side panels of one width either side of the stage, which takes the rest
     of the row (13.34 units inside the display's padding) at its fixed 300:140. */
  --side: calc(var(--u) * 2.7);
  --dgap: calc(var(--u) * 0.2);
  --stage-w: calc(var(--u) * 13.34 - var(--side) * 2 - var(--dgap) * 2);
  --stage-h: calc(var(--stage-w) * 140 / 300);
  --pad: calc(var(--u) * 0.36);
  --kw: calc(var(--u) * 0.889);
  --kh: calc(var(--u) * 0.778);
  --rp: calc(var(--u) * 0.889);
  --gap: calc(var(--u) * 0.111);
  --pc: var(--p1);
  position: relative;
  width: calc(var(--u) * 13.78 + var(--pad) * 2);
  padding: calc(var(--pad) * 0.7) var(--pad) var(--pad);
  background: var(--body);
  border-radius: calc(var(--u) * 0.24);
  box-shadow: inset 0 1px 0 var(--body-hi), 0 2px 0 var(--body-edge);
  color: var(--silk);
  font-weight: 500;
  touch-action: none;
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  height: calc(var(--u) * 0.3);
  text-transform: uppercase;
}
.brand .wordmark { display: inline-flex; align-items: center; gap: 7px; color: var(--silk); }
.brand .name { font-size: 11px; font-weight: 700; letter-spacing: 0.24em; color: var(--silk); }
.logo { flex: none; width: 14px; height: 14px; display: block; }
.logo .logo-base { fill: var(--hero); }

/* The display row: transport on the left, the stage, the song on the right; the side panels are
   tall columns as high as the stage, on one set of rows (below). */
.display {
  --top-h: calc(var(--u) * 0.92 + 16px);
  position: relative;
  display: grid;
  grid-template-columns: var(--side) var(--stage-w) var(--side);
  column-gap: var(--dgap);
  padding: calc(var(--u) * 0.16) calc(var(--u) * 0.22);
  background: var(--glass);
  border-radius: calc(var(--u) * 0.1);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--body-edge);
  color: var(--disp-text);
  overflow: hidden;
}
/*
 * The side panels share one set of rows (SPEC section 15.1, "Controls on the display", rule 6), so their parts line
 * up across the stage: the top block, a spacer, a caption, the middle value, its line, a spacer, MORE, the two-line
 * message row and the foot. The right panel has two columns: the chord, and the bar map flush right.
 */
.d-left, .d-right {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: var(--top-h) minmax(0, 1fr) 12px calc(var(--u) * 0.5 + 4px) 20px minmax(0, 1fr) 20px 36px 14px;
  column-gap: 8px;
  min-width: 0;
  height: var(--stage-h);
}
.d-left > *, .d-right > *, .d-tempo > *, .d-scene > * { grid-column: 1 / -1; min-width: 0; }

/* Captions and small print: 9 px, 500, tracked, upper case, dim (rule 5). */
.dcap, .d-fine, .more-sub, .scene-name.unnamed {
  font-size: 9px;
  font-weight: 500;
  line-height: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--disp-dim);
  white-space: nowrap;
}
/* Words: 12 px, names and values 700 in upper case (the message line is set below). */
.key-text, .scene-name, .scene-field, .d-info, .scene-line, .sound-pager .sp-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg { display: block; overflow: visible; }
.seg polygon, .seg rect {
  fill: var(--seg-off);
  stroke: var(--seg-off-line);
  stroke-width: 0.55;
  stroke-linejoin: round;
}
.seg .on { fill: var(--seg-fill); stroke: var(--seg-line); }
.seg.time { --seg-fill: var(--seg-time); --seg-line: var(--seg-time-line); width: auto; height: calc(var(--u) * 0.92); }
.seg.bpm { --seg-fill: var(--seg-white); --seg-line: var(--seg-white-line); width: auto; height: calc(var(--u) * 0.5); flex: none; }
.seg.scene { --seg-fill: var(--seg-sky); --seg-line: var(--seg-sky-line); width: auto; height: calc(var(--u) * 0.5); flex: none; }

/* The left panel: BAR · BEAT on top, the BPM on the middle row, the key on its line, the take or UNDO on the message row. */
.d-time { grid-row: 1; display: grid; grid-template-rows: 12px auto; row-gap: 4px; align-content: start; justify-self: start; align-self: start; }
.d-time .icons { display: flex; align-items: center; gap: 8px; height: 12px; }
.icon { width: 8px; height: 8px; }
.icon.play polygon { fill: var(--disp-orange); }
.icon.stop rect { fill: var(--disp-dim); }
.icon.hidden { display: none; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--error); }
.d-tempo { display: contents; }
.bpm-row { grid-row: 4; display: flex; align-items: center; min-width: 0; }
.bpm-read { display: flex; align-items: center; gap: 8px; }
.d-tempo .key-text { grid-row: 5; justify-self: start; align-self: end; max-width: 100%; }
.d-info { grid-row: 8; justify-self: start; align-self: center; max-width: 100%; color: var(--disp-text); }
.d-info:empty { visibility: hidden; }

.d-stage { position: relative; width: var(--stage-w); height: var(--stage-h); }
.stage {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--u) * 0.05);
  box-shadow: 0 0 0 1px var(--glass-hi);
}
/* The proscenium sits 4 px outside the canvas: a rounded film-frame rule with a diamond on each corner. */
.proscenium {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--frame);
  border-radius: calc(var(--u) * 0.05 + 4px);
  pointer-events: none;
}
.proscenium::before {
  content: "";
  position: absolute;
  inset: -4px;
  background: var(--frame);
  -webkit-mask: url(stage-art/ui/diamond.svg) left top / 6px 6px no-repeat, url(stage-art/ui/diamond.svg) right top / 6px 6px no-repeat,
    url(stage-art/ui/diamond.svg) left bottom / 6px 6px no-repeat, url(stage-art/ui/diamond.svg) right bottom / 6px 6px no-repeat;
  mask: url(stage-art/ui/diamond.svg) left top / 6px 6px no-repeat, url(stage-art/ui/diamond.svg) right top / 6px 6px no-repeat,
    url(stage-art/ui/diamond.svg) left bottom / 6px 6px no-repeat, url(stage-art/ui/diamond.svg) right bottom / 6px 6px no-repeat;
}

/* The right panel: NOW → NEXT and BARS on top, SCENE on the caption, middle and line rows, MORE, the message row, the foot. */
.d-bars { grid-row: 1; grid-column: 2; display: grid; align-content: start; row-gap: 4px; }
.dval { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
/* The chord pair: the next chord drops to a line of its own when the pair is too wide. */
.d-chord { grid-row: 1; grid-column: 1; justify-self: start; align-self: start; max-width: 100%; display: grid; grid-template-rows: 12px auto; row-gap: 4px; }
.d-chord .dval { flex-wrap: wrap; row-gap: 0; font-size: calc(var(--u) * 0.34); font-weight: 700; line-height: 1.15; color: var(--disp-sky); }
.d-chord .arrow { font-size: 0.6em; font-weight: 500; color: var(--disp-dim); }
/* Pending things are hollow and dashed (SPEC section 15.1), square on the display. */
.pending {
  flex: none;
  padding: 0 4px;
  border: 1px dashed currentColor;
  line-height: 1.15;
}
.d-scene { display: contents; }
.d-scene > .dcap { grid-row: 3; align-self: end; }
.d-scene .dval { grid-row: 4; color: var(--disp-sky); }
.d-scene .pending { font-size: 12px; font-weight: 700; }
.scene-num { display: inline-flex; flex: none; }
.d-scene .scene-name { min-width: 0; color: var(--disp-text); }
/* A scene with no name: a faint NAME THIS SCENE to click, in caption type. */
.d-scene .scene-name.unnamed { line-height: 16px; color: var(--disp-dim); }
/* Under the scene's name: where the song is (SONG · 3 OF 12) or LOOPING. */
.scene-line { grid-row: 5; align-self: end; font-size: 9px; letter-spacing: 0.14em; color: var(--disp-text); }
/* The scene's name edited in place: a field in reverse video at the name's size, with the cursor (rule 4). */
.scene-field {
  display: none;
  flex: 1;
  min-width: 0;
  height: 16px;
  border: 0;
  border-radius: 0;
  outline: 0;
  font-family: inherit;
  caret-color: var(--glass);
}
.scene-field::selection { background: var(--glass); color: var(--disp-text); }
.dval.naming .scene-name { display: none; }
.dval.naming .scene-field { display: block; }

/*
 * Controls on the display (SPEC section 15.1, "Controls on the display"). The display is glass over lit elements:
 * selected, in use, latched or held down is reverse video (rule 1); corner brackets say a thing can be touched (rule
 * 2: on hover, always on the touch layout, always on a soft key); keyboard focus is the brackets in full white (rule
 * 3). The padding the brackets and the reverse draw in is always there, so nothing moves (rule 8).
 */
.live, .bpm-step, .kc-root, .sound-pager .pager-btn, .bar-pager .pager-btn, .line-load {
  --bk: transparent;
  --dot: transparent;
  position: relative;
  cursor: pointer;
  touch-action: none;
  outline: 0;
}
.live { padding: 2px 4px; margin: -2px -4px; }
.live::before, .bpm-step::before, .kc-root::before, .sound-pager .pager-btn::before, .bar-pager .pager-btn::before, .line-load::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--bk), var(--bk)) left top / 4px 1px no-repeat,
    linear-gradient(var(--bk), var(--bk)) left top / 1px 4px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right top / 4px 1px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right top / 1px 4px no-repeat,
    linear-gradient(var(--bk), var(--bk)) left bottom / 4px 1px no-repeat,
    linear-gradient(var(--bk), var(--bk)) left bottom / 1px 4px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right bottom / 4px 1px no-repeat,
    linear-gradient(var(--bk), var(--bk)) right bottom / 1px 4px no-repeat,
    linear-gradient(to right, var(--dot) 2px, transparent 2px) left bottom / 4px 1px repeat-x;
}
.live:hover, .kc-root:hover { --bk: var(--disp-dim); }
.live:focus-visible { --bk: var(--disp-text); }
/* Reverse video: the value as a block of the display's white with the glass's black in it (rule 1). */
.bpm-read .seg, .d-chord .dval, .scene-field { padding: 2px 4px; margin: -2px -4px; box-sizing: content-box; }
.bpm-read.on .seg, .key-text.on, .scene-num.on, .d-chord.on .dval, .scene-field, .d-info.live:active,
.kc-root.on, .kc-mode.on, .bm-box.shown::before, .bm-box:active::before,
.bpm-step:active, .sound-pager .pager-btn:active, .line-load:active {
  background-color: var(--disp-text);
  color: var(--glass);
}
.bpm-read.on .seg, .scene-num.on .seg { --seg-fill: var(--seg-rev); --seg-line: var(--seg-rev-line); --seg-off: transparent; --seg-off-line: transparent; }
.d-chord.on .arrow { color: var(--glass); }

/* The buttons of the display are its own marks, never a browser's. */
.bpm-step, .kc-root, .kc-mode, .bm-box, .pager-btn, .way button, .line-load {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: none;
}
/* − and + beside the BPM while it is selected: soft keys in the room to its right, so the readout never moves. */
.bpm-steps { grid-row: 4; justify-self: end; align-self: center; display: flex; gap: 4px; visibility: hidden; }
.bpm-steps.on { visibility: visible; }
.bpm-step { --bk: var(--disp-dim); width: 20px; height: 20px; color: var(--disp-text); font-size: 12px; font-weight: 700; line-height: 20px; }
.bpm-step:hover { --bk: var(--disp-text); }

/*
 * The key card over the left of the display, a panel (rule 4): the twelve roots in one row (two rows of six on the
 * touch layout), the present reversed, and MAJOR | MINOR under them as the switch.
 */
.key-card {
  position: absolute;
  z-index: 5;
  left: calc(var(--u) * 0.22 - 8px);
  top: calc(var(--u) * 0.16 - 4px);
  display: none;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--frame);
  background: var(--glass);
}
.key-card.open { display: grid; }
.kc-roots { display: flex; gap: 4px; }
.kc-root { min-width: 28px; height: 24px; padding: 0 4px; color: var(--disp-text); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.kc-modes, .way { display: flex; border: 1px solid var(--disp-dim); }
.kc-mode { flex: 1; height: 20px; padding: 0 8px; color: var(--disp-dim); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
.kc-mode:hover { color: var(--disp-text); }

/*
 * MORE COWBELL, how hard and how loud the band plays: one thin row, the words and sixteen ticks no taller than the
 * caption, lit to the level and ending on the bar map's right edge, BAND VOLUME in small print under the ticks.
 * On each bar line while playing they run one chase (chase-a and chase-b alternate so each bar restarts it).
 */
.d-more { grid-row: 7; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.d-more > .dcap { line-height: 8px; }
.ticks { display: flex; align-items: center; gap: clamp(1px, calc((var(--u) - 60px) / 16 + 1px), 2px); }
.more-ticks { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
/* Under the ticks, ending with them; wider than they are on a small plate, it reaches left under the words. */
.more-sub { position: absolute; top: 10px; right: 0; line-height: 9px; }
.tick { width: clamp(2px, calc((var(--u) - 60px) / 8 + 2px), 4px); height: 8px; background: var(--bulb-off); box-shadow: inset 0 0 0 1px var(--bulb-rim); }
.tick.on { background: var(--disp-text); box-shadow: none; }
.ticks.chase-a .tick.on { animation: tick-chase-a 160ms ease-out calc(var(--i, 0) * 10ms) both; }
.ticks.chase-b .tick.on { animation: tick-chase-b 160ms ease-out calc(var(--i, 0) * 10ms) both; }
@keyframes tick-chase-a { 0% { opacity: 0.35; } 100% { opacity: 1; } }
@keyframes tick-chase-b { 0% { opacity: 0.35; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .ticks.chase-a .tick.on, .ticks.chase-b .tick.on { animation: none; }
}
/* The small print at the foot of the display: the output's latency, and MUTED under `?mute`. */
.d-fine {
  grid-row: 9;
  align-self: end;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/*
 * The SONG | SCENE switch at the right end of the play key, the plate's one switch (rule 4) printed in the key's ink:
 * the chosen half reversed; SONG dimmed for a song with no arrangement. The key's words stand left of it.
 */
.key[data-code="Space"] .label { right: calc(var(--u) * 0.3 + 108px); }
.way {
  position: absolute;
  top: 50%;
  right: calc(var(--u) * 0.14 + 18px);
  border-color: var(--ink);
  transform: translateY(-50%);
}
.way button {
  position: relative;
  height: 18px;
  padding: 0 8px;
  color: var(--ink-dim);
  font-size: 9px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.way button:hover { color: var(--ink); }
.way button.on { background: var(--ink); color: var(--cap); }
.way button.dim { opacity: 0.4; }

/*
 * The touch layout (touch.js TOUCH_QUERY). Touch has no hover, and brackets round every readout at once are noise: a
 * readout that can be touched has a dotted rule under its field instead (rule 2); brackets stay for keyboard focus,
 * the reverse for selected. Each readout is a 44 px target that overlaps its neighbours rather than moving them.
 */
@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  .live { --dot: var(--disp-dim); }
  .live.on { --dot: transparent; }
  .live:hover, .kc-root:hover { --bk: transparent; }
  .live:focus-visible { --bk: var(--disp-text); }
  .live::after, .way button::after, .bpm-step::after, .line-load::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
  /* While the BPM is selected the message row is its control row: BPM − + (rule 4, a selection is modal). */
  .bpm-steps {
    position: relative;
    z-index: 3;
    grid-area: line;
    align-items: center;
    gap: 8px;
    background: var(--glass);
  }
  .bpm-steps::before { content: "bpm"; margin-right: 4px; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--disp-dim); }
  .bpm-step { width: 44px; height: 26px; font-size: 16px; line-height: 26px; }
  .key-card { left: 4px; right: 4px; top: 4px; padding: 4px; }
  /* Two rows of six roots, each 44 px wide and high at the least. */
  .kc-roots { display: grid; grid-template-columns: repeat(6, minmax(44px, 1fr)); }
  .kc-root { min-width: 44px; height: 44px; font-size: 16px; }
  .kc-mode { height: 44px; font-size: 11px; }
  .key[data-code="Space"] .label { right: 98px; }
  .way { right: 6px; }
  .way button { padding: 0 6px; font-size: 9px; }
}

/* The message line: up to two lines between its rules, wrapping between words, so a dial or an error is read whole. */
.d-line {
  grid-row: 8;
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.02em;
  color: var(--disp-text);
  overflow: hidden;
}
.d-line .line-text {
  flex: 0 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: break-word;
}
/* The caption rules: a short line ending in a diamond either side of the text, always dim. */
.d-line .rule {
  position: relative;
  flex: none;
  width: 20px;
  height: 7px;
  margin-right: 8px;
  background: linear-gradient(var(--disp-dim), var(--disp-dim)) left center / calc(100% - 4px) 1px no-repeat;
}
.d-line .rule::after {
  content: "";
  position: absolute;
  right: 0;
  top: 1.5px;
  width: 4px;
  height: 4px;
  background: var(--disp-dim);
  transform: rotate(45deg);
}
.d-line .rule.end { margin: 0 0 0 auto; padding-left: 8px; width: 28px; background-origin: content-box; background-position: right center; }
.d-line .rule.end::after { right: auto; left: 8px; }
.d-line.error { color: var(--error); }
.d-line.dial { color: var(--disp-orange); }
.d-line .console {
  display: none;
  flex: 1;
  min-width: 0;
  margin-left: 0.5em;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--disp-text);
  font: inherit;
  caret-color: var(--disp-text);
}
.d-line.console-open .console { display: block; }
.d-line.console-open .line-text { color: var(--disp-orange); }
/* LOAD A SOUND after the words of an empty pad: a soft key, its brackets at rest (rule 4), in caption type. */
.d-line .line-load { display: none; }
.d-line.loads .line-load {
  display: block;
  flex: none;
  --bk: var(--disp-dim);
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  font-size: 9px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--disp-text);
}
.d-line.loads .line-load:hover, .d-line.loads .line-load:focus-visible { --bk: var(--disp-text); }
/*
 * The sound picker's SOUND pager takes the message row while a part is held and no dial is: SOUND and the place over
 * ◀ the name ▶ and SETUP ▼, soft keys with drawn arrows (rule 4), in the row's own 36 px, so MORE and the scene stay put.
 */
.d-line .sound-pager { display: none; }
.d-line.picker { position: relative; overflow: visible; }
.d-line.picker .line-text, .d-line.picker .rule { display: none; }
.d-line.picker .sound-pager {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-rows: 12px 20px;
  grid-template-areas: "word place place place" "left what right setup";
  align-content: end;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}
.sound-pager .sp-word { grid-area: word; font-size: 9px; line-height: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--disp-dim); }
.sound-pager .sp-left { grid-area: left; justify-self: start; }
.sound-pager .sp-right { grid-area: right; }
.sound-pager .sp-setup { grid-area: setup; }
/* The name between the arrows; its place on the caption row after SOUND (SOUND · 4 OF 12). */
.sound-pager .sp-what { display: contents; }
.sound-pager .sp-name { grid-area: what; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: center; color: var(--disp-text); }
.sound-pager .sp-place { grid-area: place; font-size: 9px; font-weight: 500; line-height: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--disp-dim); }
.sound-pager .pager-btn { --bk: var(--disp-dim); min-width: 20px; height: 20px; padding: 0 6px; color: var(--disp-text); }
.sound-pager .pager-btn:hover { --bk: var(--disp-text); }

.d-info.live { cursor: pointer; }

.silk { position: relative; height: calc(var(--u) * 0.46); }
.bracket {
  position: absolute;
  bottom: calc(var(--u) * 0.1);
  height: 5px;
  border-top: 1px solid var(--bracket);
  border-left: 1px solid var(--bracket);
  border-right: 1px solid var(--bracket);
}
.bracket > span {
  position: absolute;
  top: -0.62em;
  left: calc(var(--u) * 0.12);
  padding: 0 5px;
  background: var(--body);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk);
  white-space: nowrap;
  line-height: 1.2;
}
.b-pads { left: var(--u); width: calc(var(--u) * 3.889); }
.b-parts { left: calc(var(--u) * 5); width: calc(var(--u) * 1.889); }
.b-steps { left: calc(var(--u) * 7); width: calc(var(--u) * 3.889); }
.b-slide { left: calc(var(--u) * 12.556); width: calc(var(--u) * 1.222); }
.b-slide span { left: 50%; transform: translateX(-50%); }
/*
 * The pager's controls, on the display and on the body: a word in caption type and the drawn arrow of its key (rule 4),
 * pointing the way the key does (`data-code`), at 30% where it would do nothing.
 */
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pager-btn .pb-word:empty { display: none; }
.pager-btn .pb-key { display: inline-block; flex: none; width: 6px; height: 7px; font-size: 0; }
.pager-btn .pb-key::before { content: ""; display: block; width: 100%; height: 100%; background: currentColor; }
.pager-btn[data-code="ArrowLeft"] .pb-key::before { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.pager-btn[data-code="ArrowRight"] .pb-key::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.pager-btn[data-code="ArrowDown"] .pb-key, .pager-btn[data-code="ArrowUp"] .pb-key { width: 7px; height: 6px; }
.pager-btn[data-code="ArrowDown"] .pb-key::before { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.pager-btn[data-code="ArrowUp"] .pb-key::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.pager-btn.idle { opacity: 0.3; }
/*
 * The bar pager over the step keys, printed on the body: ◀ BAR 2 OF 8 ▶ (+ BAR on the last bar), the bar sounding
 * (▸ 5) while playing, HOLD reversed in the silk ink and FOLLOW ▼ while a bar is held.
 */
.b-steps.paging > .caption, .b-steps:not(.paging) > .bar-pager { display: none; }
.bracket > .bar-pager { display: inline-flex; align-items: center; gap: 4px; top: -8px; height: 16px; padding: 0 4px; line-height: 1; }
.bar-pager .pager-btn { height: 16px; padding: 0 4px; color: var(--silk); }
.bar-pager .pager-btn:hover { --bk: var(--silk-dim); }
.bar-pager .pager-btn:active { background: var(--silk); color: var(--body); }
.bp-text { white-space: nowrap; }
.bp-hold, .bp-follow { display: none; }
.bar-pager.held .bp-hold { display: inline; padding: 2px 4px; background: var(--silk); color: var(--body); }
.bar-pager.held .bp-follow { display: inline-flex; }
.bp-tick:empty { display: none; }
.bp-tick { color: var(--silk-dim); white-space: nowrap; }

/*
 * The bar map at the top right of the display, under its caption BARS: a cell a bar in rows of four (rule 4), a
 * line lit across it where the bar has hits, reversed where it is the bar the steps show, a segment under the one
 * sounding that blinks on the beat, `+` after the last. The button is the target; the cell is drawn centred in it.
 */
.bar-map { --cw: clamp(16px, calc(var(--u) * 0.263), 20px); --ch: 12px; display: grid; grid-template-columns: repeat(4, var(--cw)); gap: 4px; }
.bm-box {
  --rule: var(--disp-dim);
  --lit: transparent;
  position: relative;
  width: var(--cw);
  height: var(--ch);
  color: var(--disp-dim);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}
.bm-box::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cw);
  height: var(--ch);
  border: 1px solid var(--rule);
  background: linear-gradient(var(--lit), var(--lit)) center / calc(100% - 6px) 2px no-repeat;
  transform: translate(-50%, -50%);
}
.bm-box.gone { display: none; }
.bm-box.filled { --lit: var(--disp-text); }
.bm-box:hover { --rule: var(--disp-text); color: var(--disp-text); }
.bm-box.shown::before, .bm-box:active::before { border-color: var(--disp-text); }
.bm-box.shown.filled, .bm-box.filled:active { --lit: var(--glass); }
.bm-box.plus { line-height: var(--ch); }
.bm-box.sounding::after {
  content: "";
  position: absolute;
  left: calc(50% - var(--cw) / 2 + 2px);
  width: calc(var(--cw) - 4px);
  top: calc(50% + var(--ch) / 2 + 1px);
  height: 2px;
  background: var(--disp-text);
  animation: bm-tick calc(var(--beat, 0.3s) * 2) steps(1) infinite;
}
@keyframes bm-tick { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .bm-box.sounding::after { animation: none; }
}

.board { position: relative; height: calc(var(--rp) * 4 - var(--gap)); }

.key {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--rp));
  width: var(--kw);
  height: var(--kh);
  cursor: pointer;
  touch-action: none;
  --cap: var(--mid-cap);
  --ink: var(--mid-ink);
  --ink-dim: var(--mid-ink-dim);
}

.cap {
  --cap-wall: color-mix(in srgb, var(--cap) 66%, var(--wall-tint));
  --cap-down: color-mix(in srgb, var(--cap) 92%, var(--wall-tint));
  position: absolute;
  inset: 0 0 5px 0;
  border-radius: calc(var(--kw) * 0.12);
  background-color: var(--cap);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 5px 0 var(--cap-wall), 0 7px 6px -1px var(--cap-drop);
  transition: transform 70ms ease-out, box-shadow 70ms ease-out, background-color 70ms ease-out;
}
.key.held .cap, .key.mode .cap, .key.locked .cap {
  transform: translateY(4px);
  background-color: var(--cap-down);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 1px 0 var(--cap-wall), 0 2px 2px 0 var(--cap-drop);
  transition-duration: 50ms;
}
@media (prefers-reduced-motion: reduce) {
  .cap, .key.held .cap, .key.mode .cap, .key.locked .cap { transition: none; }
}
/*
 * A hold latched by a double tap (SPEC section 15, "Latching a hold"): drawn pressed, with the plate's one lock (SPEC
 * section 15.1, "Controls on the display", rule 4): 7 by 8 px in the key's ink at the top centre of the cap, clear of
 * the legend, the part's block and the marks in the corners.
 */
.key.locked .cap::before, .key.locked .cap::after {
  content: "";
  position: absolute;
  left: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}
.key.locked .cap::before {
  top: calc(var(--u) * 0.06);
  width: 5px;
  height: 4px;
  border: 1.5px solid var(--ink);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}
.key.locked .cap::after {
  top: calc(var(--u) * 0.06 + 4px);
  width: 7px;
  height: 4px;
  background: var(--ink);
}

.has-strip .cap { bottom: calc(var(--kh) * 0.31 + 5px); }
.strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--kh) * 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: var(--strip);
  color: var(--strip-ink);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cap .legend, .cap .num {
  position: absolute;
  top: calc(var(--u) * 0.06);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.cap .legend { left: calc(var(--u) * 0.08); }
.cap .num { right: calc(var(--u) * 0.08); }
.cap .label {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 22%;
  bottom: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(10px, calc(var(--u) * 0.15), 11px);
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
}
.cap .label.cased { text-transform: none; letter-spacing: 0.02em; font-size: 12px; }
.cap .mark {
  position: absolute;
  top: calc(var(--u) * 0.05);
  right: calc(var(--u) * 0.08);
  font-size: 8px;
  line-height: 1.1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pc);
}
.board:not([data-mode="play"]):not([data-mode="sample"]) .key.pad .mark { color: var(--lamp-alt); }

.lamp {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 11%;
  height: max(4px, 8%);
  border-radius: 2px;
  border: 1.5px solid transparent;
  opacity: var(--lo, 1);
  transition: background-color 60ms linear, opacity 60ms linear;
}
.lamp.lit { background: var(--lc); border-color: var(--lamp-edge); }
.lamp.ring { border: 1.5px solid var(--lc); }
.lamp.dash { border: 1.5px dashed var(--lc); }
.lamp.thin { height: 2px; bottom: 14%; background: var(--lc); border: 0; opacity: 0.7; }
.board[data-mode="play"] .key.pad.held .lamp,
.board[data-mode="part"] .key.pad.held .lamp,
.board[data-mode="scenes"] .key.pad.held .lamp,
.key.pad.flash .lamp { background: var(--pc); border-color: var(--lamp-edge); opacity: 1; transition: none; }

.key.pad { --ink: var(--pad-ink); --ink-dim: var(--pad-ink-dim); }
.key.pad.row0 { --cap: var(--pad-cap-3); }
.key.pad.row1 { --cap: var(--pad-cap-2); }
.key.pad.row2 { --cap: var(--pad-cap-1); }
.key.pad.row3 { --cap: var(--pad-cap-0); }
/*
 * Sound files dragged over the plate: every pad is a place to drop, framed in a dashed white rule; the pads a drop
 * would fill in a solid one, the pad under the pointer in a heavier one (it says DROP HERE). White, as marks are.
 */
.board.dropping .key.pad .cap { outline: 1px dashed #ffffff; outline-offset: 2px; }
.board.dropping .key.pad.drop-to .cap { outline: 2px solid #ffffff; }
.board.dropping .key.pad.drop-at .cap { outline-width: 3px; }
.board.dropping .key.pad.drop-to .mark { color: var(--ink); }
.key.step { --cap: var(--step-cap); --ink: var(--step-ink); --ink-dim: var(--step-ink-dim); }
.key.step .label { top: 22%; bottom: 36%; font-size: 12px; letter-spacing: 0.04em; }
.key.step .lamp { left: 20%; right: 20%; bottom: 12%; height: 7px; border-radius: 1.5px; }
.key.step .lamp.accent { height: 11px; }
.key.step .lamp.lit { border: 1px solid var(--step-lamp-edge); }
.key.step .lamp.dash { border: 1.5px dashed var(--lc); background: transparent; }
.key.step .lamp.thin { height: 2px; bottom: calc(12% + 2.5px); border: 0; opacity: 1; }
.key.step.beat .lamp.lit { opacity: 1; filter: brightness(1.45); transition: none; }
.key.step .sub, .key.step .dbar { display: none; }
.board[data-dials="1"] .key.step .label { top: 22%; bottom: 46%; font-size: 11px; }
.board[data-dials="1"] .key.step .sub {
  display: block;
  position: absolute;
  left: 3px;
  right: 3px;
  top: 57%;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
}
.board[data-dials="1"] .key.step .dbar {
  display: block;
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 14%;
  height: 4px;
  border-radius: 1px;
  background: var(--meter-off);
  overflow: hidden;
}
.board[data-dials="1"] .key.step .dbar .fill { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--pc); }
.board[data-dials="1"] .key.step .lamp { display: none; }
/* A dial the snapshot does not give (setup's rows 3 and 4, a dial that does not apply): unlit. */
.board[data-dials="1"] .key.step.dark .dbar { visibility: hidden; }
.key.dark .cap { filter: brightness(0.62); }
.key.dark .cap .legend { opacity: 0.35; }

.key.step.playhead::after {
  content: "";
  position: absolute;
  inset: calc(var(--u) * -0.055);
  border: 1.5px solid var(--ring);
  border-radius: calc(var(--kw) * 0.16);
  pointer-events: none;
}

.key.part .block {
  position: absolute;
  top: calc(var(--u) * 0.07);
  right: calc(var(--u) * 0.08);
  width: calc(var(--u) * 0.13);
  height: calc(var(--u) * 0.13);
  border-radius: 2px;
  background: var(--pc);
  box-shadow: inset 0 0 0 1px var(--lamp-edge);
  opacity: 0.3;
}
.key.part.sel .block { opacity: 1; }
.key.part.empty .block { opacity: 0.08; }
.key.part.empty .label { color: var(--ink-dim); }
.key.part .label { bottom: 34%; }
.key.part .mark { top: auto; bottom: 22%; left: 0; right: 0; text-align: center; color: var(--ink-dim); }
.key.part.muted .label { text-decoration: line-through; color: var(--ink-dim); }
.key.part.muted .block, .key.part.muted .meter { opacity: 0.15; }
.key.part.muted { --cap: color-mix(in srgb, var(--mid-cap) 70%, var(--body)); }
.key.part.mute-pending::after {
  content: "";
  position: absolute;
  inset: calc(var(--u) * -0.055);
  border: 1.5px dashed var(--pc);
  border-radius: calc(var(--kw) * 0.16);
  pointer-events: none;
}
.board[data-mode="scenes"] .key.part.muted .mark { color: var(--ink); }
.key.part .meter {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 13%;
  height: 2px;
  background: var(--meter-off);
  overflow: hidden;
}
.key.part .meter .fill { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--pc); }

.key.edge { width: calc(var(--w, 1) * var(--u) - var(--gap)); }
.key.edge .label { letter-spacing: 0.1em; }

.zone {
  position: absolute;
  left: calc(var(--u) * 12.556);
  top: 0;
  width: calc(var(--u) * 1.222);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: grab;
  touch-action: none;
}
.zone.locked { cursor: none; }
.knob { display: flex; flex-direction: column; align-items: center; }
.knob-silk {
  position: relative;
  width: 100%;
  height: 5px;
  margin: 6px 0 calc(var(--u) * 0.1);
  border-top: 1px solid var(--bracket);
  border-left: 1px solid var(--bracket);
  border-right: 1px solid var(--bracket);
}
.knob-silk span {
  position: absolute;
  top: -0.62em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 5px;
  background: var(--body);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk);
  line-height: 1.2;
  white-space: nowrap;
}
.knob.idle .knob-silk span { color: var(--silk-dim); }
.disc {
  position: relative;
  width: calc(var(--u) * 0.92);
  height: calc(var(--u) * 0.92);
  border-radius: 50%;
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 2px 0 var(--cap-shadow);
}
.kcap {
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 2px 0 var(--cap-shadow);
  transform: rotate(var(--a, 0deg));
  transition: transform 80ms linear;
}
.kcap .tick {
  position: absolute;
  top: 9%;
  left: 50%;
  width: 2px;
  height: 32%;
  margin-left: -1px;
  border-radius: 1px;
}
.knob-x .disc { background: var(--knob-x-base); }
.knob-x .kcap { background: var(--knob-x-cap); }
.knob-x .tick { background: var(--knob-x-tick); }
.knob-y .disc { background: var(--knob-y-base); }
.knob-y .kcap { background: var(--knob-y-cap); }
.knob-y .tick { background: var(--knob-y-tick); }
.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--u) * 0.24);
  height: calc(var(--u) * 0.24);
  margin-top: calc(var(--u) * 0.1);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
}
.knob-x .badge { background: var(--badge-x); color: var(--badge-x-ink); }
.knob-y .badge { background: var(--badge-y); color: var(--badge-y-ink); }

.controls {
  display: flex;
  gap: var(--gap);
  height: calc(var(--u) * 0.82);
  margin-top: calc(var(--u) * 0.26);
}
.key.control {
  position: relative;
  left: auto;
  top: auto;
  flex: 1 1 0;
  width: auto;
  height: 100%;
}
.key.control .cap { bottom: calc(var(--u) * 0.82 * 0.31 + 5px); }
.key.control .label { top: 0; bottom: 0; letter-spacing: 0.1em; }
.key.control .legend { left: calc(var(--u) * 0.1); }
.key.control .lamp { left: auto; right: calc(var(--u) * 0.14); bottom: 50%; width: 10px; height: 4px; transform: translateY(50%); }
.key.control.hero { --cap: var(--hero); --ink: var(--hero-ink); --ink-dim: var(--hero-ink); }

.foot { position: relative; height: 34px; margin-top: calc(var(--u) * 0.18); }

/*
 * Marks of the lesson, in the theme's highest-contrast neutral, never a colour:
 * white on the black finish, near-black on the silver one, each edged in the other (--mark, --mark-edge). Orange
 * stays the plate's own (the bell, KEEP); a KEEP to press wears the ring around its own orange. A spotlight: while a
 * step waits every other key steps back to about half, so the instrument still looks like itself; on the silver
 * finish light keys also turn grey, so a key that waits reads "not now", not white on white. The key to press: a
 * ring with a soft glow that pulses slowly. A key to hold: lit in the marking, its legend in the edge colour. A key
 * whose turn comes later in the same step: a quiet dashed ring. Each marked key carries its word (TAP, HOLD, THEN
 * TAP) above it and, when a step takes more than one press, its number; a key the plate saw done carries a tick.
 * The step keys a fill writes light up in turn (--seq). The zone takes the same ring, a large gliding arrow and its
 * word for a drag. Reduced motion: no pulse, no glide, the fill lit at once; the marks stay as they are.
 */
:root {
  --mark: light-dark(#111111, #ffffff);
  --mark-edge: light-dark(#ffffff, #111111);
  --mark-glow: light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
  --dim-opacity: 0.5;
  --dim-filter: none;
}
:root[data-theme="silver"] { --dim-opacity: 0.8; --dim-filter: grayscale(0.8) brightness(0.8); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="black"]) { --dim-opacity: 0.8; --dim-filter: grayscale(0.8) brightness(0.8); }
}
.key, .zone { transition: opacity 200ms ease-out, filter 200ms ease-out; }
.device.spotlight .key:not(.mark-tap):not(.mark-hold):not(.mark-held):not(.mark-next):not(.mark-done):not(.mark-fill),
.device.spotlight .zone:not(.mark-drag):not(.mark-tap) { opacity: var(--dim-opacity); filter: var(--dim-filter); }
.key.mark-tap::before, .key.mark-hold::before, .key.mark-held::before, .key.mark-next::before, .key.mark-done::before,
.key.mark-fill::before, .zone.mark-drag::before, .zone.mark-tap::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 3px solid var(--mark);
  border-radius: calc(var(--kw) * 0.2);
  box-shadow: inset 0 0 0 1.5px var(--mark-edge), 0 0 0 1.5px var(--mark-edge), 0 0 12px 3px var(--mark-glow);
  pointer-events: none;
  z-index: 2;
}
.zone.mark-drag::before, .zone.mark-tap::before { border-radius: calc(var(--u) * 0.2); }
.key.mark-tap::before, .zone.mark-drag::before, .zone.mark-tap::before { animation: mark-pulse 1.8s ease-in-out infinite alternate; }
@keyframes mark-pulse {
  from { box-shadow: inset 0 0 0 1.5px var(--mark-edge), 0 0 0 1.5px var(--mark-edge), 0 0 4px 1px var(--mark-glow); }
  to { box-shadow: inset 0 0 0 1.5px var(--mark-edge), 0 0 0 1.5px var(--mark-edge), 0 0 20px 7px var(--mark-glow); }
}
.key.mark-next::before { border-width: 2px; border-style: dashed; box-shadow: none; opacity: 0.7; }
.key.mark-tap .cap .label, .key.mark-tap .cap .legend, .key.mark-hold .cap .label, .key.mark-held .cap .label { font-weight: 800; }
.key.mark-tap .cap .legend { font-size: 12px; color: var(--ink); }
.key.mark-hold, .key.mark-held { --cap: var(--mark); --ink: var(--mark-edge); --ink-dim: var(--mark-edge); }
.key.mark-held::before { border-style: double; border-width: 5px; }
/* SHOW ME presses the key: it is seen to go down. */
.key.mark-pressed .cap {
  transform: translateY(4px);
  background-color: var(--cap-down);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 1px 0 var(--cap-wall), 0 2px 2px 0 var(--cap-drop);
}
/* The fill: the step keys the lesson wrote light up one after another. */
.key.mark-fill::before { background: color-mix(in srgb, var(--mark) 30%, transparent); opacity: 0; animation: mark-fill 240ms ease-out forwards; animation-delay: calc(var(--seq, 0) * 90ms); }
@keyframes mark-fill { to { opacity: 1; } }
.mark-tag, .mark-order {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.mark-tag {
  left: 50%;
  top: -14px;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--mark);
  color: var(--mark-edge);
  letter-spacing: 0.14em;
  white-space: nowrap;
  box-shadow: 0 0 0 1.5px var(--mark-edge);
}
.key:not(.mark-labelled) > .mark-tag, .zone:not(.mark-drag) > .mark-tag { display: none; }
.key.mark-next > .mark-tag { background: var(--mark-edge); color: var(--mark); box-shadow: 0 0 0 1.5px var(--mark); }
.mark-order {
  right: -9px;
  top: -9px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--mark);
  color: var(--mark-edge);
  box-shadow: 0 0 0 2px var(--mark-edge);
}
.key.mark-next > .mark-order { background: var(--mark-edge); color: var(--mark); box-shadow: 0 0 0 2px var(--mark); }
.key:not([data-order]) > .mark-order { display: none; }
/* The drag: a large arrow over the knobs, gliding the way to drag. */
.drag-arrow { display: none; position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.zone.mark-drag .drag-arrow { display: block; }
.drag-arrow[data-dir="down"] { transform: rotate(180deg); }
.drag-arrow[data-dir="left"] { transform: rotate(-90deg); }
.drag-arrow[data-dir="right"] { transform: rotate(90deg); }
.drag-arrow i {
  position: absolute;
  left: calc(var(--u) * -0.09);
  top: calc(var(--u) * -0.9);
  width: calc(var(--u) * 0.18);
  height: calc(var(--u) * 1.8);
  border-radius: calc(var(--u) * 0.09);
  background: var(--mark);
  box-shadow: 0 0 0 3px var(--mark-edge);
  animation: drag-glide 1.2s ease-in-out infinite;
}
.drag-arrow i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--u) * -0.34);
  transform: translateX(-50%);
  border-left: calc(var(--u) * 0.26) solid transparent;
  border-right: calc(var(--u) * 0.26) solid transparent;
  border-bottom: calc(var(--u) * 0.4) solid var(--mark);
  filter: drop-shadow(0 0 2px var(--mark-edge));
}
@keyframes drag-glide { 0% { transform: translateY(calc(var(--u) * 0.5)); opacity: 0.25; } 70% { transform: translateY(calc(var(--u) * -0.35)); opacity: 1; } 100% { transform: translateY(calc(var(--u) * -0.45)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .key, .zone { transition: none; }
  .key.mark-tap::before, .zone.mark-drag::before, .zone.mark-tap::before { animation: none; }
  .key.mark-fill::before { animation: none; opacity: 1; }
  .drag-arrow i { animation: none; }
}

/* Key names on the card, drawn as little keycaps in the keyboard's marking; the card is dark glass in both finishes. */
.cap-mini {
  display: inline-block;
  min-width: 1.5em;
  margin: 0 1px;
  padding: 0 4px;
  border: 1.5px solid var(--disp-dim);
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.cap-mini.mark-tap { border: 2.5px solid #ffffff; color: #ffffff; }
.cap-mini.mark-hold, .cap-mini.mark-held { border-color: #ffffff; background: #ffffff; color: #111111; }
.cap-mini.mark-next { border: 1.5px dashed #ffffff; color: #ffffff; }

.tour-card {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: calc(var(--pad) * 0.55);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 6px 8px 6px 0;
  background: var(--glass);
  color: var(--disp-text);
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--glass), inset 0 0 0 4px var(--frame), inset 0 1px 0 var(--glass-hi), 0 2px 0 var(--body-edge);
  z-index: 4;
  overflow: hidden;
}
/* The lesson's card is a ticket: a stub with the place as its seat, torn off along a perforation. */
.tour-stub {
  position: relative;
  flex: none;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 70px;
  margin: -6px 0;
  padding: 0 14px;
  border-right: 1.5px dashed var(--frame);
}
.tour-stub::before, .tour-stub::after {
  content: "";
  position: absolute;
  right: -6.75px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--body);
}
.tour-stub::before { top: -6px; }
.tour-stub::after { bottom: -6px; }
.tour-seat { font-size: 8px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--disp-dim); }
.tour-card.hidden-card { display: none; }
.tour-count {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--disp-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tour-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tour-text { margin: 0; font-size: 13px; letter-spacing: 0.02em; }
.tour-why { margin: 0; font-size: 12px; letter-spacing: 0.02em; color: color-mix(in srgb, var(--disp-text) 72%, transparent); }
/* The lesson's card: the chapters as a row, the current one lit; one large sentence; one line under it. */
.tour-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.tour-chapters { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--disp-dim); white-space: nowrap; }
.tour-chapters li.now { color: var(--disp-text); font-weight: 800; box-shadow: 0 1.5px 0 var(--disp-text); }
.tour-heading { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.lesson-card { padding-top: 5px; padding-bottom: 5px; }
.lesson-card .tour-text { font-size: 19px; font-weight: 600; line-height: 1.2; }
.lesson-card.titled .tour-text { font-size: 14px; font-weight: 500; line-height: 1.25; }
.lesson-card.tick .tour-text::before { content: "✓ "; font-weight: 800; }
.tour-chapters[hidden], .tour-heading[hidden], .tour-why[hidden], .tour-actions button[hidden] { display: none; }
.tour-actions { flex: none; display: flex; gap: 6px; }
/*
 * The plate's small key cap (SPEC section 15.1, "Controls on the display", rule 4), for controls on the body and on
 * the cards that lie on it: HELP, the lesson card's NEXT, BACK, SHOW ME, SKIP and LEAVE, the help sheet's
 * controls. A key in miniature: the mid key's face, a 1 px highlight, a 2 px wall of its own colour, a 9 px legend;
 * pressed it travels down 2 px. The control that moves on (NEXT, MORE) has the finish's light face.
 */
.tour-actions button, .sheet-ctl button, .copy-btn, .lesson-start, .help-mark {
  --cap: var(--mid-cap);
  padding: 5px 10px;
  border: 0;
  border-radius: 3px;
  background: var(--cap);
  color: var(--mid-ink);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 2px 0 color-mix(in srgb, var(--cap) 66%, var(--wall-tint));
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.tour-actions button:active, .sheet-ctl button:active, .copy-btn:active, .lesson-start:active, .help-mark:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 var(--cap-hi);
}
.tour-actions .tour-next, .tour-actions .tour-more { --cap: var(--cap-light); color: var(--cap-light-ink); }

.sheet {
  position: absolute;
  top: calc(var(--pad) * 0.7 + var(--u) * 0.3);
  left: var(--pad);
  right: var(--pad);
  bottom: var(--pad);
  display: flex;
  flex-direction: column;
  background: var(--body);
  border-radius: calc(var(--u) * 0.12);
  box-shadow: 0 0 0 1px var(--body-edge), inset 0 1px 0 var(--body-hi);
  color: var(--silk);
  z-index: 6;
  overflow: hidden;
}
.sheet[hidden] { display: none; }
.sheet.chooser { left: 22%; right: 22%; bottom: auto; max-height: calc(100% - var(--pad) * 2 - var(--u) * 0.3); }
.chooser-input {
  margin: 12px 16px 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  outline: 0;
  background: var(--glass);
  color: var(--disp-text);
  caret-color: var(--disp-orange);
  font: inherit;
  font-size: 13px;
}
.chooser-list { overflow-y: auto; padding: 4px 8px 12px; min-height: 60px; }
.chooser-row {
  display: grid;
  grid-template-columns: 1fr auto 48px;
  gap: 12px;
  align-items: center;
  padding: 7px 8px;
  border: 1.5px solid transparent;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}
.chooser-row:hover { background: var(--meter-off); }
.chooser-row.marked { border-color: var(--tour-ring); }
.chooser-row .p-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chooser-row .p-vendor { color: var(--silk-dim); white-space: nowrap; }
.chooser-row .p-format { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--silk-dim); text-align: right; }
.chooser-note { padding: 4px 8px; font-size: 12px; color: var(--silk); }
/* The help sheet is a programme: a masthead over a double rule, headings set between rules. */
.sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 9px 16px 7px;
  border-bottom: 3px double var(--bracket);
}
.sheet-house { display: inline-flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; }
.sheet-mast { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.sheet-bill { display: flex; align-items: center; gap: 8px; font-size: 8px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--silk-dim); }
.sheet-bill::before, .sheet-bill::after { content: ""; width: 24px; border-top: 1px solid var(--silk-dim); }
.sheet-title { margin-right: -0.42em; font-size: 15px; font-weight: 700; letter-spacing: 0.42em; text-transform: uppercase; }
.sheet-ctl { justify-self: end; display: flex; gap: 8px; }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  grid-template-areas: "company company company" "set set set" "lesson lesson lesson" "keys sample files" "keys talk agent";
  grid-template-rows: auto auto auto auto 1fr;
  column-gap: 26px;
  align-content: start;
}
.sheet-sec { margin-bottom: 16px; min-width: 0; }
.sec-keys { grid-area: keys; }
.sec-sample { grid-area: sample; }
.sec-talk { grid-area: talk; }
.sec-files { grid-area: files; }
.sec-agent { grid-area: agent; }
.sec-company { grid-area: company; }
/* TONIGHT'S SET: the running order, a numbered line of songs with a tick and up and down each; the one on stage lit. */
.sec-set { grid-area: set; }
/* THE LESSON: its two controls, then each part's chapters side by side, each with its numbered steps. */
.sec-lesson { grid-area: lesson; }
.lesson-how { align-items: center; }
.lesson-start { --cap: var(--hero); flex: none; color: var(--hero-ink); }
.lesson-start.lesson-more { --cap: var(--mid-cap); color: var(--mid-ink); }
.lesson-part { margin: 8px 0 0; font-size: 10px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--silk); }
.songbook-open {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--silk-dim);
  border-radius: 5px;
  color: var(--silk);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}
.songbook-open:hover, .songbook-open:focus-visible { border-color: var(--silk); }
.lesson-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 18px; margin: 4px 0 0; padding: 0; list-style: none; }
.lesson-chapter { min-width: 0; }
.lesson-title { display: block; font-size: 9px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--silk); }
.lesson-steps { margin: 2px 0 0; padding-left: 16px; font-size: 11px; line-height: 1.35; color: var(--silk); }
.set-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 2px 0 4px; list-style: none; }
.set-song { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--silk); }
.set-song.off .set-name, .set-song.off .set-place { color: var(--silk-dim); text-decoration: line-through; }
.set-song.playing .set-name { font-weight: 700; }
.set-place { min-width: 12px; font-size: 10px; text-align: right; color: var(--silk-dim); }
.set-now { padding: 0 5px; border: 1px solid var(--silk); border-radius: 3px; font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; }
.set-tick, .set-move {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--silk-dim);
  border-radius: 4px;
  background: none;
  color: var(--silk);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}
.set-move { width: 18px; border-color: transparent; color: var(--silk-dim); }
.set-move:disabled { visibility: hidden; }
.set-tick:hover, .set-move:hover { border-color: var(--silk); color: var(--silk); }
.set-empty { font-size: 12px; color: var(--silk-dim); }
.set-how { min-height: 0; padding: 2px 0 0; }
/* THE COMPANY: the programme's cast page, five players side by side, a round portrait over each billing. */
.cast { display: grid; grid-template-columns: repeat(5, 1fr); column-gap: 18px; padding: 4px 0 2px; }
.cast-member { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; text-align: center; }
.cast-face {
  position: relative;
  width: 58px;
  height: 58px;
  margin-bottom: 5px;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #ececea, #b9b9b6);
  box-shadow: 0 0 0 2px var(--body), 0 0 0 3px var(--silk-dim);
}
.cast-art { position: absolute; left: var(--fx, 4%); top: var(--fy, 6%); width: var(--fw, 92%); }
.cast-art img { display: block; width: 100%; height: auto; }
.cast-art .cast-hat { position: absolute; left: 22.9%; top: -6.6%; width: 38.7%; }
.cast-moxie .cast-art { --fx: 3%; --fy: 18%; --fw: 92%; }
.cast-gus .cast-art { --fx: -18%; --fy: -4%; --fw: 125%; }
.cast-ozzie .cast-art { --fx: 2%; --fy: 8%; --fw: 96%; }
.cast-pip .cast-art { --fx: 2%; --fy: 4%; --fw: 92%; }
.cast-nib .cast-art { --fx: 4%; --fy: 8%; --fw: 92%; }
.cast-name { font-size: 13px; font-weight: 700; letter-spacing: 0.22em; margin-right: -0.22em; text-transform: uppercase; color: var(--silk); }
.cast-job { font-size: 8px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--silk-dim); }
.cast-line { margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--silk); text-wrap: balance; }
.device.lesson-on .foot p { visibility: hidden; }
/* The lesson's card is taller than the foot's line: the foot makes room, so the card never covers SPACE or KEEP. */
.device.lesson-on .foot { height: 50px; }
.sheet-cap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--silk);
}
.sheet-cap::before, .sheet-cap::after { content: ""; flex: 1; border-top: 1px solid var(--silk-dim); }
.sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.3;
}
.sheet-row .what { flex: 1; }
.caps { flex: none; display: inline-flex; align-items: center; gap: 3px; min-width: 96px; }
.mini-cap {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--mid-cap);
  color: var(--mid-ink);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 1px 0 var(--cap-shadow);
  font-size: 10px;
  text-transform: uppercase;
}
.plus { font-size: 10px; color: var(--silk-dim); }
.word {
  flex: none;
  min-width: 96px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--silk);
}
.copy-row { flex-direction: column; align-items: stretch; gap: 4px; padding: 4px 0; }
.copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  background: var(--glass);
  border-radius: 5px;
  color: var(--disp-text);
}
.copy-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  user-select: text;
  -webkit-user-select: text;
}
.copy-status { flex: none; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--disp-orange); }
.foot p {
  margin: 4px 0 0;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk);
}
.foot p.dim { color: var(--silk-dim); }

/*
 * The start overlay is a silent-film title card in a dark house; the plate opens from it with an iris. The card holds
 * only its title and one quiet line; around it, the lobby: a marquee in season, three tickets below, and the
 * programme (your songs) beside the card, or as a sheet over it on a narrow window.
 */
@property --iris { syntax: "<length>"; inherits: false; initial-value: 0px; }
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  overflow-y: auto;
  background: #0a0a0a;
  z-index: 10;
  cursor: pointer;
}
/* The plate needs 900px; the card does not. While the card is up a phone sees the card at its own width. */
html:has(> body > .overlay:not([hidden]):not(.iris)) { overflow: hidden; }
body:has(> .overlay:not([hidden]):not(.iris)) { min-width: 0; overflow: hidden; }
.overlay[hidden] { display: none; }
.overlay.iris {
  cursor: auto;
  pointer-events: none;
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + 1px));
  mask: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + 1px));
  animation: iris-open 400ms cubic-bezier(0.45, 0, 0.7, 1) forwards;
}
@keyframes iris-open { to { --iris: 75vmax; } }
.overlay.iris .lobby { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .overlay.iris { animation: none; }
}
.lobby {
  --card-w: min(640px, 86vw, max(320px, calc((100svh - 240px) * 16 / 11)));
  margin: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.card-wrap { position: relative; }
.title-card {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 16 / 11;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 14px / 12px;
  background:
    radial-gradient(ellipse 40% 58% at 80% 54%, rgba(214, 214, 208, 0.4), transparent 70%),
    radial-gradient(ellipse 72% 72% at 42% 48%, #3c3c3a, #1f1f1e 68%, #121212);
  box-shadow: 0 0 0 1px #262626, 0 30px 80px rgba(0, 0, 0, 0.6);
  color: #f0f0ec;
  text-align: center;
  text-transform: uppercase;
}
.title-card::before, .title-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.title-card::before { background: url(stage-art/ui/grain.svg) 0 0 / 180px 180px; opacity: 0.13; mix-blend-mode: overlay; }
.title-card::after { background: radial-gradient(ellipse 72% 72% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.62) 100%); }
.card-rule {
  position: absolute;
  inset: 14px;
  z-index: 1;
  border: 4px double rgba(226, 226, 221, 0.62);
  border-radius: 6px;
  pointer-events: none;
}
.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  background: rgba(226, 226, 221, 0.75);
  -webkit-mask: url(stage-art/ui/corner.svg) center / contain no-repeat;
  mask: url(stage-art/ui/corner.svg) center / contain no-repeat;
}
.corner.tl { top: 4px; left: 4px; }
.corner.tr { top: 4px; right: 4px; transform: scaleX(-1); }
.corner.bl { bottom: 4px; left: 4px; transform: scaleY(-1); }
.corner.br { bottom: 4px; right: 4px; transform: scale(-1); }
.title-card .moxie {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: auto;
  height: 88%;
  filter: drop-shadow(-6px 8px 10px rgba(0, 0, 0, 0.45));
}
.card-text {
  position: absolute;
  z-index: 2;
  left: 7%;
  top: 50%;
  width: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-50%);
}
/* The card's words keep their 640px sizes and shrink with a smaller card (cqw: hundredths of the card's width). */
.title-card .logo { width: min(44px, 6.9cqw); height: min(44px, 6.9cqw); margin: 0 0 min(12px, 1.9cqw); color: #f0f0ec; }
.title-card .logo .logo-base { fill: #9d9d98; }
.title-card h1 { margin: 0 -0.3em 0 0; font-size: min(34px, 5.3cqw); font-weight: 700; letter-spacing: 0.3em; color: #f4f4f0; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.card-flourish {
  position: relative;
  width: min(150px, 23.4cqw);
  height: 8px;
  margin: min(12px, 1.9cqw) 0 min(14px, 2.2cqw);
  background: linear-gradient(#bdbdb8, #bdbdb8) left center / 44% 1px no-repeat, linear-gradient(#bdbdb8, #bdbdb8) right center / 44% 1px no-repeat;
}
.card-flourish::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  background: #d8d8d3;
  transform: translate(-50%, -50%) rotate(45deg);
}
.title-card p { margin: 0; font-size: max(8px, min(11px, 1.72cqw)); line-height: 1.7; letter-spacing: 0.16em; color: #d8d8d3; text-wrap: balance; }
.title-card p[hidden] { display: none; }
/* The one quiet line: the song and its place in the set, or what went wrong. */
.title-card .card-song { margin-top: min(12px, 1.9cqw); color: #a9a9a4; text-transform: none; letter-spacing: 0.06em; }
.title-card .card-song.missing { color: #e8c39e; }
.title-card .card-song.error { color: var(--error); letter-spacing: 0.02em; }

/* The marquee: the season's title framed in bulbs that chase; steady with reduced motion. */
.marquee {
  position: relative;
  padding: 10px 30px;
  border-radius: 6px;
  background: linear-gradient(#1b1a18, #121110);
  box-shadow: 0 0 0 1px #2b2a27, inset 0 0 0 9px #0e0d0c, 0 10px 30px rgba(0, 0, 0, 0.5);
}
.marquee[hidden] { display: none; }
.marquee::before, .marquee::after {
  --b: radial-gradient(circle, var(--bulb-on) 0 2px, transparent 2.6px);
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    var(--b) 0 1px / 12px 8px repeat-x,
    var(--b) 0 calc(100% - 1px) / 12px 8px repeat-x,
    var(--b) 1px 0 / 8px 12px repeat-y,
    var(--b) calc(100% - 1px) 0 / 8px 12px repeat-y;
  filter: drop-shadow(0 0 2px var(--bulb-halo));
}
.marquee::after { background-position: 6px 1px, 6px calc(100% - 1px), 1px 6px, calc(100% - 1px) 6px; animation: marquee-chase 1.2s steps(1) infinite; }
.marquee::before { animation: marquee-chase 1.2s steps(1) infinite reverse; }
@keyframes marquee-chase { 0% { opacity: 1; } 50% { opacity: 0.25; } }
.marquee-title {
  display: block;
  margin-right: -0.34em;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.34em;
  color: #f7f1e3;
  text-shadow: 0 0 6px var(--bulb-halo), 0 0 1px var(--bulb-on);
  white-space: nowrap;
}

/* The tickets: the lesson card's ticket (stub, perforation, words) with a drawn emblem and the key that works it. */
.tickets { display: flex; gap: 14px; width: var(--card-w); }
.ticket {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--glass);
  color: var(--disp-text);
  box-shadow: inset 0 0 0 3px var(--glass), inset 0 0 0 4px var(--frame), inset 0 1px 0 var(--glass-hi), 0 6px 18px rgba(0, 0, 0, 0.45);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease-out;
}
.ticket-stub {
  position: relative;
  flex: none;
  width: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-right: 1.5px dashed var(--frame);
  color: var(--disp-orange);
}
.ticket-stub::before, .ticket-stub::after {
  content: "";
  position: absolute;
  right: -6.75px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0a0a0a;
}
.ticket-stub::before { top: -6px; }
.ticket-stub::after { bottom: -6px; }
.ticket-emblem { width: 24px; height: 24px; }
.ticket-key { padding: 0 4px; border: 1px solid var(--disp-dim); border-radius: 3px; font-size: 8px; font-weight: 700; line-height: 1.4; color: var(--disp-dim); }
.ticket-words { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 8px 12px; }
.ticket-title { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; }
.ticket-line { font-size: 11px; line-height: 1.3; letter-spacing: 0.02em; color: var(--disp-dim); text-wrap: balance; }
.ticket:hover, .ticket:focus-visible { animation: ticket-wobble 420ms ease-out; transform: translateY(-2px) rotate(-0.6deg); }
.ticket:focus-visible { outline: 2px solid var(--disp-orange); outline-offset: 3px; }
.ticket[aria-expanded="true"] { box-shadow: inset 0 0 0 3px var(--glass), inset 0 0 0 4px var(--disp-orange), 0 6px 18px rgba(0, 0, 0, 0.45); }
@keyframes ticket-wobble {
  0% { transform: none; }
  35% { transform: translateY(-3px) rotate(-1.4deg); }
  70% { transform: translateY(-2px) rotate(0.6deg); }
  100% { transform: translateY(-2px) rotate(-0.6deg); }
}

/* The programme: your songs and the ways in and out, printed like a theatre's programme. */
.programme {
  position: absolute;
  left: calc(100% + 24px);
  top: 0;
  width: 284px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
  border-radius: 10px;
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #262624, #171716);
  box-shadow: 0 0 0 1px #2b2b29, inset 0 0 0 6px #171716, inset 0 0 0 9px rgba(226, 226, 221, 0.35), 0 24px 60px rgba(0, 0, 0, 0.6);
  color: #e6e6e1;
  cursor: auto;
  z-index: 3;
}
.programme[hidden] { display: none; }
.programme-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 4px 0 8px; border-bottom: 1px solid rgba(226, 226, 221, 0.25); }
.programme-head h2 { margin: 0 -0.3em 0 0; font-size: 12px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: #f4f4f0; }
.programme-close {
  position: absolute;
  right: -2px;
  top: 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #bdbdb8;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.programme-close:hover, .programme-close:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.08); }
.programme-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.programme-heading { margin: 10px 0 2px; font-size: 9px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: #8d8d88; }
.programme-list { margin: 0; padding: 0; list-style: none; }
.programme-entry {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 6px;
  border: 0;
  border-bottom: 1px dotted rgba(226, 226, 221, 0.18);
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.programme-entry:hover, .programme-entry:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; box-shadow: inset 2px 0 0 var(--disp-orange); }
.programme-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #f0f0ec; }
.programme-line { font-size: 11px; color: #a9a9a4; }
.programme-entry.current { cursor: default; }
.programme-entry.current .programme-label::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--disp-orange); box-shadow: 0 0 5px var(--bulb-halo); }
.programme-note { margin: 10px 0 0; font-size: 10px; color: #8d8d88; }
.programme-error { margin: 8px 0 0; font-size: 11px; color: var(--error); }
.programme-error[hidden], .programme-hint[hidden] { display: none; }
.programme-hint {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px dashed rgba(226, 226, 221, 0.25);
  font: 10px/1.5 ui-monospace, Menlo, Consolas, monospace;
  color: #8d8d88;
  user-select: text;
  overflow-wrap: anywhere;
}
.lobby-scrim { display: none; }

/* Narrower than the card and a programme side by side: the programme is a sheet from the bottom, over a dimmed house. */
@media (max-width: 1259px) {
  .lobby-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 2; background: rgba(0, 0, 0, 0.6); cursor: auto; }
  .programme {
    position: fixed;
    left: 50%;
    top: auto;
    bottom: 0;
    width: min(520px, 100vw);
    max-height: min(80svh, 620px);
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0;
    transform: translateX(-50%);
    animation: programme-rise 220ms ease-out;
  }
  @keyframes programme-rise { from { transform: translate(-50%, 40%); opacity: 0; } }
}
/* A phone: the tickets stack under the card. */
@media (max-width: 560px) {
  .lobby { gap: 16px; }
  .tickets { flex-direction: column; gap: 10px; }
  .ticket { flex: none; min-height: 54px; }
  .marquee { padding: 9px 20px; }
  .marquee-title { font-size: 11px; letter-spacing: 0.26em; margin-right: -0.26em; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee::before, .marquee::after { animation: none; }
  .ticket { transition: none; }
  .ticket:hover, .ticket:focus-visible { animation: none; transform: none; }
  .programme { animation: none; }
}

/*
 * The touch layout (SPEC section 15, "Touch"): narrower than the plate's 900 px, or a coarse pointer under 700 px
 * tall (a large phone on its side, wider than 900 px with `viewport-fit=cover`), the plate fills the window and is
 * laid out on a grid for fingers, every control at least 44 px each way, nothing that scrolls or zooms the page.
 * Wide (600 px and wider: phones on their side, tablets upright) keeps the block as the keyboard has it, unstaggered:
 * the edge keys, the pads, the part and hold columns, the steps and the knobs, twelve columns over four rows, with
 * the action row, the arrows and ESC below. Narrow (phones upright) shows the parts and the holds in two rows and one
 * deck of sixteen keys that is the pads or the steps (`data-deck`), with the knobs, ESC and LATCH beside it. The
 * keys come first: 44 px at least (76 px at most upright, 88 px wide); the stage keeps its 300:140 in what height is
 * left, and where too little is left it goes and only the readouts stay. Where even the keys cannot fit, a note asks
 * for a taller window. A coarse pointer 700 px tall or more (a tablet on its side) keeps the desktop plate.
 * The queries here are touch.js `TOUCH_QUERY` and `NARROW_QUERY`, and their combinations; keep them in step.
 */
.touch-only, .say-touch, .too-short { display: none; }

@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  .say-keys, .ticket-key { display: none; }
  .say-touch { display: inline; }
  .overlay { touch-action: pan-y; }
  .programme-close { min-width: 44px; min-height: 44px; top: -9px; right: -9px; }

  html, body { overscroll-behavior: none; }
  body {
    display: block;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  #plate { padding: 0; }

  .device {
    --edge: 6px;
    --g: 3px;
    --W: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - var(--edge) * 2);
    --H: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--edge) * 2);
    --u: 52px;
    --kw: 60px;
    --kh: var(--r);
    --gap: var(--g);
    display: grid;
    gap: var(--g);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: calc(var(--edge) + env(safe-area-inset-top, 0px)) calc(var(--edge) + env(safe-area-inset-right, 0px))
      calc(var(--edge) + env(safe-area-inset-bottom, 0px)) calc(var(--edge) + env(safe-area-inset-left, 0px));
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }
  .brand, .board, .controls { display: contents; }
  .brand .name { display: none; }
  .foot { display: none; }
  .touch-only { display: block; }

  .help-mark { min-width: 44px; min-height: 44px; padding: 0 6px; font-size: 10px; touch-action: manipulation; }

  .key, .key.control, .key.edge {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    min-width: 44px;
    min-height: 44px;
  }
  .key.control .cap { bottom: calc(var(--r) * 0.31 + 5px); }
  /* No keyboard legends on the touch layout (a phone has no such keys); steps keep their numbers 1 to 16. */
  .key:not(.t-deck) .cap .legend { display: none; }
  /* SHIFT keeps its keyboard name on the touch layout, where the words call it that: the name over what it does. */
  .key[data-code="ShiftLeft"] .label { left: 1px; right: 1px; flex-direction: column; font-size: 0; line-height: 1.2; }
  .key[data-code="ShiftLeft"] .label::before { content: "shift"; font-size: 11px; }
  .key[data-code="ShiftLeft"] .label::after { content: "accent · mute"; font-size: 8px; letter-spacing: 0; color: var(--ink-dim); white-space: nowrap; }
  .key.idle .cap .label { color: var(--ink-dim); }
  /* A key LATCH holds down: dashed round, as other pending things are. */
  .key.latched::after {
    content: "";
    position: absolute;
    inset: -2px -2px 3px;
    border: 1.5px dashed var(--hero);
    border-radius: calc(var(--kw) * 0.16);
    pointer-events: none;
  }
  .key.mark-tap::before, .key.mark-hold::before, .key.mark-held::before, .key.mark-next::before, .key.mark-done::before, .key.mark-fill::before { inset: -3px; }
  /*
   * SONG | SCENE on the play key: a switch at the key's right end, framed, with a rule between it and the play area,
   * so a thumb anywhere else on the key plays and stops. Its targets are their own boxes, 44 px and no more, within
   * the key (`--top` sets the 44 px box on the key's face where the key is taller); the frame is drawn on the face.
   * Where the key is short of room (upright on a phone, a tablet upright under 760 px, on its side under 740 px) it is
   * one 44 px target, the two halves stacked: a tap on it chooses the half not chosen, as that half's own tap does.
   */
  .key[data-code="Space"] .label { right: 63px; }
  /* The lamp stands upright on the play side of the rule, clear of the switch's words. */
  .key[data-code="Space"] .lamp { right: 56px; width: 4px; height: 10px; }
  .key[data-code="Space"] .way {
    --top: clamp(0px, calc(var(--r) * 0.345 - 24.5px), calc(var(--r) - 44px));
    --band: 28px;
    --pt: clamp(0px, calc(var(--r) * 0.345 - 2.5px - var(--top) - var(--band) / 2), calc(44px - var(--band)));
    top: var(--top);
    right: 4px;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    flex-direction: column;
    padding-top: var(--pt);
    border: 0;
    transform: none;
  }
  .key[data-code="Space"] .way::before {
    content: "";
    position: absolute;
    left: -5px;
    top: calc(var(--pt) - 4px);
    height: calc(var(--band) + 8px);
    border-left: 1px solid var(--ink-dim);
    pointer-events: none;
  }
  .key[data-code="Space"] .way button { position: static; width: 100%; height: 14px; padding: 0; border: 1px solid var(--ink); font-size: 9px; line-height: 12px; letter-spacing: 0.04em; }
  .key[data-code="Space"] .way button + button { border-top: 0; line-height: 13px; }
  .key[data-code="Space"] .way button.on { pointer-events: none; }

  .silk { display: grid; grid-template-columns: subgrid; height: 14px; }
  .bracket { position: relative; left: auto; bottom: auto; width: auto; margin-top: 8px; }
  .bracket > span { left: 6px; }
  .b-slide span { left: 50%; }
  /* On touch the bar pager's controls are ◀ ▶ and ▼ (FOLLOW) of the touch layout, at least 44 px; the caption stays. */
  .bar-pager .pager-btn { display: none; }
  .bar-pager.held .bp-follow { display: none; }
  .bracket > .bar-pager { top: -8px; }
  /* The SOUND pager lies over the foot of the stage (over the readouts where the stage has gone), 44 px controls. */
  .display { position: relative; }
  .d-line.picker { position: static; }
  /*
   * The bar map on touch (SPEC section 15.1, "Controls on the display"): a row of 44 px targets for the four-bar phrase
   * that holds the bar shown (and + after the last bar), each a cell drawn 30 by 14 px; ◀ ▶ reach the other phrases. It
   * has a row of the display where there is one for it, and goes where there is not (below).
   */
  .d-right { position: static; }
  .d-bars { display: flex; align-items: center; gap: 8px; }
  .d-bars > .dcap { display: none; }
  .bar-map { --cw: 30px; --ch: 14px; grid-template-columns: none; grid-auto-flow: column; gap: 0; }
  .bm-box { width: 44px; height: 44px; font-size: 16px; line-height: 44px; }
  .bm-box.plus { line-height: 44px; }
  .bm-box:not(.phrase) { display: none; }
  .d-line.picker .sound-pager {
    position: absolute;
    z-index: 3;
    left: 4px;
    right: 4px;
    top: max(4px, calc(4px + var(--stage-h, 0px) - 50px));
    bottom: auto;
    min-height: 46px;
    padding: 0 4px;
    border: 1px solid var(--frame);
    background: var(--glass);
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
    grid-template-rows: 44px;
    grid-template-areas: "word left what place right setup";
    gap: 4px;
  }
  .sound-pager .pager-btn, .sound-pager .sp-setup { min-width: 44px; height: 44px; }
  .sound-pager .sp-name { font-size: 13px; text-align: right; }
  .sound-pager .sp-place { font-size: 11px; line-height: 44px; letter-spacing: 0.08em; }

  .zone { position: relative; left: auto; width: auto; height: auto; justify-content: space-around; padding: 2px 0; }
  .knob-silk { margin: 4px 0 3px; }
  .knob-silk span { font-size: 9px; letter-spacing: 0.1em; }
  .disc { width: var(--disc); height: var(--disc); }
  .badge { display: none; }
  .drag-arrow { transform-origin: 0 0; scale: 0.6; }

  .display {
    grid-row: 1;
    grid-column: 1 / -1;
    min-width: 0;
    padding: 4px;
    justify-self: stretch;
    border-radius: 6px;
  }
  .d-stage { justify-self: center; }
  /*
   * The stage's box may be taller than the picture's 300:140 (`--stage-w` by `--stage-h`): the canvas is then drawn
   * wider than the box (`--pic-w`, 300:140 at the box's height, so its backing store stays sharp), centred, its sides
   * cut off evenly, by at most `--stage-zoom`: 1.2, the most at which the whole band's wide shot still shows all five
   * players (Ozzie's hand and Nib's tail at the edges). A billing card at the picture's left edge loses its first
   * letters there ("ry solo is his last.").
   */
  .device { --stage-zoom: 1.2; --pic-w: calc(var(--stage-h) * 300 / 140); }
  .stage {
    width: var(--pic-w);
    margin-left: calc((var(--stage-w) - var(--pic-w)) / 2);
    border-radius: 0;
    clip-path: inset(0 calc((var(--pic-w) - var(--stage-w)) / 2) round 3px);
  }
  /* No MORE COWBELL meter on touch: the MORE dial and the phone's own volume buttons do its work. */
  .d-more { display: none; }
  /*
   * Each control on the display is a 44 px target (rule 10) in its own box, as tall as the 44 px row it stands in, its
   * field drawn in the middle: the reverse and the dotted rule stay round the field, and no two targets overlap (side
   * by side they may touch, the 4 px either side of a field being in its box). Captions over the fields are left out.
   */
  .d-time, .bpm-read, .d-tempo .key-text, .d-chord, .scene-num, .d-scene .scene-name, .d-info.live {
    z-index: 1;
    box-sizing: border-box;
    min-width: 44px;
    height: 44px;
    margin-block: 0;
    padding-block: 0;
  }
  .d-time, .bpm-read, .scene-num, .d-chord { display: flex; align-items: center; justify-content: center; }
  .d-time { gap: 4px; }
  .d-time .icons .dcap, .rec-dot.hidden, .bpm-read .dcap, .d-chord > .dcap, .d-scene > .dcap { display: none; }
  .d-chord .dval { flex-wrap: nowrap; }
  .d-tempo .key-text, .d-scene .scene-name, .d-scene .scene-name.unnamed, .d-info.live { line-height: 44px; }
  .d-info.live { width: max-content; max-width: none; text-align: center; letter-spacing: 0.02em; }
  /* The dotted rule and the brackets round the field: 2 px in from the box, so two targets side by side show two rules. */
  .d-time::before, .bpm-read::before, .d-tempo .key-text::before, .d-chord::before, .scene-num::before,
  .d-scene .scene-name::before, .d-info.live::before { inset: 12px 2px; }
  .key-text.on, .scene-num.on, .d-info.live:active { background: linear-gradient(var(--disp-text), var(--disp-text)) center / 100% 20px no-repeat; }
  /* The scene's number and name side by side, SONG · 3 OF 12 under the name in the foot of their row. */
  .d-scene { position: relative; display: grid; min-width: 0; height: 44px; }
  .d-scene > .dval, .d-scene > .scene-line { grid-area: 1 / 1; }
  .d-scene .dval { align-self: stretch; gap: 8px; }
  .d-scene .dval .pending.hidden { display: none; }
  .d-scene > .scene-line { align-self: end; justify-self: end; margin-bottom: 1px; pointer-events: none; }
  /*
   * The key card lies over the display from its top left, and over the keys where the display is shorter than the card
   * (fixed, so the display's edge does not cut it off); a touch outside it closes it.
   */
  .key-card {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: calc(env(safe-area-inset-left, 0px) + 10px);
    right: calc(env(safe-area-inset-right, 0px) + 10px);
  }

  /*
   * The card's base place on touch is over the top of the stage, so the keys it names and the readouts under the stage,
   * the message line among them, stay free; while TALK's line is open the card steps aside.
   */
  .tour-card {
    grid-row: 1 / 2;
    grid-column: 1 / -1;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    gap: 8px;
    padding: 4px 6px 4px 0;
  }
  .device.console-open .tour-card { visibility: hidden; }
  .tour-stub { min-width: 52px; padding: 0 8px; }
  .tour-text { font-size: 12px; line-height: 1.3; }
  .lesson-card .tour-text { font-size: 17px; }
  .tour-why { font-size: 11px; line-height: 1.3; }
  .tour-actions { display: grid; grid-template-columns: repeat(2, auto); gap: 4px; }
  .tour-actions button { min-width: 52px; min-height: 44px; touch-action: manipulation; }

  /* The help sheet and the plugin chooser cover the window and scroll by finger. */
  .sheet, .sheet.chooser {
    position: fixed;
    inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    max-height: none;
    border-radius: 0;
    z-index: 20;
  }
  .sheet-head { grid-template-columns: 1fr auto; row-gap: 6px; padding: 8px 10px; }
  .sheet-mast { grid-column: 1 / -1; grid-row: 2; }
  .sheet-ctl { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .sheet-body, .chooser-list, .programme-body {
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sheet-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "company" "set" "lesson" "keys" "sample" "talk" "files" "agent";
    grid-template-rows: none;
    padding: 10px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .cast { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); row-gap: 12px; }
  .lesson-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .sheet-row { flex-wrap: wrap; }
  .sheet-ctl button, .copy-btn, .lesson-start, .songbook-open, .chooser-input, .chooser-row {
    min-height: 44px;
    touch-action: manipulation;
  }
  .songbook-open { display: inline-flex; align-items: center; }
  .set-tick, .set-move { width: 44px; height: 44px; font-size: 13px; touch-action: manipulation; }
  .set-list { flex-direction: column; flex-wrap: nowrap; }
  .chooser-input { font-size: 16px; }
  .d-line .console { font-size: 16px; }
  /* 16 px, so a phone does not zoom the plate when the field takes the cursor; as high as the name, so nothing moves. */
  .scene-field { height: 15px; font-size: 16px; line-height: 15px; letter-spacing: 0.04em; }
  /* The text a person may copy by hand keeps the phone's press-and-hold menu the plate turns off elsewhere. */
  .copy-text, .programme-hint { -webkit-touch-callout: default; }
}

/* Narrow: five columns; rows are the display, room to spare, the util row, parts, holds, the deck's caption, the deck and the action row. */
@media (max-width: 599px) {
  .device {
    --fixed: calc(88px + 14px + 10 * var(--g));
    /* The stage takes the height the keys at 44 px leave, up to `--stage-zoom` times the picture's height at full width. */
    --stage-h: max(0px, min(calc((var(--W) - 8px) * var(--stage-zoom) * 140 / 300), calc(var(--H) - var(--fixed) - 8 * 44px)));
    --r: clamp(44px, calc((var(--H) - var(--fixed) - var(--stage-h)) / 8), 76px);
    --stage-w: min(calc(var(--stage-h) * 300 / 140), calc(var(--W) - 8px));
    --disc: clamp(26px, calc(var(--r) - 18px), 46px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1fr) repeat(3, var(--r)) 14px repeat(4, var(--r)) var(--r);
  }
  .brand .wordmark { display: none; }
  .help-mark { grid-row: 3; grid-column: 1; }
  .t-deck { grid-row: 3; grid-column: 2; }
  .t-left { grid-row: 3; grid-column: 3; }
  .t-right { grid-row: 3; grid-column: 4; }
  .t-setup { grid-row: 3; grid-column: 5; }
  .key.part { grid-row: 4; grid-column: calc(4 - var(--y)); }
  .key[data-code="ShiftLeft"] { grid-row: 4; grid-column: 5; }
  .board > .key.hold:not(.edge):not(.touch-only) { grid-row: 5; grid-column: calc(var(--y) + 1); }
  .key[data-code="Tab"] { grid-row: 5; grid-column: 5; }
  .silk { grid-row: 6; grid-column: 1 / 5; }
  .key.pad { grid-row: calc(var(--y) + 7); grid-column: calc(var(--col) + 1); }
  .key.step { grid-row: calc(var(--y) + 7); grid-column: calc(var(--col) - 5); }
  .device:not([data-deck="steps"]) .key.step, .device[data-deck="steps"] .key.pad { display: none; }
  .zone { grid-row: 7 / span 2; grid-column: 5; }
  .t-esc { grid-row: 9; grid-column: 5; }
  .t-latch { grid-row: 10; grid-column: 5; }
  .key[data-code="Space"] { grid-row: 11; grid-column: 1 / span 2; }
  .key[data-code="Enter"] { grid-row: 11; grid-column: 3; }
  .key[data-code="Backspace"] { grid-row: 11; grid-column: 4; }
  .key[data-code="Backquote"] { grid-row: 11; grid-column: 5; }
  .b-parts, .b-slide { display: none; }
  .bracket { grid-column: 1 / -1; }
  .device:not([data-deck="steps"]) .b-steps, .device[data-deck="steps"] .b-pads { display: none; }
  .knob-silk { margin-top: 2px; }
}

/* Wide: twelve columns, the block as the keyboard has it; rows are the display, room to spare, the caption, four rows of keys and the action row. */
@media (min-width: 600px) and (max-width: 899px), (min-width: 600px) and (pointer: coarse) and (max-height: 699px) {
  .device {
    --fixed: calc(8px + 14px + 7 * var(--g));
    --stage-h: max(0px, min(calc(var(--W) * 0.55 * 140 / 300), calc(var(--H) - var(--fixed) - 5 * 44px)));
    --stage-w: calc(var(--stage-h) * 300 / 140);
    --r: clamp(44px, calc((var(--H) - var(--fixed) - var(--stage-h)) / 5), 88px);
    --disc: clamp(32px, calc(var(--r) * 0.9), 56px);
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1fr) 14px repeat(5, var(--r));
  }
  .display { grid-column: 1 / 12; }
  .tour-card { grid-column: 1 / 12; }
  .help-mark { grid-row: 1; grid-column: 12; align-self: start; }
  .brand .wordmark { grid-row: 1; grid-column: 12; align-self: end; justify-self: center; }
  .t-deck { display: none; }
  .board > .key:not(.edge):not(.touch-only) { grid-row: calc(var(--y) + 4); grid-column: calc(var(--col) + 2); }
  .key[data-code="Backquote"] { grid-row: 4; grid-column: 1; }
  .key[data-code="Tab"] { grid-row: 5; grid-column: 1; }
  .t-latch { grid-row: 6; grid-column: 1; }
  .key[data-code="ShiftLeft"] { grid-row: 7; grid-column: 1; }
  .zone { grid-row: 4 / span 4; grid-column: 12; }
  .key[data-code="Space"] { grid-row: 8; grid-column: 1 / span 4; }
  .t-left { grid-row: 8; grid-column: 5; }
  .t-right { grid-row: 8; grid-column: 6; }
  .t-setup { grid-row: 8; grid-column: 7; }
  .t-esc { grid-row: 8; grid-column: 8; }
  .key[data-code="Enter"] { grid-row: 8; grid-column: 9 / span 2; }
  .key[data-code="Backspace"] { grid-row: 8; grid-column: 11 / span 2; }
  .silk { grid-row: 3; grid-column: 1 / -1; }
  .b-pads { grid-column: 2 / 6; }
  .b-parts { grid-column: 6 / 8; }
  .b-steps { grid-column: 8 / 12; }
  .b-slide { grid-column: 12; }
  .t-setup .label { font-size: 10px; }
  /* The key card's twelve roots in two rows of six, MAJOR over MINOR beside them. */
  .key-card { right: auto; grid-template-columns: auto auto; }
  .kc-modes { flex-direction: column; }
}
/*
 * With room (on its side from 740 px wide, a tablet upright from 760 px) the switch's halves stand side by side, 44 px
 * each, and the key's middle stays well clear of them (Chrome on Android moves a touch near a button onto it).
 */
@media (min-width: 740px) and (max-width: 899px), (min-width: 740px) and (pointer: coarse) and (max-height: 699px),
  (min-width: 760px) and (max-width: 899px) and (orientation: portrait) {
  .key[data-code="Space"] .label { right: 107px; }
  .key[data-code="Space"] .lamp { right: 100px; }
  .key[data-code="Space"] .way { --band: 18px; width: 88px; flex-direction: row; padding-top: 0; }
  .key[data-code="Space"] .way::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: var(--pt);
    height: var(--band);
    box-sizing: border-box;
    border: 1px solid var(--ink);
    pointer-events: none;
  }
  .key[data-code="Space"] .way button, .key[data-code="Space"] .way button + button {
    position: relative;
    width: 44px;
    height: 44px;
    padding: var(--pt) 0 calc(44px - var(--band) - var(--pt));
    border: 0;
    line-height: var(--band);
    background-clip: content-box;
  }
  .key[data-code="Space"] .way button.on { pointer-events: auto; }
}

/*
 * The display on every touch layout: the readouts in rows of 44 px, under the stage upright and where it is too short
 * for the stage (the default here), either side of it on its side (below).
 */
@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  .display {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "stage stage stage stage stage" "time bpm key chord scene" "line line line line info";
    column-gap: 8px;
    row-gap: 0;
    align-items: center;
    padding-bottom: 4px;
  }
  .d-left, .d-right, .d-tempo, .bpm-row { display: contents; }
  .d-stage { grid-area: stage; width: var(--stage-w); height: var(--stage-h); }
  .d-time { grid-area: time; justify-self: start; }
  .seg.time { width: auto; height: 16px; margin: 0; }
  .bpm-read { grid-area: bpm; }
  .seg.bpm { height: 14px; }
  .d-tempo .key-text { grid-area: key; width: max-content; max-width: 34vw; font-size: 11px; letter-spacing: 0.06em; }
  .d-chord { grid-area: chord; justify-self: end; }
  .d-chord .dval { font-size: 15px; overflow: hidden; }
  .d-scene { grid-area: scene; }
  /* The field lies over the readouts to its left rather than widening the scene's cell (rule 8). */
  .dval.naming .scene-name { display: block; visibility: hidden; }
  .dval.naming .scene-field { position: absolute; z-index: 3; right: 4px; top: 14px; width: min(60vw, 224px); }
  .seg.scene { height: 14px; }
  .d-scene .scene-name { font-size: 11px; letter-spacing: 0.06em; }
  .d-scene .scene-name.unnamed { font-size: 9px; letter-spacing: 0.08em; }
  .scene-line { line-height: 11px; letter-spacing: 0.08em; }
  /* The message line has two lines, so a whole message is read (a new bar's words among them). */
  .d-line { grid-area: line; min-height: 26px; font-size: 11px; line-height: 13px; }
  .d-line .rule { display: none; }
  .d-line .console { margin-left: 0.3em; }
  /* The take over the small print, in the one cell at the end of the line. */
  .d-info { grid-area: info; align-self: start; justify-self: end; font-size: 11px; line-height: 13px; }
  .d-fine { grid-area: info; align-self: end; line-height: 11px; letter-spacing: 0.08em; }
}
/*
 * Upright (a phone, a tablet held upright) the display under the stage has two rows of 44 px: the readouts; the bar
 * map's cells (44 px targets, slim cells drawn in them), the message line over the small print after them, and UNDO
 * or the take at the end. The readouts' targets reach 8 px up over the frame and foot of the stage. While something
 * is selected that has controls (the BPM's − +, a part held for the SOUND pager) the second row is its control row
 * (a selection is modal).
 */
@media (max-width: 599px), (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  .display {
    grid-template-rows: auto 44px 44px;
    grid-template-areas: "stage stage stage stage stage" "time bpm key chord scene" "bars bars bars bars bars";
  }
  .d-stage { margin-bottom: -8px; }
  .d-bars { grid-area: bars; justify-self: start; }
  /* The message line in the row's middle, three tight lines over the small print, so a whole message is still read. */
  .d-line, .d-fine { grid-area: bars; margin-left: 184px; margin-right: 68px; }
  .d-line { align-self: start; line-height: 11.5px; }
  .d-line .line-text { -webkit-line-clamp: 3; line-clamp: 3; }
  .d-fine { align-self: end; justify-self: end; line-height: 9.5px; letter-spacing: 0.02em; }
  .d-info, .d-info.live { grid-area: bars; justify-self: end; align-self: center; }
  .d-info:not(.live) { max-width: 64px; white-space: normal; text-align: right; }
  .bpm-steps, .d-line.picker { grid-column: 1 / -1; grid-row: 3; justify-self: stretch; align-self: stretch; margin: 0; }
  .bpm-steps { justify-content: center; }
  .bpm-step { height: 44px; line-height: 44px; }
  .d-line.picker { position: relative; z-index: 3; background: var(--glass); }
  .d-line.picker .sound-pager { inset: 0; min-height: 0; padding: 0; border: 0; align-content: center; }
}
/* On a phone the `+` after the last cell is left out, so the message line keeps its room: ▶ reads + BAR there and adds one. */
@media (max-width: 599px) {
  .bm-box.plus { display: none; }
}
@media (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  .display:has(.bm-box.plus.phrase) :is(.d-line, .d-fine) { margin-left: 228px; }
  .device {
    --fixed: calc(88px + 14px + 7 * var(--g));
    /* As wide as the display's eleven columns (HELP has the twelfth) less its padding. */
    --stage-h: max(0px, min(calc(((var(--W) * 11 - var(--g)) / 12 - 8px) * 140 / 300), calc(var(--H) - var(--fixed) - 5 * 44px)));
  }
}

/*
 * Where the keys leave too little height for the stage, it goes, and the bar map with it (the pager over the steps and
 * ◀ ▶ do its work): the readouts stay, in one row on a phone on its side (under 365 px tall) or two upright (under
 * 540 px), the small print under the message line. The keys keep 44 px.
 */
@media (max-width: 599px) and (max-height: 539px) {
  .device { --stage-h: 0px; --fixed: calc(88px + 14px + 10 * var(--g)); }
  .d-stage, .d-bars { display: none; }
  .display {
    grid-template-rows: 44px 44px;
    grid-template-areas: "time bpm key chord scene" "line line line line info";
    padding-block: 0;
  }
  .d-info, .d-info.live { grid-area: info; align-self: center; }
  .d-line, .d-fine { grid-area: line; margin: 0; }
  .d-line { align-self: start; }
  .d-fine { align-self: end; justify-self: end; }
  .bpm-steps, .d-line.picker { grid-row: 2; }
}
/* Narrower than 360 px the bar map goes too (the pager over the steps and ◀ ▶ do its work) and the key moves down beside the message line. */
@media (max-width: 359px) {
  .d-bars { display: none; }
  .display {
    grid-template-rows: auto 44px 44px;
    grid-template-areas: "stage stage stage stage stage" "time bpm chord chord scene" "key line line line info";
  }
  .d-tempo .key-text { justify-self: start; }
  .d-line, .d-fine { grid-area: line; margin: 0; }
  .d-info, .d-info.live { grid-area: info; }
}
@media (max-width: 359px) and (max-height: 539px) {
  .display { grid-template-rows: 44px 44px; grid-template-areas: "time bpm chord chord scene" "key line line line info"; }
}
@media (min-width: 600px) and (max-width: 899px) and (max-height: 364px), (min-width: 600px) and (pointer: coarse) and (max-height: 364px) {
  /* One row as tall as HELP (44 px); the stage and the bar map have gone, the small print stands under the message line. */
  .device { --stage-h: 0px; --fixed: calc(44px + 14px + 7 * var(--g)); }
  .d-stage, .d-bars { display: none; }
  .display {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto minmax(0, 2fr) auto;
    grid-template-rows: 44px;
    grid-template-areas: "time bpm key chord scene line info";
    padding-block: 0;
  }
  .d-info { align-self: center; }
  .d-line { align-self: start; }
  .d-fine { grid-area: line; justify-self: end; }
  .d-line.picker .sound-pager { top: 0; min-height: 44px; border-block: 0; }
  .tour-card { top: auto; bottom: 0; }
}

/* Too short even for the keys: a note instead of a broken plate (a phone on its side asks to be turned upright). */
@media (max-width: 599px) and (max-height: 459px), (min-width: 600px) and (max-width: 899px) and (max-height: 310px),
  (min-width: 600px) and (pointer: coarse) and (max-height: 310px) {
  #plate { display: none; }
  .too-short {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--backdrop);
    color: var(--silk);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-align: center;
    text-transform: uppercase;
  }
  .too-short .say-upright { display: none; }
}
@media (orientation: landscape) and (max-width: 599px) and (max-height: 459px), (orientation: landscape) and (min-width: 600px) and (max-height: 310px) {
  .too-short .say-upright { display: inline; }
  .too-short .say-taller { display: none; }
}

/*
 * Wide and on its side with room for the stage: the stage between the readouts, which stand in rows of 44 px either
 * side of it: BAR · BEAT, the BPM and the key on its left, MORE and UNDO under them; NOW → NEXT and the scene on its
 * right, the message line over the small print under them. The stage keeps the room the readouts need (400 px of the
 * display's width), and the display is never shorter than two rows. The bar map has a row of its own only three rows
 * tall (below); two rows tall it goes, as where the stage has gone.
 */
@media (min-width: 600px) and (max-width: 899px) and (orientation: landscape) and (min-height: 365px),
  (min-width: 600px) and (pointer: coarse) and (orientation: landscape) and (min-height: 365px) and (max-height: 699px) {
  .device {
    --rows-h: 88px;
    /* The stage keeps the room the readouts need, and grows taller than its picture up to `--stage-zoom` (above). */
    --stage-box: min(calc(var(--W) * 0.55), calc((var(--W) * 11 - var(--g)) / 12 - 408px));
    --stage-h: max(0px, min(calc(var(--H) - var(--fixed) - 5 * 44px), calc(var(--stage-box) * var(--stage-zoom) * 140 / 300)));
    --stage-w: min(calc(var(--stage-h) * 300 / 140), var(--stage-box));
    --r: clamp(44px, calc((var(--H) - var(--fixed) - max(var(--stage-h), var(--rows-h))) / 5), 88px);
  }
  .display {
    grid-template-columns: auto auto minmax(auto, 1fr) var(--stage-w) auto minmax(auto, 1fr);
    grid-template-rows: repeat(2, minmax(44px, 1fr));
    grid-template-areas: "time bpm key stage chord scene" "info info info stage line line";
  }
  .d-stage { margin-inline: 2px; }
  .d-tempo .key-text, .d-scene, .d-info { justify-self: start; }
  .d-chord { justify-self: center; }
  .d-bars { display: none; }
  .d-line { align-self: start; }
  .d-fine { grid-area: line; justify-self: end; }
  .d-info:not(.live) { white-space: normal; }
  .bpm-steps { grid-area: 2 / 1 / 3 / 4; justify-self: stretch; align-self: stretch; }
}
@media (min-width: 600px) and (max-width: 899px) and (orientation: landscape) and (min-height: 407px),
  (min-width: 600px) and (pointer: coarse) and (orientation: landscape) and (min-height: 407px) and (max-height: 699px) {
  .device {
    --rows-h: 132px;
    --stage-box: min(calc(var(--W) * 0.55), calc((var(--W) * 11 - var(--g)) / 12 - 444px));
  }
  .display {
    grid-template-rows: repeat(3, minmax(44px, 1fr));
    grid-template-areas: "time bpm key stage chord scene" "info info info stage bars bars" "line line line stage fine fine";
  }
  .d-bars { grid-area: bars; display: flex; justify-self: start; }
  .d-fine { grid-area: fine; }
  .d-info:not(.live) { grid-area: fine; align-self: start; justify-self: end; }
}

/* The start card's word when the show could not load (js/boot.js), with a reload as large as a ticket. */
.title-card .boot-failed { color: var(--error); letter-spacing: 0.12em; }
.boot-reload {
  margin-top: min(12px, 1.9cqw);
  min-width: 96px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(226, 226, 221, 0.62);
  border-radius: 6px;
  background: transparent;
  color: #f0f0ec;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
}

/* A short window on its side (a phone held sideways): the card and the tickets side by side, the marquee above. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1259px) {
  .lobby {
    --card-w: min(52vw, calc((100svh - 96px) * 16 / 11));
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 12px;
  }
  /* The marquee has the top row to itself, as wide as the card and the tickets under it (wider than the card alone). */
  .marquee { flex-basis: 100%; padding: 7px 20px; text-align: center; }
  .lobby > .marquee { max-width: none; margin-inline: max(0px, calc((100% - var(--card-w) - 16px - min(300px, 100vw - var(--card-w) - 56px)) / 2)); }
  .marquee-title { font-size: 11px; letter-spacing: 0.26em; margin-right: -0.26em; }
  .tickets { flex-direction: column; width: min(300px, calc(100vw - var(--card-w) - 56px)); gap: 8px; }
  .ticket { flex: none; min-height: 48px; }
  .ticket-words { padding: 6px 10px; }
}

@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  /* "Your songs": every row and control a finger's size. */
  .programme-entry { min-height: 44px; justify-content: center; }
  /* The arrows, SETUP and ESC in the wide action row stand as high as PLAY, KEEP and DROP beside them. */
  .key.touch-only:not(.t-latch):not(.t-deck) .cap { bottom: calc(var(--r) * 0.31 + 5px); }
}
@media (max-width: 599px) {
  .key.touch-only:not(.t-latch):not(.t-deck) .cap { bottom: 5px; }
}

/* Labels that must not be cut: smaller type where the keys are narrow, and SHIFT without its sub-label. */
@media (max-width: 359px) {
  .cap .label { letter-spacing: 0.02em; }
  .key[data-code="ShiftLeft"] .label::after { display: none; }
}
@media (min-width: 600px) and (max-width: 819px), (min-width: 600px) and (pointer: coarse) and (max-height: 699px) and (max-width: 819px) {
  .key[data-code="ShiftLeft"] .label::after { display: none; }
}
@media (min-width: 600px) and (max-width: 759px) {
  .cap .label { font-size: 9px; letter-spacing: 0.02em; }
}

/* A tablet upright: taller keys take up the room under the display. */
@media (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  .device { --r: clamp(44px, calc((var(--H) - var(--fixed) - var(--stage-h)) / 5), 112px); }
}

/* On its side the card's base place covers the left panel and the top of the stage; the right panel, the message line in it, stays. */
@media (min-width: 600px) and (max-width: 899px) and (orientation: landscape) and (min-height: 365px),
  (min-width: 600px) and (pointer: coarse) and (orientation: landscape) and (min-height: 365px) and (max-height: 699px) {
  .tour-card { right: calc((100% - var(--stage-w)) / 2 - 2px); }
}
@media (min-width: 600px) and (max-width: 679px) and (orientation: portrait) {
  .cap .label { left: 1px; right: 1px; font-size: 8.5px; letter-spacing: 0; }
}

/*
 * The lesson card on the touch layout. Its line, its why and its SHOW ME and LEAVE need more than the top of the
 * stage, so it is not laid over the display: it takes a row of its own between the display and
 * the keys, and the stage gives up the height (`--lesson-h`) first. The chapter row is left out: the stub already
 * names the chapter and the place in it ("START · 1 OF 1"). Upright: the stub and the buttons on one line, the words
 * the card's full width under them. On its side the display drops the stage and keeps one row of readouts where the
 * captions were, and the card runs across the top, the stub, the words and the buttons side by side.
 */
@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  .tour-card.lesson-card:not(.hidden-card) {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    grid-row: 2;
    grid-column: 1 / -1;
    align-self: start;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "words words" "stub side";
    align-items: center;
    gap: 2px 6px;
    padding: 3px 6px 4px;
  }
  .lesson-card .tour-stub {
    grid-area: stub;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0 0 0 4px;
    border-right: 0;
  }
  .lesson-card .tour-stub::before, .lesson-card .tour-stub::after { display: none; }
  .lesson-card .tour-seat { display: none; }
  .lesson-card .tour-count { white-space: nowrap; font-size: 9px; letter-spacing: 0.06em; }
  .lesson-card .tour-side { grid-area: side; align-items: stretch; min-width: 0; }
  .lesson-card .tour-chapters { display: none; }
  .lesson-card .tour-words { grid-area: words; padding: 0 4px; }
  .lesson-card .tour-text { font-size: 15px; line-height: 1.15; }
  .lesson-card .tour-why { font-size: 11px; line-height: 1.2; }
  .lesson-card.titled .tour-text { font-size: 13px; }
  .lesson-card .tour-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .lesson-card .tour-actions button { flex: 1 1 auto; min-width: 44px; padding: 4px; font-size: 9px; letter-spacing: 0.04em; }
  .device:has(> .lesson-card:not(.hidden-card)) { --lesson-h: 100px; }
}
@media (max-width: 599px) {
  .device:has(> .lesson-card:not(.hidden-card)) { --fixed: calc(88px + 14px + 11 * var(--g) + var(--lesson-h)); }
}
@media (max-width: 359px) {
  .device:has(> .lesson-card:not(.hidden-card)) { --lesson-h: 118px; }
}
/*
 * Upright and short, the card, the readouts and the keys do not all fit: while the lesson runs the stage and the bar
 * map make way and the display keeps only its message line and the small print (the lesson is worked from the keys
 * and its card).
 */
@media (max-width: 599px) and (max-height: 599px) {
  .device:has(> .lesson-card:not(.hidden-card)) { --stage-h: 0px; --fixed: calc(34px + 14px + 11 * var(--g) + var(--lesson-h)); }
  .device:has(> .lesson-card:not(.hidden-card)) :is(.d-stage, .d-bars, .d-time, .bpm-read, .d-tempo .key-text, .d-chord, .d-scene, .d-more, .d-info, .bpm-steps, .sound-pager) { display: none; }
  .device:has(> .lesson-card:not(.hidden-card)) .display { grid-template-rows: auto; grid-template-areas: "line line line line fine"; padding-block: 4px; }
  .device:has(> .lesson-card:not(.hidden-card)) :is(.d-line, .d-fine) { grid-area: line; margin: 0; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line { line-height: 13px; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line .line-text { -webkit-line-clamp: 2; line-clamp: 2; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-fine { grid-area: fine; align-self: end; }
}
@media (min-width: 600px) and (max-width: 899px) and (orientation: portrait) {
  .device:has(> .lesson-card:not(.hidden-card)) { --lesson-h: 64px; --fixed: calc(88px + 14px + 8 * var(--g) + var(--lesson-h)); }
  .tour-card.lesson-card:not(.hidden-card) { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "stub words side"; align-items: center; }
  .lesson-card .tour-stub { flex-direction: column; gap: 2px; padding: 0 8px; border-right: 1.5px dashed var(--frame); }
}
@media (min-width: 600px) and (max-width: 899px) and (orientation: landscape), (min-width: 600px) and (pointer: coarse) and (max-height: 699px) {
  .device:has(> .lesson-card:not(.hidden-card)) {
    --stage-h: 0px;
    --rows-h: 0px;
    /* The card's height is not known here: 80 px (two lines of words and the why) keeps the keys clear of it. */
    --fixed: calc(80px + 44px + 7 * var(--g));
    grid-template-rows: auto minmax(0, 1fr) auto repeat(5, var(--r));
  }
  .device:has(> .lesson-card:not(.hidden-card)) .silk,
  .device:has(> .lesson-card:not(.hidden-card)) .d-stage,
  .device:has(> .lesson-card:not(.hidden-card)) .d-bars { display: none; }
  .device:has(> .lesson-card:not(.hidden-card)) .display {
    grid-row: 3;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto minmax(0, 2fr) auto;
    grid-template-rows: 44px;
    grid-template-areas: "time bpm key chord scene line info";
    column-gap: 8px;
    align-items: center;
    padding: 0 6px;
  }
  .device:has(> .lesson-card:not(.hidden-card)) :is(.d-left, .d-right, .d-tempo, .bpm-row) { display: contents; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-time { grid-area: time; display: flex; align-items: center; gap: 4px; }
  .device:has(> .lesson-card:not(.hidden-card)) :is(.d-time .icons .dcap, .bpm-read .dcap, .d-chord > .dcap, .d-scene > .dcap, .d-line .rule) { display: none; }
  .device:has(> .lesson-card:not(.hidden-card)) .seg.time { width: auto; height: 16px; margin: 0; }
  .device:has(> .lesson-card:not(.hidden-card)) .bpm-read { grid-area: bpm; }
  .device:has(> .lesson-card:not(.hidden-card)) .seg.bpm { height: 13px; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-tempo .key-text { grid-area: key; font-size: 12px; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-chord { grid-area: chord; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-chord .dval { min-height: 0; font-size: 14px; flex-wrap: nowrap; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-scene { grid-area: scene; display: grid; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-scene .dval { min-height: 0; }
  .device:has(> .lesson-card:not(.hidden-card)) .scene-line { font-size: 9px; }
  .device:has(> .lesson-card:not(.hidden-card)) .seg.scene { height: 13px; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line { grid-area: line; align-self: start; min-height: 0; font-size: 11px; }
  .device:has(> .lesson-card:not(.hidden-card)) .bpm-steps { grid-area: line; background: var(--glass); }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line .line-text { -webkit-line-clamp: 2; line-clamp: 2; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-info { grid-area: info; align-self: center; font-size: 11px; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-fine { grid-area: line; align-self: end; justify-self: end; line-height: 10px; }
  .tour-card.lesson-card:not(.hidden-card) {
    grid-row: 1;
    grid-column: 1 / 12;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "stub words side";
    align-items: center;
    padding: 3px 6px 3px 0;
  }
  .lesson-card .tour-stub { flex-direction: column; gap: 2px; padding: 0 8px; border-right: 1.5px dashed var(--frame); }
  .lesson-card .tour-text { font-size: 14px; }
}
/*
 * On its side and under 351 px tall the card, a row of 44 px readouts and the keys do not all fit: while the lesson
 * runs, the display keeps only its message line (the lesson is worked from the keys and its card).
 */
@media (min-width: 600px) and (max-width: 899px) and (orientation: landscape) and (max-height: 350px),
  (min-width: 600px) and (pointer: coarse) and (max-height: 350px) {
  .device:has(> .lesson-card:not(.hidden-card)) { --fixed: calc(80px + 16px + 7 * var(--g)); }
  .device:has(> .lesson-card:not(.hidden-card)) :is(.d-time, .bpm-read, .d-tempo .key-text, .d-chord, .d-scene, .d-more, .d-info, .d-fine, .bpm-steps, .sound-pager) { display: none; }
  .device:has(> .lesson-card:not(.hidden-card)) .display { grid-template-rows: minmax(16px, auto); }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line { align-self: center; }
  .device:has(> .lesson-card:not(.hidden-card)) .d-line .line-text { -webkit-line-clamp: 1; line-clamp: 1; }
}

/*
 * The palette for browsers without light-dark() (Safari before 17.5: all of iOS 16, the last for the iPhone 8 and X,
 * and iOS 17.0 to 17.4), where every value above that uses it is invalid and the plate shows almost no colour. The
 * same colours spelled out: the black finish by default, the silver one when the system prefers light, and the
 * data-theme attribute over either, as color-scheme decides above. web/test/palette.test.js keeps it in step with the
 * palette: change a colour above and the test names what to change here.
 */
@supports not (color: light-dark(#000, #fff)) {
  :root, :root[data-theme="black"] {
    --backdrop: #070707;
    --body: #151515;
    --body-hi: #2c2c2c;
    --body-edge: #000000;
    --silk: #9b9b9b;
    --silk-dim: #5d5d5d;
    --bracket: #575757;
    --glass: #000000;
    --glass-hi: #1c1c1c;
    --disp-text: #ededed;
    --disp-dim: #6e6e6e;
    --disp-orange: #ededed;
    --disp-sky: #ededed;
    --seg-time: transparent;
    --seg-time-line: #ededed;
    --seg-white: transparent;
    --seg-white-line: #ededed;
    --seg-sky: transparent;
    --seg-sky-line: #ededed;
    --seg-off: transparent;
    --seg-off-line: rgba(255, 255, 255, 0.05);
    --seg-rev: transparent;
    --seg-rev-line: #000000;
    --bulb-off: rgba(255, 255, 255, 0.06);
    --bulb-rim: rgba(255, 255, 255, 0.2);
    --bulb-halo: rgba(237, 237, 237, 0.42);
    --frame: rgba(255, 255, 255, 0.26);
    --pad-cap-0: #f3f3f1;
    --pad-cap-1: #cdcdcb;
    --pad-cap-2: #a8a8a6;
    --pad-cap-3: #868684;
    --pad-ink: #171717;
    --pad-ink-dim: #4c4c4c;
    --step-cap: #2b2b2c;
    --step-ink: #d8d8d8;
    --step-ink-dim: #7a7a7a;
    --mid-cap: #3b3b3c;
    --mid-ink: #e2e2e2;
    --mid-ink-dim: #8c8c8c;
    --hero: #ff5b1a;
    --hero-ink: #111111;
    --strip: #c2c2c0;
    --strip-ink: #2a2a2a;
    --cap-light: #f3f3f1;
    --cap-light-ink: #171717;
    --cap-hi: rgba(255, 255, 255, 0.22);
    --cap-shadow: rgba(0, 0, 0, 0.85);
    --wall-tint: #000000;
    --cap-drop: rgba(0, 0, 0, 0.75);
    --ring: #f1f1f1;
    --tour-ring: #ededed;
    --lamp-edge: rgba(0, 0, 0, 0.55);
    --step-lamp-edge: rgba(0, 0, 0, 0.7);
    --lamp-alt: #ffffff;
    --meter-off: rgba(255, 255, 255, 0.12);
    --knob-x-base: #2e2e2e;
    --knob-x-cap: #e9e9e7;
    --knob-x-tick: #1a1a1a;
    --knob-y-base: #2e2e2e;
    --knob-y-cap: #6f6f6e;
    --knob-y-tick: #ffffff;
    --badge-x: #e9e9e7;
    --badge-x-ink: #111111;
    --badge-y: #4a4a4a;
    --badge-y-ink: #ffffff;
    --p1: #3d8eff;
    --p2: #34c759;
    --p3: #ffd60a;
    --p4: #ffffff;
    --error: #ff453a;
  }
  :root, :root[data-theme="black"] {
    --mark: #ffffff;
    --mark-edge: #111111;
    --mark-glow: rgba(255, 255, 255, 0.6);
  }
  @media (prefers-color-scheme: light) {
    :root {
      --backdrop: #dcdcd8;
      --body: #c4c5c4;
      --body-hi: #e4e5e4;
      --body-edge: #9d9e9d;
      --silk: #2a2a2a;
      --silk-dim: #5f6060;
      --bracket: #ff5b1a;
      --glass: #0b0b0c;
      --glass-hi: #2e2e30;
      --disp-text: #f1f1ef;
      --disp-dim: #7d7d7d;
      --disp-orange: #ff5b1a;
      --disp-sky: #5cc6ff;
      --seg-time: #ff5b1a;
      --seg-time-line: transparent;
      --seg-white: #f1f1ef;
      --seg-white-line: transparent;
      --seg-sky: #5cc6ff;
      --seg-sky-line: transparent;
      --seg-off: rgba(255, 255, 255, 0.06);
      --seg-off-line: transparent;
      --seg-rev: #0b0b0c;
      --seg-rev-line: transparent;
      --bulb-off: rgba(255, 255, 255, 0.07);
      --bulb-rim: rgba(255, 255, 255, 0.16);
      --bulb-halo: rgba(255, 91, 26, 0.55);
      --frame: rgba(255, 255, 255, 0.3);
      --pad-cap-0: #1c1c1d;
      --pad-cap-1: #1c1c1d;
      --pad-cap-2: #1c1c1d;
      --pad-cap-3: #1c1c1d;
      --pad-ink: #ececea;
      --pad-ink-dim: #868686;
      --step-cap: #f2f2f0;
      --step-ink: #1b1b1b;
      --step-ink-dim: #8c8c8a;
      --mid-cap: #8d8e8f;
      --mid-ink: #121212;
      --mid-ink-dim: #3c3c3c;
      --hero: #ff5b1a;
      --hero-ink: #ffffff;
      --strip: #e8e8e5;
      --strip-ink: #585858;
      --cap-light: #f2f2f0;
      --cap-light-ink: #1b1b1b;
      --cap-hi: rgba(255, 255, 255, 0.5);
      --cap-shadow: rgba(0, 0, 0, 0.38);
      --wall-tint: #2a2722;
      --cap-drop: rgba(0, 0, 0, 0.26);
      --ring: #151515;
      --tour-ring: #ff5b1a;
      --lamp-edge: rgba(0, 0, 0, 0.35);
      --step-lamp-edge: rgba(0, 0, 0, 0.5);
      --lamp-alt: #2fa8f0;
      --meter-off: rgba(0, 0, 0, 0.18);
      --knob-x-base: #ff5b1a;
      --knob-x-cap: #ff6a2c;
      --knob-x-tick: #ffffff;
      --knob-y-base: #2a2a2b;
      --knob-y-cap: #161617;
      --knob-y-tick: #ffffff;
      --badge-x: #ff5b1a;
      --badge-x-ink: #ffffff;
      --badge-y: #1a1a1b;
      --badge-y-ink: #ffffff;
      --p1: #1e78ff;
      --p2: #17a34a;
      --p3: #ffc300;
      --p4: #ffffff;
      --error: #ff3b30;
    }
    :root {
      --mark: #111111;
      --mark-edge: #ffffff;
      --mark-glow: rgba(255, 255, 255, 0.95);
    }
  }
  :root[data-theme="silver"] {
    --backdrop: #dcdcd8;
    --body: #c4c5c4;
    --body-hi: #e4e5e4;
    --body-edge: #9d9e9d;
    --silk: #2a2a2a;
    --silk-dim: #5f6060;
    --bracket: #ff5b1a;
    --glass: #0b0b0c;
    --glass-hi: #2e2e30;
    --disp-text: #f1f1ef;
    --disp-dim: #7d7d7d;
    --disp-orange: #ff5b1a;
    --disp-sky: #5cc6ff;
    --seg-time: #ff5b1a;
    --seg-time-line: transparent;
    --seg-white: #f1f1ef;
    --seg-white-line: transparent;
    --seg-sky: #5cc6ff;
    --seg-sky-line: transparent;
    --seg-off: rgba(255, 255, 255, 0.06);
    --seg-off-line: transparent;
    --seg-rev: #0b0b0c;
    --seg-rev-line: transparent;
    --bulb-off: rgba(255, 255, 255, 0.07);
    --bulb-rim: rgba(255, 255, 255, 0.16);
    --bulb-halo: rgba(255, 91, 26, 0.55);
    --frame: rgba(255, 255, 255, 0.3);
    --pad-cap-0: #1c1c1d;
    --pad-cap-1: #1c1c1d;
    --pad-cap-2: #1c1c1d;
    --pad-cap-3: #1c1c1d;
    --pad-ink: #ececea;
    --pad-ink-dim: #868686;
    --step-cap: #f2f2f0;
    --step-ink: #1b1b1b;
    --step-ink-dim: #8c8c8a;
    --mid-cap: #8d8e8f;
    --mid-ink: #121212;
    --mid-ink-dim: #3c3c3c;
    --hero: #ff5b1a;
    --hero-ink: #ffffff;
    --strip: #e8e8e5;
    --strip-ink: #585858;
    --cap-light: #f2f2f0;
    --cap-light-ink: #1b1b1b;
    --cap-hi: rgba(255, 255, 255, 0.5);
    --cap-shadow: rgba(0, 0, 0, 0.38);
    --wall-tint: #2a2722;
    --cap-drop: rgba(0, 0, 0, 0.26);
    --ring: #151515;
    --tour-ring: #ff5b1a;
    --lamp-edge: rgba(0, 0, 0, 0.35);
    --step-lamp-edge: rgba(0, 0, 0, 0.5);
    --lamp-alt: #2fa8f0;
    --meter-off: rgba(0, 0, 0, 0.18);
    --knob-x-base: #ff5b1a;
    --knob-x-cap: #ff6a2c;
    --knob-x-tick: #ffffff;
    --knob-y-base: #2a2a2b;
    --knob-y-cap: #161617;
    --knob-y-tick: #ffffff;
    --badge-x: #ff5b1a;
    --badge-x-ink: #ffffff;
    --badge-y: #1a1a1b;
    --badge-y-ink: #ffffff;
    --p1: #1e78ff;
    --p2: #17a34a;
    --p3: #ffc300;
    --p4: #ffffff;
    --error: #ff3b30;
  }
  :root[data-theme="silver"] {
    --mark: #111111;
    --mark-edge: #ffffff;
    --mark-glow: rgba(255, 255, 255, 0.95);
  }
}

/* ==== Sharing a song (SPEC section 13.2, "The playbill"; startcard.js): the playbill on the start card, the SHARE
   card with its poster, YOUR NAME. Everything from a song is a stranger's text: each line is isolated (`dir="auto"`),
   kept to its lines and cut with an ellipsis, never allowed to push the card's layout. ==== */
.card-text[hidden], .playbill[hidden], .playbill-after[hidden] { display: none; }
.marquee { max-width: var(--card-w); box-sizing: border-box; }
.marquee-title { overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; unicode-bidi: isolate; }

/* The playbill: where the card's words stand, in the card's title lettering, sized by the card (cqw). */
.playbill {
  position: absolute;
  z-index: 2;
  left: 6%;
  top: 50%;
  width: 49%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-50%);
}
.playbill > * { max-width: 100%; }
.title-card .playbill p { line-height: 1.5; }
.title-card .playbill-top {
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin: 0 0 clamp(6px, 1.6cqw, 10px);
  font-size: clamp(8px, 1.6cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.42em;
  color: #bdbdb8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playbill-top::before, .playbill-top::after { content: ""; flex: none; width: clamp(14px, 4cqw, 26px); height: 1px; background: currentColor; opacity: 0.7; }
.playbill-title {
  margin: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-weight: 800;
  line-height: 1.08;
  color: #f4f4f0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  text-wrap: balance;
}
.playbill-title.size-l { font-size: clamp(24px, 6.4cqw, 41px); letter-spacing: 0.14em; margin-inline-end: -0.14em; }
.playbill-title.size-m { font-size: clamp(20px, 5cqw, 32px); letter-spacing: 0.1em; margin-inline-end: -0.1em; }
.playbill-title.size-s { font-size: clamp(17px, 3.9cqw, 25px); letter-spacing: 0.07em; margin-inline-end: -0.07em; }
.playbill-title.size-xs { font-size: clamp(14px, 3.1cqw, 20px); letter-spacing: 0.05em; margin-inline-end: -0.05em; }
.playbill .card-flourish { margin: clamp(8px, 1.9cqw, 12px) 0 clamp(6px, 1.6cqw, 10px); }
.title-card .playbill-by, .title-card .playbill-after, .title-card .playbill-from {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  unicode-bidi: isolate;
}
.title-card .playbill-by { font-size: clamp(11px, 2.1cqw, 14px); font-weight: 600; letter-spacing: 0.06em; text-transform: none; color: #ecece8; }
.title-card .playbill-after { font-size: clamp(9px, 1.6cqw, 10px); letter-spacing: 0.08em; text-transform: none; color: #9d9d98; }
.title-card .playbill-facts { margin-top: clamp(2px, 0.9cqw, 6px); font-size: clamp(8px, 1.6cqw, 10px); font-weight: 700; letter-spacing: 0.24em; color: #d8d8d3; white-space: nowrap; }
.title-card .playbill-from { margin-top: clamp(6px, 1.6cqw, 10px); font-size: clamp(8px, 1.4cqw, 9px); letter-spacing: 0.18em; color: #8d8d88; }
.title-card .playbill-from.error { color: var(--error); letter-spacing: 0.04em; white-space: normal; text-transform: none; }
/* PLAY IT and KEEP IT: two keys in the plate's manner, with depth. PLAY IT, the one that moves on, has the light
   face; KEEP IT is the KEEP key's orange, the one colour the house allows besides the bell. */
.playbill-keys { display: flex; gap: clamp(8px, 2cqw, 12px); margin-top: clamp(10px, 2.5cqw, 16px); }
.playbill-key {
  --cap: var(--cap-light);
  min-width: clamp(84px, 17cqw, 108px);
  height: clamp(30px, 5.6cqw, 36px);
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: var(--cap);
  color: var(--cap-light-ink);
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 3px 0 color-mix(in srgb, var(--cap) 62%, #000), 0 6px 12px rgba(0, 0, 0, 0.45);
  font: inherit;
  font-size: clamp(10px, 1.8cqw, 11px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 50ms ease-out, box-shadow 50ms ease-out;
}
.playbill-keep { --cap: var(--hero); color: #fff; }
.playbill-close { --cap: var(--mid-cap); color: var(--mid-ink); }
.playbill-key[hidden] { display: none; }
/* A song from a link that arrived while the show runs: its bill over the plate, the lobby's tickets put away. */
.overlay.offering .tickets { display: none; }
.playbill-key:active { transform: translateY(3px); box-shadow: inset 0 1px 0 var(--cap-hi), 0 0 0 color-mix(in srgb, var(--cap) 62%, #000), 0 2px 4px rgba(0, 0, 0, 0.45); transition-duration: 50ms; }
.playbill-key:focus-visible { outline: 2px solid #f4f4f0; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .playbill-key { transition: none; }
}
/* The touch layout: every key at least 44 px to the finger. */
@media (max-width: 899px), (pointer: coarse) and (max-height: 699px) {
  .playbill-key { height: 44px; }
  .programme-entry.share-copy { min-height: 56px; }
}
/* A phone: the card grows to hold the playbill, Moxie leans in at the foot beside the keys. */
@media (max-width: 560px) {
  .title-card.has-playbill { aspect-ratio: auto; min-height: calc(var(--card-w) * 11 / 16); }
  .title-card.has-playbill .moxie { height: 190px; }
  .has-playbill .playbill { position: relative; left: auto; top: auto; width: auto; transform: none; padding: 48px 24px 232px; }
  .has-playbill .playbill-top { font-size: 10px; }
  .has-playbill .playbill-title.size-l { font-size: 36px; }
  .has-playbill .playbill-title.size-m { font-size: 29px; }
  .has-playbill .playbill-title.size-s { font-size: 23px; }
  .has-playbill .playbill-title.size-xs { font-size: 19px; }
  .title-card.has-playbill .playbill-by { font-size: 15px; }
  .title-card.has-playbill .playbill-after, .title-card.has-playbill .playbill-facts { font-size: 11px; }
  .title-card.has-playbill .playbill-from { font-size: 9px; white-space: normal; text-wrap: balance; }
  .has-playbill .playbill-keys { position: absolute; left: 30px; bottom: 50px; flex-direction: column; gap: 12px; margin: 0; width: calc(100% - 60px - 150px); max-width: 200px; }
  .has-playbill .playbill-key { width: 100%; height: 48px; font-size: 12px; }
}

/* The SHARE card: over the dimmed house, the poster first and the controls under it. */
.overlay.sharing .lobby-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 2; background: rgba(0, 0, 0, 0.66); cursor: auto; }
.programme.sharing {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(680px, calc(100vw - 48px));
  max-height: calc(100svh - 48px);
  transform: translate(-50%, -50%);
}
@media (max-width: 1259px) {
  .programme.sharing { top: auto; bottom: 0; width: min(680px, 100vw); max-height: min(94svh, 900px); transform: translateX(-50%); }
}
.share-poster {
  position: relative;
  margin: 12px 0 14px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: #f2f0ea;
  box-shadow: 0 0 0 1px #000, 0 14px 34px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.share-poster-art { display: block; width: 100%; height: 100%; }
.share-poster-wait { margin: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: #4a4a47; }
.programme-entry.share-copy {
  --cap: var(--cap-light);
  align-items: center;
  gap: 3px;
  padding: 10px 14px 9px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 4px;
  background: var(--cap);
  color: var(--cap-light-ink);
  text-align: center;
  box-shadow: inset 0 1px 0 var(--cap-hi), 0 3px 0 color-mix(in srgb, var(--cap) 62%, #000), 0 6px 14px rgba(0, 0, 0, 0.45);
  transition: transform 50ms ease-out, box-shadow 50ms ease-out;
}
.programme-entry.share-copy .programme-label { font-size: 13px; font-weight: 800; letter-spacing: 0.26em; margin-inline-end: -0.26em; color: inherit; }
.programme-entry.share-copy .programme-line { font-size: 10px; letter-spacing: 0.04em; color: #55554f; overflow-wrap: anywhere; }
.programme-entry.share-copy:hover { background: var(--cap); box-shadow: inset 0 1px 0 var(--cap-hi), 0 3px 0 color-mix(in srgb, var(--cap) 62%, #000), 0 6px 14px rgba(0, 0, 0, 0.45); }
.programme-entry.share-copy:focus-visible { outline: 2px solid #f4f4f0; outline-offset: 3px; background: var(--cap); }
.programme-entry.share-copy:active { transform: translateY(3px); box-shadow: inset 0 1px 0 var(--cap-hi), 0 2px 4px rgba(0, 0, 0, 0.45); }
.share-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
@media (max-width: 420px) {
  .share-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .programme-entry.share-copy { transition: none; }
}
.programme-entry:disabled { cursor: default; opacity: 0.45; box-shadow: none; background: transparent; }
/* No link for this song: the key stays where it is, flat, and its small print says why. */
.programme-entry.share-copy:disabled { opacity: 1; background: transparent; color: #8d8d88; box-shadow: inset 0 0 0 1px rgba(226, 226, 221, 0.25); }
.programme-entry.share-copy:disabled .programme-line { color: #e8c39e; }
.programme-name { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px 6px; }
.programme-name-field {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid rgba(226, 226, 221, 0.25);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
  color: #f0f0ec;
  font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
}
.programme-name-field:focus-visible { outline: none; border-color: var(--disp-orange); }
/* ==== end of sharing a song ==== */
