/* Harmonica Tab Generator — switchable skins.
 *   [data-skin="cr78"]   Roland CR-78-inspired hardware: wood cabinet, brushed
 *                        faceplate, cream pushbuttons, knob, fader, LEDs.
 *   [data-skin="studio"] Flat dark "studio" theme (to be revised later).
 * Structure/layout is shared; skins set CSS variables + a few decorations. */

/* 7-segment LED font for the readouts */
@font-face {
  font-family: "DSEG7";
  src: url("https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--room);
  -webkit-font-smoothing: antialiased;
}

/* ---------- skin palettes ---------- */
:root[data-skin="cr78"] {
  --room: #2a2320;
  --cabinet-a: #845330; --cabinet-b: #582f15;
  --faceplate-a: #2b2d31; --faceplate-b: #1b1d20;
  --panel-bg: #202327; --panel-edge: #34383e; --panel-inset: rgba(0,0,0,.5);
  --text: #f3f1ec; --muted: #b6bbc2; --label: #f2f4f6;
  --accent: #d69843; --accent-soft: #e6bd80; --accent-glow: rgba(214,152,67,.5);
  --btn-a: #efe9da; --btn-b: #cdc4b0; --btn-edge: #b3aa95; --btn-text: #2b2723;
  --led: #ff4233; --led-glow: rgba(255,66,51,.7);
  --display-bg: #140d06; --display-text: #d69843; --display-glow: rgba(214,152,67,.55);
  --paper: #f4ecd8; --ink: #14110b;
  --tab: #9a6510; --danger: #b3261e;
  --knob-a: #3a3d42; --knob-b: #121316;
}
/* "Conservatory": engraved printed-score — ivory/parchment, ink, burgundy + gilt */
:root[data-skin="studio"] {
  --gold: #b08a3e;
  --room: #d8c9a8;
  --cabinet-a: #e4d8bf; --cabinet-b: #d2c2a0;
  --faceplate-a: #f4ecd9; --faceplate-b: #ece1c8;
  --panel-bg: #f7f1e2; --panel-edge: rgba(58,42,28,.30); --panel-inset: rgba(120,90,50,.10);
  --text: #2a2018; --muted: #6b5a44; --label: #6e1f2a;
  --accent: #6e1f2a; --accent-soft: #8b2f3a; --accent-glow: rgba(110,31,42,.28);
  --btn-a: #faf4e6; --btn-b: #e8ddc4; --btn-edge: #c2ad85; --btn-text: #2a2018;
  --led: #6e1f2a; --led-glow: rgba(110,31,42,.25);
  --display-bg: #efe6d0; --display-text: #2a2018; --display-glow: rgba(0,0,0,0);
  --paper: #f7f1e3; --ink: #1a1612;
  --tab: #6e1f2a; --danger: #9a2b22;
  --knob-a: #e9cf95; --knob-b: #8a6a2e;
}

/* ---------- cabinet / faceplate ---------- */
.cabinet { min-height: 100%; padding: 22px; }
:root[data-skin="cr78"] .cabinet {
  background:
    /* top sheen + bottom shade for depth */
    linear-gradient(180deg, rgba(255,231,201,.07), transparent 16%, rgba(0,0,0,.28)),
    /* fine, irregular grain lines */
    repeating-linear-gradient(90deg,
      rgba(28,14,5,.22) 0 1px, transparent 1px 5px,
      rgba(74,42,18,.13) 5px 6px, transparent 6px 13px,
      rgba(20,10,4,.18) 13px 14px, transparent 14px 22px),
    /* gentle broad tonal bands (planks) */
    repeating-linear-gradient(90deg,
      rgba(120,72,36,.09) 0 34px, transparent 34px 68px),
    linear-gradient(162deg, #7c4a25, #5d3415);
}
:root[data-skin="studio"] .cabinet {
  background:
    repeating-linear-gradient(0deg, rgba(120,90,50,.035) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, var(--cabinet-a), var(--cabinet-b));
}

/* ===== Studio "Conservatory" component overrides ===== */
:root[data-skin="studio"] body { font-family: "EB Garamond", Georgia, "Times New Roman", serif; }
/* serif labels in small-caps */
:root[data-skin="studio"] .panel-label,
:root[data-skin="studio"] .readout-cap,
:root[data-skin="studio"] .ctl-cap,
:root[data-skin="studio"] .rbtn-cap,
:root[data-skin="studio"] .skin-bracket span,
:root[data-skin="studio"] .mswitch-pos,
:root[data-skin="studio"] .logo-model,
:root[data-skin="studio"] .collapse-btn {
  font-family: "EB Garamond", Georgia, serif; font-weight: 600;
  font-variant: small-caps; letter-spacing: .07em; text-transform: none;
}

/* faceplate = ivory page with an engraved double-rule frame */
:root[data-skin="studio"] .faceplate {
  background: linear-gradient(180deg, var(--faceplate-a), var(--faceplate-b));
  border: 1px solid var(--gold); border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(110,31,42,.22), inset 0 0 0 5px var(--faceplate-a),
              0 14px 34px rgba(80,50,20,.28);
}
:root[data-skin="studio"] .pinstripe {
  height: 3px; background: none; opacity: 1; border-radius: 0;
  border-top: 1px solid var(--accent); border-bottom: 1px solid var(--gold);
}

/* logo: display serif + a burgundy fleuron instead of the chip */
:root[data-skin="studio"] .logo-name {
  font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600;
  font-size: 31px; letter-spacing: .005em; color: var(--text); text-shadow: none;
}
:root[data-skin="studio"] .logo-model { color: var(--muted); border-color: var(--gold); }

/* panels: cream cards with hairline ink border + inner rule */
:root[data-skin="studio"] .panel {
  border: 1px solid var(--panel-edge); border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(247,241,226,.55), 0 1px 2px rgba(80,50,20,.12);
}

/* round buttons = ivory organ-stop draw-knobs */
:root[data-skin="studio"] .round-btn {
  border: 1px solid var(--gold);
  background: radial-gradient(circle at 50% 36%, #fffdf5, #efe6cf 68%, #e1d5b7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), inset 0 0 0 3px rgba(176,138,62,.16),
              0 2px 4px rgba(80,50,20,.3);
}
:root[data-skin="studio"] .round-btn:active:not(:disabled) {
  box-shadow: inset 0 2px 5px rgba(80,50,20,.35), 0 1px 2px rgba(80,50,20,.3);
}
:root[data-skin="studio"] .skin-round[aria-pressed="true"] {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 0 0 2px var(--accent), 0 2px 4px rgba(80,50,20,.3);
}
:root[data-skin="studio"] .skin-bracket { border-color: rgba(58,42,28,.45); }

/* zoom knob = brass with a dark pointer + ink ticks */
:root[data-skin="studio"] .knob {
  border: 2px solid #7a5a22;
  background: radial-gradient(circle at 50% 38%, #ecd49b, #b78f44 70%, #8a6a2e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 2px 5px rgba(80,50,20,.4);
}
:root[data-skin="studio"] .knob-ind { background: #3a2a12; box-shadow: none; }
:root[data-skin="studio"] .knob-ticks {
  background: repeating-conic-gradient(from -123deg at 50% 100%,
      rgba(58,42,18,.7) 0 1.6deg, transparent 1.6deg 17deg);
}

/* Meas/Line = engraved serif numeral on an ivory plaque (no LED) */
:root[data-skin="studio"] .seg-readout {
  background: #efe6d0; border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 3px rgba(80,50,20,.22);
  font-family: "EB Garamond", Georgia, serif; padding: 2px 13px;
}
:root[data-skin="studio"] .seg-ghost { display: none; }
:root[data-skin="studio"] .seg-digit {
  position: static; color: var(--text); text-shadow: none; font-weight: 600;
}
:root[data-skin="studio"] .arrow-btn {
  border: 1px solid var(--gold); color: var(--text);
  background: radial-gradient(circle at 50% 35%, #fffdf5, #e6dcc3);
}

/* note-letters switch = brass lever in a cream slot */
:root[data-skin="studio"] .mswitch-slot {
  background: linear-gradient(180deg, #ded2b4, #c9bb98);
  border: 1px solid var(--gold); box-shadow: inset 0 1px 3px rgba(80,50,20,.3);
}
:root[data-skin="studio"] .mswitch-lever {
  background:
    repeating-linear-gradient(180deg, rgba(120,90,40,.22) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #ecd49b, #b78f44);
  box-shadow: 0 1px 2px rgba(80,50,20,.45);
}
:root[data-skin="studio"] .mswitch-pos { color: var(--muted); }

/* selects = ivory form fields */
:root[data-skin="studio"] select {
  background: #fffdf5; color: var(--text); border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 2px rgba(80,50,20,.15); text-shadow: none;
  font-family: "EB Garamond", Georgia, serif;
}
:root[data-skin="studio"] .select-wrap::after { color: var(--accent); }

/* meta = italic serif caption */
:root[data-skin="studio"] .meta.display {
  background: #fbf6e9; color: var(--text); border: 1px solid var(--panel-edge);
  box-shadow: none; text-shadow: none; font-style: italic;
  font-family: "EB Garamond", Georgia, serif;
}
:root[data-skin="studio"] .meta .pill {
  color: var(--accent); border-color: rgba(110,31,42,.4); background: rgba(110,31,42,.07);
}

/* dropzone / status / OMR banner */
:root[data-skin="studio"] .dropzone { background: rgba(255,255,255,.25); border-color: var(--panel-edge); }
:root[data-skin="studio"] .dropzone-glyph {
  color: var(--accent); background: rgba(110,31,42,.07); box-shadow: inset 0 0 0 1px rgba(110,31,42,.2);
}
:root[data-skin="studio"] .dropzone-title { color: var(--text); font-family: "Cormorant Garamond", serif; font-size: 20px; }
:root[data-skin="studio"] .status.info { background: rgba(110,31,42,.06); color: var(--accent); border-color: rgba(110,31,42,.25); }
:root[data-skin="studio"] .status.error { background: rgba(154,43,34,.08); color: var(--danger); border-color: rgba(154,43,34,.3); }
:root[data-skin="studio"] .omr-banner { background: rgba(110,31,42,.06); color: var(--accent); border-color: rgba(110,31,42,.25); }
:root[data-skin="studio"] .omr-banner strong { color: var(--text); }
:root[data-skin="studio"] .omr-warns { color: var(--danger); background: rgba(154,43,34,.1); border-color: rgba(154,43,34,.35); }

/* collapse button */
:root[data-skin="studio"] .collapse-btn { color: var(--text); border: 1px solid var(--panel-edge); background: #fbf6e9; }
:root[data-skin="studio"] .collapse-btn:hover { border-color: var(--accent); }
:root[data-skin="studio"] .collapse-caret { color: var(--accent); }

/* tabs = burgundy serif on the page */
:root[data-skin="studio"] .tab-cell {
  font-family: "EB Garamond", Georgia, serif; font-weight: 600; color: var(--tab); text-shadow: none;
}
:root[data-skin="studio"] .tab-cell.out-of-range { color: var(--danger); }
:root[data-skin="studio"] .debug-letter { color: var(--muted); font-family: "EB Garamond", Georgia, serif; }

.faceplate {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--faceplate-a), var(--faceplate-b));
}
:root[data-skin="cr78"] .faceplate {
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--faceplate-a), var(--faceplate-b));
  border: 1px solid #0a0b0c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 40px rgba(0,0,0,.5);
}

/* ---------- masthead / logo / pinstripe ---------- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark { display: inline-flex; align-items: center; color: var(--accent); }
.logo-mark svg { width: 42px; height: auto; display: block; }
.logo-text { display: flex; align-items: baseline; gap: 10px; }
.logo-name {
  font-family: "Rajdhani", sans-serif; font-weight: 700; font-size: 27px;
  letter-spacing: .01em; color: var(--text); line-height: 1;
}
:root[data-skin="cr78"] .logo-name { color: #f6f3ed; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.logo-model {
  font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 13px;
  letter-spacing: .22em; text-transform: uppercase; color: var(--label);
  border: 1px solid rgba(255,255,255,.28); border-radius: 4px; padding: 1px 7px;
}
.pinstripe { height: 2px; margin: 9px 0 12px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 8%, var(--accent) 92%, transparent); opacity: .85; }

/* ---------- console / panels ---------- */
.console { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.panel {
  position: relative; padding: 18px 14px 12px; border-radius: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 18px var(--panel-inset);
}
/* white silkscreen outline boxes, Cherry-Audio style */
:root[data-skin="cr78"] .panel { border-color: rgba(255,255,255,.22); }
.panel-body { display: flex; align-items: flex-end; gap: 16px; height: 100%; }
.panel-label {
  position: absolute; top: 6px; left: 12px;
  font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--label);
}
.skins { padding-top: 18px; }

/* ---------- pushbuttons (cream / flat) ---------- */
.pushbtn-row { display: flex; gap: 8px; }
.pushbtn {
  font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 13px;
  letter-spacing: .04em; line-height: 1.05;
  padding: 9px 14px; border-radius: 7px; cursor: pointer;
  color: var(--btn-text);
  background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
  border: 1px solid var(--btn-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 5px rgba(0,0,0,.45);
  transition: transform .05s ease, filter .12s ease;
}
:root[data-skin="studio"] .pushbtn { box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 2px 5px rgba(0,0,0,.4); }
.pushbtn:hover:not(:disabled) { filter: brightness(1.05); }
.pushbtn:active:not(:disabled) { transform: translateY(1px); }
.pushbtn:disabled { opacity: .45; cursor: default; }
.pushbtn-lg { padding: 12px 18px; font-size: 14px; }
.pushbtn[aria-pressed="true"] {
  outline: 2px solid var(--accent); outline-offset: 1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 0 14px var(--accent-glow);
}

/* ---------- round concave pushbuttons (transport) ---------- */
.roundbtns { display: flex; gap: 26px; align-items: flex-end; }
.skin-btns { gap: 16px; }
.rbtn { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.rbtn-cap {
  font-family: "Rajdhani", sans-serif; font-weight: 700; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text);
  text-align: center; line-height: 1.15;
}
.round-btn {
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid var(--btn-edge);
  /* concave dish lit from above: bright rim, shadowed top wall, lit floor at
     the bottom-center — the dish reads centered, not edge-heavy. */
  background: radial-gradient(125% 130% at 50% 118%, #efe8d9 0%, #d3cab5 46%, #b1a78f 72%, #c9bfa9 100%);
  box-shadow:
    inset 0 5px 7px rgba(0,0,0,.45),
    inset 0 -4px 5px rgba(255,255,255,.6),
    inset 0 0 0 2px rgba(255,255,255,.22),
    0 2px 5px rgba(0,0,0,.55);
  transition: transform .05s ease, filter .12s ease;
}
.round-btn:hover:not(:disabled) { filter: brightness(1.04); }
.round-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 6px 9px rgba(0,0,0,.5), inset 0 0 0 2px rgba(255,255,255,.18), 0 1px 2px rgba(0,0,0,.5);
}
.round-btn:disabled { opacity: .5; cursor: default; }

/* ---------- masthead right: collapse + round skin selector ---------- */
.masthead-right { display: flex; align-items: center; gap: 14px; }
.collapse-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 13px;
  border-radius: 7px; cursor: pointer; line-height: 1;
  color: #fff; font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 11px;
  letter-spacing: .09em; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.4); background: var(--panel-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.collapse-btn:hover { border-color: #fff; }
.collapse-caret { color: var(--accent); font-size: 10px; }
.skins { padding-top: 8px; }
.skin-bracket {
  height: 7px; margin: 0 12px 8px; position: relative;
  border: 1px solid rgba(255,255,255,.5); border-bottom: none; border-radius: 3px 3px 0 0;
}
.skin-bracket span {
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  background: var(--panel-bg); padding: 0 6px;
  font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--label);
}
.skin-btns { gap: 20px; }
.skin-round { width: 34px; height: 34px; }
.skin-round[aria-pressed="true"] {
  box-shadow:
    inset 0 5px 7px rgba(0,0,0,.45), inset 0 -4px 5px rgba(255,255,255,.6),
    0 0 0 2px var(--accent), 0 0 12px var(--accent-glow), 0 2px 5px rgba(0,0,0,.55);
}

/* ---------- recessed selector readouts ---------- */
.voices .panel-body { gap: 12px; }
.readout-field { display: flex; flex-direction: column; gap: 5px; }
.readout-cap, .ctl-cap {
  font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--label);
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: 12px; pointer-events: none;
}
select {
  appearance: none; -webkit-appearance: none; font: inherit;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; font-weight: 600;
  color: var(--display-text); min-width: 150px; padding: 8px 28px 8px 11px;
  border-radius: 6px; cursor: pointer;
  background: var(--display-bg); border: 1px solid #000;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.7);
  text-shadow: 0 0 6px var(--display-glow);
}
select:disabled { opacity: .5; cursor: default; }
select:focus { outline: none; border-color: var(--accent); }
/* Compact fixed widths so all five console panels fit on one row. The closed
   control clips a long option; the open list still shows the full name. */
#part-select { min-width: 108px; width: 108px; }
#harmonica-select { min-width: 196px; width: 196px; }

/* ---------- knob (zoom), VARIATION-style with tick arc ---------- */
.knob-unit { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 8px; }
.knob-ticks {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 68px; height: 36px; pointer-events: none; opacity: .9;
  background: repeating-conic-gradient(from -123deg at 50% 100%,
      rgba(255,255,255,.85) 0 1.6deg, transparent 1.6deg 17deg);
  -webkit-mask: radial-gradient(circle at 50% 100%, transparent 28px, #000 28px 34px, transparent 34px);
  mask: radial-gradient(circle at 50% 100%, transparent 28px, #000 28px 34px, transparent 34px);
}
.knob {
  width: 50px; height: 50px; border-radius: 50%; cursor: grab; padding: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  position: relative; border: 2px solid #0b0c0d;
  /* concave/dished black cap: dark dished center, lighter inner wall, dark rim */
  background: radial-gradient(circle at 50% 44%, #0d0e10 0%, #303338 52%, #45484d 76%, #131417 100%);
  box-shadow:
    inset 0 3px 7px rgba(0,0,0,.65), inset 0 -2px 3px rgba(255,255,255,.08),
    0 3px 6px rgba(0,0,0,.55);
}
.knob:focus { outline: none; }
.knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.knob:active { cursor: grabbing; }
.knob-dial { position: absolute; inset: 0; transition: transform .14s ease; }
.knob-ind {
  position: absolute; left: 50%; top: 5px; width: 3px; height: 15px;
  transform: translateX(-50%); border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 6px var(--accent-glow);
}

/* ---------- 7-segment readout + arrow stepper (measures/line) ---------- */
.stepper { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stepper-row { display: flex; align-items: center; gap: 8px; }
.stepper-btns { display: flex; flex-direction: column; gap: 4px; }
.arrow-btn {
  width: 22px; height: 17px; cursor: pointer; padding: 0; color: #2b2723;
  display: grid; place-items: center; font-size: 8px; line-height: 1;
  border: 1px solid var(--btn-edge); border-radius: 4px;
  background: linear-gradient(180deg, #d7d2c4, #b3ab97);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 2px rgba(0,0,0,.5);
}
.arrow-btn:active { transform: translateY(1px); }
.seg-readout {
  position: relative; padding: 5px 10px; border-radius: 5px;
  background: #190c04; border: 1px solid #000;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.85);
  font-family: "DSEG7", "JetBrains Mono", monospace; font-size: 26px; line-height: 1;
}
.seg-ghost { color: rgba(255,66,51,.13); }
.seg-digit {
  position: absolute; left: 10px; top: 5px;
  color: var(--led); text-shadow: 0 0 8px var(--led-glow);
}

/* ---------- octave / reset buttons (pitch panel) ---------- */
.pitch-extra { display: flex; flex-direction: column; gap: 4px; }
.wide-btn {
  cursor: pointer; padding: 3px 7px; color: #2b2723;
  font-size: 9px; line-height: 1; font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--btn-edge); border-radius: 4px;
  background: linear-gradient(180deg, #d7d2c4, #b3ab97);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 2px rgba(0,0,0,.5);
}
.wide-btn:active { transform: translateY(1px); }
:root[data-skin="studio"] .wide-btn {
  color: var(--muted); background: none;
  border-color: var(--line); box-shadow: none;
}

/* ---------- vertical metal switch (note letters) ---------- */
.mswitch { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.mswitch input { position: absolute; opacity: 0; pointer-events: none; }
.mswitch-stack { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mswitch-pos {
  font-family: "Rajdhani", sans-serif; font-weight: 700; font-size: 9px;
  letter-spacing: .12em; color: #d2d6dd;
}
.mswitch-slot {
  width: 22px; height: 40px; border-radius: 5px; position: relative;
  background: linear-gradient(180deg, #050606, #1d2024);
  border: 1px solid #000; box-shadow: inset 0 0 7px rgba(0,0,0,.9);
}
.mswitch-lever {
  position: absolute; left: 3px; right: 3px; top: 3px; height: 18px; border-radius: 4px;
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #e4e6e9, #9aa0a8 70%, #797e86);
  box-shadow: 0 2px 3px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .15s ease;
}
.mswitch input:checked + .mswitch-stack .mswitch-lever { transform: translateY(0); }
.mswitch input:not(:checked) + .mswitch-stack .mswitch-lever { transform: translateY(16px); }

/* ---------- stage / status / dropzone ---------- */
.stage { margin-top: 12px; }
.status { padding: 10px 13px; border-radius: 7px; font-size: 13.5px; margin-bottom: 14px; }
.status.error { background: rgba(179,38,30,.14); color: #ff9a91; border: 1px solid rgba(179,38,30,.4); }
.status.info  { background: rgba(255,138,30,.1); color: var(--accent-soft); border: 1px solid rgba(255,138,30,.3); }

.dropzone {
  border: 2px dashed var(--panel-edge); border-radius: 14px;
  background: rgba(0,0,0,.12); transition: border-color .15s ease, background .15s ease;
}
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 54px 20px; text-align: center; }
.dropzone-glyph {
  font-size: 34px; width: 62px; height: 62px; display: grid; place-items: center;
  border-radius: 50%; color: var(--accent);
  background: rgba(255,138,30,.08); box-shadow: inset 0 0 0 1px rgba(255,138,30,.25);
}
.dropzone-title { font-size: 16px; font-weight: 600; color: var(--text); }
.dropzone-sub { font-size: 12.5px; color: var(--muted); }
.dropzone.dragover { border-color: var(--accent); background: rgba(255,138,30,.08); }
/* Once a score is loaded the dropzone is redundant (use "Load Score") — hide
   it for more score room. The collapse button hides the rest of the chrome. */
.app-loaded .dropzone { display: none; }
.chrome-collapsed .console,
.chrome-collapsed .dropzone,
.chrome-collapsed .meta,
.chrome-collapsed .omr-banner { display: none !important; }
.chrome-collapsed .pinstripe { margin-bottom: 8px; }
.chrome-collapsed .stage { margin-top: 6px; }

/* ---------- meta = LED display strip ---------- */
.meta.display {
  margin: 16px 0 12px; padding: 10px 14px; border-radius: 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px;
  letter-spacing: .02em; color: var(--display-text);
  background: var(--display-bg); border: 1px solid #000;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.7);
  text-shadow: 0 0 7px var(--display-glow);
}
.meta .pill {
  margin-left: 8px; padding: 1px 8px; border-radius: 12px; font-size: 11px;
  color: var(--accent-soft); border: 1px solid rgba(255,138,30,.4);
}

/* ---------- OMR banner ---------- */
.omr-banner {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.45;
  background: rgba(255,138,30,.09); border: 1px solid rgba(255,138,30,.32); color: var(--accent-soft);
}
.omr-banner strong { color: var(--text); }
.omr-icon { font-size: 16px; flex: none; }
.omr-warns { margin-left: auto; flex: none; cursor: help; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 12px; background: rgba(179,38,30,.18); color: #ff9a91; border: 1px solid rgba(179,38,30,.4); }

/* ---------- score: aged-paper display well ---------- */
.screen { border-radius: 12px; padding: 26px 22px 40px; }
:root[data-skin="cr78"] .screen {
  background: var(--paper);
  border: 1px solid #0a0b0c;
  box-shadow: inset 0 0 0 8px #15161a, inset 0 2px 10px rgba(0,0,0,.5), 0 0 0 1px #2a2d31;
  background-image:
    linear-gradient(var(--paper), var(--paper)),
    repeating-linear-gradient(0deg, rgba(120,90,40,.03) 0 2px, transparent 2px 4px);
}
:root[data-skin="studio"] .screen {
  background: var(--paper);
  border: 1px solid var(--gold); border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(110,31,42,.22), inset 0 0 0 5px var(--paper),
              0 12px 30px rgba(80,50,20,.26);
}
.score { position: relative; }
.tab-layer { position: absolute; inset: 0; pointer-events: none; }
.tab-cell, .debug-letter { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tab-cell { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; font-weight: 700; color: var(--tab); }
.tab-cell.out-of-range { color: var(--danger); }
.debug-letter { font-family: "JetBrains Mono", monospace; font-size: 10.5px; font-weight: 600; color: #5a6470; }

/* ---------- responsive / mobile ---------- */
/* Never let the page scroll sideways; the score scrolls inside its own well. */
html, body { max-width: 100%; overflow-x: hidden; }
.panel { max-width: 100%; }
select { max-width: 100%; }
.screen { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 760px) {
  .cabinet { padding: 10px; }
  .faceplate { padding: 12px 12px 16px; }
  .masthead { gap: 12px; }
  .masthead-right { flex-wrap: wrap; justify-content: flex-end; }
  /* stack the control panels into one column */
  .console { flex-direction: column; }
  .panel { width: 100%; }
  /* Part / Harmonica stack and fill the width */
  .voices .panel-body { flex-direction: column; align-items: stretch; gap: 12px; }
  .readout-field { width: 100%; }
  select { width: 100%; min-width: 0; }
  /* bigger touch targets */
  .arrow-btn { width: 34px; height: 26px; font-size: 10px; }
  .round-btn { width: 50px; height: 50px; }
  .knob { width: 56px; height: 56px; }
  .meta.display { overflow-x: auto; white-space: nowrap; }
  .screen { padding: 16px 12px 26px; }
}

/* ---------- print: clean paper, no chrome ---------- */
@media print {
  @page { size: letter portrait; margin: 0; }
  body { background: #fff; }
  .cabinet, .faceplate { padding: 0; background: #fff; border: none; box-shadow: none; }
  .masthead, .pinstripe, .console, .dropzone, .meta, .status, .omr-banner { display: none !important; }
  .stage { margin: 0; }
  .screen { background: #fff !important; border: none !important; box-shadow: none !important; padding: 0; }
  .score { zoom: 0.713; }
  #score svg { break-after: page; }
  #score svg:last-of-type { break-after: auto; }
  .tab-cell, .tab-cell.out-of-range { color: #000; }
  .debug-letter { color: #333; }
}
