/* Fonts, self-hosted (SIL OFL, see ../fonts/OFL.txt). Roboto is the family on the grandMA3 screens;
   the condensed cut is for key legends, the mono for the command line and numbers. */
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/roboto-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/roboto-500.woff2") format("woff2"); }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/roboto-condensed-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/roboto-condensed-500.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/roboto-mono-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/roboto-mono-500.woff2") format("woff2"); }

/* A companion to the grandMA3 hardware: matte-black chassis, flat grey key caps with white legends,
   the console screens' cell conventions (index top-left, dropdown triangle / toggle bar top-right,
   a colored top line), cyan for what is selected, magenta for the feature line. Flat: no shadows,
   no gradients except the fader fill. One screen, no scroll. */
:root {
  --bg: #0c0c0e;        /* chassis */
  --panel: #151518;     /* panels, strips */
  --cell: #1c1c20;      /* screen cells, tracks */
  --cap: #222226;       /* key caps */
  --cap-dn: #34343a;    /* pressed */
  --cell-on: #2a2a2f;   /* selected cell */
  --title: #4a4a50;     /* pop-up title bar */
  --line: #2a2a2f;
  --text: #ececee; --dim: #8e8e96; --faint: #6c6c74; --ghost: #3a3a40;
  --accent: #5bd9e6;    /* selected */
  --feature: #e264b8;   /* feature line */
  --ok: #4cc36a; --warn: #f5c542; --ink: #0c0c0e;
  --learn: #9d8cff;     /* MIDI learn */
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "Roboto Condensed", "Roboto", system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --barH: 56px; --dial: 178px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 14px/1.35 var(--font); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--ink); }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--ghost); }
h1, h2, h3, p { margin: 0; }
.dim { color: var(--dim); } .small { font-size: 12px; }

/* ---------- top bar ---------- */
.bar { height: var(--barH); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--bg); }
.brand { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.brand h1 { font-weight: 500; font-size: 17px; letter-spacing: .01em; }
.brand span { color: var(--dim); font-size: 11px; margin-top: 4px; }

.cmd { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; gap: 2px; height: 40px; }
.cmdkw { flex: none; height: 100%; display: flex; align-items: center; padding: 0 12px; background: var(--cell); font: 500 11px/1 var(--font); letter-spacing: .14em; color: var(--dim); transition: color .12s; }
.cmdkw:hover { color: var(--accent); }
/* command line mode: CMD breathes in the accent colour while the history replaces the encoders */
.cmdkw.on { color: var(--accent); animation: cmdpulse 2.4s ease-in-out infinite; }
@keyframes cmdpulse { 0%, 100% { background: var(--cell); } 50% { background: color-mix(in srgb, var(--accent) 28%, var(--cell)); } }
@media (prefers-reduced-motion: reduce) { .cmdkw.on { animation: none; background: color-mix(in srgb, var(--accent) 20%, var(--cell)); } }
.cmdline { flex: 1; min-width: 0; height: 100%; background: var(--cell); border: none; outline: none; padding: 0 12px; font: 400 16px var(--mono); color: var(--text); box-shadow: inset 0 -2px 0 transparent; }
.cmd:focus-within .cmdline { box-shadow: inset 0 -2px 0 var(--accent); }
.cmdline::placeholder { color: var(--ghost); }
.cmdbtn { flex: none; width: 44px; height: 100%; background: var(--cap); color: var(--dim); font-size: 16px; }
.cmdbtn:hover, .cmdbtn.on { color: var(--accent); }
.cmdlast { position: absolute; right: 56px; top: 50%; transform: translateY(-50%); font: 12px var(--mono); color: var(--dim); pointer-events: none; opacity: 0; transition: opacity .3s; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdlast.show { opacity: 1; }
.cmdlast.err { color: var(--feature); }

.status { display: flex; gap: 2px; flex: none; height: 40px; }
.st { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--cell); font-size: 13px; color: var(--dim); white-space: nowrap; }
.st .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ghost); display: block; }
.st.on { color: var(--text); } .st.on .dot { background: var(--ok); }
.st.warn { color: var(--text); } .st.warn .dot { background: var(--warn); animation: blink 1s steps(2, start) infinite; }
button.st:hover { color: var(--accent); }   /* the Console chip is a button: it opens the start menu */
@keyframes blink { to { opacity: .15; } }

.tabs { display: flex; flex: none; gap: 2px; height: 40px; }
.tab { padding: 0 16px; background: var(--cell); border-top: 2px solid var(--ghost); font-size: 14px; color: var(--text); transition: color .12s; }
.tab:hover { color: var(--accent); }
.tab.on { background: var(--cell-on); border-top-color: var(--accent); color: var(--accent); }
/* MIDI learn toggle, shown while MIDI is enabled (midi-view.js); violet is MIDI learn's colour everywhere */
.learnhd { flex: none; height: 40px; padding: 0 14px; background: var(--cell); border-top: 2px solid var(--learn); font-size: 14px; color: var(--learn); transition: color .12s; }
.learnhd:hover { color: var(--text); } .learnhd.on { background: var(--learn); color: var(--ink); }
/* fullscreen toggle (app.js), hidden where the browser has no fullscreen for pages (iPhone) */
.fsbtn { flex: none; width: 44px; height: 40px; display: grid; place-items: center; background: var(--cell); border-top: 2px solid var(--ghost); color: var(--dim); transition: color .12s; }
.fsbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; }
.fsbtn:hover { color: var(--accent); }
.fsbtn.on { background: var(--cell-on); border-top-color: var(--accent); color: var(--accent); }
.fsbtn .fs-out, .fsbtn.on .fs-in { display: none; } .fsbtn.on .fs-out { display: block; }

/* ---------- shared controls ---------- */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 16px 14px; gap: 10px; }
.ptitle { font-weight: 500; font-size: 16px; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.ptitle em { font-style: normal; color: var(--accent); font-size: 13px; font-weight: 400; }
.ptitle.sub { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; }
/* segmented cells: a row of screen cells, 2 px apart */
.seg { display: inline-flex; gap: 2px; }
.segb { height: 36px; padding: 0 14px; background: var(--cell); border-top: 2px solid var(--ghost); font-size: 13px; color: var(--text); white-space: nowrap; transition: color .12s; }
.segb:hover { color: var(--accent); }
.segb.on { background: var(--cell-on); color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; background: var(--cap); border-radius: 3px; padding: 0 16px; font-weight: 500; font-size: 13px; color: var(--text); white-space: nowrap; text-decoration: none; transition: background .08s, color .12s; }
.btn:hover { color: var(--accent); }
.btn:active { background: var(--cap-dn); }
.btn.primary { background: var(--accent); color: var(--ink); }
.btn.primary:hover { color: var(--ink); }
.btn:disabled { color: var(--faint); background: var(--cell); cursor: default; } .btn:disabled:hover { color: var(--faint); }
.ti { background: var(--bg); border: 1px solid var(--line); border-radius: 2px; height: 34px; padding: 0 10px; width: 100%; min-width: 0; font: 13px var(--mono); }
.ti:focus { outline: none; border-color: var(--accent); }
button:focus, button:focus-visible { outline: none; }   /* flat: no focus ring glow on tapped buttons */
.ti[type=number] { -moz-appearance: textfield; } .ti::-webkit-inner-spin-button, .ti::-webkit-outer-spin-button { -webkit-appearance: none; }

/* the encoder section: bar + encoders (a page of its own on phones) */
.encsec { flex: none; display: flex; flex-direction: column; gap: inherit; position: relative; }
/* command line mode: the history lies over the encoder section, which keeps its size so the keys stay put */
#view-keys.cmdmode .encsec > :not(.cmdhist) { visibility: hidden; }
.cmdhist { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; min-height: 0; padding: 10px 14px; background: var(--panel); border-top: 2px solid var(--accent); border-radius: 0 0 4px 4px; }
.chlist { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; font: 17px/1.55 var(--mono); color: var(--dim); }
.chlist > :first-child { margin-top: auto; }   /* the newest line sits at the bottom, like the console's */
.chlist div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.chlist .tx { color: var(--text); } .chlist .rx { color: var(--accent); } .chlist .er { color: var(--feature); }
.chlist .t { margin-right: 14px; font-size: 12px; color: var(--faint); }
.chlist .hint { font: 13px var(--font); color: var(--dim); }
.pager { display: none; }

/* ---------- encoder bar: feature tabs (numbered, magenta top line) + bank / resolution ---------- */
.encbar { flex: none; display: flex; align-items: stretch; gap: 22px; }
.fgroups { display: flex; gap: 2px; flex: 1; min-width: 0; }
.ft { position: relative; flex: 1 1 0; min-width: 0; height: 44px; background: var(--cell); border-top: 2px solid var(--feature); font-size: 14px; color: var(--text); padding: 6px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .12s; }
.ft i { position: absolute; top: 5px; left: 7px; font-style: normal; font-size: 11px; color: var(--dim); }
.ft s { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--faint); }
.ft.has s { background: var(--accent); border-color: var(--accent); }
.ft:hover { color: var(--accent); }
.ft.on { background: var(--cell-on); color: var(--accent); }
.encopts { display: flex; gap: 22px; }
.encopts .segb { height: 44px; }
/* the encoder bank: the console's feature, "n of N" and a light per bank; a tap steps to the next */
.bankbtn { position: relative; flex: none; width: 168px; height: 44px; padding: 3px 12px 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; background: var(--cell); border-top: 2px solid var(--ghost); text-align: left; color: var(--text); }
.bankbtn:active { background: var(--cell-on); }
.bankbtn .bn { min-width: 0; font: 500 15px/1.1 var(--font); color: var(--accent); white-space: nowrap; overflow: hidden; }
.bankbtn .bc { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.bankbtn .dots { position: absolute; left: 12px; right: 12px; bottom: 6px; display: flex; gap: 6px; }
.bankbtn .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ghost); }
.bankbtn .dots i.on { background: var(--accent); }
.bankbtn.warn { background: color-mix(in srgb, var(--warn) 16%, var(--cell)); border-top-color: var(--warn); }   /* the feed has no feature info (plugin < 23): blocks of five, not the console's banks */
.bankbtn.warn .bn { color: var(--warn); }

/* ---------- dual encoders ---------- */
.encrow { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 280px); gap: 22px; align-items: stretch; }
.encoders { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.minilog { background: var(--panel); border-radius: 4px; padding: 10px 12px; font: 12px/1.6 var(--mono); color: var(--dim); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.minilog div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minilog .tx { color: var(--text); } .minilog .rx { color: var(--accent); } .minilog .er { color: var(--feature); }
.minilog .hint { color: var(--dim); font: 500 11px var(--font); letter-spacing: .14em; text-transform: uppercase; }
.enc { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
/* the encoder-bar cell above each wheel: just the attribute (value and steps are in the knob, so the dial gets the room) */
.ecell { width: 100%; max-width: 220px; background: var(--cell); border-top: 2px solid var(--feature); display: flex; flex-direction: column; }
.enc .name { display: block; width: 100%; padding: 7px 6px; font-size: 14px; font-weight: 500; color: var(--text); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enc .name:hover { color: var(--accent); }
.enc .name.blank { color: var(--faint); font-weight: 400; }
/* in the knob, centred and scaled with the dial (cqmin = the dial's size): the value, or the last nudge while the console reports none */
.enc .readout { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52cqmin; display: flex; flex-direction: column; align-items: center; pointer-events: none; text-align: center; }
.enc .val { max-width: 100%; font: 500 15cqmin/1.1 var(--font); color: var(--accent); white-space: nowrap; overflow: hidden; }   /* fit() in encoders.js shrinks long text */
.enc .val:empty { display: none; }
.enc .val.wrap, .enc .pname.wrap { white-space: normal; max-height: 2.2em; line-height: 1.08; }   /* a long name on two lines */
.enc .gimg { width: 34cqmin; height: 34cqmin; margin-bottom: 2cqmin; object-fit: contain; border-radius: 50%; background: #000; }   /* the gobo slot's image */
.enc .gsw { display: block; width: 26cqmin; height: 26cqmin; margin-bottom: 3cqmin; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }   /* a colour wheel slot's colour */
.enc .gsw[hidden] { display: none; }
.enc .readout:has(.gimg:not([hidden]), .gsw:not([hidden])) { width: 62cqmin; } .enc .readout:has(.gimg:not([hidden]), .gsw:not([hidden])) .val { font-size: 10.5cqmin; }
.enc .pname { max-width: 100%; margin-top: 1.5cqmin; font: 500 9.5cqmin/1.15 var(--font); color: var(--text); white-space: nowrap; overflow: hidden; }   /* an applied preset's name, under the level */
.enc .pname[hidden] { display: none; }
.enc .readout:has(.pname:not([hidden])) { width: 62cqmin; }
.enc .delta { font: 500 11cqmin/1.1 var(--mono); color: var(--dim); white-space: nowrap; }
.enc .val:not(:empty) + .delta { display: none; }
.enc .readout:has(.val:empty):has(.delta:empty)::before { content: "—"; font-size: 12cqmin; color: var(--faint); }
.enc .delta.pos { color: var(--accent); } .enc .delta.neg { color: var(--feature); }
.enc.m-in .dial .ptr, .enc.m-out .dial .omark { stroke: var(--learn); }   /* the marker a MIDI encoder turns (enc:<i>, its push switches) */
.wheelbox { position: relative; width: 100%; height: var(--dial); flex: none; container-type: size; }
.enc .efader { display: none; }   /* the phone's encoders are faders (see the phone section) */
.enc .dial { width: 100cqmin; height: 100cqmin; margin: 0 auto; display: block; touch-action: none; cursor: grab; }
.enc .dial:active { cursor: grabbing; }
.enc .dial .ring { fill: none; stroke: var(--cell); stroke-width: 24; }
.enc .dial .knurl { fill: none; stroke: #2a2a30; stroke-width: 24; stroke-dasharray: 1.2 7.18; }
.enc .dial .omark { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.enc .dial .gap { fill: var(--bg); }
.enc .dial .trk { fill: none; stroke: var(--cap); stroke-width: 3; }
.enc .dial .arc { fill: none; stroke: var(--accent); stroke-width: 3; }
.enc .dial .knob { fill: var(--cap); }
.enc .dial .ptr { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.enc.t-in .dial .knob { fill: var(--ghost); } .enc.t-in .dial .ptr { stroke: var(--accent); }
.enc.t-out .dial .omark { stroke: var(--text); }
.enc.t-out .dial .ring { stroke: #26262b; } .enc.t-out .dial .knurl { stroke: #45454c; }
.enc .push { position: absolute; left: max(0px, calc(50% - 68cqmin)); bottom: 0; width: 20cqmin; height: 20cqmin; max-width: 28px; max-height: 28px; border-radius: 50%; background: var(--cap); }
.enc .push:hover { background: var(--cap-dn); } .enc .push:active { background: var(--accent); }
.enc.off .ecell { border-top-color: var(--ghost); } .enc.off .name { color: var(--faint); }
.enc.off .dial { cursor: default; } .enc.off .dial .ring { stroke: var(--panel); } .enc.off .dial .knurl { stroke: #1f1f23; } .enc.off .dial .trk { stroke: var(--cell); }
.enc.off .dial .knob { fill: #18181b; } .enc.off .dial .ptr, .enc.off .dial .omark { stroke: var(--ghost); } .enc.off .push { background: #18181b; }

/* ---------- command section (key grid) ---------- */
/* Align mode (keys.js): the console's arrows in blue, in the free cell right of the Align key */
.keygrid .amode { align-self: center; justify-self: start; padding-left: 2px; font: 500 20px/1 var(--mono); letter-spacing: -.04em; color: #4d9bff; pointer-events: none; white-space: nowrap; }
.keygrid { flex: 1; min-height: 0; display: grid; gap: 8px;
  grid-template-columns: 1fr 1fr .3fr repeat(4, 1fr) .3fr repeat(8, 1fr) .3fr 1fr 1fr .3fr .7fr;
  grid-template-rows: repeat(5, 1fr) .3fr repeat(5, 1fr); }
/* every key the same flat cap, like the hardware: the legend says what it does */
.key { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 0;
  background: var(--cap); border-radius: 3px; color: var(--text); user-select: none; -webkit-user-select: none; touch-action: manipulation;
  font: 500 clamp(12px, 1.12vw, 16px)/1 var(--cond); transition: background .05s; padding: 2px; }
.key:hover { color: var(--accent); }
.key.down, .key:active { background: var(--cap-dn); }
.key .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.key .s { font: 400 clamp(9px, .78vw, 11px)/1 var(--cond); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* MA held: the second function becomes the legend */
.keygrid.ma .key.hasma { flex-direction: column-reverse; }
.keygrid.ma .key.hasma .l { font-size: clamp(9px, .78vw, 11px); font-weight: 400; color: var(--dim); }
.keygrid.ma .key.hasma .s { font: 500 clamp(11px, 1vw, 14.5px)/1 var(--cond); color: var(--accent); }
.key.ma { background: var(--bg); box-shadow: inset 0 0 0 1px var(--ghost); }
.key.ma .l { font-size: clamp(12px, 1.05vw, 15px); letter-spacing: .18em; }
.key.ma.on { background: var(--accent); box-shadow: none; color: var(--ink); }
/* on / lit: a short LED bar over the legend, legend in the selected color */
.key.toggle.on, .key.x.lit { color: var(--accent); }
.key.toggle.on::before, .key.x.lit::before { content: ""; position: absolute; top: 6px; left: 50%; width: 18px; height: 3px; margin-left: -9px; background: var(--accent); }
.key.big { border-radius: 4px; }
.key.big .l { font-size: clamp(16px, 1.55vw, 22px); }
.key.please .l, .key.wide .l { font-size: clamp(13px, 1.2vw, 17px); }
.key.num .l, .key.num.wide .l { font-size: clamp(17px, 1.6vw, 24px); font-weight: 400; }

/* executor knobs 301–308 */
.knob { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; cursor: grab; user-select: none; min-height: 0; padding: 2px; }
.knob svg { width: auto; height: calc(100% - 16px); max-width: 100%; display: block; }
.knob .ring { fill: none; stroke: var(--cap); stroke-width: 3; }
.knob .disc { fill: var(--cap); }
.knob .ptr { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.knob .n { font: 11px var(--font); color: var(--dim); line-height: 1; }
.knob:hover .ptr, .knob.live .ptr { stroke: var(--accent); } .knob.live .disc { fill: var(--ghost); }
/* level wheel: endless, ribbed */
.wheel { position: relative; background: var(--cell); border-radius: 8px; overflow: hidden; touch-action: none; cursor: ns-resize; user-select: none; }
.wheel .grip { position: absolute; left: 18%; right: 18%; top: 10px; bottom: 34px; background: repeating-linear-gradient(to bottom, transparent 0 7px, #2e2e34 7px 9px); }
.wheel .cap { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font: 500 10px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.wheel.live .grip { background: repeating-linear-gradient(to bottom, transparent 0 7px, #45454c 7px 9px); }
.wheel.live .cap { color: var(--accent); }

/* ---------- faders ---------- */
.fadbar { flex: none; display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.fadbar .ptitle { flex: none; }
.fadbar .seg, .fadbar .btn { flex: none; }
.fadbar .fadhint { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fadbar .fadhint.warn, .help.warn { color: var(--warn); }
.fadbar .btn.on { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fadbar .ly-btn { display: none; }   /* phone only: the layer column becomes this button (see the phone rules) */
/* A column per executor number; in it a block per shown row (400 on top … 100 at the bottom), all the same height.
   --sc is the sequence's appearance color (set per block from the feed), --si the text on it. */
.fadbody { flex: 1; min-height: 0; display: flex; gap: 10px; position: relative; }
.fadbody .strips { min-width: 0; }
#view-faders.layer .pg-only, #view-faders:not(.layer) .ly-only { display: none; }
/* custom layer, Edit: the playback list beside the strips (drag onto a slot) */
.fadlist { flex: 0 0 230px; display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 8px; background: var(--cell); border-radius: 2px; }
.fadlist[hidden] { display: none; }
.fadlist.drop { outline: 2px dashed var(--warn); outline-offset: -2px; }
.fl-items { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.fl-item { display: grid; grid-template-columns: 8px 30px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 34px; padding: 3px 8px; background: var(--cap); border-radius: 2px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; font: 500 13px/1.15 var(--cond); color: var(--text); }
.fl-item .chip { width: 8px; height: 24px; border-radius: 2px; background: var(--ghost); }
.fl-item .no { font: 11px var(--mono); color: var(--dim); }
.fl-item .nm { overflow-wrap: anywhere; }
.fl-item em { font: 10px var(--mono); font-style: normal; color: var(--accent); }
.fl-item.armed { box-shadow: inset 0 0 0 2px var(--accent); }
.fl-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; padding: 6px 10px; background: var(--cell); border: 2px solid var(--accent); border-radius: 2px; font: 500 13px var(--cond); color: var(--text); white-space: nowrap; }
.strips.slots .blk .name { cursor: grab; touch-action: none; }
.strip .blk.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.strips.editing .blk.armable .name { box-shadow: inset 0 0 0 1px var(--accent); }
.strips { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 10px; }
.strip { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.blk { --sc: var(--accent); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 8px; min-height: 0; min-width: 0; }
.blk.blk-fader { flex: 1 1 0; grid-template-rows: auto minmax(0, 1fr) auto; }
/* A knob block never grows: its dial is a fixed size, so the fader blocks get all the spare height. */
.blk.blk-knob { flex: 0 0 auto; grid-template-rows: auto 72px auto auto; }   /* not `.knob`: that class styles the Keys view's executor knobs */
.strips.dense .blk.blk-knob { grid-template-rows: auto 56px auto auto; }
.blk.blk-key { flex: 0 0 auto; grid-template-rows: auto auto; }   /* row 100: header and key only, no control or value */
.strips.dense .blk { gap: 5px; } .strips.dense .strip { gap: 8px; }
/* A row with a chosen height (Setup → Playbacks, faders.js fitRows() sets its px height): the control takes what the header leaves, so a knob's
   dial, a sideways fader's track and a key row's header (its label centred) scale with the row. */
.strips .strip .blk.sized { flex: none; }
.strips .strip .blk.blk-fader.sized { grid-template-rows: auto minmax(0, 1fr) auto; }
.strips .strip .blk.blk-knob.sized { grid-template-rows: auto minmax(0, 1fr) auto; }
.strips .strip .blk.blk-knob.blk-side.sized { grid-template-rows: auto minmax(0, 1fr); }
.strips .strip .blk.blk-key.sized { grid-template-rows: minmax(0, 1fr); }
.strips .strip .blk.blk-key.sized .name { height: 100%; }
.strips .strip .blk.blk-key.sized .name .ht { top: 50%; transform: translateY(-50%); }
/* header = the executor key: a square button filled with the sequence color, number and cue on top, name
   in the middle; a bar along its top edge lights while the executor runs, pressing darkens it */
.strip .name { position: relative; display: block; width: 100%; height: 62px; min-width: 0; padding: 0; border: 0; border-radius: 0; background: var(--cap); color: var(--dim); font: inherit; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.strip .blk.colored .name { background: var(--sc); color: var(--si); }
.strip .name .hn, .strip .name .hc { position: absolute; top: 8px; font: 500 11px/1 var(--font); opacity: .78; white-space: nowrap; }
.strip .name .hn { left: 8px; } .strip .name .hc { right: 8px; max-width: calc(100% - 46px); overflow: hidden; text-overflow: ellipsis; }
.strip .name .ht { position: absolute; left: 6px; right: 6px; top: 28px; text-align: center; font: 500 15px/1.2 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .name .ht:empty::before { content: "—"; opacity: .5; }
.strip .blk:not(.colored) .name.has { color: var(--text); }
.strip .name:hover .ht { text-decoration: underline; text-underline-offset: 3px; }
.strip .name.down, .strip .name:active { background: var(--cap-dn); }
.strip .blk.colored .name.down, .strip .blk.colored .name:active { background: color-mix(in srgb, var(--sc) 72%, #000); }
.strip .name.lit::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--accent); }
.strip .blk.colored .name.lit::before { background: var(--si); opacity: .85; }
.strips.dense .name { height: 48px; } .strips.dense .name .hn, .strips.dense .name .hc { top: 7px; font-size: 10px; }
.strips.dense .name .ht { top: 17px; font-size: 13px; }   /* a little higher: room for the mode underneath */
.strip .blk-key .name { height: 54px; } .strips.dense .blk-key .name { height: 48px; }
.strip .blk-key .name .ht { top: 22px; } .strips.dense .blk-key .name .ht { top: 17px; }
/* TouchOSC-style fader: a filled track in the sequence color with a bright edge at the level, quarter lines behind */
.strip .fader { --v: 0; position: relative; min-height: 0; background: var(--cell); border-radius: 4px; overflow: hidden; touch-action: none; cursor: ns-resize; user-select: none; }
.strip .fader .grid { position: absolute; inset: 0; background: linear-gradient(var(--cap), var(--cap)) 0 25% / 100% 1px no-repeat, linear-gradient(var(--cap), var(--cap)) 0 50% / 100% 1px no-repeat, linear-gradient(var(--cap), var(--cap)) 0 75% / 100% 1px no-repeat; }
.strip .fader .fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--v) * 1%); background: linear-gradient(to top, color-mix(in srgb, var(--sc) 38%, transparent), color-mix(in srgb, var(--sc) 8%, transparent)); }
.strip .fader .cap { position: absolute; left: 0; right: 0; height: 3px; top: calc((100% - 3px) * (100 - var(--v)) / 100); background: var(--sc); }
.strip .fader.live { background: #202025; }
.strip .blk.empty { --sc: var(--ghost); } .strip .blk.empty .val { color: var(--faint); }
.strip .val { text-align: center; font: 500 13px var(--font); color: var(--text); }
.strip .val.in { position: absolute; left: 0; right: 0; bottom: 12px; font-size: 20px; pointer-events: none; }
.strip .val[data-fn]:not([data-fn=""])::after { content: attr(data-fn); display: block; font: 500 10px/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--warn); }   /* the console's fader is not the master */
.strip .blk-knob .val:not(.in)[data-fn]:not([data-fn=""])::after { display: inline; margin-left: 6px; }   /* beside a knob's value, so every knob block keeps one height and the rows below stay level */
.strips.dense .val { font-size: 12px; line-height: 14px; } .strips.dense .val.in { font-size: 16px; bottom: 11px; line-height: 1; }
/* rows 300 / 400 are knobs, absolutely sized so the circle fits whatever the block leaves */
.strip .kn { position: relative; min-height: 0; width: 100%; justify-self: stretch; touch-action: none; cursor: ns-resize; user-select: none; }   /* fill the column: the dial is sized by the fixed row height */
.strip .kn svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }   /* square viewBox: the dial fits the 72 px row, centred by preserveAspectRatio */
.strip .kn .trk { fill: none; stroke: var(--cap); stroke-width: 4; }
.strip .kn .arc { fill: none; stroke: var(--sc); stroke-width: 4; }
.strip .kn .knob { fill: var(--cap); }
.strip .kn .ptr { stroke: var(--text); stroke-width: 6; stroke-linecap: round; }
.strip .kn.live .knob { fill: var(--ghost); } .strip .kn.live .ptr { stroke: var(--sc); }
/* Knob rows as sideways faders (S.knobStyle 'faders', Setup → Playbacks): a slim fader exactly the width of the header, the fader's fill and
   edge drawn along x, the level at the right of the track and the mode (when shown) at its left. */
.strips .blk.blk-knob.blk-side { grid-template-rows: auto 30px; } .strips.dense .blk.blk-knob.blk-side { grid-template-rows: auto 26px; }
.strip .fader.side { cursor: ew-resize; }
.strip .fader.side .grid { background: linear-gradient(var(--cap), var(--cap)) 25% 0 / 1px 100% no-repeat, linear-gradient(var(--cap), var(--cap)) 50% 0 / 1px 100% no-repeat, linear-gradient(var(--cap), var(--cap)) 75% 0 / 1px 100% no-repeat; }
.strip .fader.side .fill { top: 0; right: auto; bottom: 0; width: calc(var(--v) * 1%); height: auto; background: linear-gradient(to right, color-mix(in srgb, var(--sc) 8%, transparent), color-mix(in srgb, var(--sc) 38%, transparent)); }
.strip .fader.side .cap { top: 0; right: auto; bottom: 0; left: calc((100% - 3px) * var(--v) / 100); width: 3px; height: auto; }
.strip .fader.side .val.in { left: auto; right: 7px; top: 0; bottom: 0; display: flex; align-items: center; gap: 5px; font-size: 14px; }
.strip .fader.side .val[data-fn]:not([data-fn=""])::after { font-size: 9px; letter-spacing: .06em; }
.strips.editing .fader.side .val[data-fn]:not([data-fn=""])::after { display: none; }   /* Edit layer shows the mode at the left instead: no room for both */
.strip .fader.side .cm { left: 7px; top: 50%; transform: translateY(-50%); } .strips.dense .fader.side .cm { top: 50%; }
.strips.dense .fader.side .val.in { font-size: 12px; }

/* A mode as corner text, in the header's own style (the .hn / .hc corners: Roboto 500 11px, the header's colour, no box): a key's at the
   bottom left of its header, a fader's or knob's at the top left of the control. Edit layer shows every one, the default ones dimmed; outside
   it only a non-default mode shows. They take no taps: Edit layer's taps go to the header / control itself. */
.strip .hm, .strip .cm { display: none; position: absolute; font: 500 11px/1 var(--font); opacity: .5; white-space: nowrap; pointer-events: none; user-select: none; -webkit-user-select: none; }
.strip .hm.nd, .strip .cm.nd { opacity: .78; }
.strips.editing .hm, .strips.editing .cm, .strip .hm.nd, .strip .cm.nd { display: block; }
.strip .hm { left: 8px; bottom: 6px; }
.strip .cm { left: 8px; top: 8px; color: var(--text); } .strip .kn .cm { left: 6px; top: 3px; }   /* a knob's corner is the dial's too: tucked in, clear of its ring */
.strips.dense .hm, .strips.dense .cm { font-size: 10px; } .strips.dense .hm { bottom: 4px; } .strips.dense .cm { top: 7px; } .strips.dense .kn .cm { top: 3px; }

/* The layer column, right of the strips (Mixing Station style): the visible layers top to bottom, the shown one lit, + adds a custom
   layer. A named page layer carries its number small, a custom layer a magenta edge. The list scrolls inside the column, never the page. */
.fadlayers { flex: 0 0 104px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.ly-items { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.ly { position: relative; flex: none; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 3px 6px; background: var(--cap); border-radius: 2px; font: 500 13px/1.1 var(--cond); color: var(--text); text-align: center; overflow-wrap: anywhere; overflow: hidden; user-select: none; -webkit-user-select: none; }
.ly.nm { padding-top: 14px; min-height: 58px; }
.ly i { position: absolute; top: 3px; left: 6px; font: 10px var(--mono); font-style: normal; color: var(--dim); }
.ly:hover { color: var(--accent); } .ly:active { background: var(--cap-dn); }
.ly.cu { box-shadow: inset 3px 0 0 var(--feature); }
.ly.on { background: var(--cell-on); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ly.cu.on { box-shadow: inset 3px 0 0 var(--feature), inset 0 0 0 1px var(--accent); }
.ly-add { min-height: 52px; font: 400 24px/1 var(--font); color: var(--dim); }
.pop .pgrid button.on { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }   /* the layer list on the phone */

/* ---------- open scribble ---------- */
/* Four columns (rows 400 / 300 / 200 / 100), a header and ten entries each: number · console sequence · custom name. No scrolling. */
.sc-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sc-col { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto repeat(10, minmax(28px, 48px)); align-content: start; gap: 4px; background: var(--panel); border-radius: 4px; padding: 10px 12px; }
.sc-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; border-bottom: 1px solid var(--line); font: 500 11px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.sc-head em { font: 12px var(--font); font-style: normal; letter-spacing: 0; color: var(--accent); }
.sc-ent { display: grid; grid-template-columns: 34px minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: 6px; min-height: 0; min-width: 0; }
.sc-n { font: 500 12px var(--mono); color: var(--dim); }
.sc-seq { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--faint); }
.sc-seq.has { color: var(--text); }
.sc-in { height: 30px; }
.sc-in::placeholder { color: var(--ghost); }

/* ---------- setup ---------- */
/* Sub-tabs down the left (Mixing Station style), one pane at a time: Console, Layers, Playbacks, Advanced playback, Encoders, MIDI, Log. */
.setup { flex: 1; min-height: 0; display: flex; gap: 14px; }
.stabs { flex: none; width: 148px; display: flex; flex-direction: column; gap: 2px; }
.stab { height: 44px; padding: 0 14px; background: var(--cell); border-left: 2px solid var(--ghost); text-align: left; font-size: 14px; line-height: 1.15; color: var(--text); transition: color .12s; }   /* (Advanced playback takes two lines) */
.stab:hover { color: var(--accent); }
.stab.on { background: var(--cell-on); border-left-color: var(--accent); color: var(--accent); }
.spane { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 28px; background: var(--panel); border-radius: 4px; padding: 16px 20px; overflow: hidden; }
#sp-layers, #sp-playbacks, #sp-log { display: flex; flex-direction: column; gap: 10px; }
#sp-advanced .sgroup { gap: 8px; }
#sp-midi { display: flex; flex-direction: column; gap: 10px; padding: 0; background: none; border-radius: 0; overflow: hidden; }   /* the MIDI toolbar and its three panels (see MIDI below) sit on the chassis, not in a panel */
.sgroup { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 34px; }
.form label > span { font-size: 12.5px; color: var(--dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.help { font-size: 12.5px; color: var(--dim); line-height: 1.5; } .help b { color: var(--text); font-weight: 500; }
.help.versions { margin-top: auto; font-size: 12px; }   /* the bottom of the Console pane's right column */
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); } .chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.slotrow { display: flex; gap: 8px; align-items: center; } .slotrow .slotn { width: 80px; }
.feedsec { gap: 8px 22px; } #fb-stats { font-variant-numeric: tabular-nums; }   /* Two-way feedback: the two feed switches and the rate readout */
.slotrow .segb, .form .seg .segb { height: 34px; }
.help code, .steps code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.code { margin: 0; padding: 7px 10px; background: var(--cell); font: 12.5px var(--mono); color: var(--accent); }
.steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.steps.small { font-size: 12.5px; color: var(--dim); }
.steps b { color: var(--text); font-weight: 500; }
.loglist { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); border-radius: 2px; padding: 8px 10px; font: 12px/1.55 var(--mono); color: var(--dim); display: flex; flex-direction: column; }
.loglist .tx { color: var(--text); } .loglist .rx { color: var(--accent); } .loglist .er { color: var(--feature); } .loglist .in { color: var(--dim); }
.loglist span.t { opacity: .5; margin-right: 6px; }

/* Layers editor: a row per layer in S.layers order (js/setup-layers.js); the list scrolls inside the pane, the page never does.
   Magenta edge = a custom layer, as in the Faders column; the line shows where a dragged layer will land. */
.slhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sllist { position: relative; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.sl-row { flex: none; display: grid; grid-template-columns: 36px minmax(0, 1fr) 118px 88px auto; align-items: center; gap: 8px; min-height: 48px; padding: 6px 8px; background: var(--cell); border-left: 3px solid var(--ghost); }
.sl-row.cu { border-left-color: var(--feature); }
.sl-row.drag { opacity: .4; }
.sl-row.off .sl-tag, .sl-row.off .sl-name { color: var(--faint); }
.sl-grip { width: 36px; height: 36px; display: grid; place-items: center; color: var(--dim); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.sl-grip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; }
.sl-grip:hover, .sl-grip:focus-visible { color: var(--accent); }
.sl-name { height: 34px; }
.sl-tag { font: 11.5px var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-vis { height: 34px; } .sl-vis:not(.on) { color: var(--faint); }
.sl-acts { display: flex; gap: 6px; }
.sl-acts .btn, .sl-nodel { flex: 0 0 76px; height: 34px; padding: 0; }   /* one width, so Delete's gap on a page layer keeps the columns aligned */
.sl-drop { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); pointer-events: none; z-index: 2; }

/* Playbacks editor (js/setup-playbacks.js): a row per wing row, 400 on top; the key's default mode and, on 200–400, the fader's or knob's. */
.pblist { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; align-content: start; }
.pb-row { flex: none; display: grid; grid-template-columns: 110px auto auto minmax(0, 1fr); justify-content: start; align-items: center; gap: 8px 28px; min-height: 60px; padding: 8px 12px; background: var(--cell); border-left: 3px solid var(--ghost); }
.pb-head { display: flex; flex-direction: column; gap: 3px; }
.pb-head b { font: 500 20px/1 var(--font); }
.pb-head span { font: 11.5px var(--mono); color: var(--dim); white-space: nowrap; }
.pb-grp { display: flex; align-items: center; gap: 10px; }
.pb-lab { min-width: 34px; font-size: 12.5px; color: var(--dim); }
.pb-row .segb { background: var(--cap); } .pb-row .segb.on { background: var(--cell-on); }
/* Height: Default, or a slider (a share of the strip's height) with its value; Auto while on Default. Flat: a bar thumb, no ring. */
.pb-ht { grid-column: 4; min-width: 0; } .pb-ht .seg { flex: none; }   /* (the last column also on row 100, which has no Level) */
.pb-range { -webkit-appearance: none; appearance: none; flex: 1 1 90px; min-width: 60px; max-width: 200px; height: 26px; margin: 0; background: transparent; cursor: pointer; }
.pb-range:focus { outline: none; }
.pb-range::-webkit-slider-runnable-track { height: 4px; background: var(--cap); }
.pb-range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 22px; margin-top: -9px; border: 0; border-radius: 2px; background: var(--accent); }
.pb-range::-moz-range-track { height: 4px; background: var(--cap); }
.pb-range::-moz-range-thumb { width: 12px; height: 22px; border: 0; border-radius: 2px; background: var(--accent); }
.pb-range.auto::-webkit-slider-thumb { background: var(--ghost); } .pb-range.auto::-moz-range-thumb { background: var(--ghost); }
.pb-val { flex: none; min-width: 40px; font: 12px var(--mono); color: var(--text); } .pb-val.auto { color: var(--faint); }

/* ---------- response curves (js/curve-editor.js) ---------- */
/* Setup → Advanced playback and Setup → MIDI → Curves: a bar (Mirror, presets), a square chart that takes the room it is given, a readout.
   Flat: the line is the accent colour, handles are plain discs, the live ring is an outline. */
.ce { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ce-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ce-bar .segb { height: 30px; padding: 0 8px; font-size: 12px; background: var(--cap); }
.ce-bar .segb:disabled { color: var(--faint); cursor: default; }
.ce-box { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ce-svg { position: absolute; inset: 0 0 auto 0; margin: 0 auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.ce-bg { fill: var(--bg); }
.ce-grid { stroke: var(--cap); stroke-width: 1; } .ce-edge { stroke: var(--ghost); stroke-width: 1; }
.ce-ref { stroke: var(--ghost); stroke-width: 1; stroke-dasharray: 3 5; }
.ce-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ce-line.dim { stroke: var(--dim); stroke-width: 2; }
.ce-handle { fill: var(--accent); stroke: var(--bg); stroke-width: 2; cursor: grab; }
.ce-handle.on { fill: var(--text); }
.ce-guide { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.ce-dot { fill: none; stroke: var(--text); stroke-width: 2; pointer-events: none; }
.ce-tick { font: 10px var(--mono); fill: var(--dim); } .ce-name { font: 500 11.5px var(--font); fill: var(--dim); } .ce-note { font: 12px var(--font); fill: var(--faint); }
.ce-foot { flex: none; min-height: 17px; }
.ce-read { display: block; font: 11.5px/1.5 var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-mirror { gap: 6px; }

/* ---------- midi ---------- */
/* Setup → MIDI. Three panels: ports + last message, learn + mapping list, notes. Lists scroll inside their boxes, the page never does. */
.midi { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 1.2fr) minmax(320px, 1.5fr) minmax(200px, .9fr); gap: 14px; position: relative; }
.mcol { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; background: var(--panel); border-radius: 4px; padding: 12px 14px; }
.mcurves { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }   /* Setup → MIDI → Curves: a panel and a chart each */
.mcol.notes { overflow-y: auto; }   /* fits at 1024 × 768 and 1280 × 720; scrolls inside only if a browser's fonts run long */
.mcol .help { flex: none; }
.msub { flex: none; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font: 500 11px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.msub em { font: 12px var(--font); font-style: normal; letter-spacing: 0; color: var(--accent); }
.msub.gap { margin-top: 6px; }
.mlist { flex: 1 1 0; min-height: 52px; overflow-y: auto; background: var(--bg); border-radius: 2px; }
/* Controllers: one block per port pair, a line of switches, a line of preset / target / clear */
.ctl { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; font-size: 12.5px; border-bottom: 1px solid var(--line); min-width: 0; }
.ctl:last-child { border-bottom: none; }
.ctl1, .ctl2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctl2 { flex-wrap: wrap; }
.ctl .pmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ctl .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl.gone .pn { color: var(--dim); text-decoration: line-through; }
.ctl.off .pn { color: var(--dim); }
.ctl input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.ctl .cn { flex: none; min-width: 22px; padding: 1px 6px; text-align: center; font: 11px var(--mono); color: var(--learn); background: var(--cell); border-radius: 2px; }
.ctl .lcd { display: inline-flex; align-items: center; gap: 4px; font: 500 10px var(--font); letter-spacing: .1em; color: var(--dim); cursor: pointer; }
.ctl .btn { flex: 1 1 60px; min-width: 0; height: 26px; padding: 0 8px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl select { flex: none; height: 26px; padding: 0 4px; background: var(--cap); border: none; border-radius: 2px; font-size: 12px; }
.ctl .mx { flex: none; height: 26px; padding: 0 8px; background: var(--cap); border-radius: 2px; color: var(--dim); font-size: 12px; }
.ctl .mx:hover { color: var(--feature); }
.mrow input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.mrow .mfb { display: inline-flex; align-items: center; gap: 4px; font: 500 10px var(--font); letter-spacing: .1em; color: var(--dim); cursor: pointer; }
.mempty { padding: 8px 10px; font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.mlast { flex: none; min-height: 48px; background: var(--bg); border-radius: 2px; padding: 6px 8px; font: 12px/1.45 var(--mono); color: var(--accent); overflow: hidden; overflow-wrap: anywhere; }
.learnbig { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; background: var(--cell); border-top: 2px solid var(--learn); color: var(--learn); text-align: left; }
.learnbig b { font: 500 22px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; }
.learnbig span { font-size: 12.5px; color: var(--dim); }
.learnbig:hover:not(:disabled) { color: var(--text); }
.learnbig.on { background: var(--learn); color: var(--ink); } .learnbig.on span { color: var(--ink); }
.learnbig:disabled { opacity: .35; cursor: default; }
.mmap { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); border-radius: 2px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto auto auto; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; transition: background .15s; }
.mrow.hit { background: var(--cell-on); }
.mrow .mlab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mrow .msrc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px var(--mono); color: var(--dim); }
.mrow .mctl { display: flex; gap: 4px; align-items: center; }
.mrow select { height: 26px; width: 88px; padding: 0 4px; background: var(--cap); border: none; border-radius: 2px; font-size: 12px; }
.mrow .ti { height: 26px; width: 44px; padding: 2px 4px; }
.mrow .mx { width: 26px; height: 26px; background: var(--cap); border-radius: 2px; color: var(--dim); font-size: 11px; }
.mrow .mx:hover { color: var(--feature); }
/* controller presets: a picker in the learn column, and the guide drawn over the three panels */
.prow { flex: none; display: flex; gap: 8px; }
.prow select { flex: 1; min-width: 0; height: 36px; padding: 0 8px; background: var(--cap); border: none; border-radius: 3px; font-size: 13px; }
.mguide { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px 14px; background: var(--panel); border-top: 2px solid var(--learn); border-radius: 4px; }
.mg-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mg-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; white-space: nowrap; }
.mg-title b { font: 500 16px var(--font); } .mg-title em { font-style: normal; font-size: 13px; color: var(--accent); }
.mg-head .mx { width: 32px; height: 32px; flex: none; background: var(--cap); border-radius: 2px; color: var(--dim); }
.mg-head .mx:hover { color: var(--text); }
.mg-dia { flex: 1 1 0; min-height: 0; display: grid; gap: 4px; padding: 6px; background: var(--bg); border-radius: 3px; }
.mg-layers { flex: 1 1 0; min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 8px; }   /* one layer above the other */
.mg-layer { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; } .mg-layer .mg-dia { flex: 1 1 0; }
.mg-cell { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px 5px; background: var(--cell); border-radius: 3px; overflow: hidden; cursor: default; }
.mg-cell i { display: block; flex: none; }
.mg-cell > div { min-width: 0; display: flex; flex-direction: column; }
.mg-cell.mg-enc i { width: 13px; height: 13px; border: 2px solid var(--dim); border-radius: 50%; }
.mg-cell.mg-btn i, .mg-cell.mg-pad i { width: 15px; height: 7px; background: var(--ghost); border-radius: 2px; }
.mg-cell.mg-fader { flex-direction: column; justify-content: flex-start; padding-top: 6px; }
.mg-cell.mg-fader i { order: 3; flex: 1; width: 4px; margin: 2px 0 4px; background: var(--ghost); border-radius: 2px; }
.mg-cell b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11.5px/1.15 var(--cond); color: var(--text); }
.mg-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 10.5px/1.15 var(--cond); color: var(--dim); }
.mg-cell span:empty { display: none; }
.mg-dia.dense .mg-cell:not(.mg-fader) i { display: none; }
@media (max-width: 1200px) { .mg-cell:not(.mg-fader) i { display: none; } .mg-cell { padding: 2px; } .mg-cell b { font-size: 11px; } .mg-cell span { font-size: 10px; } }
.mg-foot { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(230px, .8fr); gap: 16px; }
.mg-col { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mg-col .steps { gap: 2px; line-height: 1.4; }
.mg-load .form label { grid-template-columns: 92px minmax(0, 1fr); }
.mg-load select.ti { padding: 0 6px; }

/* MIDI learn (midi.js puts .midi-learn on <html>): everything MIDI can drive is outlined, mapped items solid,
   the armed one blinks. The encoder dials' inner knob / outer ring are SVG groups: fills and strokes there, not outlines. */
.midi-learn .learnable { outline: 1px dashed var(--learn); outline-offset: -1px; cursor: crosshair; }
.midi-learn .learnable.mapped { outline: 2px solid var(--learn); outline-offset: -2px; }
.midi-learn .learnable.armed { outline: 2px solid var(--warn); outline-offset: -2px; animation: blink .8s steps(2, start) infinite; }
.midi-learn .enc .dial .learnable { outline: none; }
.midi-learn .enc .dial .outer.learnable .ring { stroke: color-mix(in srgb, var(--learn) 28%, var(--cell)); }
.midi-learn .enc .dial .outer.learnable.mapped .ring { stroke: color-mix(in srgb, var(--learn) 60%, var(--cell)); }
.midi-learn .enc .dial .outer.learnable.armed .ring { stroke: var(--warn); }
.midi-learn .enc .dial .rot.learnable .knob { stroke: var(--learn); stroke-dasharray: 5 5; stroke-width: 3; }
.midi-learn .enc .dial .rot.learnable.mapped .knob { stroke-dasharray: none; stroke-width: 5; }
.midi-learn .enc .dial .rot.learnable.armed .knob { stroke: var(--warn); stroke-dasharray: none; stroke-width: 5; }

/* ---------- pop-up (console style: grey title bar) + toast ---------- */
.pop { position: fixed; z-index: 30; width: 280px; max-width: calc(100vw - 16px); background: var(--cell); border: 1px solid var(--title); border-radius: 3px; padding: 0 0 14px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pop .pt { height: 36px; display: flex; align-items: center; padding: 0 12px; background: var(--title); font: 500 14px var(--font); color: #fff; }
.pop > :not(.pt) { margin: 0 14px; }
.pop .row { margin-top: 0; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px; }
.pop .btn { height: 40px; }
.pop .ti { width: auto; align-self: stretch; height: 44px; font-size: 18px; }
.pop .help { font-size: 12px; }
.pop.wide { width: 380px; }
.pop.big { width: 560px; } .pop.big .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 320px; } .pop.big .pgrid button { height: 50px; }   /* the encoder value box */
.pop.movable .pt { cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
/* an encoder's presets in its value box (encoders.js): number in the corner, name, scrolls inside if the pool is long */
.pop .pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-height: 216px; overflow-y: auto; }
.pop .pgrid button { position: relative; display: flex; align-items: center; height: 44px; padding: 12px 6px 1px; background: var(--cap); border-radius: 2px; font: 500 12.5px/1.05 var(--cond); color: var(--text); text-align: left; overflow: hidden; overflow-wrap: anywhere; }   /* names wrap to two lines, never "…" */
.pop .pgrid button i { position: absolute; top: 3px; left: 6px; font: 10px var(--mono); font-style: normal; color: var(--dim); }
.pop .pgrid button:hover { color: var(--accent); } .pop .pgrid button:active { background: var(--cap-dn); }
.pop .pgrid button.th { padding-left: 40px; } .pop .pgrid button.th i { left: 40px; }   /* gobo image / colour at the left */
.pop .calc { display: grid; gap: 8px; }
.pop .calctabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.pop .calctabs .segb { height: 46px; padding: 0 6px; font: 500 15px var(--cond); }
.pop .pgrid button.plain { padding-top: 1px; justify-content: center; text-align: center; }   /* specials, sound codes: no number */
.pop .csets { display: grid; gap: 6px; }
.pop .cstabs { display: flex; flex-wrap: wrap; gap: 4px; } .pop .cstabs[hidden] { display: none; }
.pop .cstabs .segb { flex: 1 1 auto; height: 40px; padding: 0 12px; font: 500 14px var(--cond); }
.pop .pgrid .pth { position: absolute; left: 5px; top: 5px; width: 30px; height: 30px; border-radius: 50%; background: #000; object-fit: contain; box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
/* plugin install: a full-window loading screen that takes every tap (keys and MIDI are held off in js) */
/* ---------- start menu: "Connect to grandMA3", a modal over the app (js/start.js). Solid border, no shadow. ---------- */
.start { position: fixed; inset: 0; z-index: 36; display: grid; place-items: center; padding: 12px; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.startbox { width: min(460px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 22px; background: var(--panel); border: 1px solid var(--ghost); border-radius: 4px; }
.starthd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.starthd h2 { font: 500 19px var(--font); }
.startx { flex: none; width: 36px; height: 36px; margin-right: -8px; display: grid; place-items: center; color: var(--dim); }
.startx:hover { color: var(--accent); }
.startx svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; }
.startform { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px 12px; }
.startform label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.startform label > span { font-size: 12px; color: var(--dim); }
.startform .ti { height: 38px; font-size: 14px; }
.startbtns { display: flex; gap: 8px; }
.startbtns .btn { flex: 1 1 0; height: 52px; flex-direction: column; gap: 2px; line-height: 1.15; font-size: 15px; }
.startbtns .btn b { font-weight: 500; } .startbtns .btn small { font: 400 11px var(--font); color: var(--dim); }
@media (max-height: 520px) { .startbox { gap: 10px; padding: 12px 16px 14px; } .start .steps { display: none; } .startbtns .btn { height: 46px; } }

.busy { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 88%, transparent); cursor: progress; touch-action: none; }
.busybox { width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 24px; background: var(--panel); border-top: 2px solid var(--accent); border-radius: 4px; text-align: center; }
.spin { width: 40px; height: 40px; border: 3px solid var(--ghost); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.busyt { font: 500 17px var(--font); }
.busybar { align-self: stretch; height: 6px; background: var(--cell); border-radius: 3px; overflow: hidden; } .busybar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.busys { font: 13px var(--mono); color: var(--dim); min-height: 1.4em; }
.busyn { font-size: 12.5px; line-height: 1.5; color: var(--dim); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); background: var(--cell); border-top: 2px solid var(--accent); color: var(--text); padding: 10px 16px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 40; max-width: 80vw; font-size: 13px; }
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }

/* ---------- compaction: tablet keeps the same layout, condensed ---------- */
@media (max-height: 860px) { :root { --dial: 156px; } .view { gap: 8px; } .keygrid { gap: 6px; } .enc { gap: 8px; } .ft, .encopts .segb, .bankbtn { height: 40px; } }
@media (max-height: 760px) { :root { --dial: 132px; --barH: 52px; } .view { padding: 4px 14px 10px; gap: 6px; } .keygrid { gap: 5px; } .enc { gap: 6px; } .enc .name { padding: 5px 6px; } .ft, .encopts .segb, .bankbtn { height: 36px; } .bankbtn .dots { bottom: 4px; } }
@media (max-width: 1320px) {
  .brand span { display: none; } .bar { gap: 10px; }
  .encbar, .encopts { gap: 12px; } .encrow { gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(150px, 220px); } .encoders { gap: 10px; }
  .ft { font-size: 13px; } .segb { padding: 0 11px; } .tab { padding: 0 12px; }
  .learnhd { padding: 0 12px; } .midi { gap: 10px; }
}
@media (max-width: 1120px) {
  .brand { display: none; }
  .sc-cols { gap: 8px; } .sc-ent { grid-template-columns: 30px minmax(0, 4fr) minmax(0, 7fr); gap: 5px; }
  .fadbar { gap: 8px; } .fadbar .segb { padding: 0 9px; }
  .fadlayers { flex-basis: 86px; } .fadlist { flex-basis: 196px; } .ly { font-size: 12.5px; }
  .ft { font-size: 12px; } .ft i { display: none; }
  .setup { gap: 10px; } .stabs { width: 128px; } .spane { gap: 20px; padding: 14px 16px; }
  .pb-row { grid-template-columns: 110px auto minmax(0, 1fr); } .pb-ht { grid-column: 1 / -1; }   /* narrower pane: the height control gets a line of its own */
  .form label { grid-template-columns: 84px minmax(0, 1fr); }
  .minilog { display: none; } .encrow { grid-template-columns: minmax(0, 1fr); }
  .mcol.notes .help { font-size: 12px; line-height: 1.4; }   /* the MIDI pane has the Setup tabs beside it: its notes column is narrower */
}
@media (max-width: 900px) { .status .st { padding: 0 8px; font-size: 0; gap: 0; } .tab { padding: 0 10px; } }

/* ---------- phone: a different arrangement, same elements ----------
   Header: view tabs and status on top, the command line under them. The Keys view is three pages side by
   side (encoders · keys · playback) that snap as you swipe; Oops / Esc / Clear and MA / Please stay
   fixed at the bottom on every page. Faders and Open Scribble scroll sideways a few strips / one column
   at a time; Setup is one column. The X keys, executor knobs and level wheel are left off the phone. */
@media (max-width: 640px) {
  :root { --dial: 92px; --fixedH: 124px; }
  .bar { height: auto; flex-wrap: wrap; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; }
  .brand { display: none; }
  .tabs { order: 1; flex: 1 1 auto; height: 40px; } .tab { flex: 1 1 0; padding: 0 4px; font-size: 13px; }
  .status { order: 2; height: 40px; } .status .st { padding: 0 10px; font-size: 0; gap: 0; }
  .cmd { order: 3; flex: 1 1 100%; height: 44px; } .cmdkw { padding: 0 10px; } .cmdline { font-size: 15px; }
  body[data-view="keys"] .pager { display: flex; gap: 2px; padding: 0 12px 6px; flex: none; }
  .pg { flex: 1 1 0; height: 32px; background: transparent; border-bottom: 2px solid var(--line); font-size: 13px; color: var(--dim); }
  .pg.on { color: var(--accent); border-bottom-color: var(--accent); }

  #view-keys { flex-direction: row; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 0 0 calc(var(--fixedH) + env(safe-area-inset-bottom)); gap: 0; overscroll-behavior-x: contain; }
  #view-keys::-webkit-scrollbar { display: none; }
  .encsec { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; padding: 4px 12px 8px; gap: 10px; overflow: hidden; }
  .encbar { flex-direction: column; gap: 8px; }
  .fgroups { flex: none; overflow-x: auto; scrollbar-width: none; } .fgroups::-webkit-scrollbar { display: none; }
  .ft { flex: 0 0 auto; padding: 6px 14px 0; height: 38px; font-size: 13px; } .ft i { display: block; }
  .encopts { gap: 8px; } .encopts .seg { flex: 1 1 auto; } .encopts .segb { flex: 1 1 0; height: 36px; padding: 0 6px; } .encopts .bankbtn { flex: 1 1 auto; width: auto; height: 36px; }
  .encrow { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); } .minilog { display: none; }
  /* five encoders, two per row; each wheel takes whatever height its row leaves */
  .encoders { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 10px 12px; min-height: 0; }
  .enc { gap: 6px; min-height: 0; } .enc:nth-child(5) { grid-column: 1 / span 2; }
  /* encoders as faders: five side by side, the fill is the attribute's level; drag up / down nudges, a tap types a value */
  .encoders { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 6px; }
  .encoders .enc:nth-child(5) { grid-column: auto; }
  .ecell { flex-direction: row; align-items: center; max-width: none; height: 32px; flex: none; }
  .enc .name { flex: 1 1 auto; min-width: 0; padding: 0 8px; text-align: left; font-size: 13px; }
  .wheelbox { flex: 1 1 0; min-height: 0; height: auto; }
  .encoders .ecell { height: 30px; } .encoders .enc .name { padding: 0 3px; text-align: center; font: 500 12px var(--cond); }
  .enc .dial, .enc .push { display: none; }
  .enc .efader { display: block; position: absolute; inset: 0; background: var(--cell); border-radius: 3px; overflow: hidden; touch-action: none; cursor: ns-resize; }
  .enc .efader .fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--lv, 0) * 1%); background: color-mix(in srgb, var(--accent) 22%, var(--cell)); border-top: 2px solid var(--accent); transition: height .1s linear; }
  .enc.live .efader, .enc.t-in .efader { box-shadow: inset 0 0 0 1px var(--accent); }
  .enc.off .efader { opacity: .35; }
  .enc .readout { width: 100%; } .enc .gimg { width: 44px; height: 44px; margin-bottom: 6px; } .enc .gsw { width: 30px; height: 30px; margin-bottom: 6px; } .enc .val { font-size: 16px; } .enc .pname { font-size: 12px; margin-top: 2px; } .enc .delta { font-size: 12px; } .enc .readout::before { font-size: 14px; }

  .keygrid { flex: 0 0 200%; min-width: 0; gap: 8px; scroll-snap-align: start;
    grid-template-columns: 4px repeat(4, minmax(0, 1fr)) 8px repeat(4, minmax(0, 1fr)) 4px;
    grid-template-rows: repeat(9, minmax(0, 1fr)); padding: 2px 0; }
  .keygrid .amode { display: none; }
  .keygrid .knob, .keygrid .wheel, .keygrid .key.x, .keygrid .key[data-id="ma2"],
  .keygrid .key[data-id="pause"], .keygrid .key[data-id="gominus"], .keygrid .key[data-id="goplus"] { display: none; }
  .key { font-size: 15px; } .key .s { font-size: 10.5px; } .key.num .l, .key.num.wide .l { font-size: 22px; }
  .keygrid.ma .key.hasma .l { font-size: 10.5px; } .keygrid.ma .key.hasma .s { font-size: 14px; }
  .keygrid .key[data-id="fixture"] { grid-column: 2 !important; grid-row: 1 !important; }
  .keygrid .key[data-id="channel"] { grid-column: 3 !important; grid-row: 1 !important; }
  .keygrid .key[data-id="group"] { grid-column: 4 !important; grid-row: 1 !important; }
  .keygrid .key[data-id="preset"] { grid-column: 5 !important; grid-row: 1 !important; }
  .keygrid .key[data-id="sequ"] { grid-column: 2 !important; grid-row: 2 !important; }
  .keygrid .key[data-id="cue"] { grid-column: 3 !important; grid-row: 2 !important; }
  .keygrid .key[data-id="edit"] { grid-column: 4 !important; grid-row: 2 !important; }
  .keygrid .key[data-id="assign"] { grid-column: 5 !important; grid-row: 2 !important; }
  .keygrid .key[data-id="time"] { grid-column: 2 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="update"] { grid-column: 3 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="store"] { grid-column: 4 / span 2 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="n7"] { grid-column: 2 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="n8"] { grid-column: 3 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="n9"] { grid-column: 4 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="plus"] { grid-column: 5 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="n4"] { grid-column: 2 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="n5"] { grid-column: 3 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="n6"] { grid-column: 4 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="thru"] { grid-column: 5 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="n1"] { grid-column: 2 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="n2"] { grid-column: 3 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="n3"] { grid-column: 4 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="minus"] { grid-column: 5 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="n0"] { grid-column: 2 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="dot"] { grid-column: 3 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="if"] { grid-column: 4 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="at"] { grid-column: 5 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="slash"] { grid-column: 2 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="full"] { grid-column: 3 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="move"] { grid-column: 4 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="delete"] { grid-column: 5 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="copy"] { grid-column: 2 !important; grid-row: 9 !important; }
  .keygrid .key[data-id="align"] { grid-column: 3 !important; grid-row: 9 !important; }
  .keygrid .key[data-id="on"] { grid-column: 4 !important; grid-row: 9 !important; }
  .keygrid .key[data-id="off"] { grid-column: 5 !important; grid-row: 9 !important; }
  .keygrid .key[data-id="highlt"] { grid-column: 7 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="solo"] { grid-column: 8 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="freeze"] { grid-column: 9 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="prvw"] { grid-column: 10 !important; grid-row: 3 !important; }
  .keygrid .key[data-id="blind"] { grid-column: 7 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="selfix"] { grid-column: 8 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="prev"] { grid-column: 9 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="next"] { grid-column: 10 !important; grid-row: 4 !important; }
  .keygrid .key[data-id="set"] { grid-column: 7 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="up"] { grid-column: 8 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="down"] { grid-column: 9 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="select"] { grid-column: 10 !important; grid-row: 5 !important; }
  .keygrid .key[data-id="stomp"] { grid-column: 7 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="help"] { grid-column: 8 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="goto"] { grid-column: 9 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="list"] { grid-column: 10 !important; grid-row: 6 !important; }
  .keygrid .key[data-id="U1"] { grid-column: 7 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="U2"] { grid-column: 8 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="pageup"] { grid-column: 9 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="pagedn"] { grid-column: 10 !important; grid-row: 7 !important; }
  .keygrid .key[data-id="menu"] { grid-column: 7 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="learn"] { grid-column: 8 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="rew"] { grid-column: 9 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="ffw"] { grid-column: 10 !important; grid-row: 8 !important; }
  .keygrid .key[data-id="bigpause"] { grid-column: 7 !important; grid-row: 1 / span 2 !important; scroll-snap-align: start; scroll-margin-left: 16px; }
  .keygrid .key[data-id="biggominus"] { grid-column: 8 !important; grid-row: 1 / span 2 !important; }
  .keygrid .key[data-id="biggoplus"] { grid-column: 9 / span 2 !important; grid-row: 1 / span 2 !important; }
  /* fixed thumb block: Oops / Esc / Clear above MA / Please */
  .keygrid .key[data-id="oops"], .keygrid .key[data-id="esc"], .keygrid .key[data-id="clear"],
  .keygrid .key[data-id="ma1"], .keygrid .key[data-id="please"] { position: fixed !important; z-index: 5; }
  .keygrid .key[data-id="oops"], .keygrid .key[data-id="esc"], .keygrid .key[data-id="clear"] { bottom: calc(env(safe-area-inset-bottom) + 12px + 56px + 8px); height: 48px; width: calc((100% - 24px - 16px) / 3); }
  .keygrid .key[data-id="oops"] { left: 12px; }
  .keygrid .key[data-id="esc"] { left: calc(12px + (100% - 40px) / 3 + 8px); }
  .keygrid .key[data-id="clear"] { right: 12px; }
  .keygrid .key[data-id="ma1"] { left: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); width: 72px; height: 56px; }
  .keygrid .key[data-id="please"] { left: 92px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); height: 56px; width: auto; }
  .keygrid .key[data-id="please"] .l { font-size: 18px; }
  body[data-view="keys"] .main { background: var(--bg); }

  .fadbar { flex-wrap: wrap; gap: 8px; } .fadbar .fadhint, .fadbar .ptitle { display: none; }
  .fadlayers { display: none; }   /* the column is the layer button + popover list here */
  .fadbar .ly-btn { display: inline-block; max-width: 48%; overflow: hidden; text-overflow: ellipsis; line-height: 36px; padding: 0 12px; }
  .fadbar .ly-btn::after { content: "▾"; margin-left: 8px; color: var(--dim); }
  .strips { grid-template-columns: repeat(10, calc((100% - 32px) / 5)); gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .strips::-webkit-scrollbar { display: none; }
  .strip { scroll-snap-align: start; }
  .fadlist { position: absolute; right: 0; top: 0; bottom: 0; width: min(60%, 260px); z-index: 5; border-left: 1px solid var(--ghost); }   /* over the strips */
  /* narrow strips: number on top, name in the middle, cue underneath */
  .strip .name .ht { top: 21px; font-size: 13px; left: 4px; right: 4px; }
  .strip .name .hc, .strips.dense .name .hc { top: auto; bottom: 6px; left: 4px; right: 4px; max-width: none; text-align: center; font-size: 10px; }
  .strip .name .hm { left: auto; right: 4px; top: 8px; bottom: auto; font-size: 0; }   /* top right, clear of the cue underneath: a short form of the mode */
  .strip .name .hm::before { content: attr(data-s); font: 500 11px/1 var(--font); }
  .strips.dense .name .hm { top: 7px; } .strips.dense .name .hm::before { font-size: 10px; }
  .strip .fader.side .cm { font-size: 0; } .strip .fader.side .cm::before { content: attr(data-s); font: 500 10px/1 var(--font); }   /* the sideways fader's mode, short */
  .strip .fader.side .val.in { right: 5px; font-size: 13px; } .strips.dense .fader.side .val.in { font-size: 12px; }
  .sc-cols { grid-template-columns: repeat(4, 100%); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .sc-cols::-webkit-scrollbar { display: none; } .sc-col { scroll-snap-align: start; }
  .setup { flex-direction: column; gap: 8px; }
  .stabs { flex-direction: row; flex-wrap: wrap; width: auto; } .stab { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 8px; text-align: center; font-size: 12px; border-left: 0; border-top: 2px solid var(--ghost); } .stab.on { border-top-color: var(--accent); }   /* seven tabs: a second line rather than squeezed ones */
  .spane { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; gap: 18px; padding: 14px 12px; overflow-y: auto; }
  #sp-layers, #sp-log { overflow: hidden; }
  .pb-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } .pb-ht { grid-column: auto; } .pb-head { flex-direction: row; align-items: baseline; gap: 10px; } .pb-grp { flex-wrap: wrap; gap: 6px 10px; } .pb-row .seg { flex-wrap: wrap; }
  /* a layer is two lines: handle, name, Visible; then its tag at the left and the buttons at the right */
  .sl-row { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 6px; }
  .sl-grip { grid-area: 1 / 1; } .sl-name { grid-area: 1 / 2; } .sl-vis { grid-area: 1 / 3; }
  .sl-tag, .sl-acts { grid-area: 2 / 1 / 3 / 4; } .sl-acts { justify-self: end; }
  .sl-acts .btn { flex: none; padding: 0 10px; } .sl-nodel { display: none; }
  .learnhd { order: 2; padding: 0 10px; font-size: 13px; }
  .fsbtn { order: 2; width: 40px; }
  body[data-view="keys"][data-kpage="0"] .cmd { display: none; }   /* the Encoders page has no use for the command line: more room for the faders */
  .midi, .mcurves { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow-y: auto; } .mcol.notes { overflow: visible; }
  .ce-box { flex: none; width: 100%; aspect-ratio: 1; }   /* the chart is as wide as the pane and square; the pane scrolls inside */
  .mlist { flex: none; max-height: 240px; } .mmap { flex: none; min-height: 200px; max-height: 60vh; }
  .mguide { position: fixed; inset: 0; z-index: 35; overflow: auto; border-radius: 0; padding-top: calc(env(safe-area-inset-top) + 12px); }
  .mg-title { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
  .mg-dia { flex: none; height: 360px; min-width: 640px; } .mg-foot { grid-template-columns: minmax(0, 1fr); }   /* the diagram scrolls sideways */
  .mg-layers { flex: none; } .mg-layer .mg-dia { flex: none; height: 200px; }
  .view { padding: 4px 12px 12px; }
}
