/* ═══════════════════════════════════════════════
   BH Beat Studio  ·  [beat_studio] shortcode
   Scoped under #bh-bs so nothing leaks.
   Dark visual language shared with Vocal Studio:
   accent #22B6FF, DM Mono / Syne / Manrope stacks.
   ═══════════════════════════════════════════════ */

#bh-bs{
  /* palette / tokens (mirror vocal-studio.css) */
  --cb:#22B6FF; --cb-deep:#1A96E8; --cb-light:#4AB8F5; --cb-tint:#7FD0FF;
  --cbo:rgba(34,182,255,.14); --cbg:rgba(34,182,255,.06);
  --cr:#ef4444; --crh:#f87171;
  --bg:#0a0910; --panel:rgba(255,255,255,.02);
  --sur:rgba(255,255,255,.035); --sur2:rgba(255,255,255,.06);
  --bdr:rgba(255,255,255,.08); --bdr2:rgba(255,255,255,.14);
  --muted:rgba(255,255,255,.34); --txt:rgba(255,255,255,.86);
  --mono:'DM Mono',ui-monospace,'SF Mono',Menlo,monospace;
  --disp:'Syne',system-ui,sans-serif;
  --sans:'Manrope',system-ui,sans-serif;
  --r:12px; --r-sm:7px;

  box-sizing:border-box;
  width:100%;
  max-width:1040px;      /* cap the sprawl on desktop so pads stay ~channel-rack */
  margin-inline:auto;    /* and center it */
  padding:20px;
  background:
    radial-gradient(120% 80% at 12% -10%, rgba(34,182,255,.07) 0%, transparent 55%),
    var(--bg);
  border:1px solid var(--bdr);
  border-radius:16px;
  color:var(--txt);
  font-family:var(--mono);
  -webkit-font-smoothing:antialiased;
  overflow:hidden; /* never let inner grids push page-body scroll */
}
#bh-bs *,#bh-bs *::before,#bh-bs *::after{box-sizing:border-box;}

/* optional heading if the markup ships one */
#bh-bs .bh-bs-title{
  margin:0 0 14px;
  font-family:var(--disp);
  font-weight:800;
  font-size:20px;
  letter-spacing:-.01em;
  color:#fff;
}
#bh-bs .bh-bs-sub{
  margin:-8px 0 16px;
  font-size:11px;
  letter-spacing:.05em;
  color:var(--muted);
}

/* ─────────────────────────────────────────────
   Transport bar
   ───────────────────────────────────────────── */
#bh-bs .bh-bs-transport,
#bh-bs .bh-bs-bar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  margin-bottom:16px;
  background:var(--panel);
  border:1px solid var(--bdr);
  border-radius:var(--r);
}

/* labels around the number inputs */
#bh-bs .bh-bs-transport label,
#bh-bs .bh-bs-bar label,
#bh-bs .bh-bs-field{
  display:inline-flex;
  align-items:center;
  gap:7px;
  font-size:10px;
  letter-spacing:.09em;
  text-transform:uppercase;
  color:var(--muted);
  white-space:nowrap;
}

/* Base for EVERY themed button (.bh-bs-btn). `button.bh-bs-btn` (0,1,1,1) beats
   the WP theme's `#main button` (0,1,0,1), so generic buttons — Save, Clear,
   cloud, publish — get the dark rounded style instead of the native grey button
   the theme was forcing. Per-button id rules below layer accent colours on top. */
#bh-bs button.bh-bs-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:40px; padding:0 18px;
  border:1px solid var(--bdr, rgba(255,255,255,.14)); border-radius:22px;
  background:var(--sur, rgba(255,255,255,.05)); color:#f4f4f5;
  font-family:var(--mono, 'DM Mono', ui-monospace, monospace);
  font-size:12px; font-weight:700; letter-spacing:.06em; cursor:pointer;
  transition:background .14s ease, border-color .14s ease, transform .14s ease;
}
#bh-bs button.bh-bs-btn:hover{ border-color:var(--bdr2, rgba(255,255,255,.26)); }
#bh-bs button.bh-bs-btn:active{ transform:translateY(1px); }

/* generic buttons in the transport */
#bh-bs button#bh-bs-play,
#bh-bs button#bh-bs-stop,
#bh-bs button#bh-bs-export{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:40px;
  padding:0 20px;
  border:1px solid transparent;
  border-radius:22px;
  font-family:var(--mono);
  font-size:12px;
  font-weight:700;
  letter-spacing:.06em;
  cursor:pointer;
  transition:transform .14s ease, opacity .14s ease,
             background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
#bh-bs button#bh-bs-play:active,
#bh-bs button#bh-bs-stop:active,
#bh-bs button#bh-bs-export:active{transform:translateY(1px);}

/* Play — accent gradient */
#bh-bs button#bh-bs-play{
  color:#fff;
  background:linear-gradient(135deg,var(--cb-light) 0%,var(--cb-deep) 100%);
  box-shadow:0 4px 18px rgba(34,182,255,.32);
}
#bh-bs button#bh-bs-play:hover{opacity:.9;transform:translateY(-1px);}
#bh-bs button#bh-bs-play.is-playing{
  background:linear-gradient(135deg,var(--cb-deep) 0%,#0f6fb0 100%);
}

/* Stop — neutral surface */
#bh-bs button#bh-bs-stop{
  color:var(--txt);
  background:var(--sur);
  border-color:var(--bdr2);
}
#bh-bs button#bh-bs-stop:hover{
  background:rgba(239,68,68,.12);
  border-color:rgba(239,68,68,.4);
  color:var(--crh);
}

/* Export — outline accent */
#bh-bs button#bh-bs-export{
  color:var(--cb-tint);
  background:transparent;
  border-color:rgba(34,182,255,.35);
}
#bh-bs button#bh-bs-export:hover{
  background:var(--cbo);
  border-color:var(--cb);
  color:#fff;
}
#bh-bs button#bh-bs-export:disabled{
  opacity:.45;cursor:not-allowed;
}

/* number inputs (tempo / bars) + wave select */
#bh-bs input#bh-bs-tempo,
#bh-bs input#bh-bs-bars,
#bh-bs select#bh-bs-wave{
  min-height:38px;
  padding:0 12px;
  background:var(--sur);
  border:1px solid var(--bdr);
  border-radius:9px;
  color:#fff;
  font-family:var(--mono);
  font-size:13px;
  font-weight:600;
  transition:border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
#bh-bs input#bh-bs-tempo,
#bh-bs input#bh-bs-bars{
  width:66px;
  text-align:center;
}
#bh-bs input#bh-bs-tempo:focus,
#bh-bs input#bh-bs-bars:focus,
#bh-bs select#bh-bs-wave:focus{
  outline:none;
  border-color:var(--cb);
  box-shadow:0 0 0 3px var(--cbo);
  background:rgba(34,182,255,.06);
}

/* wave selector — custom caret, mono */
#bh-bs select#bh-bs-wave{
  padding-right:32px;
  min-width:132px;
  cursor:pointer;
  -webkit-appearance:none;appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237FD0FF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 11px center;
}
#bh-bs select#bh-bs-wave option{
  background:#12111a;color:#fff;
}

/* ─────────────────────────────────────────────
   Sequencer sections
   ───────────────────────────────────────────── */
#bh-bs .bh-bs-section{
  padding:14px;
  margin-bottom:14px;
  background:var(--panel);
  border:1px solid var(--bdr);
  border-radius:var(--r);
}
#bh-bs .bh-bs-section-label,
#bh-bs .bh-bs-heading{
  margin:0 0 10px;
  font-size:10px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--cb-tint);
}

/* ─────────────────────────────────────────────
   Drum grid  ·  .bh-bs-drums > .bh-bs-row[data-drum]
   Row = label + 16 .bh-bs-cell[data-step]
   ───────────────────────────────────────────── */
#bh-bs .bh-bs-drums{
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow-x:auto;               /* horizontal scroll on small screens */
  -webkit-overflow-scrolling:touch;
  /* framed as a panel (channel-rack look) so it reads as its own instrument */
  padding:12px;
  margin-bottom:14px;
  background:var(--panel);
  border:1px solid var(--bdr);
  border-radius:var(--r);
}
#bh-bs .bh-bs-row{
  display:grid;
  grid-template-columns:72px repeat(16, minmax(30px,1fr));
  gap:5px;
  align-items:center;
  min-width:max-content;         /* keeps all rows scrolling in sync */
}
/* drum name label */
#bh-bs .bh-bs-row > label,
#bh-bs .bh-bs-row-label{
  font-size:10px;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--muted);
  white-space:nowrap;
  padding-right:4px;
}
#bh-bs .bh-bs-row[data-drum="kick"]  > label{color:#ff8a5c;}
#bh-bs .bh-bs-row[data-drum="snare"] > label{color:#c58cff;}
#bh-bs .bh-bs-row[data-drum="hat"]   > label{color:var(--cb-tint);}

/* step cell */
#bh-bs .bh-bs-cell{
  height:38px;
  min-width:30px;
  padding:0;
  border:1px solid var(--bdr);
  border-radius:var(--r-sm);
  background:var(--sur);
  cursor:pointer;
  transition:background .1s ease, border-color .1s ease,
             box-shadow .1s ease, transform .06s ease;
}
#bh-bs .bh-bs-cell:hover{
  background:var(--sur2);
  border-color:var(--bdr2);
}
#bh-bs .bh-bs-cell:active{transform:scale(.94);}

/* beat-group shading — every 4 steps */
#bh-bs .bh-bs-cell[data-step="4"],
#bh-bs .bh-bs-cell[data-step="5"],
#bh-bs .bh-bs-cell[data-step="6"],
#bh-bs .bh-bs-cell[data-step="7"],
#bh-bs .bh-bs-cell[data-step="12"],
#bh-bs .bh-bs-cell[data-step="13"],
#bh-bs .bh-bs-cell[data-step="14"],
#bh-bs .bh-bs-cell[data-step="15"]{
  background:rgba(255,255,255,.055);
}
/* downbeat divider on group starts */
#bh-bs .bh-bs-cell[data-step="0"],
#bh-bs .bh-bs-cell[data-step="4"],
#bh-bs .bh-bs-cell[data-step="8"],
#bh-bs .bh-bs-cell[data-step="12"]{
  box-shadow:inset 2px 0 0 rgba(34,182,255,.18);
}

/* active cell — accent fill */
#bh-bs .bh-bs-cell.is-on{
  background:linear-gradient(160deg,var(--cb-light) 0%,var(--cb-deep) 100%);
  border-color:var(--cb-light);
  box-shadow:0 0 0 1px rgba(34,182,255,.35), 0 3px 12px rgba(34,182,255,.28);
}
#bh-bs .bh-bs-cell.is-on:hover{filter:brightness(1.08);background:linear-gradient(160deg,var(--cb-light) 0%,var(--cb-deep) 100%);}

/* ─────────────────────────────────────────────
   Piano roll  ·  .bh-bs-roll (flat 16-col grid)
   13 pitch rows × 16 .bh-bs-note[data-note][data-step]
   ───────────────────────────────────────────── */
#bh-bs .bh-bs-roll{
  display:grid;
  grid-template-columns:repeat(16, minmax(30px,1fr));
  gap:4px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  padding:8px;
  background:rgba(0,0,0,.22);
  border:1px solid var(--bdr);
  border-radius:var(--r);
}
#bh-bs .bh-bs-note{
  height:30px;
  min-width:30px;
  padding:0;
  border:1px solid var(--bdr);
  border-radius:5px;
  background:var(--sur);        /* white-key default */
  cursor:pointer;
  transition:background .1s ease, border-color .1s ease,
             box-shadow .1s ease, transform .06s ease;
}
#bh-bs .bh-bs-note:hover{background:var(--sur2);border-color:var(--bdr2);}
#bh-bs .bh-bs-note:active{transform:scale(.92);}

/* black-key row hinting (C#,D#,F#,G#,A# → midi 61,63,66,68,70) */
#bh-bs .bh-bs-note[data-note="61"],
#bh-bs .bh-bs-note[data-note="63"],
#bh-bs .bh-bs-note[data-note="66"],
#bh-bs .bh-bs-note[data-note="68"],
#bh-bs .bh-bs-note[data-note="70"]{
  background:rgba(0,0,0,.35);
  border-color:rgba(255,255,255,.05);
}
#bh-bs .bh-bs-note[data-note="61"]:hover,
#bh-bs .bh-bs-note[data-note="63"]:hover,
#bh-bs .bh-bs-note[data-note="66"]:hover,
#bh-bs .bh-bs-note[data-note="68"]:hover,
#bh-bs .bh-bs-note[data-note="70"]:hover{background:rgba(255,255,255,.06);}

/* octave anchors (C = midi 60 & 72) get a faint accent tick */
#bh-bs .bh-bs-note[data-note="60"],
#bh-bs .bh-bs-note[data-note="72"]{
  box-shadow:inset 0 -2px 0 rgba(34,182,255,.22);
}

/* beat-group shading in the roll — every 4 steps */
#bh-bs .bh-bs-note[data-step="4"],
#bh-bs .bh-bs-note[data-step="5"],
#bh-bs .bh-bs-note[data-step="6"],
#bh-bs .bh-bs-note[data-step="7"],
#bh-bs .bh-bs-note[data-step="12"],
#bh-bs .bh-bs-note[data-step="13"],
#bh-bs .bh-bs-note[data-step="14"],
#bh-bs .bh-bs-note[data-step="15"]{
  box-shadow:inset 0 0 0 99px rgba(255,255,255,.03);
}

/* active note — accent fill */
#bh-bs .bh-bs-note.is-on{
  background:linear-gradient(160deg,var(--cb-tint) 0%,var(--cb) 100%);
  border-color:var(--cb-tint);
  box-shadow:0 0 0 1px rgba(34,182,255,.4), 0 3px 12px rgba(34,182,255,.3);
}
#bh-bs .bh-bs-note.is-on:hover{filter:brightness(1.08);background:linear-gradient(160deg,var(--cb-tint) 0%,var(--cb) 100%);}

/* ─────────────────────────────────────────────
   Playhead column highlight (JS toggles .bh-bs-playhead)
   ───────────────────────────────────────────── */
#bh-bs .bh-bs-cell.bh-bs-playhead,
#bh-bs .bh-bs-note.bh-bs-playhead{
  border-color:rgba(127,208,255,.6);
  box-shadow:0 0 0 1px rgba(127,208,255,.45), 0 0 14px rgba(34,182,255,.4);
}
#bh-bs .bh-bs-cell.bh-bs-playhead:not(.is-on){
  background:rgba(127,208,255,.14);
}
#bh-bs .bh-bs-note.bh-bs-playhead:not(.is-on){
  background:rgba(127,208,255,.12);
}

/* ─────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────── */
@media (max-width:640px){
  #bh-bs{padding:14px;border-radius:12px;}
  #bh-bs .bh-bs-transport,
  #bh-bs .bh-bs-bar{padding:10px;gap:8px;}
  #bh-bs button#bh-bs-play,
  #bh-bs button#bh-bs-stop,
  #bh-bs button#bh-bs-export{padding:0 16px;min-height:38px;font-size:11px;}
}

/* keyboard focus visibility for all interactive controls */
#bh-bs .bh-bs-cell:focus-visible,
#bh-bs .bh-bs-note:focus-visible,
#bh-bs button#bh-bs-play:focus-visible,
#bh-bs button#bh-bs-stop:focus-visible,
#bh-bs button#bh-bs-export:focus-visible{
  outline:2px solid var(--cb-tint);
  outline-offset:2px;
}
/* The rest of the controls: the selects, the sliders and the fields showed nothing at all when the keyboard got to them (the theme resets
   their outline), and every other button only the browser's own ring. Keyboard focus only (:focus-visible): a tap or a click draws nothing. */
#bh-bs :is(button, a, select, input, textarea):focus-visible{
  outline:2px solid var(--cb-tint);
  outline-offset:2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 2 layout correction + MIDI Genius bar.
   The markup wraps each row's step buttons in a .bh-bs-cells element and labels
   rows with .bh-bs-rowlabel / .bh-bs-notelabel; the piano-roll now spans TWO
   octaves (midi 48..72). Earlier rules put the 16-col grid directly on
   .bh-bs-row / .bh-bs-roll and targeted `> label` / .bh-bs-row-label — these
   overrides restore the real structure so the grids render and the tall roll
   scrolls. (Being later in the file, they win at equal specificity.)
   ═══════════════════════════════════════════════════════════════════════════ */
#bh-bs .bh-bs-row,
#bh-bs .bh-bs-noterow{ display:flex; align-items:center; gap:8px; min-width:0; }

#bh-bs .bh-bs-cells{
  display:grid;
  grid-template-columns:repeat(16, minmax(28px, 1fr));
  gap:4px; flex:1 1 auto; min-width:0;
}

#bh-bs .bh-bs-rowlabel,
#bh-bs .bh-bs-notelabel{
  flex:0 0 62px; width:62px;
  font:600 11px/1 'DM Mono', ui-monospace, monospace;
  color:var(--muted, rgba(244,244,245,.55));
  text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#bh-bs .bh-bs-row[data-drum="kick"]  .bh-bs-rowlabel{ color:#ff8a5c; }
#bh-bs .bh-bs-row[data-drum="snare"] .bh-bs-rowlabel{ color:#c58cff; }
#bh-bs .bh-bs-row[data-drum="hat"]   .bh-bs-rowlabel{ color:var(--cb-tint, #5ad0ff); }

/* piano-roll is a vertical stack of note rows; scrolls when tall (2 octaves) */
#bh-bs .bh-bs-roll{
  display:flex; flex-direction:column; gap:4px;
  max-height:340px; overflow-y:auto; overflow-x:auto;
}
/* black-key row hint — pitch-class based, covers the whole 48..72 range */
#bh-bs .bh-bs-noterow.is-black{ background:rgba(0,0,0,.24); border-radius:6px; }
#bh-bs .bh-bs-noterow.is-black .bh-bs-note{ background:rgba(0,0,0,.30); }

/* MIDI Genius "Generate melody" bar */
#bh-bs .bh-bs-gen{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:2px 0 6px; }
#bh-bs .bh-bs-generate{
  background:linear-gradient(135deg, #22B6FF, #7c5cff);
  color:#04121c; font-weight:700; border:0;
}
#bh-bs .bh-bs-generate:disabled{ opacity:.55; cursor:progress; }
#bh-bs .bh-bs-gen-status{
  font:500 12px/1.35 'DM Mono', ui-monospace, monospace;
  color:var(--muted, rgba(244,244,245,.6));
}

/* Publish-to-community bar (Phase 3) */
#bh-bs .bh-bs-publish{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin-top:14px; padding-top:14px;
  border-top:1px solid rgba(255,255,255,.08);
}
#bh-bs .bh-bs-title{
  flex:1 1 220px; min-width:160px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.12); border-radius:8px;
  color:#f4f4f5; padding:9px 12px;
  font:500 13px/1.2 'DM Mono', ui-monospace, monospace;
}
#bh-bs .bh-bs-title:focus{ outline:2px solid var(--cb-tint, #5ad0ff); outline-offset:1px; }
#bh-bs .bh-bs-publish-btn{
  background:linear-gradient(135deg, #34d399, #22B6FF);
  color:#04121c; font-weight:700; border:0;
}
#bh-bs .bh-bs-publish-btn:disabled{ opacity:.55; cursor:progress; }
#bh-bs .bh-bs-publish-link{ color:var(--cb-tint, #5ad0ff); text-decoration:underline; }
#bh-bs .bh-bs-publish-undo{ background:none; border:0; padding:0; min-height:0; color:var(--cb-tint, #5ad0ff); text-decoration:underline; cursor:pointer; font:inherit; }
#bh-bs .bh-bs-publish-undo:disabled{ opacity:.55; cursor:progress; }

/* Drag-paint: cells own the touch gesture so a swipe paints instead of scrolls
   (Phase 4). Scroll the roll by dragging its labels/gaps, not the pads. */
/* Let touch swipe-scroll the grid (mouse drag-paint is unaffected; beat-studio.js
   also skips drag-paint on touch so a tap toggles and a swipe scrolls). */
#bh-bs .bh-bs-cell, #bh-bs .bh-bs-note{ touch-action:pan-x pan-y; }

/* Expanded kit row-label colors (Phase 4) */
#bh-bs .bh-bs-row[data-drum="openhat"] .bh-bs-rowlabel{ color:#7cf5c0; }
#bh-bs .bh-bs-row[data-drum="clap"]    .bh-bs-rowlabel{ color:#ffd166; }

/* Project persistence bar (save / load / clear) */
#bh-bs .bh-bs-projects{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:2px 0 12px; }
#bh-bs .bh-bs-proj-name{
  flex:0 1 200px; min-width:120px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.12); border-radius:8px;
  color:#f4f4f5; padding:8px 11px;
  font:500 13px/1.2 'DM Mono', ui-monospace, monospace;
}
#bh-bs .bh-bs-proj-name:focus{ outline:2px solid var(--cb-tint, #5ad0ff); outline-offset:1px; }
#bh-bs .bh-bs-clear{ background:transparent; border:1px solid rgba(255,255,255,.16); color:#f4f4f5; }
#bh-bs .bh-bs-clear:hover{ border-color:rgba(255,255,255,.32); }

/* Per-track mute / solo. Fixed-width gutter (matched by an invisible spacer on
   note rows) so drum columns line up with the piano-roll columns. */
#bh-bs .bh-bs-rowctl{ display:flex; align-items:center; gap:4px; flex:0 0 58px; }
#bh-bs .bh-bs-rollhdr{ display:flex; align-items:center; gap:8px; margin:0 0 8px; }
#bh-bs .bh-bs-ms{
  /* !important + border-box beats the theme's global button padding, which was
     inflating these to ~44px and blowing out the fixed control gutter. */
  box-sizing:border-box;
  width:26px !important; height:26px !important;
  min-width:0 !important; min-height:0 !important; padding:0 !important;
  flex:0 0 auto; border-radius:5px;
  border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.03);
  color:rgba(244,244,245,.6);
  font:700 11px/1 'DM Mono', ui-monospace, monospace; cursor:pointer;
}
#bh-bs .bh-bs-ms:hover{ border-color:rgba(255,255,255,.28); color:#f4f4f5; }
#bh-bs .bh-bs-row.is-muted .bh-bs-ms[data-act="mute"],
#bh-bs .bh-bs-rollhdr.is-muted .bh-bs-ms[data-act="mute"]{ background:#ff5c5c; border-color:#ff5c5c; color:#160404; }
#bh-bs .bh-bs-row.is-soloed .bh-bs-ms-solo,
#bh-bs .bh-bs-rollhdr.is-soloed .bh-bs-ms-solo{ background:#ffd166; border-color:#ffd166; color:#161200; }
#bh-bs .bh-bs-row.is-muted .bh-bs-cells{ opacity:.4; }

/* ── GarageBand track lanes: inline per-channel fader in the lane header ───────
   The lane header groups label + M/S + a volume fader. Its total width MUST equal
   the note-row gutter (label + gap + rowctl) so the 16 drum columns stay aligned
   with the 16 piano-roll columns. Fader shows ≥720px; below that only label + M/S,
   and ≤640 the header dissolves (display:contents) back into the phone gutter. */
#bh-bs .bh-bs-lanehd{ display:flex; align-items:center; gap:8px; min-width:0; }
/* (.bh-bs-chan, written further down, sets display:flex at the same weight and used to win: the lane fader showed on phones as a little
   toggle under M/S, though this block says "below 720 only label + M/S". Naming both classes makes the intent hold.) */
#bh-bs .bh-bs-chan.bh-bs-lanevol{ display:none; }
@media (min-width:720px){
  #bh-bs .bh-bs-lanehd{ flex-direction:column; align-items:stretch; gap:5px; flex:0 0 128px; }
  #bh-bs .bh-bs-lanehd .bh-bs-rowlabel{ flex:none; width:auto; text-align:left; }
  #bh-bs .bh-bs-lanehd .bh-bs-rowctl{ flex:none; width:100%; flex-direction:row; justify-content:flex-start; gap:6px; }
  #bh-bs .bh-bs-chan.bh-bs-lanevol{ display:flex; flex:1 1 auto; min-width:0; align-items:center; }
  #bh-bs .bh-bs-lanevol .bh-bs-vol{ flex:1; width:100%; min-width:0; margin:0; accent-color:var(--cb-tint); height:22px; cursor:pointer; }
}
@media (min-width:1024px){
  #bh-bs .bh-bs-lanehd{ flex-basis:150px; }
}
@media (max-width:640px){
  #bh-bs .bh-bs-lanehd{ display:contents; }
  #bh-bs .bh-bs-chan.bh-bs-lanevol{ display:none; }
}

/* Swing slider */
#bh-bs .bh-bs-range{ width:120px; accent-color:var(--cb-tint, #5ad0ff); cursor:pointer; vertical-align:middle; height:24px; }

/* Sliders in Safari and in the app's iPhone WebView. Chromium draws a blue filled track from accent-color; WebKit only a white thumb on a
   track that is black on this near-black panel, so the level could not be read. Here the track is a visible groove, filled up to the thumb
   (beat-studio.js writes the slider's position as --bh-frac, 0 to 1), with a thumb in the accent color. Only for WebKit on Apple
   platforms (the font keyword is theirs): Chromium keeps what it draws. */
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
  /* (the theme gives every input a border and 10px 12px of padding: harmless while the browser draws the slider itself, a frame around the
     groove once it does not) */
  #bh-bs input[type="range"]:is(.bh-bs-range, .bh-bs-vol){
    -webkit-appearance:none; appearance:none; background:transparent;
    border:0 !important; padding:0 !important; box-shadow:none !important; border-radius:0;
  }
  #bh-bs input[type="range"]:is(.bh-bs-range, .bh-bs-vol)::-webkit-slider-runnable-track{
    height:6px; border-radius:3px;
    background:linear-gradient(to right,
      var(--cb-tint,#7FD0FF) 0, var(--cb-tint,#7FD0FF) calc(9px + (100% - 18px) * var(--bh-frac,0)),
      rgba(255,255,255,.22) calc(9px + (100% - 18px) * var(--bh-frac,0)), rgba(255,255,255,.22) 100%);
  }
  #bh-bs input[type="range"]:is(.bh-bs-range, .bh-bs-vol)::-webkit-slider-thumb{
    -webkit-appearance:none; appearance:none;
    width:18px; height:18px; margin-top:-6px;           /* centered on the 6px track */
    border-radius:50%; border:2px solid #fff; background:var(--cb-tint,#7FD0FF);
    box-shadow:0 1px 4px rgba(0,0,0,.5);
  }
}

/* Cloud sync button */
#bh-bs .bh-bs-cloud-save{ background:rgba(34,182,255,.12); border:1px solid rgba(34,182,255,.4); color:#bfe9ff; }
#bh-bs .bh-bs-cloud-save:hover{ background:rgba(34,182,255,.2); }
#bh-bs .bh-bs-cloud-save:disabled{ opacity:.55; cursor:progress; }

/* ── Mobile track area — fit-to-width with ALIGNED columns ─────────────────
   The BASE rules (written for an older markup) force min-width:30px on every
   cell + min-width:max-content on drum rows + independent overflow-x scroll on
   .bh-bs-drums AND .bh-bs-roll. On a phone that blew each row past ~500px and
   scrolled the drum grid and piano roll independently and out of alignment —
   the "super buggy" look. Override all of it: no horizontal scroll, cells shrink
   to fit, and a fixed-width control gutter (label + M/S, matched by an invisible
   spacer on note rows) keeps the 16 drum columns lined up with the 16 roll
   columns. */
@media (max-width:640px){
  #bh-bs{ padding:12px; }

  /* ── Fit-to-width mobile (SINGLE model): all 16 columns are equal 1fr cells that
     shrink to fill the phone — NO per-row horizontal scroll — and labels are STATIC
     + transparent so nothing ever hides behind them. A narrow M/S gutter of the
     SAME width on drum rows and note rows keeps both 16-col grids column-aligned. ── */
  #bh-bs .bh-bs-drums{ overflow-x:hidden; padding:8px; }
  #bh-bs .bh-bs-roll{ overflow-x:hidden; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:8px; max-height:220px; }
  #bh-bs .bh-bs-row,
  #bh-bs .bh-bs-noterow{ min-width:0; width:auto; gap:6px; }
  #bh-bs .bh-bs-cells{ grid-template-columns:repeat(16, 1fr); gap:2px; flex:1 1 auto; min-width:0; margin-left:0; }
  #bh-bs .bh-bs-cell{ min-width:0; width:auto; height:34px; }
  #bh-bs .bh-bs-note{ min-width:0; width:auto; height:30px; }
  #bh-bs .bh-bs-cell.is-beat, #bh-bs .bh-bs-note.is-beat{ scroll-snap-align:none; }
  /* Static, transparent labels never cover a pad; matched widths keep columns aligned. */
  #bh-bs .bh-bs-rowlabel,
  #bh-bs .bh-bs-notelabel{ position:static; z-index:auto; background:transparent; flex:0 0 34px; width:34px; font-size:9px; align-self:center; display:flex; align-items:center; }
  #bh-bs .bh-bs-rowlabel{ white-space:normal; line-height:1.05; }   /* "Open Hat" breaks at its space instead of being cut to "Open Ha" */
  #bh-bs .bh-bs-rowctl{ position:static; z-index:auto; background:transparent; flex:0 0 22px; flex-direction:column; gap:2px; align-items:center; justify-content:center; align-self:center; }
  #bh-bs .bh-bs-ms{ width:20px !important; height:15px !important; font-size:9px; }

  /* Genre / Generate + Publish rows had NO mobile treatment — compact them. */
  #bh-bs .bh-bs-gen{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:2px 0 8px; }
  #bh-bs .bh-bs-gen .bh-bs-field{ grid-column:1 / -1; }
  #bh-bs #bh-bs-genre{ width:100%; height:36px; }
  #bh-bs #bh-bs-generate{ grid-column:1 / -1; height:38px; }
  #bh-bs .bh-bs-publish{ gap:8px; margin-top:10px; padding-top:10px; }
  #bh-bs .bh-bs-title{ flex:1 1 100%; min-width:0; padding:8px 11px; font-size:12px; }
  #bh-bs .bh-bs-publish-btn{ flex:1 1 100%; height:38px; }
}

/* ============================================================================
 * Compact transport v2 — BPM/Bars steppers, instrument chips, icon save row.
 * A single-screen, tap-friendly control strip. Uses the #bh-bs design tokens.
 * ========================================================================== */
#bh-bs .bh-bs-tp-play{ display:inline-flex; gap:8px; align-items:center; }
#bh-bs .bh-bs-play .bh-bs-ic, #bh-bs .bh-bs-stop .bh-bs-ic{ font-size:12px; line-height:1; }
#bh-bs button#bh-bs-stop{ min-width:46px; padding:0 14px; }
#bh-bs button#bh-bs-loop{ min-width:44px; padding:0 12px; }
#bh-bs .bh-bs-loop .bh-bs-ic{ font-size:14px; line-height:1; }
#bh-bs button#bh-bs-loop.is-active{ background:linear-gradient(135deg,var(--cb-light),var(--cb-deep)); color:#fff; border-color:transparent; box-shadow:0 2px 10px rgba(34,182,255,.3); }

/* GarageBand LCD: the two steppers + a bar.beat.16th position readout, centered */
#bh-bs .bh-bs-lcd{ display:inline-flex; align-items:center; gap:10px; flex-wrap:wrap; }
#bh-bs .bh-bs-lcd-pos{ font:700 16px/1 var(--mono); letter-spacing:.12em; color:var(--cb-tint); min-width:70px; text-align:center; }
#bh-bs .bh-bs-tp-out{ display:inline-flex; gap:10px; align-items:center; }

/* Stepper pill: [−]  value/label  [+] */
#bh-bs .bh-bs-stepper{
  display:inline-flex; align-items:center; height:40px; padding:2px;
  background:var(--sur); border:1px solid var(--bdr); border-radius:22px;
}
#bh-bs button.bh-bs-step{
  width:32px; height:34px; min-height:0; padding:0; border:0; border-radius:18px;
  background:transparent; color:var(--cb-tint); cursor:pointer;
  font:700 18px/1 var(--mono); display:inline-flex; align-items:center; justify-content:center;
}
#bh-bs button.bh-bs-step:hover{ background:var(--sur2); }
#bh-bs button.bh-bs-step:active{ transform:translateY(1px); }
#bh-bs .bh-bs-stepper-mid{ display:inline-flex; flex-direction:column; align-items:center; min-width:54px; }
#bh-bs .bh-bs-stepper-mid input#bh-bs-tempo,
#bh-bs .bh-bs-stepper-mid input#bh-bs-bars{
  width:52px; min-height:0; height:20px; padding:0; text-align:center;
  background:transparent; border:0; border-radius:0; color:#fff;
  font:700 15px/1 var(--mono); -moz-appearance:textfield;
}
#bh-bs .bh-bs-stepper-mid input::-webkit-outer-spin-button,
#bh-bs .bh-bs-stepper-mid input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
#bh-bs .bh-bs-stepper-mid em{
  font:700 8px/1 var(--mono); letter-spacing:.14em; text-transform:uppercase;
  color:var(--muted); font-style:normal; margin-top:3px;
}

/* Instrument (waveform) chips */
#bh-bs .bh-bs-waves{
  display:inline-flex; gap:3px; padding:3px;
  background:var(--sur); border:1px solid var(--bdr); border-radius:22px;
}
#bh-bs button.bh-bs-wave-chip{
  min-height:0; height:30px; padding:0 11px; border:0; border-radius:16px;
  background:transparent; color:var(--muted); cursor:pointer;
  font:700 11px/1 var(--mono); letter-spacing:.04em;
}
#bh-bs button.bh-bs-wave-chip:hover{ color:var(--txt); }
#bh-bs button.bh-bs-wave-chip.is-active{
  background:linear-gradient(135deg,var(--cb-light),var(--cb-deep));
  color:#fff; box-shadow:0 2px 10px rgba(34,182,255,.3);
}
/* The Piano chip while its samples download (the first seconds of a session): a still line under the word (R-183: it was a sweeping light; how far
   the samples are is on the loading card, bh-studio-load.js). Nothing is blocked: the built-in piano plays until the recorded one is in, so the chip
   stays pressable. */
#bh-bs button.bh-bs-wave-chip{ position:relative; overflow:hidden; }
#bh-bs button.bh-bs-wave-chip.is-loading::after{
  content:""; position:absolute; left:6px; right:6px; bottom:4px; height:2px; border-radius:2px; pointer-events:none;
  background:currentColor; opacity:.5;
}

/* Compact save/project row: icon buttons + tighter fields */
#bh-bs .bh-bs-projects{ gap:6px; }
#bh-bs button#bh-bs-save, #bh-bs button#bh-bs-clear, #bh-bs button#bh-bs-cloud-save{
  min-height:0; height:36px; width:40px; padding:0; font-size:15px; border-radius:10px;
}
#bh-bs .bh-bs-projects .bh-bs-proj-name{ flex:1 1 150px; min-width:120px; height:36px; }
#bh-bs .bh-bs-projects .bh-bs-select{ height:36px; min-width:108px; }

@media (max-width:640px){
  /* GarageBand transport, phone: three stacked rows — Play/Loop/Stop · LCD · out.
     [ ▶Play | 🔁 | ■ ] · [ −BPM+  −Bars+  1.1.1 ] · [ ↓WAV | 💾Save▾ ]
     Every child min-width:0 so nothing is pushed off-screen by #bh-bs overflow.
     waves/swing now live in the tools rail, not here. Not sticky on phone. */
  #bh-bs .bh-bs-transport{
    display:grid; gap:8px; align-items:center; grid-template-columns:1fr;
    grid-template-areas:"play" "lcd" "out";
  }
  #bh-bs .bh-bs-tp-play,
  #bh-bs .bh-bs-lcd,
  #bh-bs .bh-bs-tp-out,
  #bh-bs .bh-bs-stepper{ min-width:0; }
  #bh-bs .bh-bs-tp-play{ grid-area:play; display:flex; gap:8px; }
  #bh-bs .bh-bs-tp-play > .bh-bs-btn{ flex:1; }
  #bh-bs .bh-bs-play .bh-bs-btn-tx{ display:inline; }
  #bh-bs .bh-bs-lcd{ grid-area:lcd; display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
  #bh-bs .bh-bs-lcd .bh-bs-stepper{ flex:1 1 40%; height:36px; justify-content:space-between; }
  #bh-bs .bh-bs-lcd .bh-bs-stepper-mid{ min-width:0; }
  #bh-bs .bh-bs-lcd button.bh-bs-step{ width:28px; height:32px; }
  #bh-bs .bh-bs-lcd-pos{ flex:1 1 100%; text-align:center; }
  #bh-bs .bh-bs-tp-out{ grid-area:out; display:flex; gap:8px; }
  #bh-bs .bh-bs-tp-out > *{ flex:1; min-width:0; }
  #bh-bs .bh-bs-tp-out .bh-bs-projmenu, #bh-bs .bh-bs-tp-out .bh-bs-projmenu-btn{ width:100%; justify-content:center; }
  #bh-bs button#bh-bs-export{ width:100%; }
  #bh-bs .bh-bs-projpop{ right:0; }
}

/* ── DAW-style Save▾ popover: one button holds save / load / clear / cloud ── */
#bh-bs .bh-bs-projmenu{ position:relative; display:inline-flex; }
#bh-bs button.bh-bs-projmenu-btn{ gap:6px; }
#bh-bs .bh-bs-caret{ font-size:9px; opacity:.7; }
#bh-bs .bh-bs-projpop{
  position:absolute; top:calc(100% + 8px); right:0; z-index:60;
  width:250px; max-width:80vw; display:flex; flex-direction:column; gap:8px;
  padding:12px; background:#14121d; border:1px solid var(--bdr2);
  border-radius:12px; box-shadow:0 18px 50px rgba(0,0,0,.55);
}
#bh-bs .bh-bs-projpop[hidden]{ display:none; }
#bh-bs .bh-bs-projpop-row{ display:flex; gap:8px; }
#bh-bs .bh-bs-projpop-row .bh-bs-btn{ flex:1; min-height:36px; width:auto; }
#bh-bs .bh-bs-projpop .bh-bs-input,
#bh-bs .bh-bs-projpop .bh-bs-select{ width:100%; height:38px; min-width:0; }
#bh-bs .bh-bs-projpop .bh-bs-select{ padding-top:0; padding-bottom:0; line-height:1.2; }
#bh-bs .bh-bs-projpop-sep{ height:1px; background:var(--bdr); margin:2px 0; }
#bh-bs .bh-bs-projpop .bh-bs-gen-status{ font-size:11px; min-height:14px; color:var(--cb-tint); }

/* ── Desktop / Mac / iPad-landscape (≥1024): drop the narrow container, go
 *    full-view, bigger pads + taller roll so the whole DAW fits one screen. ── */
@media (min-width:1024px){
  /* overflow:clip clips exactly as hidden does but makes #bh-bs no scroll container: with hidden it was the transport's sticky
     container, so the "sticky" bar below scrolled away with the page (it never stuck). A browser that does not know clip keeps hidden. */
  #bh-bs{ max-width:none; width:100%; padding:22px 26px; overflow:clip; }
  #bh-bs .bh-bs-cells{ grid-template-columns:repeat(16, minmax(40px,1fr)); }
  #bh-bs .bh-bs-cell{ height:44px; }
  #bh-bs .bh-bs-roll{ max-height:min(50vh,540px); }
  #bh-bs .bh-bs-rowlabel, #bh-bs .bh-bs-notelabel{ flex-basis:84px; width:84px; font-size:11px; }
  /* GarageBand transport: sticky frosted bar — Play/Loop/Stop · LCD · WAV/Save */
  /* top: under the site's fixed header (beat-studio.js measures it into --bh-bs-nav-h; none when the header is not there) */
  #bh-bs .bh-bs-transport{ position:sticky; top:var(--bh-bs-nav-h,0px); z-index:70; flex-wrap:nowrap; gap:14px;
    backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); background:rgba(12,10,20,.86); }
  #bh-bs .bh-bs-lcd{ flex:1 1 auto; justify-content:center; gap:16px; flex-wrap:nowrap;
    padding:8px 16px; background:#0c0a14; border:1px solid var(--bdr2); border-radius:12px;
    box-shadow:inset 0 1px 6px rgba(0,0,0,.6); }
  #bh-bs .bh-bs-lcd-pos{ font-size:18px; min-width:74px; }
  #bh-bs .bh-bs-tp-out{ margin-left:auto; }
}
/* Ultra-wide: cap pad growth so cells stay tap-square, left-aligned. */
@media (min-width:1500px){
  #bh-bs .bh-bs-cells{ grid-template-columns:repeat(16, minmax(48px,60px)); justify-content:start; }
}
/* Phone: the Save▾ popover opens a touch wider, clamped to the viewport, and
   scrolls internally so a tall menu is never sliced by the container. */
@media (max-width:640px){
  #bh-bs .bh-bs-projpop{ width:min(300px,86vw); max-width:calc(100vw - 24px); max-height:70vh; overflow:auto; }
}

/* ============================================================================
 * Tools strip — auto-scale · MIDI import/export · one-shot Sounds popover.
 * ========================================================================== */
#bh-bs .bh-bs-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:0 0 12px; }
#bh-bs .bh-bs-scale{ display:inline-flex; align-items:center; gap:6px; min-width:0; }
#bh-bs .bh-bs-tools-lbl{ font:700 9px/1 var(--mono); letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
#bh-bs .bh-bs-tools .bh-bs-select{ height:34px; min-width:0; padding-top:0; padding-bottom:0; line-height:1.2; font-size:13px; }
#bh-bs #bh-bs-scale-root{ min-width:54px; }
#bh-bs #bh-bs-scale-type{ min-width:96px; }
#bh-bs button.bh-bs-scale-lock{ min-height:0; height:34px; padding:0 12px; font-size:11px; }
#bh-bs button.bh-bs-scale-lock.is-active{ background:linear-gradient(135deg,var(--cb-light),var(--cb-deep)); color:#fff; border-color:transparent; }
#bh-bs .bh-bs-tools-io{ display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; min-width:0; }
#bh-bs .bh-bs-tools-io .bh-bs-btn{ min-height:0; height:34px; padding:0 12px; font-size:11px; }

/* One-shot Sounds popover (reuses the DAW-menu pattern) */
#bh-bs .bh-bs-soundsmenu{ position:relative; display:inline-flex; }
#bh-bs .bh-bs-soundspop{
  position:absolute; top:calc(100% + 8px); right:0; z-index:60;
  width:280px; max-width:calc(100vw - 24px); display:flex; flex-direction:column; gap:6px;
  padding:12px; background:#14121d; border:1px solid var(--bdr2); border-radius:12px;
  box-shadow:0 18px 50px rgba(0,0,0,.55); max-height:70vh; overflow:auto;
}
#bh-bs .bh-bs-soundspop[hidden]{ display:none; }
#bh-bs .bh-bs-soundspop-hd{ font:700 9px/1.3 var(--mono); letter-spacing:.1em; text-transform:uppercase; color:var(--muted); margin-bottom:2px; }
#bh-bs .bh-bs-sound{ display:flex; align-items:center; gap:8px; }
#bh-bs .bh-bs-sound-name{ flex:1; min-width:0; font:600 12px/1.2 var(--mono); color:var(--txt); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#bh-bs .bh-bs-sound.has-sample .bh-bs-sound-name{ color:var(--cb-tint); }
#bh-bs .bh-bs-sound button{
  flex:0 0 auto; width:30px; height:30px; min-height:0; padding:0; border-radius:8px;
  border:1px solid var(--bdr); background:var(--sur); color:var(--txt);
  font:700 13px/1 var(--mono); cursor:pointer;
}
#bh-bs .bh-bs-sound button:hover{ border-color:var(--bdr2); }
#bh-bs .bh-bs-sound-clear{ color:#ff8a8a !important; }
#bh-bs .bh-bs-sound.has-sample .bh-bs-sound-load{ border-color:var(--cb); color:var(--cb-tint); }

/* Auto-scale highlighting on the piano roll */
#bh-bs .bh-bs-noterow.bh-out-scale{ opacity:.34; }
#bh-bs .bh-bs-noterow.bh-scale-root .bh-bs-notelabel{ color:var(--cb-tint); font-weight:700; }
#bh-bs .bh-bs-noterow .bh-bs-note:disabled{ opacity:.28; cursor:not-allowed; pointer-events:none; }

/* Mobile: tools strip stacks into full-width rows */
@media (max-width:640px){
  #bh-bs .bh-bs-tools{ gap:6px; }
  #bh-bs .bh-bs-scale{ flex:1 1 100%; }
  #bh-bs .bh-bs-scale .bh-bs-select{ flex:1 1 0; }
  #bh-bs .bh-bs-tools-io{ flex:1 1 100%; }
  #bh-bs .bh-bs-tools-io .bh-bs-btn{ flex:1 1 auto; }
  #bh-bs .bh-bs-soundsmenu{ flex:1 1 auto; }
  #bh-bs #bh-bs-sounds{ width:100%; }
  #bh-bs .bh-bs-soundspop{ right:auto; left:0; }
}

/* Master reverb ("Space") slider in the tools strip */
#bh-bs .bh-bs-mix{ display:inline-flex; align-items:center; gap:8px; min-width:0; }
#bh-bs .bh-bs-mix .bh-bs-tools-lbl{ flex:0 0 auto; }
#bh-bs .bh-bs-mix .bh-bs-range{ width:120px; min-width:0; }
@media (max-width:640px){
  #bh-bs .bh-bs-mix{ flex:1 1 100%; }
  #bh-bs .bh-bs-mix .bh-bs-range{ flex:1; width:auto; }
}

/* Mixer popover — per-track volume faders */
#bh-bs .bh-bs-mixmenu{ position:relative; display:inline-flex; }
#bh-bs .bh-bs-mixpop{
  position:absolute; top:calc(100% + 8px); right:0; z-index:60;
  width:250px; max-width:calc(100vw - 24px); display:flex; flex-direction:column; gap:8px;
  padding:12px; background:#14121d; border:1px solid var(--bdr2); border-radius:12px;
  box-shadow:0 18px 50px rgba(0,0,0,.55); max-height:70vh; overflow:auto;
}
#bh-bs .bh-bs-mixpop[hidden]{ display:none; }
#bh-bs .bh-bs-mixpop-hd{ font:700 9px/1.3 var(--mono); letter-spacing:.1em; text-transform:uppercase; color:var(--muted); margin-bottom:2px; }
#bh-bs .bh-bs-chan{ display:flex; align-items:center; gap:10px; }
#bh-bs .bh-bs-chan-name{ flex:0 0 64px; font:600 11px/1.2 var(--mono); color:var(--txt); }
#bh-bs .bh-bs-chan .bh-bs-vol{ flex:1; min-width:0; accent-color:var(--cb-tint,#5ad0ff); height:22px; cursor:pointer; }
@media (max-width:640px){
  #bh-bs .bh-bs-mixmenu{ flex:1 1 auto; }
  #bh-bs #bh-bs-mixer{ width:100%; }
  #bh-bs .bh-bs-mixpop{ right:auto; left:0; }
}

/* Drum grooves picker */
#bh-bs .bh-bs-groovepick{ display:inline-flex; align-items:center; gap:6px; min-width:0; }
#bh-bs #bh-bs-groove{ min-width:96px; height:34px; }
@media (max-width:640px){
  #bh-bs .bh-bs-groovepick{ flex:1 1 100%; }
  #bh-bs #bh-bs-groove{ flex:1; }
}

/* Undo / redo */
#bh-bs .bh-bs-hist{ display:inline-flex; gap:4px; }
#bh-bs button#bh-bs-undo, #bh-bs button#bh-bs-redo{ min-height:0; height:34px; width:38px; padding:0; font-size:16px; }
#bh-bs button#bh-bs-undo:disabled, #bh-bs button#bh-bs-redo:disabled{ opacity:.38; cursor:default; }

/* Drum kit picker */
#bh-bs .bh-bs-kitpick{ display:inline-flex; align-items:center; gap:6px; min-width:0; }
#bh-bs #bh-bs-kit{ min-width:92px; height:34px; }
@media (max-width:640px){
  #bh-bs .bh-bs-kitpick{ flex:1 1 100%; }
  #bh-bs #bh-bs-kit{ flex:1; }
}

/* Play button: unmistakable "now playing" state — green→blue glow + gentle pulse
   + the icon flips ▶→⏸ (set in JS). Clicking it again stops. */
#bh-bs button#bh-bs-play.is-active{
  background:linear-gradient(135deg,#34d399,#22B6FF);
  color:#04121c;
  box-shadow:0 0 0 3px rgba(52,211,153,.22), 0 4px 18px rgba(52,211,153,.4);
  animation:bhBsPlayPulse 1.25s ease-in-out infinite;
}
@keyframes bhBsPlayPulse{
  0%,100%{ box-shadow:0 0 0 3px rgba(52,211,153,.22), 0 4px 16px rgba(52,211,153,.35); }
  50%{ box-shadow:0 0 0 6px rgba(52,211,153,.10), 0 4px 22px rgba(52,211,153,.55); }
}
@media (prefers-reduced-motion:reduce){ #bh-bs button#bh-bs-play.is-active{ animation:none; } }

/* GarageBand-like touch response: pads flash on press (brightness only — no
   layout shift, so it can't disturb the scroll/drag-paint grid). */
#bh-bs .bh-bs-cell:active, #bh-bs .bh-bs-note:active{ filter:brightness(1.45); }
#bh-bs .bh-bs-wave-chip:active, #bh-bs button.bh-bs-step:active, #bh-bs .bh-bs-ms:active{ filter:brightness(1.3); }

/* ============================================================================
 * Play view — Grid|Play segmented tabs · live drum pads · touch keyboard.
 * The keyboard is a fit-to-width 2-octave board (no horizontal scroll): white
 * keys flex to fill, black keys overlay absolutely at a PHP-computed left%.
 * ========================================================================== */
#bh-bs .bh-bs-viewtabs{ display:inline-flex; gap:3px; padding:3px; margin:0 0 12px;
  background:var(--sur); border:1px solid var(--bdr); border-radius:22px; }
#bh-bs button.bh-bs-viewtab{ min-height:0; height:34px; padding:0 22px; border:0; border-radius:16px;
  background:transparent; color:var(--muted); cursor:pointer; font:700 12px/1 var(--mono); letter-spacing:.06em; }
#bh-bs button.bh-bs-viewtab:hover{ color:var(--txt); }
#bh-bs button.bh-bs-viewtab.is-active{ background:linear-gradient(135deg,var(--cb-light),var(--cb-deep)); color:#fff; box-shadow:0 2px 10px rgba(34,182,255,.3); }

#bh-bs .bh-bs-stage{ display:none; }
#bh-bs .bh-bs-stage.is-active{ display:block; }

/* Live bar: REC arm + step-record status readout */
#bh-bs .bh-bs-live-bar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:0 0 14px; }
#bh-bs button.bh-bs-live-rec{ display:inline-flex; align-items:center; gap:6px; }
#bh-bs button.bh-bs-live-rec .bh-bs-ic{ color:#ff5c5c; font-size:11px; }
#bh-bs button.bh-bs-live-rec.is-armed{ background:#ff5c5c; border-color:#ff5c5c; color:#160404; }
#bh-bs button.bh-bs-live-rec.is-armed .bh-bs-ic{ color:#160404; animation:bhBsRecPulse 1s ease-in-out infinite; }
@keyframes bhBsRecPulse{ 0%,100%{opacity:1} 50%{opacity:.3} }
@media (prefers-reduced-motion:reduce){ #bh-bs button.bh-bs-live-rec.is-armed .bh-bs-ic{ animation:none; } }
#bh-bs .bh-bs-live-step{ flex:1 1 auto; min-width:0; font:600 12px/1.3 var(--mono); color:var(--muted); }

/* Drum pads: 5-up grid, GarageBand pad-flash on hit */
#bh-bs .bh-bs-pads{ display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin:0 0 16px; }
#bh-bs button.bh-bs-pad{ min-height:96px; border:1px solid var(--bdr2); border-radius:14px;
  background:linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.01));
  color:var(--txt); cursor:pointer; font:700 13px/1 var(--mono); letter-spacing:.04em;
  touch-action:none; user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color:transparent;
  transition:filter .08s, transform .06s; }
#bh-bs button.bh-bs-pad:hover{ border-color:var(--cb); }
#bh-bs button.bh-bs-pad.is-hit{ filter:brightness(1.5); transform:translateY(1px);
  background:linear-gradient(160deg,var(--cb-tint),var(--cb)); border-color:var(--cb-tint); color:#04121c; }

/* Keyboard: white keys flex fill, black keys absolute overlay via inline left% */
#bh-bs .bh-bs-keys{ position:relative; display:flex; align-items:flex-end;
  height:150px; border-radius:12px; overflow:hidden; background:#0c0a14; border:1px solid var(--bdr2); }
#bh-bs button.bh-bs-key{ flex:1 1 0; min-width:0; height:100%; margin:0;
  border:1px solid #0c0a14; border-radius:0 0 6px 6px; background:linear-gradient(#f7f6fb,#e5e1ee);
  color:#6b6678; cursor:pointer; display:flex; align-items:flex-end; justify-content:center; padding-bottom:6px;
  touch-action:none; user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color:transparent; }
#bh-bs button.bh-bs-key.is-black{ position:absolute; top:0; z-index:3; flex:0 0 auto;
  width:calc((100% / 15) * 0.62); height:62%; transform:translateX(-50%); padding:0;
  background:linear-gradient(#2c2937,#131019); border:1px solid #000; border-radius:0 0 4px 4px; }
#bh-bs button.bh-bs-key:active, #bh-bs button.bh-bs-key.is-hit{ filter:brightness(.85); }
#bh-bs button.bh-bs-key.is-black:active, #bh-bs button.bh-bs-key.is-black.is-hit{ filter:brightness(1.6); }
#bh-bs .bh-bs-key-lbl{ pointer-events:none; opacity:.45; font:600 8px/1 var(--mono); }
/* Scale feedback reuses the roll's out-of-scale styling */
#bh-bs button.bh-bs-key.bh-out-scale{ opacity:.3; }
#bh-bs button.bh-bs-key[disabled]{ pointer-events:none; }

@media (min-width:1024px){
  #bh-bs .bh-bs-pads{ gap:14px; }
  #bh-bs button.bh-bs-pad{ min-height:120px; font-size:14px; }
  #bh-bs .bh-bs-keys{ height:190px; }
}
@media (max-width:600px){
  #bh-bs .bh-bs-pads{ grid-template-columns:repeat(3,1fr); grid-auto-rows:84px; gap:10px; }
  #bh-bs button.bh-bs-pad{ min-height:0; }
  #bh-bs .bh-bs-keys{ height:132px; }
  #bh-bs .bh-bs-key-lbl{ display:none; }
}

/* ════════════════════════════════════════════════════════════════════════════
 * Mobile "RAIL" — the tools strip becomes ONE horizontal-scroll icon rail
 * instead of ~5 stacked full-width rows. Compact 34px controls, icon-first
 * (verbose labels hidden, a leading emoji marks each group). Overrides the
 * earlier ≤640 rules that set flex:1 1 100% on scale/io/mix/mixmenu.
 * ════════════════════════════════════════════════════════════════════════════ */
@media (max-width:640px){
  #bh-bs .bh-bs-tools{
    flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
    gap:7px; padding:2px 0 5px; margin:0 0 10px;
    scrollbar-width:none; -ms-overflow-style:none;
    -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 22px),transparent);
            mask-image:linear-gradient(90deg,#000 calc(100% - 22px),transparent);
  }
  #bh-bs .bh-bs-tools::-webkit-scrollbar{ display:none; }
  /* Every group is a fixed-size rail item — cancel the full-width stacking. */
  #bh-bs .bh-bs-tools > *{ flex:0 0 auto; width:auto; min-width:0; }
  #bh-bs .bh-bs-hist, #bh-bs .bh-bs-groovepick, #bh-bs .bh-bs-kitpick,
  #bh-bs .bh-bs-scale, #bh-bs .bh-bs-mix, #bh-bs .bh-bs-tools-io,
  #bh-bs .bh-bs-mixmenu, #bh-bs .bh-bs-soundsmenu, #bh-bs .bh-bs-waves,
  #bh-bs .bh-bs-field--swing{
    display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; width:auto;
  }
  #bh-bs .bh-bs-tools-io{ flex-wrap:nowrap; }
  #bh-bs .bh-bs-tools-io .bh-bs-btn{ flex:0 0 auto; }
  #bh-bs #bh-bs-mixer, #bh-bs #bh-bs-sounds{ width:auto; }
  #bh-bs .bh-bs-soundspop, #bh-bs .bh-bs-mixpop{ left:auto; right:0; }
  /* Icon-first: hide verbose text; a leading emoji marks each grouped control. */
  #bh-bs .bh-bs-tools .bh-bs-tools-lbl,
  #bh-bs .bh-bs-tools .bh-bs-btx,
  #bh-bs .bh-bs-field--swing > span{ display:none; }
  #bh-bs .bh-bs-groovepick::before{ content:"✨"; }
  #bh-bs .bh-bs-kitpick::before{ content:"🥁"; }
  #bh-bs .bh-bs-scale::before{ content:"🎼"; }
  #bh-bs .bh-bs-mix::before{ content:"🌫"; }
  #bh-bs .bh-bs-field--swing::before{ content:"〰"; }
  #bh-bs .bh-bs-groovepick::before, #bh-bs .bh-bs-kitpick::before,
  #bh-bs .bh-bs-scale::before, #bh-bs .bh-bs-mix::before,
  #bh-bs .bh-bs-field--swing::before{ font-size:15px; line-height:1; flex:0 0 auto; }
  /* Compact controls: 34px tap height, tighter widths, snug ranges. */
  #bh-bs .bh-bs-tools .bh-bs-select{ height:34px; font-size:11px; padding:0 7px; }
  #bh-bs #bh-bs-groove, #bh-bs #bh-bs-kit{ max-width:98px; }
  #bh-bs #bh-bs-scale-root{ min-width:44px; max-width:56px; }
  #bh-bs #bh-bs-scale-type{ min-width:78px; max-width:106px; }
  #bh-bs .bh-bs-tools .bh-bs-btn{ height:34px; min-height:0; padding:0 11px; font-size:12px; }
  #bh-bs .bh-bs-tools .bh-bs-range{ flex:0 0 68px; width:68px; height:26px; }
}

/* ════════════════════════════════════════════════════════════════════════════
 * One-time "quest" tutorial — spotlight coach-marks + mission cards.
 * (Markup injected by assets/js/beat-studio/bs-tutorial.js.)
 * ════════════════════════════════════════════════════════════════════════════ */
.bh-bs-tour{ position:fixed; inset:0; z-index:99999; }
.bh-bs-tour[hidden]{ display:none; }
/* The hole is a target-sized box whose huge box-shadow dims everything else and
   rings + glows the spotlighted control. pointer-events:none so it's visual only. */
.bh-bs-tour-hole{
  position:fixed; top:0; left:0; width:0; height:0; border-radius:12px; pointer-events:none; opacity:0;
  box-shadow:0 0 0 9999px rgba(6,6,12,.76), 0 0 0 3px #7FD0FF, 0 0 26px 5px rgba(34,182,255,.5);
  transition:top .3s cubic-bezier(.4,0,.2,1), left .3s cubic-bezier(.4,0,.2,1),
             width .3s cubic-bezier(.4,0,.2,1), height .3s cubic-bezier(.4,0,.2,1), opacity .2s;
}
/* The steps with no control to point at (the welcome and the last one) dim the page too: the hole is then just the dimming (no ring, no glow). */
.bh-bs-tour-hole.is-shade{ box-shadow:0 0 0 9999px rgba(6,6,12,.76); }
/* While the tour is open the page behind it stays where it is (bs-tutorial.js puts bh-bs-tour-lock on <html>; no rule used it, so a swipe or
   the wheel moved the page under the overlay and the spotlight left the screen). The overlay takes the touches itself; its card may scroll. */
html.bh-bs-tour-lock{ overflow:hidden; scrollbar-gutter:stable; }
.bh-bs-tour{ touch-action:none; overscroll-behavior:contain; }
.bh-bs-tour-card{ touch-action:pan-y; overscroll-behavior:contain; }
.bh-bs-tour-card{
  box-sizing:border-box;              /* width:340 stays 340 incl. padding+border (was overflowing right) */
  position:fixed; z-index:2; width:340px; max-width:calc(100vw - 24px);
  max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); overflow-y:auto;  /* tall card on a short screen scrolls itself, never off-screen */
  background:linear-gradient(180deg,#181624,#100e18); border:1px solid rgba(255,255,255,.16);
  border-radius:16px; padding:18px 18px 16px; box-shadow:0 26px 64px rgba(0,0,0,.62);
  color:rgba(255,255,255,.9); font-family:'dm mono',"dm mono Fallback",ui-monospace,Menlo,monospace;
  animation:bhBsTourPop .26s cubic-bezier(.2,.8,.2,1);
}
.bh-bs-tour-card.is-center{ left:50%; top:50%; transform:translate(-50%,-50%); }
@keyframes bhBsTourPop{ from{ opacity:0; transform:translateY(8px) scale(.97); } to{ opacity:1; } }
.bh-bs-tour-card.is-center{ animation:bhBsTourPopC .26s cubic-bezier(.2,.8,.2,1); }
@keyframes bhBsTourPopC{ from{ opacity:0; transform:translate(-50%,-46%) scale(.97); } to{ opacity:1; transform:translate(-50%,-50%) scale(1); } }
.bh-bs-tour-x{
  position:absolute; top:10px; right:10px; width:26px; height:26px; padding:0; border-radius:8px;
  border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.04); color:rgba(255,255,255,.55);
  font-size:12px; line-height:1; cursor:pointer;
}
.bh-bs-tour-x:hover{ color:#fff; border-color:rgba(255,255,255,.3); }
.bh-bs-tour-badge{ display:flex; align-items:center; gap:9px; margin-bottom:11px; }
.bh-bs-tour-emoji{ font-size:23px; line-height:1; }
.bh-bs-tour-step{
  font:700 10px/1 'DM Mono',ui-monospace,monospace; letter-spacing:.14em; color:#7FD0FF;
  background:rgba(34,182,255,.13); border:1px solid rgba(34,182,255,.32); padding:4px 9px; border-radius:20px;
}
.bh-bs-tour-title{ margin:0 0 7px; font:700 17px/1.22 'DM Mono',ui-monospace,monospace; color:#fff; text-wrap:balance; }
.bh-bs-tour-body{ margin:0 0 14px; font:400 13.5px/1.55 system-ui,-apple-system,'Segoe UI',sans-serif; color:rgba(255,255,255,.7); }
.bh-bs-tour-body b{ color:#7FD0FF; font-weight:600; }
.bh-bs-tour-dots{ display:flex; gap:6px; margin-bottom:15px; }
.bh-bs-tour-dot{ width:7px; height:7px; border-radius:50%; background:rgba(255,255,255,.18); transition:all .2s; }
.bh-bs-tour-dot.is-on{ background:#22B6FF; transform:scale(1.35); box-shadow:0 0 8px rgba(34,182,255,.7); }
.bh-bs-tour-dot.is-done{ background:#1A96E8; }
.bh-bs-tour-nav{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.bh-bs-tour-navr{ display:inline-flex; gap:8px; }
.bh-bs-tour-nav button{ font-family:'dm mono',"dm mono Fallback",ui-monospace,monospace; cursor:pointer; border-radius:10px; }
.bh-bs-tour-skip{ height:36px; padding:0 12px; background:transparent; border:0; color:rgba(255,255,255,.42); font-size:12px; }
.bh-bs-tour-skip:hover{ color:rgba(255,255,255,.75); }
.bh-bs-tour-back{ height:36px; padding:0 14px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.14); color:rgba(255,255,255,.8); font-size:12px; }
.bh-bs-tour-back:hover{ border-color:rgba(255,255,255,.28); }
.bh-bs-tour-next{ height:36px; padding:0 18px; border:0; color:#04121c; font-weight:700; font-size:12px;
  background:linear-gradient(135deg,#34d399,#22B6FF); box-shadow:0 4px 16px rgba(34,182,255,.4); }
.bh-bs-tour-next:hover{ filter:brightness(1.06); }
.bh-bs-tour-next:focus-visible, .bh-bs-tour-back:focus-visible, .bh-bs-tour-skip:focus-visible, .bh-bs-tour-x:focus-visible{
  outline:2px solid #7FD0FF; outline-offset:2px; }

/* Floating "?" launcher — replay the tour any time. */
.bh-bs-tour-launch{
  position:fixed; right:16px; bottom:16px; z-index:9990; width:44px; height:44px; border-radius:50%;
  border:1px solid rgba(34,182,255,.5); background:linear-gradient(135deg,#1A96E8,#0e2340); color:#eaf7ff;
  font:700 20px/1 'DM Mono',ui-monospace,monospace; cursor:pointer;
  box-shadow:0 8px 24px rgba(0,0,0,.4), 0 0 0 4px rgba(34,182,255,.12); animation:bhBsTourGlow 2.6s ease-in-out infinite;
}
.bh-bs-tour-launch:hover{ filter:brightness(1.12); transform:translateY(-1px); }
@keyframes bhBsTourGlow{ 0%,100%{ box-shadow:0 8px 24px rgba(0,0,0,.4), 0 0 0 4px rgba(34,182,255,.1); }
  50%{ box-shadow:0 8px 24px rgba(0,0,0,.4), 0 0 0 8px rgba(34,182,255,.03); } }
@media (max-width:640px){ .bh-bs-tour-launch{ width:40px; height:40px; right:12px; bottom:12px; font-size:18px; } }
/* At phone width the ? sits in the transport, next to Save (bs-tutorial.js puts it there; the app's sheet does the same, at 44pt):
   floating over the corner it covered steps 15 and 16 of whichever lane was under it and took their taps. */
@media (max-width:640px){
  #bh-bs .bh-bs-tour-launch.bh-bs-tour-launch--inline{ position:static; flex:0 0 40px; width:40px; height:40px; min-width:0; min-height:0; margin:0; padding:0; animation:none; box-shadow:none; }
}

/* A short screen (a phone on its side): a card about 100px shorter, so it fits beside or under the control it points at. */
@media (max-height:480px){
  .bh-bs-tour-card{ padding:12px 14px 10px; }
  .bh-bs-tour-badge{ margin-bottom:6px; }
  .bh-bs-tour-emoji{ font-size:19px; }
  .bh-bs-tour-title{ font-size:15px; margin-bottom:4px; }
  .bh-bs-tour-body{ font-size:12.5px; line-height:1.45; margin-bottom:8px; }
  .bh-bs-tour-dots{ margin-bottom:8px; }
  .bh-bs-tour-nav button{ height:32px; }
}

@media (prefers-reduced-motion:reduce){
  .bh-bs-tour-hole{ transition:none; }
  .bh-bs-tour-card{ animation:none; }
  .bh-bs-tour-launch{ animation:none; }
  .bh-bs-tour-dot{ transition:none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Correcciones del test en vivo — 2026-09-20
   ══════════════════════════════════════════════════════════════════════════ */

/* "☁ Sync to cloud" salía en una caja de 44×36 con el texto partido en tres
   líneas, encimándose con "Load from cloud…". La regla de la línea 663 le da
   width:40px junto a Save y Clear, pero esos dos se salvan porque dentro de
   .bh-bs-projpop-row reciben flex:1; el de cloud es hijo directo del popup en
   columna y se queda con los 40px. Acá recupera el ancho de la columna. */
#bh-bs .bh-bs-projpop > #bh-bs-cloud-save{
  width:100%;
  height:38px;
  padding:0 12px;
  font-size:13px;
  white-space:nowrap;
}

/* El input de nombre medía 200px de ALTO: .bh-bs-proj-name lleva flex:0 1 200px,
   un basis pensado para la barra horizontal vieja; dentro del popup en columna
   ese basis gobierna la altura y le gana al height:38px. */
#bh-bs .bh-bs-projpop .bh-bs-proj-name{
  flex:0 0 auto;
  height:38px;
}

/* "Open Hat" se cortaba como "Open H": la etiqueta mide 34px, el texto 43, y el
   text-overflow era clip. Entra con 46px; la elipsis queda de red por si alguna
   pista futura trae un nombre más largo. */
#bh-bs .bh-bs-rowlabel{ text-overflow:ellipsis; }
/* El ensanche va solo arriba de 640px: en móvil las celdas ya están en 15px de
   ancho y robarles 12 más para la etiqueta las deja peor. Ahí manda la elipsis. */
@media (min-width:641px){
  #bh-bs .bh-bs-rowlabel{ min-width:46px; }
}

/* En móvil la barra de herramientas esconde 9 de 13 controles tras un
   overflow-x sin ninguna señal: no hay scrollbar visible ni degradado, y la
   fila se corta en seco. Una barra fina y visible avisa que hay más. */
@media (max-width:640px){
  #bh-bs .bh-bs-tools{
    scrollbar-width:thin;
    scrollbar-color:rgba(34,182,255,.45) transparent;
    -webkit-overflow-scrolling:touch;
    padding-bottom:4px;
  }
  #bh-bs .bh-bs-tools::-webkit-scrollbar{ height:3px; }
  #bh-bs .bh-bs-tools::-webkit-scrollbar-track{ background:transparent; }
  #bh-bs .bh-bs-tools::-webkit-scrollbar-thumb{
    background:rgba(34,182,255,.45);
    border-radius:999px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Organización de la interfaz — 2026-09-20
   ══════════════════════════════════════════════════════════════════════════ */

/* La barra tenía ocho grupos seguidos con el mismo peso visual y separados solo
   por 8px: onda, swing, deshacer, groove, kit, escala, lock y reverb, sin nada
   que dijera qué va con qué. El markup ya quedó agrupado por tema; esta línea
   fina marca dónde empieza cada bloque — batería, melodía, sensación y
   herramientas. En móvil no va: la fila se desliza y los bordes cortados al
   principio de cada línea confunden más de lo que ayudan. */
@media (min-width:641px){
  #bh-bs .bh-bs-kitpick,
  #bh-bs .bh-bs-waves,
  #bh-bs .bh-bs-field--swing,
  #bh-bs .bh-bs-tools-io{
    border-left:1px solid var(--bdr);
    padding-left:14px;
    margin-left:6px;
  }
}

/* Transporte: el LCD es flex:1 con el contenido centrado, así que la caja se
   estiraba y dejaba un hueco muerto a su izquierda. Y la posición (1.1.1)
   quedaba al final, detrás de BPM y BARS, cuando es justo lo que se mira
   mientras suena. Acá sí se reordena por CSS y no en el markup: es un
   <span role="status"> que no recibe foco, así que no altera el recorrido. */
@media (min-width:1024px){
  #bh-bs .bh-bs-lcd{ justify-content:flex-start; }
  #bh-bs .bh-bs-lcd-pos{ order:-1; margin-right:2px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Type Beat — noticias y catálogo como punto de partida (2026-09-20)
   Panel dentro de la barra de herramientas (mismo patrón que Sounds/Mixer) y
   franja de referencia bajo los controles, para que siempre se vea de qué
   noticia o beat salió el preset que está sonando.
   ══════════════════════════════════════════════════════════════════════════ */
#bh-bs .bh-bs-tbmenu{ position:relative; display:inline-flex; }
/* While Type Beat is switched off (the option bh_tb_enabled, type-beat.php; beat_studio.php prints it as data-tb) the website does not show
   it either, as the app already did (bh-studio-app.css): not the rail's button, not the phone's 44 px dial, which is the same button and the
   only way into its sheet. With the switch on both are back as they were. A Type Beat link (?bh_tb=) still applies its preset. (w26, BS-1) */
#bh-bs .bh-bs-tbmenu[data-tb="0"]{ display:none !important; }
#bh-bs .bh-bs-tb-btn{ min-height:0; height:34px; padding:0 12px; font-size:11px; }
#bh-bs .bh-bs-tb-btn[aria-expanded="true"]{ border-color:var(--cb); color:var(--cb-tint); }
#bh-bs .bh-bs-tbpop{
  position:absolute; top:calc(100% + 8px); left:0; z-index:60;
  width:340px; max-width:calc(100vw - 24px); display:flex; flex-direction:column; gap:8px;
  padding:12px; background:#14121d; border:1px solid var(--bdr2); border-radius:12px;
  box-shadow:0 18px 50px rgba(0,0,0,.55); max-height:min(70vh,440px); overflow:auto;
}
#bh-bs .bh-bs-tbpop[hidden]{ display:none; }
#bh-bs .bh-bs-tbpop-hd{ font:700 9px/1.3 var(--mono); letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
#bh-bs .bh-bs-tbtabs{ display:flex; gap:6px; }
#bh-bs .bh-bs-tbtab{
  flex:1 1 0; height:30px; padding:0 10px; cursor:pointer; border-radius:8px;
  border:1px solid var(--bdr); background:var(--sur); color:var(--txt);
  font:700 11px/1 var(--sans);
}
#bh-bs .bh-bs-tbtab.is-active{ border-color:transparent; color:#fff; background:linear-gradient(135deg,var(--cb-light),var(--cb-deep)); }
#bh-bs .bh-bs-tblist{ display:flex; flex-direction:column; gap:6px; }
#bh-bs .bh-bs-tbitem{
  display:flex; align-items:center; gap:10px; width:100%; text-align:left; cursor:pointer;
  padding:8px; border-radius:10px; border:1px solid var(--bdr); background:var(--sur); color:var(--txt);
}
#bh-bs .bh-bs-tbitem:hover{ border-color:var(--cb); background:var(--cbg); }
#bh-bs .bh-bs-tbitem__img{ flex:0 0 auto; width:44px; height:44px; object-fit:cover; border-radius:8px; }
#bh-bs .bh-bs-tbitem__tx{ display:flex; flex-direction:column; gap:2px; min-width:0; }
#bh-bs .bh-bs-tbitem__tx strong{ font:700 12px/1.25 var(--sans); color:var(--txt); }
#bh-bs .bh-bs-tbitem__tx em{ font-style:normal; font:600 10px/1.2 var(--mono); color:var(--cb-tint); }
#bh-bs .bh-bs-tbitem__tx small{ font:400 10px/1.3 var(--sans); color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#bh-bs .bh-bs-tbempty{ margin:0; font:600 11px/1.4 var(--sans); color:var(--muted); }

#bh-bs .bh-bs-tbref{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  margin:10px 0 0; padding:8px 12px; border-radius:10px;
  border:1px solid var(--cbo); background:var(--cbg);
}
#bh-bs .bh-bs-tbref[hidden]{ display:none; }
#bh-bs .bh-bs-tbref__kick{ font:700 9px/1.3 var(--mono); letter-spacing:.1em; text-transform:uppercase; color:var(--cb); }
#bh-bs .bh-bs-tbref__link{ flex:1 1 auto; min-width:0; font:700 12px/1.3 var(--sans); color:var(--cb-tint); text-decoration:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#bh-bs .bh-bs-tbref__link:hover{ text-decoration:underline; }
#bh-bs .bh-bs-tbref__x{
  flex:0 0 auto; width:24px; height:24px; padding:0; cursor:pointer; border-radius:7px;
  border:1px solid var(--bdr); background:transparent; color:var(--muted); font:700 11px/1 var(--mono);
}
#bh-bs .bh-bs-tbref__x:hover{ color:var(--txt); border-color:var(--bdr2); }

/* ══════════════════════════════════════════════════════════════════════════
   Wave 12 — the rail's panels, the playhead, a few touch details
   ══════════════════════════════════════════════════════════════════════════ */

/* The Mixer, Sounds and Type Beat panels hang from the tools rail, which on a phone scrolls sideways and so clips whatever
   hangs below it (overflow-y:hidden): they opened out of sight, and Type Beat (100% wide in a rail) collapsed to a 26 px
   sliver over the wave chips. At phone width each one is a sheet over the bottom of the screen: a fixed panel is not clipped.
   The rail's fading edge (a mask, which would clip a fixed child too) goes while one is open (bh-bs-menu-open, set by the
   script). The app had this already, in its own sheet; the website gets it here. */
@media (max-width:640px){
  #bh-bs :is(.bh-bs-mixpop,.bh-bs-soundspop,.bh-bs-tbpop){
    position:fixed; left:12px; right:12px; top:auto; bottom:calc(12px + env(safe-area-inset-bottom,0px));
    width:auto; max-width:none; max-height:min(60vh,480px); z-index:9995;
  }
  #bh-bs.bh-bs-menu-open .bh-bs-tools{ -webkit-mask-image:none; mask-image:none; }
  /* Type Beat is one more button in the rail, as wide as its label. */
  #bh-bs .bh-bs-tbmenu{ flex:0 0 auto; }
  #bh-bs #bh-bs-tb-toggle{ width:auto; }
}
/* A phone on its side (short, touch): the panels, Save included, would hang below a 390 px screen; a sheet pinned to the corner,
   as tall as the screen allows, is reachable. */
@media (min-width:641px) and (max-height:500px) and (pointer:coarse){
  #bh-bs :is(.bh-bs-mixpop,.bh-bs-soundspop,.bh-bs-tbpop,.bh-bs-projpop){
    position:fixed; top:auto; left:auto; right:12px; bottom:calc(12px + env(safe-area-inset-bottom,0px));
    width:min(380px,calc(100vw - 24px)); max-width:none;
    max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px); overflow:auto; z-index:9995;
  }
}

/* The list selects' [hidden] (a Delete menu with nothing to delete) must win over any display a sheet gives a select. */
#bh-bs .bh-bs-select[hidden]{ display:none !important; }
/* Every select: the theme's vertical padding left a 14 px window for the text. (The genre select of the Generate melody row had no
   height of its own, the padding made it 41 px: it keeps the height of the button next to it.) */
#bh-bs select.bh-bs-select{ padding-top:0; padding-bottom:0; line-height:1.2; }
#bh-bs .bh-bs-gen .bh-bs-select{ height:40px; }

/* Playhead: the column that is sounding. The script has always toggled .bh-bs-playcol on it, but only .bh-bs-playhead was ever
   styled (nothing sets that), so the moving highlight was invisible and only the LCD counter moved. */
#bh-bs .bh-bs-cell.bh-bs-playcol, #bh-bs .bh-bs-note.bh-bs-playcol{ border-color:rgba(127,208,255,.7); }
#bh-bs .bh-bs-cell.bh-bs-playcol:not(.is-on){ background:rgba(127,208,255,.16); }
#bh-bs .bh-bs-note.bh-bs-playcol:not(.is-on){ background:rgba(127,208,255,.12); }
#bh-bs .bh-bs-cell.bh-bs-playcol.is-on, #bh-bs .bh-bs-note.bh-bs-playcol.is-on{ filter:brightness(1.35); }

/* BPM and Bars − / +: a press that is held repeats (see the script), so no long-press selection or callout, no double-tap zoom. */
#bh-bs button.bh-bs-step{ touch-action:manipulation; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }

/* The Type Beat panel's close control: on a phone the panel is a sheet that covers most of the screen, and only a tap outside it (or Esc) closed it. */
#bh-bs .bh-bs-tbpop-hd{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
#bh-bs .bh-bs-tbpop-x{
  flex:0 0 auto; width:28px; height:28px; min-height:0; padding:0; cursor:pointer; border-radius:8px;
  border:1px solid var(--bdr); background:transparent; color:var(--muted); font:700 12px/1 var(--mono);
}
#bh-bs .bh-bs-tbpop-x:hover{ color:var(--txt); border-color:var(--bdr2); }

/* The genre tag of a published beat, next to its title. */
#bh-bs .bh-bs-pub-genre{
  flex:0 0 150px; width:150px; min-width:0; height:38px; padding-left:12px; padding-right:12px;
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.12); border-radius:8px; color:#f4f4f5;
  font:500 13px/1.2 'DM Mono', ui-monospace, monospace;
}
@media (max-width:640px){
  #bh-bs .bh-bs-pub-genre{ flex:1 1 100%; width:auto; height:38px; }
}

/* A warning toast. The tools rail scrolls sideways on a phone and its status line is off to the right, out of sight, so a
   warning (the browser refused to store, a file could not be read...) is also shown here, at phone width only. */
.bh-bs-toast{ display:none; }
@media (max-width:640px){
  .bh-bs-toast.is-on{
    display:block; position:fixed; left:12px; right:12px; bottom:calc(68px + env(safe-area-inset-bottom,0px)); z-index:9996;
    padding:10px 14px; border-radius:12px; background:#14121d; border:1px solid rgba(255,138,138,.5); color:#f4f4f5;
    font:600 12px/1.4 'DM Mono',ui-monospace,Menlo,monospace; box-shadow:0 12px 36px rgba(0,0,0,.5); pointer-events:none;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   WAVE 15 — THE PHONE (Beats | Melody | Keys)
   What a phone showed before: 16 steps squeezed to 16 px (half of the taps hit the step next to the one aimed at), the first drum lane at two
   thirds of the screen under a three-row transport, a roll that was 4 rows of a 220 px window, nine of twelve tool groups in a sideways rail, the
   status lines out of sight. Now: a sticky bar (Play / Stop / Loop, BPM, More) and sticky tabs, one view at a time (the Melody tab and the short
   names are only here), steps of 34 px with two pages of eight (the grid keeps its rows of 16 buttons, scrolled), a roll with all the height
   there is, a keyboard of 40 px keys that moves by octaves, every other control 44 px, one kind of sheet for More / Save / Mixer / Sounds / Type
   Beat, and a snackbar for the status line. It is for portrait phones (up to 640 px) and for a phone on its side (short and touch); a tablet
   and a desktop keep their layout (every rule below is inside that query, and the wrappers added for it are display:contents outside it).
   ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */

/* Pieces that exist for the phone: nothing of them shows anywhere else. */
#bh-bs .bh-bs-pagebar, #bh-bs .bh-bs-octs, #bh-bs .bh-bs-keysnav, #bh-bs .bh-bs-stepper--more,
#bh-bs .bh-bs-sheet-hd, #bh-bs .bh-bs-sheet-x, #bh-bs .bh-bs-vt-p, #bh-bs .bh-bs-mix-msw,
#bh-bs .bh-bs-viewtab[data-view="melody"], #bh-bs button#bh-bs-more{ display:none; }
/* More: the three blocks it holds do not have a box above the phone; they sit in the rail as they always did (hidden stays "hidden" for the
   Back button of the app and for the script, and the wrapper just does not exist for the layout). */
#bh-bs .bh-bs-moresheet, #bh-bs .bh-bs-moresheet[hidden]{ display:contents !important; }

@media (max-width:640px), (min-width:641px) and (max-height:500px) and (pointer:coarse){

  /* A sheet is open: the page behind does not scroll; a tap on the dimmed part closes it (the script closes on any click outside). */
  html.bh-bs-sheet-open{ overflow:hidden; }
  #bh-bs.bh-bs-sheet-open::after{ content:""; position:fixed; inset:0; z-index:9993; background:rgba(0,0,0,.4); }
  /* The bars stay put under the keyboard-focus scrolling too. */
  html:has(#bh-bs){ scroll-padding-top:150px; }
  /* The site's page root keeps 64 px free for its header, which is 43 px high on a phone: the studio takes the 21 px that stayed empty (its first
     lane is that much nearer the top). Where :has() is not known the root keeps its own padding. (The app has no header: bh-studio-app.css.) */
  body:has(#bh-bs) #bh-page-root{ padding-top:max(50px, calc(46px + env(safe-area-inset-top,0px) + 4px)); }

  /* ── The studio is a column of flex lines: sticky bar, the row of outputs, the sticky tabs, then the view. ───────────────────────────
     (#bh-bs is no longer a scroll container: overflow:hidden would make the "sticky" bars stick to a box that never scrolls. A browser without
     clip keeps visible: everything inside is sized not to overflow.) */
  #bh-bs{
    --bar-h:54px; --tabs-h:50px; --lane-w:64px; --gap:3px; --roll-row:36px;
    --cw:clamp(32px, calc((100vw - 24px - var(--lane-w) - 28px) / 8), 44px);
    --vis:calc(100vw - 24px - var(--lane-w));
    --tail:max(0px, calc(var(--vis) - 8 * (var(--cw) + var(--gap)) + var(--gap)));   /* room after step 16 so page two can land flush with the lane header */
    --kw:clamp(36px, calc((100vw - 24px) / 9), 48px);
    --sticky-top:var(--bh-bs-nav-h,0px);
    display:flex; flex-wrap:wrap; align-content:flex-start; align-items:stretch; column-gap:0; row-gap:0;
    max-width:none; margin:0; padding:0 12px 24px; border:0; border-radius:0; background:var(--bg);
    overflow:visible; overflow:clip;
  }
  /* The transport and the tools rail are not boxes any more: their children are lines of the column. */
  #bh-bs .bh-bs-transport, #bh-bs .bh-bs-tools{ display:contents; }
  #bh-bs > *, #bh-bs > .bh-bs-transport > *, #bh-bs > .bh-bs-tools > *{ flex:0 0 100%; min-width:0; max-width:100%; order:90; margin:0; }

  /* ── The bar: Play · Stop · Loop | − BPM + | More. Sticky under the site's header (none in the app), opaque. ─────────────────────── */
  #bh-bs .bh-bs-tp-play, #bh-bs .bh-bs-lcd{
    position:sticky; top:var(--sticky-top); z-index:71; height:var(--bar-h); align-items:center;
    order:10; background:var(--bg); box-shadow:0 1px 0 var(--bdr2); padding-top:0; padding-bottom:0;
  }
  #bh-bs .bh-bs-tp-play{ flex:0 0 auto; display:flex; gap:4px; margin:0 0 0 -12px; padding-left:12px; padding-right:4px; }
  #bh-bs .bh-bs-lcd{ flex:1 1 0; display:flex; flex-wrap:nowrap; justify-content:flex-end; gap:4px; margin:0 -12px 0 0; padding-left:0; padding-right:12px; }
  #bh-bs button#bh-bs-play, #bh-bs button#bh-bs-stop, #bh-bs button#bh-bs-loop{
    flex:0 0 auto; width:44px; min-width:44px; height:44px; min-height:44px; padding:0; border-radius:22px;
  }
  #bh-bs button#bh-bs-play{ width:48px; min-width:48px; }
  /* Play, Stop, Loop (the markup keeps the order it has on the website's wider layouts: Play, Loop, Stop) */
  #bh-bs button#bh-bs-stop{ order:2; }
  #bh-bs button#bh-bs-loop{ order:3; }
  #bh-bs .bh-bs-play .bh-bs-btn-tx{ display:none; }
  #bh-bs .bh-bs-play .bh-bs-ic, #bh-bs .bh-bs-stop .bh-bs-ic{ font-size:15px; }
  #bh-bs .bh-bs-loop .bh-bs-ic{ font-size:17px; }
  /* A static ring while it plays (the pulse was an animation that never ended: 5 percent of a phone's main thread by itself). */
  #bh-bs button#bh-bs-play.is-active{ animation:none; }
  /* BPM: − [120] + in a 44 px pill; the label sits inside the number's box. The bar has no room for Bars or the 1.1.1 counter: Bars is in More. */
  #bh-bs .bh-bs-lcd .bh-bs-stepper[data-step-for="bh-bs-bars"], #bh-bs .bh-bs-lcd .bh-bs-lcd-pos{ display:none !important; }
  #bh-bs .bh-bs-lcd .bh-bs-stepper{ flex:0 0 auto; height:44px; padding:0; border:0; border-radius:22px; box-shadow:inset 0 0 0 1px var(--bdr); justify-content:space-between; }
  #bh-bs .bh-bs-lcd button.bh-bs-step{ width:44px; min-width:44px; height:44px; min-height:44px; }
  #bh-bs .bh-bs-stepper-mid{ position:relative; min-width:44px; }
  #bh-bs .bh-bs-stepper-mid input#bh-bs-tempo, #bh-bs .bh-bs-stepper-mid input#bh-bs-bars{ width:44px; height:44px; padding:0 0 12px; font-size:16px; }
  #bh-bs .bh-bs-stepper-mid em{ position:absolute; left:0; right:0; bottom:5px; margin:0; text-align:center; pointer-events:none; font-size:11px; letter-spacing:.1em; }
  #bh-bs button#bh-bs-more{ display:inline-flex; flex:0 0 auto; width:44px; min-width:44px; height:44px; min-height:44px; padding:0; border-radius:50%; margin-left:2px; }
  #bh-bs button#bh-bs-more .bh-bs-ic{ font-size:24px; line-height:1; transform:translateY(-2px); }
  #bh-bs button#bh-bs-more[aria-expanded="true"]{ border-color:var(--cb); color:var(--cb-tint); background:var(--cbo); }
  /* Until the script has bound the studio (beat-studio.js takes the class off in the same breath): the bar reads as "not yet". */
  /* (R-183: it was dimmed with a moving shine under it. It is just dimmed now: the loading card says what is still on its way.) */
  #bh-bs.bh-bs-booting :is(.bh-bs-tp-play,.bh-bs-lcd) :is(.bh-bs-btn,.bh-bs-step){ opacity:.6; }

  /* ── WAV · MIDI · Save · ? : an ordinary row that scrolls away. ───────────────────────────────────────────────────────────────────────── */
  #bh-bs .bh-bs-tp-out{ order:20; display:flex; gap:6px; margin:4px 0; padding:0; }
  #bh-bs .bh-bs-tp-out > *{ flex:1 1 0; min-width:0; }
  #bh-bs .bh-bs-tp-out .bh-bs-btn{ height:44px; min-height:44px; padding:0 8px; font-size:12px; gap:5px; }
  #bh-bs .bh-bs-tp-out .bh-bs-projmenu{ display:flex; position:static; }
  /* (the order the row reads in: WAV, MIDI, Save, ?: beat-studio.js seats the MIDI export between WAV and Save on a phone) */
  #bh-bs .bh-bs-tp-out #bh-bs-export{ order:0; }
  #bh-bs .bh-bs-tp-out #bh-bs-midi-export{ order:1; }
  #bh-bs .bh-bs-tp-out .bh-bs-projmenu{ order:2; }
  #bh-bs .bh-bs-tp-out:not(.has-midi)::before{ content:""; order:1; flex:1 1 0; min-width:0; }   /* its place, until the script has put it there: nothing moves when it comes */
  #bh-bs .bh-bs-tp-out .bh-bs-tour-launch--inline{ order:3; position:static; flex:0 0 44px; width:44px; height:44px; min-width:44px; min-height:44px; margin:0; padding:0; animation:none; box-shadow:none; font-size:18px; }
  /* (room kept for the ? that the tour's script adds: the row does not jump when it arrives) */
  #bh-bs .bh-bs-tp-out:not(.has-launcher)::after{ content:""; order:3; flex:0 0 44px; }

  /* ── The tabs: Beats | Melody | Keys, sticky under the bar, with Undo / Redo at the right. ─────────────────────────────────────── */
  #bh-bs .bh-bs-viewtabs, #bh-bs .bh-bs-hist{
    position:sticky; top:calc(var(--sticky-top) + var(--bar-h)); z-index:70; order:30; height:var(--tabs-h);
    align-items:center; background:var(--bg); box-shadow:0 1px 0 var(--bdr2);
  }
  #bh-bs .bh-bs-viewtabs{ flex:1 1 0; display:flex; gap:4px; margin:0 0 0 -12px; padding:0 6px 0 12px; border:0; border-radius:0; }
  #bh-bs .bh-bs-hist{ order:31; flex:0 0 auto; display:flex; gap:4px; margin:0 -12px 0 0; padding:0 12px 0 0; }
  #bh-bs button.bh-bs-viewtab{ flex:1 1 0; display:inline-flex; align-items:center; justify-content:center; min-width:0; height:44px; min-height:44px; padding:0 4px; font-size:13px; border-radius:22px; }
  #bh-bs .bh-bs-viewtab[data-view="melody"]{ display:inline-flex; }
  #bh-bs .bh-bs-vt-d{ display:none; }
  #bh-bs .bh-bs-vt-p{ display:inline; }
  #bh-bs button#bh-bs-undo, #bh-bs button#bh-bs-redo{ width:44px; min-width:44px; height:44px; min-height:44px; padding:0; font-size:20px; border-radius:22px; }

  /* ── Which view shows what. (The nodes of the others stay in the document: only the view that is up has a box.) ──────────────── */
  #bh-bs[data-pview="grid"] :is(.bh-bs-waves,.bh-bs-scale,.bh-bs-rollhdr,.bh-bs-roll){ display:none !important; }
  /* Generate melody is reachable from Beats too (under the Groove row): a melody over the drums is one tap, whichever view is up. */
  #bh-bs[data-pview="grid"] .bh-bs-gen{ order:53; }
  #bh-bs[data-pview="melody"] :is(.bh-bs-groovepick,.bh-bs-kitpick,.bh-bs-tbmenu,.bh-bs-drums){ display:none !important; }
  #bh-bs[data-pview="play"] :is(.bh-bs-groovepick,.bh-bs-kitpick,.bh-bs-tbmenu,.bh-bs-scale,.bh-bs-gen,.bh-bs-stage--grid){ display:none !important; }
  #bh-bs .bh-bs-stage--grid{ order:40; margin:0; }
  #bh-bs[data-pview="melody"] .bh-bs-stage--grid{ order:42; }
  #bh-bs[data-pview="play"] .bh-bs-stage--play{ display:contents; }
  #bh-bs .bh-bs-stage--play > *{ flex:0 0 100%; min-width:0; max-width:100%; }
  #bh-bs .bh-bs-live-bar{ order:40; margin:10px 0; }
  #bh-bs .bh-bs-pads{ order:41; }
  #bh-bs .bh-bs-keysnav{ order:43; }
  #bh-bs .bh-bs-keyswrap{ order:44; }
  #bh-bs .bh-bs-publish{ order:100; margin-top:16px; }
  #bh-bs .bh-bs-tbref{ order:35; margin:8px 0 0; }   /* (the strip that says which news item a preset came from: under the tabs, where it is seen) */

  /* ── Beats: the page buttons and the lanes. ────────────────────────────────────────────────────────────────────────────────── */
  #bh-bs .bh-bs-pagebar{ display:flex; align-items:center; gap:6px; margin:8px 0 6px; }
  #bh-bs button.bh-bs-pagebtn, #bh-bs button.bh-bs-drawbtn{
    position:relative; display:inline-flex; align-items:center; justify-content:center; gap:6px; flex:0 0 auto; min-width:64px; height:44px; min-height:44px; padding:0 14px;
    border:1px solid var(--bdr2); border-radius:22px; background:var(--sur); color:var(--txt); font:700 13px/1 var(--mono); letter-spacing:.04em; cursor:pointer;
  }
  #bh-bs button.bh-bs-pagebtn.is-active, #bh-bs button.bh-bs-drawbtn[aria-pressed="true"]{
    background:linear-gradient(135deg,var(--cb-light),var(--cb-deep)); border-color:transparent; color:#fff; box-shadow:0 2px 10px rgba(34,182,255,.3);
  }
  #bh-bs button.bh-bs-pagebtn.has-notes::after{ content:""; position:absolute; top:7px; right:9px; width:6px; height:6px; border-radius:50%; background:var(--cb-tint); }
  #bh-bs button.bh-bs-pagebtn.is-active.has-notes::after{ background:#fff; }
  #bh-bs button.bh-bs-drawbtn{ margin-left:auto; }

  #bh-bs .bh-bs-drums{
    display:flex; flex-direction:column; gap:8px; padding:0; margin:0; background:none; border:0; border-radius:0;
    overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain;
    scroll-snap-type:x mandatory; scroll-padding-left:var(--lane-w); scrollbar-width:none; contain:layout style paint;
  }
  #bh-bs .bh-bs-drums::-webkit-scrollbar, #bh-bs .bh-bs-roll::-webkit-scrollbar{ display:none; }
  #bh-bs .bh-bs-row{ display:flex; align-items:center; gap:0; width:max-content; min-width:max-content; }
  /* After step 16 there is room for the second page to land flush with the lane header (the last cell is not the end of the scroll): a margin and not a
     ::after (the width of a row that is max-content counts a margin in every engine, a flex pseudo-element's basis it did not in WebKit). */
  #bh-bs .bh-bs-cells{ display:grid; grid-template-columns:repeat(16, var(--cw)); gap:var(--gap); flex:0 0 auto; width:auto; min-width:0; margin:0 var(--tail) 0 0; }
  #bh-bs .bh-bs-cell{ width:var(--cw); min-width:0; height:44px; min-height:0; transition:none; }
  #bh-bs .bh-bs-cell[data-step="0"], #bh-bs .bh-bs-cell[data-step="8"], #bh-bs .bh-bs-note[data-step="0"], #bh-bs .bh-bs-note[data-step="8"]{ scroll-snap-align:start; }
  #bh-bs .bh-bs-cell.is-beat, #bh-bs .bh-bs-note.is-beat{ scroll-snap-align:none; }
  #bh-bs .bh-bs-cell[data-step="0"].is-beat, #bh-bs .bh-bs-cell[data-step="8"].is-beat, #bh-bs .bh-bs-note[data-step="0"].is-beat, #bh-bs .bh-bs-note[data-step="8"].is-beat{ scroll-snap-align:start; }
  /* The lane header stays at the left while the steps scroll under it: label over M · S. */
  #bh-bs .bh-bs-lanehd{
    display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:2px; flex:0 0 var(--lane-w); width:var(--lane-w); min-height:44px;
    position:sticky; left:0; z-index:3; background:var(--bg); padding:0 4px 0 0;
  }
  #bh-bs .bh-bs-lanehd .bh-bs-rowlabel{ flex:none; width:auto; max-width:100%; text-align:left; font-size:11px; line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; display:block; }
  #bh-bs .bh-bs-lanehd .bh-bs-rowctl{ display:flex; flex-direction:row; align-items:center; gap:2px; flex:none; width:auto; }
  #bh-bs .bh-bs-ms{ width:30px !important; height:26px !important; font-size:11px !important; border-radius:6px; }
  #bh-bs .bh-bs-chan.bh-bs-lanevol{ display:none; }
  /* A cell the playhead is on: no filter, no moving shadow (a phone's main thread is the budget); the sounding column is a ring. */
  #bh-bs .bh-bs-cell.is-on, #bh-bs .bh-bs-note.is-on{ box-shadow:none; }
  #bh-bs .bh-bs-cell:active, #bh-bs .bh-bs-note:active{ transform:none; filter:none; transition:background-color .08s; }
  #bh-bs .bh-bs-cell.bh-bs-playcol.is-on, #bh-bs .bh-bs-note.bh-bs-playcol.is-on{ filter:none; box-shadow:inset 0 0 0 2px rgba(255,255,255,.85); }

  /* ── Melody: the sound, the scale, the roll with all the height there is, Generate. ─────────────────────────────────────────── */
  #bh-bs .bh-bs-waves{ order:40; display:flex; width:auto; margin:10px 0 0; padding:3px; gap:3px; border-radius:25px; }
  #bh-bs .bh-bs-waves .bh-bs-wave-chip, #bh-bs button.bh-bs-wave-chip{ flex:1 1 0; min-width:0; height:44px; min-height:44px; padding:0 4px; border-radius:22px; font-size:13px; }
  #bh-bs[data-pview="play"] .bh-bs-waves{ order:42; margin:12px 0 10px; }
  #bh-bs .bh-bs-scale{ order:41; display:flex; align-items:center; gap:6px; margin:8px 0 0; }
  #bh-bs .bh-bs-scale .bh-bs-select{ flex:1 1 0; min-width:0; }
  #bh-bs #bh-bs-scale-root{ flex:0 0 72px; min-width:72px; max-width:none; }
  #bh-bs #bh-bs-scale-type{ flex:1 1 0; min-width:0; max-width:none; }
  #bh-bs .bh-bs-tools button.bh-bs-scale-lock{ flex:0 0 auto; height:44px; min-height:44px; padding:0 14px; font-size:13px; }
  #bh-bs .bh-bs-scale::before{ content:"🎼"; font-size:18px; line-height:1; flex:0 0 auto; }
  #bh-bs .bh-bs-scale .bh-bs-tools-lbl{ display:none; }

  #bh-bs .bh-bs-rollhdr{ display:flex; align-items:center; gap:6px; margin:8px 0; min-height:44px; }
  #bh-bs .bh-bs-rollhdr .bh-bs-lanehd{ flex-direction:row; align-items:center; gap:8px; position:static; flex:1 1 auto; width:auto; min-height:0; background:none; padding:0; }
  #bh-bs .bh-bs-rollhdr .bh-bs-rowlabel{ font-size:13px; }
  #bh-bs .bh-bs-rollhdr .bh-bs-ms{ width:40px !important; height:36px !important; }
  #bh-bs .bh-bs-octs{ display:flex; gap:6px; margin-left:auto; flex:0 0 auto; }
  #bh-bs button.bh-bs-oct, #bh-bs button.bh-bs-keyoct{
    display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; min-width:44px; height:44px; min-height:44px; padding:0 10px;
    border:1px solid var(--bdr2); border-radius:22px; background:var(--sur); color:var(--txt); font:700 12px/1 var(--mono); letter-spacing:.04em; cursor:pointer;
  }
  #bh-bs button.bh-bs-oct:active, #bh-bs button.bh-bs-keyoct:active{ background:var(--sur2); }
  #bh-bs .bh-bs-roll{
    display:flex; flex-direction:column; gap:var(--gap); height:clamp(300px, calc(100vh - 330px), 640px); height:clamp(300px, calc(100dvh - 330px), 640px); max-height:none;
    padding:0; border-radius:12px; overflow-x:auto; overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain;
    scroll-snap-type:x mandatory; scroll-padding-left:var(--lane-w); scrollbar-width:none; contain:layout style paint;
  }
  #bh-bs .bh-bs-noterow{ display:flex; align-items:center; gap:0; width:max-content; min-width:max-content; flex:0 0 auto; }
  #bh-bs .bh-bs-notelabel{
    position:sticky; left:0; z-index:3; flex:0 0 var(--lane-w); width:var(--lane-w); height:var(--roll-row); background:var(--bg); font-size:12px;
    display:flex; align-items:center; justify-content:center; text-align:center;
  }
  #bh-bs .bh-bs-noterow.is-black .bh-bs-notelabel{ background:#07060b; color:rgba(255,255,255,.5); }
  #bh-bs .bh-bs-noterow .bh-bs-rowctl{ display:none; }
  #bh-bs .bh-bs-note{ width:var(--cw); min-width:0; height:var(--roll-row); min-height:0; border-radius:5px; transition:none; }
  #bh-bs .bh-bs-gen{ order:43; display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:10px 0 0; }
  #bh-bs .bh-bs-gen .bh-bs-field{ flex:1 1 0; min-width:0; }
  #bh-bs .bh-bs-gen .bh-bs-field > span{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  #bh-bs .bh-bs-gen #bh-bs-genre{ width:100%; height:44px; }
  #bh-bs .bh-bs-gen #bh-bs-generate{ flex:1.4 1 0; min-width:0; height:44px; min-height:44px; padding:0 12px; font-size:13px; }
  #bh-bs .bh-bs-gen .bh-bs-gen-status{ flex:0 0 100%; min-height:16px; font-size:12px; }

  /* ── Beats, bottom row: Groove · Kit · Type Beat. ──────────────────────────────────────────────────────────────────────────── */
  /* (a basis of 0 would let them join the line of the item before them, which is 100 percent wide: each has a width of its own to wrap by) */
  #bh-bs .bh-bs-groovepick, #bh-bs .bh-bs-kitpick, #bh-bs .bh-bs-tbmenu{ display:flex; align-items:center; gap:6px; flex:1 1 96px; min-width:96px; margin:10px 0 0; }
  #bh-bs .bh-bs-groovepick{ order:50; }
  #bh-bs .bh-bs-kitpick{ order:51; margin-left:6px; }
  #bh-bs .bh-bs-tbmenu{ order:52; flex:0 0 44px; min-width:44px; margin-left:6px; }
  #bh-bs .bh-bs-groovepick select, #bh-bs .bh-bs-kitpick select{ flex:1 1 0; min-width:0; max-width:none; width:100%; }
  #bh-bs .bh-bs-tb-btn .bh-bs-caret{ display:none; }
  #bh-bs .bh-bs-tbmenu .bh-bs-btn{ height:44px; min-height:44px; width:44px; padding:0; font-size:12px; }
  #bh-bs .bh-bs-tb-btn .bh-bs-btn-tx{ display:none; }   /* (the label is the sheet's: the button is the dial, 44 px, so Groove and Kit have the room) */
  #bh-bs .bh-bs-tb-btn .bh-bs-ic{ font-size:20px; }

  /* Every select and field of the studio is a 44 px control here, in the studio's own shape (the site's theme squares them). */
  /* A select is the same in every engine here (the site's mobile sheet gives every select up to 768 px a padding, a border and a background with !important and no caret; a
     phone on its side is wider than that and got WebKit's own control, which ignores a height): its own caret, 44 px, and 16 px of type (iOS zooms the page into a field of less). */
  #bh-bs select.bh-bs-select, #bh-bs .bh-bs-tools select.bh-bs-select{
    -webkit-appearance:none !important; appearance:none !important; height:44px; min-height:44px; font-size:16px; padding:0 28px 0 10px !important; border-radius:10px !important; text-overflow:ellipsis;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237FD0FF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat:no-repeat !important; background-position:right 10px center !important; background-size:12px !important;
  }
  #bh-bs input.bh-bs-input:not(#bh-bs-tempo):not(#bh-bs-bars), #bh-bs .bh-bs-title{ height:44px; min-height:44px; font-size:16px; }
  #bh-bs button.bh-bs-publish-btn{ height:44px; min-height:44px; }
  #bh-bs .bh-bs-gen-status, #bh-bs .bh-bs-live-step{ font-size:12px; }
  #bh-bs .bh-bs-tools-lbl{ font-size:11px; }

  /* ── Keys: REC, the pads, the sound, the keyboard (40 px keys, moved by octaves). ────────────────────────────────────────────── */
  #bh-bs button.bh-bs-live-rec{ height:44px; min-height:44px; }
  #bh-bs .bh-bs-pads{ grid-template-columns:repeat(3,1fr); grid-auto-rows:84px; gap:10px; margin:0; }
  #bh-bs button.bh-bs-pad{ min-height:0; }   /* (a row of the grid sets the height; the website's 96 px would spill out of it) */
  #bh-bs .bh-bs-keysnav{ display:flex; align-items:center; gap:6px; margin:0 0 8px; }
  #bh-bs .bh-bs-keymap{ position:relative; flex:1 1 auto; height:28px; border-radius:14px; background:var(--sur); border:1px solid var(--bdr2); overflow:hidden; touch-action:none; cursor:pointer; }
  #bh-bs .bh-bs-keymap-lbl{ position:absolute; inset:0; z-index:2; display:flex; align-items:center; justify-content:center; font:700 12px/1 var(--mono); letter-spacing:.06em; color:var(--txt); pointer-events:none; }
  #bh-bs .bh-bs-keymap-thumb{ position:absolute; top:0; bottom:0; left:0; width:60%; border-radius:14px; background:rgba(34,182,255,.3); border:1px solid var(--cb); pointer-events:none; }
  #bh-bs .bh-bs-keyswrap{ overflow:hidden; border-radius:12px; border:1px solid var(--bdr2); background:#0c0a14; }
  #bh-bs .bh-bs-keys{ flex:none; width:calc(var(--kw) * 15); height:170px; border:0; border-radius:0; overflow:visible; }
  #bh-bs button.bh-bs-key.is-black{ width:calc(var(--kw) * .66); }   /* (24 px at 360: the black keys are small targets, they are not smaller than that) */
  #bh-bs .bh-bs-key-lbl{ display:inline; font-size:11px; }
  #bh-bs .bh-bs-caret{ font-size:11px; }
}

/* ── One kind of sheet (More, Save, Mixer, Sounds, Type Beat): over the bottom of the screen, 70 percent of it at most, 44 px controls, dimmed
   page behind it (#bh-bs.bh-bs-sheet-open::after, above). Mixer and Sounds open on top of More, which stays open under them. ────────────────── */
@media (max-width:640px), (min-width:641px) and (max-height:500px) and (pointer:coarse){
  #bh-bs :is(.bh-bs-moresheet:not([hidden]),.bh-bs-projpop,.bh-bs-mixpop,.bh-bs-soundspop,.bh-bs-tbpop){
    position:fixed; left:12px; right:12px; top:auto; bottom:calc(12px + env(safe-area-inset-bottom,0px)); width:auto; max-width:none; margin:0;
    max-height:70vh; max-height:min(70dvh,520px); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    padding:12px; gap:10px; background:#14121d; border:1px solid var(--bdr2); border-radius:16px; box-shadow:0 -10px 40px rgba(0,0,0,.5); z-index:9995;
  }
  #bh-bs .bh-bs-moresheet[hidden]{ display:none !important; }   /* (above the phone the wrapper is display:contents even when hidden: see the top of this block) */
  #bh-bs .bh-bs-moresheet:not([hidden]){ display:flex !important; flex-direction:column; }
  /* The header of a sheet: its name and a 44 px close control. */
  #bh-bs .bh-bs-sheet-hd, #bh-bs .bh-bs-mixpop-hd, #bh-bs .bh-bs-soundspop-hd, #bh-bs .bh-bs-tbpop-hd{
    display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:30px; margin:0;
    font:700 12px/1.2 var(--mono); letter-spacing:.1em; text-transform:uppercase; color:var(--muted);
  }
  #bh-bs button.bh-bs-sheet-x, #bh-bs button.bh-bs-tbpop-x{
    display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:44px; min-width:44px; height:44px; min-height:44px; margin:-8px -8px -8px 0; padding:0;
    border:0; border-radius:50%; background:transparent; color:var(--txt); font:700 16px/1 var(--mono); cursor:pointer;
  }
  #bh-bs :is(.bh-bs-moresheet,.bh-bs-projpop,.bh-bs-mixpop,.bh-bs-soundspop,.bh-bs-tbpop) :is(button.bh-bs-btn,select.bh-bs-select,input.bh-bs-input:not([type=range])){ height:44px; min-height:44px; }
  #bh-bs .bh-bs-projpop .bh-bs-input, #bh-bs .bh-bs-projpop .bh-bs-select{ height:44px; font-size:16px; }
  #bh-bs .bh-bs-projpop .bh-bs-proj-name{ height:44px; }
  #bh-bs .bh-bs-projpop-row{ gap:8px; }
  #bh-bs .bh-bs-projpop-row .bh-bs-btn, #bh-bs button#bh-bs-save, #bh-bs button#bh-bs-clear{ flex:1 1 0; width:auto; height:44px; min-height:44px; font-size:14px; }
  #bh-bs .bh-bs-projpop > #bh-bs-cloud-save{ height:44px; min-height:44px; }
  #bh-bs .bh-bs-projpop .bh-bs-gen-status{ font-size:12px; }
  #bh-bs .bh-bs-chan{ min-height:44px; gap:8px; }
  #bh-bs .bh-bs-chan-name{ flex:0 0 64px; font-size:12px; }
  /* The Mixer's own Mute and Solo: 44 px (the lane's are 30 x 26, which is what a lane has room for). */
  #bh-bs .bh-bs-mix-msw{ display:flex; gap:6px; flex:0 0 auto; }
  #bh-bs button.bh-bs-mix-ms{
    flex:0 0 auto; width:44px; min-width:44px; height:44px; min-height:44px; padding:0; border:1px solid var(--bdr2); border-radius:10px;
    background:var(--sur); color:rgba(244,244,245,.7); font:700 14px/1 var(--mono); cursor:pointer;
  }
  #bh-bs button.bh-bs-mix-ms[aria-pressed="true"][data-act="mute"]{ background:#ff5c5c; border-color:#ff5c5c; color:#160404; }
  #bh-bs button.bh-bs-mix-ms[aria-pressed="true"][data-act="solo"]{ background:#ffd166; border-color:#ffd166; color:#161200; }
  #bh-bs .bh-bs-sound{ min-height:44px; gap:8px; }
  #bh-bs .bh-bs-sound button{ width:44px; height:44px; min-width:44px; min-height:44px; }
  #bh-bs .bh-bs-sound-name{ font-size:13px; }
  #bh-bs .bh-bs-tbtab{ height:44px; font-size:13px; }
  #bh-bs .bh-bs-tbitem{ min-height:56px; }
  /* More: Loops, Swing, Reverb, MIDI, Mixer, Sounds. */
  #bh-bs .bh-bs-moresheet .bh-bs-stepper--more{ display:inline-flex; flex:0 0 auto; width:100%; height:44px; padding:0; border:0; border-radius:22px; box-shadow:inset 0 0 0 1px var(--bdr); justify-content:space-between; align-items:center; }
  #bh-bs .bh-bs-moresheet .bh-bs-stepper--more button.bh-bs-step{ width:56px; min-width:56px; height:44px; min-height:44px; }
  #bh-bs .bh-bs-stepper--more .bh-bs-stepper-mid{ flex:1 1 auto; flex-direction:row; justify-content:center; gap:8px; min-width:0; }
  #bh-bs .bh-bs-stepper-val{ font:700 18px/1 var(--mono); color:#fff; }
  #bh-bs .bh-bs-stepper--more .bh-bs-stepper-mid em{ position:static; font-size:12px; margin:0; letter-spacing:.08em; }
  #bh-bs .bh-bs-moresheet .bh-bs-field--swing, #bh-bs .bh-bs-moresheet .bh-bs-mix{
    display:grid; grid-template-columns:76px minmax(0,1fr); align-items:center; gap:10px; width:100%; min-height:44px; flex:0 0 auto; margin:0; padding:0; border:0;
  }
  #bh-bs .bh-bs-moresheet .bh-bs-field--swing::before, #bh-bs .bh-bs-moresheet .bh-bs-mix::before{ content:none; }
  #bh-bs .bh-bs-moresheet .bh-bs-field--swing > span, #bh-bs .bh-bs-moresheet .bh-bs-mix .bh-bs-tools-lbl{
    display:block; font:700 12px/1 var(--mono); letter-spacing:.08em; text-transform:uppercase; color:var(--txt);
  }
  #bh-bs .bh-bs-moresheet .bh-bs-range{ flex:1 1 auto; width:100%; }
  #bh-bs .bh-bs-moresheet .bh-bs-tools-io{ display:grid; grid-template-columns:1fr 1fr; gap:8px; width:100%; margin:0; padding:0; border:0; }
  #bh-bs .bh-bs-moresheet .bh-bs-tools-io #bh-bs-midi-import{ grid-column:1 / -1; }
  #bh-bs .bh-bs-moresheet .bh-bs-tools-io .bh-bs-btn{ width:100%; padding:0 8px; font-size:13px; justify-content:center; }
  #bh-bs .bh-bs-moresheet .bh-bs-tools-io .bh-bs-btx{ display:inline; }
  #bh-bs .bh-bs-moresheet .bh-bs-mixmenu, #bh-bs .bh-bs-moresheet .bh-bs-soundsmenu{ display:block; position:static; width:100%; }
  #bh-bs .bh-bs-moresheet .bh-bs-mixmenu > .bh-bs-btn, #bh-bs .bh-bs-moresheet .bh-bs-soundsmenu > .bh-bs-btn{ width:100%; }
  /* Sliders: a 44 px high box (track 6, thumb 28), the same in every browser. */
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol){
    -webkit-appearance:none; appearance:none; background:transparent; height:44px; margin:0; padding:0 !important; border:0 !important; box-shadow:none !important; border-radius:0;
    cursor:pointer; touch-action:pan-y;
  }
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol)::-webkit-slider-runnable-track{
    height:6px; border-radius:3px;
    background:linear-gradient(to right, var(--cb-tint,#7FD0FF) 0, var(--cb-tint,#7FD0FF) calc(14px + (100% - 28px) * var(--bh-frac,0)), rgba(255,255,255,.22) calc(14px + (100% - 28px) * var(--bh-frac,0)), rgba(255,255,255,.22) 100%);
  }
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol)::-webkit-slider-thumb{
    -webkit-appearance:none; appearance:none; width:28px; height:28px; margin-top:-11px; border-radius:50%; border:2px solid #fff; background:var(--cb-tint,#7FD0FF); box-shadow:0 1px 4px rgba(0,0,0,.5);
  }
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol)::-moz-range-track{ height:6px; border-radius:3px; background:rgba(255,255,255,.22); }
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol)::-moz-range-progress{ height:6px; border-radius:3px; background:var(--cb-tint,#7FD0FF); }
  #bh-bs input[type="range"]:is(.bh-bs-range,.bh-bs-vol)::-moz-range-thumb{ width:24px; height:24px; border-radius:50%; border:2px solid #fff; background:var(--cb-tint,#7FD0FF); box-shadow:0 1px 4px rgba(0,0,0,.5); }

  /* ── The status line is a snackbar here: every line is seen (the rail it lived in scrolled off to the right), for 4 seconds; a line that reports a
     problem has a red edge. (Out of sight but still announced when it is not fresh: it is a live region.) ───────────────────────────────────── */
  #bh-bs #bh-bs-tools-status{
    position:fixed; left:12px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom,0px)); z-index:9997; margin:0; padding:10px 14px; border-radius:12px;
    background:#14121d; border:1px solid var(--bdr2); color:#f4f4f5; font:600 13px/1.35 var(--mono); box-shadow:0 12px 36px rgba(0,0,0,.5); pointer-events:none;
    display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden;
  }
  #bh-bs #bh-bs-tools-status.is-warn{ border-color:rgba(255,138,138,.55); }
  #bh-bs #bh-bs-tools-status:not(.is-fresh), #bh-bs #bh-bs-tools-status:empty{
    position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); border:0; white-space:nowrap; box-shadow:none;
  }
  .bh-bs-toast.is-on{ display:none !important; }   /* (the snackbar says the same: it was the status line's only way to be seen) */

  /* ── The tour, on a phone: a card docked at the bottom (the target is above it), 44 px buttons, a hole that does not animate its box. ───────────────── */
  /* (no animation of top / left / width / height: each is a layout, 40 shifts for a tour; the hole only fades) */
  .bh-bs-tour-hole{ transition:opacity .2s; }
  .bh-bs-tour-card, .bh-bs-tour-card.is-center{
    left:12px; right:12px; top:auto; bottom:calc(12px + env(safe-area-inset-bottom,0px)); width:auto; max-width:none; transform:none; animation:none; border-radius:16px; padding:16px 16px 14px;
    max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px - env(safe-area-inset-bottom,0px));
  }
  .bh-bs-tour-x{ width:44px; height:44px; top:4px; right:4px; border-radius:50%; font-size:14px; }
  .bh-bs-tour-nav button{ height:44px; min-height:44px; }
  .bh-bs-tour-skip{ border:1px solid rgba(255,255,255,.22); padding:0 16px; color:rgba(255,255,255,.75); font-size:13px; }
  .bh-bs-tour-back, .bh-bs-tour-next{ padding:0 18px; font-size:13px; }
  .bh-bs-tour-body{ font-size:14px; }
  /* what the sticky bars would cover when the tour scrolls a target into view */
  #bh-bs .bh-bs-row, #bh-bs .bh-bs-tp-out, #bh-bs .bh-bs-pagebar{ scroll-margin-top:calc(var(--sticky-top) + var(--bar-h) + var(--tabs-h) + 10px); }
}

/* Draw (a finger paints steps; the cells then keep the touch for themselves, so the steps are scrolled with the page buttons, the lane headers and the
   gaps) and the smallest screens. */
@media (max-width:640px), (min-width:641px) and (max-height:500px) and (pointer:coarse){
  #bh-bs.bh-bs-draw .bh-bs-cell, #bh-bs.bh-bs-draw .bh-bs-note{ touch-action:none; }
}
@media (max-width:339px){
  #bh-bs button#bh-bs-stop{ display:none; }
}
@media (max-width:359px){
  /* (320 pt phones: WAV, MIDI and Save share 296 - 44 px: Save says its name and nothing more, so no button spills over the next) */
  #bh-bs .bh-bs-tp-out .bh-bs-projmenu-btn .bh-bs-ic, #bh-bs .bh-bs-tp-out .bh-bs-projmenu-btn .bh-bs-caret{ display:none; }
}

/* A phone on its side: bar, tabs and Undo / Redo share ONE line, the 16 steps fit (no pages), and the sheets sit at the right. */
@media (min-width:641px) and (max-height:500px) and (pointer:coarse){
  #bh-bs{
    --bar-h:52px; --tabs-h:52px;
    --cw:clamp(32px, calc((100vw - 24px - var(--lane-w) - 51px) / 16), 44px);
    --kw:min(56px, calc((100vw - 24px) / 15));
  }
  #bh-bs .bh-bs-viewtabs, #bh-bs .bh-bs-hist{ top:var(--sticky-top); z-index:71; }
  #bh-bs .bh-bs-viewtabs{ order:11; }
  #bh-bs .bh-bs-hist{ order:12; }
  #bh-bs .bh-bs-lcd{ flex:0 0 auto; margin:0; padding-right:8px; }
  #bh-bs .bh-bs-viewtabs{ margin-left:0; padding-left:8px; }
  #bh-bs .bh-bs-tp-out{ margin:6px 0; }
  #bh-bs .bh-bs-tp-out > *{ flex:0 0 auto; min-width:120px; }   /* (the row is wide here: each takes what it needs, not a third of the screen) */
  #bh-bs .bh-bs-tp-out > .bh-bs-tour-launch--inline{ min-width:44px; }
  #bh-bs .bh-bs-tp-out:not(.has-midi)::before{ flex:0 0 120px; }
  #bh-bs .bh-bs-pagebar .bh-bs-pagebtn{ display:none; }
  #bh-bs .bh-bs-pagebar{ margin:6px 0; justify-content:flex-end; }
  /* Beats: the Draw button goes up onto the row of the outputs (its right side is empty here), so the first lane starts a row sooner. */
  #bh-bs[data-pview="grid"] .bh-bs-pagebar{ margin:-50px 0 6px; position:relative; z-index:2; pointer-events:none; }
  #bh-bs[data-pview="grid"] .bh-bs-pagebar .bh-bs-drawbtn{ pointer-events:auto; }
  #bh-bs{ --tail:0px; }
  #bh-bs .bh-bs-drums, #bh-bs .bh-bs-roll{ scroll-snap-type:none; }
  #bh-bs .bh-bs-roll{ height:clamp(190px, calc(100vh - 190px), 420px); height:clamp(190px, calc(100dvh - 190px), 420px); }
  #bh-bs .bh-bs-pads{ grid-template-columns:repeat(5,1fr); grid-auto-rows:64px; }
  #bh-bs .bh-bs-keys{ height:120px; }
  #bh-bs :is(.bh-bs-moresheet:not([hidden]),.bh-bs-projpop,.bh-bs-mixpop,.bh-bs-soundspop,.bh-bs-tbpop){
    left:auto; width:min(420px, calc(100vw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px - env(safe-area-inset-bottom,0px));
  }
  #bh-bs #bh-bs-tools-status{ left:auto; width:min(420px, calc(100vw - 24px)); }
  .bh-bs-tour-card, .bh-bs-tour-card.is-center{ left:auto; width:min(420px, calc(100vw - 24px)); padding:12px 14px 10px; }
}

/* (the phone's moving parts, for people who asked the system for less motion) */
@media (prefers-reduced-motion:reduce){
  .bh-bs-tour-hole{ transition:none; }
}

/* Credit for the piano samples (CC BY 3.0), under the studio; a div, not a p, because the theme restyles #main p with !important. */
.bh-bs-credit { margin: 8px 0 0; font-size: 11px; line-height: 1.4; color: rgba(255, 255, 255, 0.45); text-align: right; }
html:is(.bh-app-link, .bh-app-text, .bh-app-hidden) .bh-bs-credit { padding: 0 16px; }
