/* New Scribe and Player (/studio/, /play/). Builds on brand.css (fonts, tokens, top bar).
   Linked as scribe.css?v=dev; scripts/inject-html-bundles.mjs swaps in a content hash at
   deploy, since s/css is served without hashed filenames.

   Light or dark (brand.css's tokens, chosen in the account menu: theme.js): the page, controls
   and grid sit on the stage; the notation is on its own paper (and prints black on white). One shape language: 6px rounded
   rectangles for buttons, selects and labelled selects; only the play button is round. */

/* ---------- Page and tokens ---------- */
.bn-app-page {
  --stage: var(--bn-stage); --surface: var(--bn-surface); --panel: var(--bn-surface-2); --line: var(--bn-line);
  --text: var(--bn-text); --muted: var(--bn-muted); --outline: var(--bn-outline);
  /* grid colours */
  --stage-text: var(--bn-text); --stage-muted: var(--bn-muted); --stage-ring: var(--bn-step-ring);
  --hit-hat: var(--bn-cymbal); --hit-tom: var(--bn-hit-tom); --hit-kick: var(--bn-kick);
  --ctl-h: 36px; --ctl-h-lg: 42px; --r: var(--bn-radius);
  /* Page column: the content's. The header has its own (--header-max, brand.css). */
  --page-max: 1180px; --gutter: clamp(1rem, 3vw, 2rem);
  /* Quiet borders of labelled selects, switches and menus: lifted a step from the brand's
     #5d6b78 so they reach 3:1 on the menu surface (contrast.test.js). */
  --bn-control-line: #6b7986;
  margin: 0; min-height: 100vh; background: var(--stage); color: var(--text);
  font: 400 1.0625rem/1.55 var(--bn-body);
}
.bn-app-page *, .bn-app-page *::before, .bn-app-page *::after { box-sizing: border-box; }
.bn-app-page :focus-visible { outline: 3px solid var(--bn-brass); outline-offset: 2px; }
.bn-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.bn-app-wrap { max-width: var(--page-max); margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) var(--gutter); }
.bn-app h1 { font: 700 clamp(2.4rem, 7vw, 4rem)/1 var(--bn-display); margin: 0 0 1rem; }
.bn-app p { color: var(--muted); max-width: 36rem; margin: 0 0 1.5rem; }
.bn-error { color: var(--bn-danger-text); margin: .5rem 0 0; }
.bn-notice { margin: 0 0 1rem; color: var(--bn-brass); }

/* ---------- Controls: one shape language ---------- */
.bn-app-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--ctl-h-lg);
  padding: .55rem .95rem; border: 1.5px solid var(--bn-btn-fill); border-radius: var(--r); cursor: pointer; white-space: nowrap;
  font: 600 1rem/1 var(--bn-body); text-decoration: none; background: var(--bn-btn-fill); color: var(--bn-btn-ink); }
.bn-app-btn:hover { background: var(--bn-btn-fill-hover); border-color: var(--bn-btn-fill-hover); }
.bn-app-btn-quiet { background: transparent; color: var(--text); border-color: var(--outline); }
.bn-app-btn-quiet:hover { background: transparent; border-color: var(--text); }
.bn-tool { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h); padding: .3rem .7rem;
  font: 600 .92rem/1 var(--bn-body); color: var(--text); background: transparent; cursor: pointer; white-space: nowrap;
  border: 1.5px solid var(--outline); border-radius: var(--r); }
.bn-tool:hover:not(:disabled) { border-color: var(--text); }
.bn-app-page button:disabled { opacity: .45; cursor: not-allowed; }
.bn-app-page select { min-height: var(--ctl-h); font: 600 .95rem/1.2 var(--bn-body); color: var(--text); background: var(--surface);
  border: 1.5px solid var(--outline); border-radius: var(--r); padding: .3rem .5rem; }
.bn-app-page select:disabled { opacity: .5; }
.bn-app-page select option { background: var(--panel); color: var(--text); }
.bn-tempo-number, .bn-ramp-number { width: 4rem; min-height: var(--ctl-h); text-align: center;
  font: 600 1rem/1 var(--bn-body); padding: .3rem .4rem; border-radius: var(--r); border: 1.5px solid var(--outline);
  background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }
/* Joined buttons: Undo|Redo */
.bn-tool-group { display: inline-flex; }
.bn-tool-group .bn-tool { border-radius: 0; margin-left: -1.5px; }
.bn-tool-group .bn-tool:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.bn-tool-group .bn-tool:last-child { border-radius: 0 var(--r) var(--r) 0; }
.bn-tool-group .bn-tool:hover:not(:disabled) { position: relative; z-index: 1; }
/* Labelled select: a rounded box with its name, then the select (Click, Loop, Count-in, Grid, Time, Plays) */
.bn-pill, .bn-bar-field { display: inline-flex; align-items: center; gap: .45rem; min-height: var(--ctl-h);
  padding: .1rem .25rem .1rem .7rem; border: 1.5px solid var(--bn-control-line); border-radius: var(--r); background: var(--panel); }
.bn-pill-name, .bn-bar-field-name { font: 600 .74rem/1 var(--bn-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bn-app-page .bn-pill select, .bn-app-page .bn-bar-field select { min-height: calc(var(--ctl-h) - 6px); border: 0; background: transparent;
  padding: .15rem .3rem; font-weight: 600; }
.bn-pill:hover, .bn-bar-field:hover { border-color: var(--outline); }
.bn-pill:focus-within, .bn-bar-field:focus-within { border-color: var(--bn-brass); }
.bn-app-page .bn-pill select:focus-visible, .bn-app-page .bn-bar-field select:focus-visible { outline: none; }
.bn-pill:focus-within, .bn-bar-field:focus-within { outline: 3px solid var(--bn-brass); outline-offset: 2px; }
.bn-pill-on, .bn-bar-field-on { border-color: var(--bn-brass); }
.bn-pill-on .bn-pill-name, .bn-bar-field-on .bn-bar-field-name { color: var(--bn-brass); }
/* Checkboxes and switches */
.bn-tool-toggle { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--ctl-h); color: var(--text); cursor: pointer; }
.bn-tool-toggle input { accent-color: var(--bn-brass-fill); width: 18px; height: 18px; margin: 0; }
.bn-switch { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--ctl-h); padding: .2rem .7rem; cursor: pointer;
  border: 1.5px solid var(--bn-control-line); border-radius: var(--r); background: var(--panel); font: 600 .95rem/1 var(--bn-body); color: var(--text); }
.bn-switch input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 34px; height: 20px; border-radius: 99px;
  background: var(--bn-switch-off); position: relative; cursor: pointer; }
.bn-switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bn-switch-knob); transition: transform .12s; }
.bn-switch input:checked { background: var(--bn-brass-fill); }
.bn-switch input:checked::after { transform: translateX(14px); background: var(--bn-brass-ink); }

/* ---------- Transport (Scribe and Player) ---------- */
.bn-transport { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1.1rem; }
.bn-play { width: 50px; height: 50px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--bn-brass-fill); color: var(--bn-brass-ink); }
.bn-play:hover { background: var(--bn-brass-fill-hover); }
.bn-play svg { width: 22px; height: 22px; }
.bn-play-count { font: 700 1.5rem/1 var(--bn-display); font-variant-numeric: tabular-nums; }
/* Sliders (tempo, swing), drawn here so they are the accent fill in both themes: with accent-color,
   browsers turn the track dark behind a light accent. --fill is how far along the value is (set by
   the component); Firefox has its own progress part. */
.bn-app-page input[type="range"] { -webkit-appearance: none; appearance: none; width: clamp(110px, 14vw, 200px); height: 20px; margin: 0;
  background: transparent; cursor: pointer; --range-rest: color-mix(in srgb, var(--bn-outline) 45%, transparent); }
.bn-app-page input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px;
  background: linear-gradient(to right, var(--bn-brass-fill) var(--fill, 50%), var(--range-rest) var(--fill, 50%)); }
.bn-app-page input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5.5px;
  border: 0; border-radius: 50%; background: var(--bn-brass-fill); }
.bn-app-page input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--range-rest); }
.bn-app-page input[type="range"]::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--bn-brass-fill); }
.bn-app-page input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--bn-brass-fill); }
.bn-app-page input[type="range"]:hover::-webkit-slider-thumb { background: var(--bn-brass-fill-hover); }
.bn-app-page input[type="range"]:hover::-moz-range-thumb { background: var(--bn-brass-fill-hover); }
.bn-app-page input[type="range"]:focus-visible { outline: 2px solid var(--bn-brass); outline-offset: 3px; border-radius: 4px; }
.bn-app-page input[type="range"]:disabled { opacity: .5; cursor: default; }
/* Tempo, its box and −5 / +5 / Tap sit together as one group (role="group", "Tempo"). */
.bn-tap.bn-tapping { border-color: var(--bn-brass); color: var(--bn-brass); }
.bn-swing-value { min-width: 3ch; text-align: right; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.bn-swing-off .bn-swing-value { font-weight: 400; color: var(--muted); }
.bn-ramp-badge { font: 600 .9rem/1.2 var(--bn-body); color: var(--bn-brass-ink); background: var(--bn-brass-fill); border-radius: var(--r);
  padding: .3rem .6rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Player page ---------- */
.bn-player .bn-app-wrap { padding-top: clamp(1.5rem, 4vw, 2.5rem); }
.bn-player .bn-scribe-controls { margin-bottom: 0; }
.bn-player .bn-scribe-workspace { padding-top: 1.2rem; }
.bn-player-status { color: var(--muted); }

/* ---------- Focus while playing, Practice view and Studio (composables/use-practice-focus.js) ----------
   Two bars: the playing bar (larger) and the next one, under one slim row; the site header (not in View),
   title, notation (except in the Studio while playing), footer and the rest step aside until you stop. */
html.bn-practice-focus:not(.bn-practice-view, :has(main.bn-session)) .bn-topbar { display: none; }
/* The footer: in View too, except while it plays. */
html.bn-practice-focus:is(:not(.bn-practice-view), :has(main.bn-playing)) .bn-footer { display: none; }
/* View is a screen: less room under the grid, so the footer sits in view when the groove fits. */
.bn-scribe.bn-viewing .bn-app-wrap { padding-bottom: 1.5rem; }
/* The Studio keeps the site header (logo, Studio, theme, settings). With its controls off, the controls
   bar holds the light controls (the slim row), playing or not. */
/* A live session's player screen (bn-session) keeps the site header and its spacing: it's a display,
   and pressing Play on the editor screen shouldn't make it jump. (It has no title block to hide.) */
.bn-focus .bn-player-head, .bn-focus .bn-scribe-side, .bn-focus .bn-notices { display: none; }
/* The Studio keeps its notation card while playing (Show > Notation on), as a strip stuck to the top
   of the page, or the bottom if pinned (notation_view.js `docked`), in View too; and View shows it,
   stopped, as the editor does. */
.bn-focus.bn-focus-notation .bn-scribe-side, .bn-viewing:not(.bn-playing) .bn-scribe-side { display: block; }
/* Settings > While playing, "Notation": while playing, the full notation card instead of the grid
   (scribe_page.js notationOnly), under the slim row and as tall as the screen allows; its paper
   scrolls to keep the sounding line in view (notation_view.js follow). */
.bn-focus.bn-focus-notation-only .bn-scribe-side { display: block; order: 2; }
.bn-focus-notation-only .bn-scribe-main .bn-editor { display: none; }
/* The Studio's extras too: its title block, the keys, + Add measure, and each bar's fields and ⋯ menu
   (editing the two bars shown still works). */
.bn-focus:not(.bn-view-head) .bn-scribe-head, .bn-focus .bn-key, .bn-focus:not(.bn-viewing.bn-focus-controls) .bn-add-bar { display: none; }
/* (+ Add measure, + Toms and + Sticking come back in View with its controls on.) */
/* View's title block (M): as in the editor, same spacing. */
/* Each bar's fields, ⋯ menu and beat-grid labels: gone in View; while playing in the editor,
   hidden but keeping their room, so pressing play doesn't change a bar's size. */
.bn-viewing:not(.bn-focus-controls, .bn-view-keep-room) :is(.bn-bar-fields, .bn-beat-grid-label, .bn-beat-grids) { display: none; }
/* The ⋯ menu goes with them, but its place stays: the measure's quick actions (loop, insert,
   duplicate, delete) live in it, and come back under the pointer with the controls off. */
.bn-viewing:not(.bn-focus-controls) .bn-bar-menu { visibility: hidden; }
/* Playing in View with the controls on (hidden for the play): the bar's fields and ⋯ menu keep their
   room, so pressing play doesn't change a bar's size. */
.bn-view-keep-room:not(.bn-focus-controls) :is(.bn-bar-fields, .bn-beat-grid-label, .bn-beat-grids) { visibility: hidden; }
.bn-focus .bn-app-wrap { padding-top: .75rem; }
/* (:where keeps this rule's weight as it was: later rules for the Studio and the embed still win.) */
.bn-focus:where(:not(.bn-session)) .bn-scribe-workspace { padding-top: 1rem; }
.bn-focus:not(.bn-focus-controls) .bn-scribe-controls:not(.bn-session-readout) > :not(.bn-focus-bar) { display: none; }
.bn-focus-bar { display: flex; flex-wrap: nowrap; align-items: center; gap: .6rem 1rem; }
.bn-focus-tempo { display: inline-flex; align-items: center; gap: .5rem; }
.bn-focus-bpm, .bn-focus-where { font: 700 1.4rem/1 var(--bn-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bn-focus-bpm small, .bn-focus-where small { font-size: .95rem; color: var(--muted); }
.bn-focus-end { display: flex; gap: .5rem; margin-left: auto; }
.bn-focus-narrow { display: none; }
/* With Controls open, the full rows have Play and the tempo: the slim row keeps just where you are. */
.bn-focus-controls .bn-focus-bar .bn-play, .bn-focus-controls .bn-focus-bar .bn-focus-tempo { display: none; }
.bn-grid-bar.bn-focus-hidden { display: none; }
.bn-grid-bar.bn-focus-now { order: 0; }
.bn-grid-bar.bn-focus-next { order: 1; opacity: .6; }
/* View's notes are the editor's size, playing or not: pressing play never changes a bar's size. */
.bn-grid-bar-next { font: 600 .8rem/1 var(--bn-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bn-focus:not(.bn-viewing.bn-focus-controls) .bn-mute { visibility: hidden; } /* View with its controls on keeps them */
@media (max-width: 600px) {
  .bn-focus-bar { gap: .4rem; }
  .bn-focus-bar .bn-play { width: 44px; height: 44px; }
  .bn-focus-bar .bn-tool { padding: .3rem .5rem; }
  .bn-focus-tempo { gap: .3rem; }
  .bn-focus-bpm, .bn-focus-where { font-size: 1.15rem; }
  .bn-focus-bpm small, .bn-focus-wide { display: none; }
  .bn-focus-narrow { display: inline; }
  .bn-focus-where small { font-size: .85rem; }
  .bn-focus-end { gap: .35rem; }
}

.bn-player-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem 2rem; padding: 1rem 0 .75rem; }
.bn-player-head h1 { color: var(--bn-title); margin: 0; font-size: clamp(1.9rem, 4.5vw, 2.5rem); line-height: 1.05; } /* the Studio's title size */
.bn-player-head p { margin: .3rem 0 0; }
.bn-player-artist { font: 600 1.15rem/1.2 var(--bn-display); letter-spacing: .03em; color: var(--text); }
.bn-player-facts { font-size: .95rem; }
.bn-player-comments { font-size: .95rem; color: var(--text); margin-top: .3rem; max-width: 60ch; }
.bn-player-empty { max-width: 40rem; }

/* ---------- Play page (/play/?<groove>, play_page.js): a shared groove to read and play along with ----------
   One centred column, the width of a printed page and a bit: the title, the controls, the notation, the grid. */
.bn-page-player:has(.bn-play-page) { --page-max: 1100px; }
.bn-play-head { text-align: center; padding: .25rem 0 1.5rem; }
.bn-play-head h1 { color: var(--bn-title); margin: 0; font-size: clamp(2.1rem, 6vw, 3.2rem); line-height: 1.05; text-wrap: balance; }
.bn-play-head p { margin: .4rem auto 0; }
.bn-play-head .bn-player-comments { margin: .8rem auto 0; max-width: 60ch; }
.bn-show-value { margin-left: .4rem; color: var(--bn-brass); } /* Show's choice, on its button: Both, Notation or Grid */
.bn-play-page .bn-show .bn-choice { margin-bottom: .6rem; }
.bn-play-page .bn-pin { display: none; } /* nothing to edit, so nothing to keep the notation in view of */
.bn-play-page .bn-play-foot { margin: 0 auto; text-align: center; color: var(--muted); font-size: .95rem; }
.bn-play-foot a { color: var(--text); }
/* The embeddable player (/embed/, play_page.js with embed): the same page in someone else's <iframe>,
   so tight to the frame's edges -- the title on one line, Play and the tempo, the groove, one link out. */
.bn-page-embed { --gutter: .75rem; }
.bn-embed .bn-app-wrap { max-width: none; padding: .6rem var(--gutter) .75rem; }
.bn-embed .bn-play-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .7rem; text-align: left; padding: 0 0 .6rem; }
.bn-embed .bn-play-head h1 { font-size: 1.5rem; text-wrap: wrap; }
.bn-embed .bn-play-head p { margin: 0; }
.bn-embed .bn-player-artist { font-size: 1rem; color: var(--muted); }
.bn-embed .bn-scribe-workspace { padding: .75rem 0 0; gap: .75rem; }
.bn-embed .bn-notation { padding: .5rem; }
.bn-embed .bn-notation-head { display: none; } /* no Download, Print or Key in the frame: the play page has them */
.bn-embed-out { margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.bn-embed-out:hover { color: var(--text); }

/* The Grooves page (/grooves/, entries/bn-grooves.js): every preset in a framed player, two to a row
   where there's room. Each frame is as tall as its embed code says, so the cards in a row can differ. */
.bn-grooves-head { max-width: 62ch; padding-bottom: 1rem; }
.bn-grooves-head h1 { color: var(--bn-title); }
.bn-grooves-head p { margin: 0 0 .5rem; color: var(--muted); }
.bn-grooves-head a, .bn-grooves-code summary { color: var(--text); }
.bn-grooves-group h2 { font: 700 1.6rem/1.15 var(--bn-display); margin: 2rem 0 .9rem; }
.bn-grooves-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); gap: 1.5rem; align-items: start; }
.bn-grooves-card { margin: 0; min-width: 0; }
.bn-grooves-frame { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.bn-grooves-frame iframe { display: block; }
.bn-grooves-note { margin: .5rem 0 0; color: var(--muted); font-size: .95rem; }
.bn-grooves-code { margin-top: .35rem; font-size: .95rem; }
.bn-grooves-code summary { cursor: pointer; width: fit-content; }
.bn-grooves-code textarea { display: block; width: 100%; margin: .5rem 0; padding: .5rem .7rem; resize: vertical; border-radius: var(--r);
  border: 1px solid var(--bn-control-line); background: var(--surface); color: var(--text); font: 400 .85rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.bn-notices { margin-top: 1rem; color: var(--muted); font-size: .95rem; }
.bn-notices summary { cursor: pointer; }
.bn-notices ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.bn-practice { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; margin: 0 0 1rem; padding: .7rem .9rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.bn-play-area { position: relative; }
/* Live lesson: a strip across the top of both screens saying which one this is -- green for
   the teacher's (the Studio), brass for the dual screen by the drums -- with the lesson's code,
   the same on both, to match them up. */
.bn-role-strip { --role: var(--bn-kick); --role-ink: var(--bn-kick);
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .9rem; margin: .6rem 0 .9rem;
  padding: .45rem .6rem .45rem .9rem; border-radius: var(--r); font-size: .95rem; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--role) 50%, transparent); border-left: 6px solid var(--role);
  background: color-mix(in srgb, var(--role) 13%, var(--surface)); }
.bn-role-strip[data-role="dual"] { --role: var(--bn-brass-fill); --role-ink: var(--bn-brass); }
.bn-role-name { font: 700 1.05rem/1.1 var(--bn-display); text-transform: uppercase; letter-spacing: .05em; color: var(--role-ink); }
.bn-role-what { color: var(--muted); }
.bn-role-code { padding: .1rem .55rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--role) 60%, transparent);
  font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .04em; white-space: nowrap; }
button.bn-role-code { background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
button.bn-role-code:hover { background: color-mix(in srgb, var(--role) 22%, transparent); }
button.bn-role-code:focus-visible { outline: 2px solid var(--role-ink); outline-offset: 2px; }
.bn-role-note { margin-left: auto; font-weight: 600; color: var(--bn-warn); }
.bn-role-strip[data-note="ended"] .bn-role-note { color: var(--text); }
.bn-role-strip .bn-lesson-bar { margin: 0 0 0 auto; }
/* The player screen's header and footer are the page's colour, not bars of their own: a display,
   with as little as possible around the groove. (bn-page-session: bn-player.js puts it on <body>
   before anything is drawn; a shared groove's play page, also at /play/, keeps its bars.)
   The header's hairline goes too; the tempo band under it has its own. */
.bn-page-session :is(.bn-topbar, .bn-footer) { background: var(--stage); }
.bn-page-session .bn-topbar { box-shadow: none; }
/* The player screen has a pin in the site header instead (player_page.js, in the header's
   bn-header-slot): a quiet pill, with the session's details in a tip under it on hover, focus or
   tap. A note (editor screen gone, session ended, muted) shows beside it, cut short if there's no room. */
.bn-header-slot { display: flex; justify-content: flex-end; flex: 1 1 0; min-width: 0; }
.bn-role-pin { --role: var(--bn-brass-fill); position: relative; display: flex; align-items: center; gap: .7rem; min-width: 0; }
.bn-role-pin .bn-role-name { display: inline-flex; flex: none; align-items: center; gap: .45rem; padding: .32rem .7rem .32rem .6rem;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--role) 45%, transparent);
  font: 600 .8rem/1 var(--bn-display); letter-spacing: .08em; color: var(--bn-header-muted); white-space: nowrap; cursor: default; }
.bn-role-pin .bn-role-name:focus-visible { outline: 2px solid var(--bn-brass-brand); outline-offset: 2px; }
.bn-role-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--role); }
.bn-role-pin[data-note="warn"] { --role: var(--bn-warn); }
.bn-role-pin[data-note="ended"] { --role: var(--bn-header-muted); }
.bn-role-pin .bn-role-note { margin-left: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.bn-role-pin[data-note="ended"] .bn-role-note { color: var(--bn-header-text); }
.bn-role-tip { display: none; position: absolute; right: 0; top: calc(50% + var(--bn-header-h) / 2 + 8px); z-index: 50;
  flex-direction: column; gap: .3rem; width: max-content; max-width: min(19rem, calc(100vw - 2rem)); box-sizing: border-box;
  padding: .7rem .85rem; border-radius: 12px; border: 1px solid var(--bn-popover-line); background: var(--bn-popover-bg);
  color: var(--bn-text); box-shadow: 0 14px 36px var(--bn-popover-shadow); font: 400 .9rem/1.35 var(--bn-body); }
.bn-role-pin .bn-role-name:is(:hover, :focus) ~ .bn-role-tip { display: flex; }
.bn-role-tip .bn-role-code { padding: 0; border: 0; border-radius: 0; font: 700 1.05rem/1.1 var(--bn-display); letter-spacing: .05em; text-transform: uppercase; }
.bn-role-tip .bn-role-what { color: var(--bn-muted); }
.bn-role-tip-note { font-weight: 600; }
/* Phones: no room for the note beside the pin (its colour still changes, and the tip has the note),
   and the tip runs the width of the screen, under the header. */
@media (max-width: 600px) {
  .bn-topbar-inner:has(.bn-header-slot) { position: relative; }
  .bn-role-pin { position: static; }
  .bn-role-pin .bn-role-note { display: none; }
  .bn-role-tip { left: 1rem; right: 1rem; top: calc(100% + 8px); width: auto; max-width: none; }
}
/* Live session, player screen: tempo and swing read out large, in place of the controls */
.bn-scribe-controls.bn-session-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 2.5rem; padding-block: 1rem; }
.bn-readout { display: flex; align-items: baseline; gap: .7rem; }
.bn-readout-name { color: var(--muted); font: 600 .8rem/1 var(--bn-body); letter-spacing: .08em; text-transform: uppercase; }
.bn-readout-value { font: 700 2.4rem/1 var(--bn-display); font-variant-numeric: tabular-nums; color: var(--text); }
.bn-readout-value small { margin-left: .3rem; font-size: 1rem; color: var(--muted); }
/* Live lesson, dual screen: the prompt to allow sound */
/* Until sound is on, the whole player screen asks for a click: a dimmed backdrop and a large
   brass card. Playing without sound, it pulses. */
.bn-sound-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1.5rem;
  background: var(--bn-backdrop); }
.bn-sound-prompt { display: grid; justify-items: center; gap: .9rem; max-width: 34rem; margin: 0; padding: 2.4rem 2.6rem;
  border: 0; border-radius: 20px; background: var(--bn-brass-fill); color: var(--bn-brass-ink); text-align: center;
  font: inherit; cursor: pointer; box-shadow: 0 18px 50px var(--bn-shadow); }
.bn-sound-prompt:hover { background: var(--bn-brass-fill-hover); }
.bn-sound-prompt:focus-visible { outline: 3px solid var(--bn-text); outline-offset: 4px; }
.bn-sound-title { font: 700 clamp(1.6rem, 4.5vw, 2.4rem)/1.15 var(--bn-display); }
.bn-sound-hint { font-size: 1.05rem; opacity: .8; }
.bn-sound-prompt[data-urgent="true"] { outline: 4px solid var(--bn-brass-fill); outline-offset: 6px; }
@media (prefers-reduced-motion: no-preference) {
  .bn-sound-prompt[data-urgent="true"] { animation: bn-sound-pulse .8s ease-in-out infinite alternate; }
}
@keyframes bn-sound-pulse { to { outline-offset: 16px; } }
.bn-play:disabled { opacity: .45; cursor: not-allowed; }
.bn-count-in { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font: 700 clamp(5rem, 18vw, 9rem)/1 var(--bn-display); color: var(--bn-brass);
  background: color-mix(in srgb, var(--stage) 72%, transparent); border-radius: 8px; }
/* The count-in (View and the editor): pinned to the middle of the screen (the grid may be taller than it), a rounded
   panel over the grid. Its own rule, not .bn-count-in's (that one covers its whole container). */
.bn-count-in-view { position: fixed; top: 50%; left: 50%; z-index: 30; transform: translate(-50%, -50%);
  display: grid; place-items: center; min-width: 1.6em; padding: .1em .35em; pointer-events: none;
  font: 700 clamp(5rem, 18vw, 9rem)/1 var(--bn-display); color: var(--bn-brass);
  border-radius: 16px; background: color-mix(in srgb, var(--stage) 85%, transparent);
  box-shadow: 0 6px 28px color-mix(in srgb, #000 18%, transparent); }
.bn-play-status { min-height: 1.5em; margin: .5rem 0 0; color: var(--muted); font-size: .95rem; }
.bn-bar-play { background: transparent; border: 1px solid transparent; border-radius: 4px; color: inherit; font: inherit;
  padding: .1rem .4rem; cursor: pointer; }
.bn-bar-play:hover { border-color: var(--bn-brass); color: var(--bn-brass); }

/* ---------- Scribe: title area ---------- */
/* The editor and the Practice view (Player) share one wide column, so measures have room.
   The header's column (brand.css) is the same width. */
.bn-page-scribe, .bn-page-player { --page-max: 1680px; }
.bn-scribe .bn-app-wrap { padding-top: 0; }
.bn-scribe-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem 1.5rem; padding: 1rem 0 .75rem; }
.bn-scribe-names { flex: 1 1 20rem; min-width: 0; }
/* Title and artist: inline inputs with a pencil, underlined on hover and focus */
.bn-editable { position: relative; display: flex; align-items: center; gap: .4rem; width: fit-content; max-width: 100%; }
.bn-title-input, .bn-artist-input, .bn-comments-input { background: transparent; color: var(--text); border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: .1rem 0; min-width: 8ch; max-width: min(40rem, 100%); field-sizing: content; }
.bn-title-input { color: var(--bn-title); font: 700 clamp(1.9rem, 4.5vw, 2.5rem)/1.05 var(--bn-display); }
/* Artist · comment on one quiet line; empty, each is a "+ Add …" link that opens its box. */
.bn-scribe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .5rem; margin-top: .15rem; }
.bn-meta-sep { color: var(--muted); }
.bn-add-meta { min-height: 1.9rem; padding: 0; border: 0; background: transparent; cursor: pointer;
  font: 400 .95rem/1.2 var(--bn-body); color: var(--muted); }
.bn-add-meta:hover { color: var(--bn-brass); text-decoration: underline; text-underline-offset: 3px; }
.bn-artist-input { font: 600 1.1rem/1.2 var(--bn-display); letter-spacing: .03em; color: var(--muted); }
.bn-comments-input { font-size: .95rem; color: var(--text); }
.bn-title-input::placeholder, .bn-artist-input::placeholder, .bn-comments-input::placeholder { color: var(--muted); opacity: 1; }
.bn-title-input:hover, .bn-artist-input:hover, .bn-comments-input:hover { border-bottom-color: var(--line); }
.bn-app-page .bn-title-input:focus, .bn-app-page .bn-artist-input:focus, .bn-app-page .bn-comments-input:focus { outline: none; border-bottom-color: var(--bn-brass); }
.bn-edit-icon { color: var(--muted); font-size: 1rem; pointer-events: none; flex: none; }
.bn-editable-title .bn-edit-icon { font-size: 1.1rem; }
.bn-editable:hover .bn-edit-icon, .bn-editable:focus-within .bn-edit-icon { color: var(--bn-brass); }
/* Save state: Not saved yet / Unsaved changes / Saved */
.bn-scribe-state { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 0; font-size: .95rem; color: var(--muted); }
.bn-state-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bn-unsaved); flex: none; }
.bn-scribe-state[data-state="saved"] .bn-state-dot { background: var(--bn-kick); }
/* Live lesson, in the teacher's role strip: one compact bar -- status, a Live / Hold changes
   toggle, Send (only when there's something to send) and a quiet End lesson. */
.bn-lesson-bar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  padding: .3rem .35rem .3rem .4rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: .9rem; color: var(--muted); }
.bn-lesson-bar .bn-state-dot { background: var(--muted); }
.bn-lesson-bar[data-connected="true"] .bn-state-dot { background: var(--bn-brass-fill); }
.bn-lesson-bar[data-unsent="true"] .bn-state-dot { background: var(--bn-unsaved); }
.bn-lesson-status { color: var(--text); }
/* The status is a button to the player screen: dot, words and a small arrow. */
.bn-lesson-go { display: inline-flex; align-items: center; gap: .5rem; min-height: 28px; padding: .15rem .55rem .15rem .4rem;
  border: 0; border-radius: 999px; background: none; font: inherit; cursor: pointer; }
.bn-lesson-go:hover { background: var(--stage); }
.bn-lesson-go:hover .bn-lesson-status { text-decoration: underline; text-underline-offset: 3px; }
.bn-lesson-go:focus-visible { outline: 2px solid var(--bn-brass); outline-offset: 2px; }
.bn-lesson-go-arrow { color: var(--muted); font-size: .85em; }
.bn-lesson-mode { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--stage); border: 1px solid var(--line); }
.bn-lesson-mode button, .bn-lesson-send, .bn-lesson-end { min-height: 28px; padding: .2rem .75rem; border-radius: 999px;
  font: 600 .85rem/1 var(--bn-body); cursor: pointer; }
.bn-lesson-mode button { border: 0; background: transparent; color: var(--muted); }
.bn-lesson-mode button:hover { color: var(--text); }
/* Ink on a brass fill as on the app's buttons (--bn-btn-ink): dark in both themes. */
.bn-lesson-mode button[aria-pressed="true"] { background: var(--bn-brass-fill); color: var(--bn-btn-ink); }
.bn-lesson-send { border: 1.5px solid var(--bn-brass-fill); background: var(--bn-brass-fill); color: var(--bn-btn-ink); }
.bn-lesson-send:hover { background: var(--bn-brass-fill-hover); border-color: var(--bn-brass-fill-hover); }
.bn-lesson-end { border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.bn-lesson-end:hover { color: var(--text); }
.bn-scribe-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
/* "More" menu (Groove Scribe links, library) */
.bn-more { position: relative; }
.bn-more-list { right: 0; top: calc(100% + .3rem); min-width: 15rem; width: max-content; max-width: calc(100vw - 2rem); }
.bn-more-list a { display: flex; align-items: center; text-decoration: none; color: var(--text); border-radius: 4px;
  padding: .5rem .7rem; font: 500 .95rem/1.2 var(--bn-body); }

/* ---------- Scribe: controls bar (sticky, three rows) ---------- */
.bn-scribe-controls { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
  background: var(--bn-glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bn-controls-row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1.1rem; padding: .6rem 0; }
.bn-controls-row + .bn-controls-row { border-top: 1px solid var(--line); }
.bn-scribe-transport { display: block; }
/* Clear all, last in More: it asks first, in place of the menu. */
.bn-more-list .bn-clear-all:hover:not(:disabled), .bn-more-list .bn-clear-all:focus-visible { color: var(--bn-danger-text); }
.bn-more-list.bn-clear-confirm { gap: .7rem; padding: .8rem; color: var(--text); font-size: .95rem; }
.bn-clear-confirm-buttons { display: flex; gap: .5rem; }
.bn-more-list .bn-clear-confirm-buttons .bn-tool { flex: 1; justify-content: center; padding: .3rem .7rem; border: 1.5px solid var(--outline);
  border-radius: var(--r); font: 600 .92rem/1 var(--bn-body); }
.bn-more-list .bn-clear-confirm-buttons .bn-tool-danger-confirm { border-color: var(--bn-danger); color: var(--bn-danger-text); }
.bn-more-list .bn-clear-confirm-buttons .bn-tool-danger-confirm:hover { background: color-mix(in srgb, var(--bn-danger) 22%, transparent); }

/* ---------- Scribe: workspace (notation card above the grid) ---------- */
.bn-scribe-workspace { display: flex; flex-direction: column; gap: 1.2rem; padding: 1.4rem 0 2rem; }
.bn-scribe-main { order: 1; min-width: 0; }
.bn-scribe-side { order: 0; min-width: 0; }
/* Pinned: after the grid, docked to the bottom of the screen while it scrolls, up to 38% of
   the height (the paper scrolls inside), clear of the home indicator. */
.bn-scribe-side:has(.bn-notation-pinned) { order: 2; position: sticky; z-index: 7; bottom: env(safe-area-inset-bottom, 0px); }
.bn-notation-pinned { max-height: 38vh; display: flex; flex-direction: column; border-color: var(--bn-control-line);
  box-shadow: 0 -10px 24px var(--bn-shadow); }
.bn-notation-pinned .bn-notation-paper { min-height: 0; overflow-y: auto; }
/* Playing in the Studio (scribe_page.js notationDocked): the card is a strip, one line of music high
   (--bn-notation-line, notation_view.js), that moves on with the playhead; no title, buttons or key, and the
   grid keeps its usual note size. It stays where it is for editing: at the top of the page, stuck
   under the controls bar while the grid scrolls beneath it; pinned, at the bottom as above. */
.bn-scribe-side:has(.bn-notation-top) { position: sticky; z-index: 7; top: calc(env(safe-area-inset-top, 0px) + var(--bn-sticky-top, 0px)); }
.bn-notation-top { border-color: var(--bn-control-line); box-shadow: 0 10px 24px var(--bn-shadow); }
.bn-focus-notation .bn-notation-head, .bn-focus-notation .bn-notation-legend { display: none; }
.bn-focus-notation .bn-notation { padding: .35rem .5rem; }
.bn-focus-notation .bn-notation-paper { padding: 0 .5rem; max-height: var(--bn-notation-line, 38vh); overflow: hidden; }
.bn-focus-notation-only .bn-notation-head, .bn-focus-notation-only .bn-notation-legend { display: none; }
.bn-focus-notation-only .bn-notation-paper { max-height: calc(100dvh - 9rem); overflow-y: auto; }
/* A live session's player screen is a display: its notation card (shown when the editor screen's is)
   is just the music, with no "Notation" title, Download, Print, Key or Pin, and with the playing
   strip's spacing (above) stopped too, so the music and the grid under it stay put on Play. */
.bn-session .bn-notation-head, .bn-session .bn-notation-legend { display: none; }
.bn-session .bn-notation { padding: .35rem .5rem; }
.bn-session .bn-notation-paper { padding: 0 .5rem; }
/* Controls off (C, or Show > Controls): the card keeps its title and the music, without its buttons. */
.bn-focus:not(.bn-focus-controls) .bn-notation-actions { display: none; }
/* The Studio keeps the site header while playing (the player screen doesn't): clear it too. */
html.bn-practice-view .bn-focus-notation-only .bn-notation-paper { max-height: calc(100dvh - 9rem - var(--bn-header-h)); }
.bn-pin[aria-pressed="true"] { border-color: var(--bn-brass); color: var(--bn-brass); }
/* The notation card: a stage card holding the paper; sized to its content. */
.bn-notation { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem 1rem; }
.bn-notation-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.bn-notation-head h2 { margin: 0 auto 0 0; font: 700 1.3rem/1 var(--bn-display); letter-spacing: .04em; color: var(--text); }
.bn-notation-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.bn-notation-paper { --ink: var(--bn-ink); background: var(--bn-paper); color: var(--ink); border-radius: 4px; padding: .7rem .6rem .3rem;
  box-shadow: 0 6px 18px var(--bn-shadow); }
.bn-notation-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.bn-notation-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .25rem 1.2rem;
  margin: .5rem 0 .3rem; padding-top: .5rem; border-top: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); font-size: .85rem; }
.bn-notation-legend div { display: flex; gap: .4rem; }
.bn-notation-legend dt { font-weight: 700; flex: none; }
.bn-notation-legend dt::after { content: ':'; }
.bn-notation-legend dd { margin: 0; }
.bn-key-toggle[aria-pressed="true"] { border-color: var(--bn-brass); color: var(--bn-brass); }
.bn-notation-svg .bn-n-staff, .bn-notation-svg .bn-n-ledger, .bn-notation-svg .bn-n-bar { stroke: var(--ink); stroke-width: 1; fill: none; }
.bn-notation-svg .bn-n-bar { stroke-width: 1.3; }
.bn-notation-svg .bn-n-head, .bn-notation-svg .bn-n-dot { fill: var(--ink); }
.bn-notation-svg .bn-n-clef { stroke: var(--ink); stroke-width: 1.8; fill: none; }
.bn-notation-svg .bn-n-tri { stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; fill: none; }
.bn-notation-svg .bn-n-x { stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.bn-notation-svg .bn-n-ring { stroke: var(--ink); stroke-width: 1.1; fill: none; }
.bn-notation-svg .bn-n-stem { stroke: var(--ink); stroke-width: 1.2; }
.bn-notation-svg .bn-n-beam { stroke: var(--ink); stroke-width: 4.2; }
.bn-notation-svg .bn-n-grace-beam { stroke: var(--ink); stroke-width: 1.6; }
.bn-notation-svg .bn-n-accent { stroke: var(--ink); stroke-width: 1.6; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.bn-notation-svg .bn-n-slur, .bn-notation-svg .bn-n-bracket { stroke: var(--ink); stroke-width: 1; fill: none; }
.bn-notation-svg .bn-n-beam-thin, .bn-notation-svg .bn-n-flag { stroke: var(--ink); stroke-width: 1.8; fill: none; }
.bn-notation-svg .bn-n-rest { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.bn-notation-svg text { fill: var(--ink); text-anchor: middle; }
.bn-notation-svg .bn-n-sig { font: 700 22px/1 var(--bn-display); }
.bn-notation-svg .bn-n-repeat { font: 700 14px/1 var(--bn-display); text-anchor: start; }
.bn-notation-svg .bn-n-mark { font: 700 13px/1 var(--bn-body); }
.bn-notation-svg .bn-n-tuplet { font: italic 600 12px/1 var(--bn-body); }
.bn-notation-svg .bn-n-stick { font: 600 14px/1 var(--bn-body); }
.bn-notation-svg .bn-n-paren { font: 400 12px/1 var(--bn-body); text-anchor: start; }
/* The playhead markers stay invisible (they're only there to follow-scroll to): the sounding
   notes light up and nothing else. */
.bn-notation-svg .bn-ph { stroke: none; }
/* Only the heads that sound (.bn-n-h, one per row): a silenced row's heads stay ink. */
.bn-notation-svg .bn-n-h.bn-on .bn-n-head, .bn-notation-svg .bn-n.bn-on .bn-n-dot { fill: var(--bn-notation-now); }
.bn-notation-svg .bn-n-h.bn-on .bn-n-x, .bn-notation-svg .bn-n-h.bn-on .bn-n-tri { stroke: var(--bn-notation-now); }
/* Settings > Grid, "Black notes": the sounding notes stay ink. */
.bn-notation-paper.bn-notation-ink-only { --bn-notation-now: var(--ink); }
/* Settings > While playing, "Playing note: Glow": no gold; the sounding heads grow a little and get a yellow backlight. */
.bn-notation-paper.bn-no-highlight { --bn-notation-now: var(--ink); }
/* Bolder than the grid's (notation heads are small): it grows more, under a wide halo, so it can be followed
   from the drum stool. */
.bn-notation-paper.bn-no-highlight .bn-n-h.bn-on { transform-box: fill-box; transform-origin: center; transform: scale(1.45);
  /* and a soft yellow backlight round it; the head itself stays ink (teacher feedback: helps students follow along) */
  filter: drop-shadow(0 0 3px var(--bn-playhead-backlight)) drop-shadow(0 0 6px var(--bn-playhead-backlight))
    drop-shadow(0 0 12px var(--bn-playhead-backlight)) drop-shadow(0 0 18px color-mix(in srgb, var(--bn-playhead-backlight) 70%, transparent)); }

/* ---------- Grid (Scribe editor and Player) ---------- */
.bn-grid-view { --label-w: 8.6rem; color: var(--stage-text); }
@media (max-width: 600px) { .bn-grid-view { --label-w: 4.6rem; } }
.bn-grid-bars { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
/* View playing round: "From the top" between the last bar and the first (helpers/follow-playhead.js). */
.bn-loop-divider { display: none; order: 1; flex: none; width: 100%; align-items: center; gap: .75rem; padding: .25rem 0;
  color: var(--muted); font: 600 .8rem/1 var(--bn-display); letter-spacing: .08em; text-transform: uppercase; }
.bn-loop-divider.bn-loop-on { display: flex; }
.bn-loop-divider::before, .bn-loop-divider::after { content: ""; flex: 1; border-top: 1px dashed color-mix(in srgb, var(--bn-brass) 45%, var(--line)); }
/* Each measure is one card (the Scribe has no outer panel). Natural width: labels plus
   up to --bn-step-size circles; it shrinks to fit, circles flexing with equal gaps. */
/* Soft brass edge: a brass-tinted border, a line of light across the top that fades at both ends
   and a faint glow under it; brighter on the bar that's playing. --sheen sets the strength. */
.bn-grid-bar { --card: var(--surface); --sheen: 1; min-width: 0; padding: .8rem 1rem 1rem; border-radius: 8px;
  --card-sheen:
    linear-gradient(90deg, transparent 6%, color-mix(in srgb, var(--bn-brass) calc(var(--sheen) * 55%), transparent) 50%, transparent 94%) top / 100% 1px no-repeat scroll,
    radial-gradient(55% 3.5rem at 50% 0, color-mix(in srgb, var(--bn-brass) calc(var(--sheen) * var(--glow, 7%)), transparent), transparent) top / 100% 3.5rem no-repeat scroll;
  border: 1px solid color-mix(in srgb, var(--bn-brass) calc(var(--sheen) * 16%), var(--line)); background: var(--card-sheen), var(--card);
  transition: border-color .3s;
  flex: 1 1 calc(var(--label-w) + .6rem + var(--steps) * var(--bn-step-size) + (var(--steps) - 1) * var(--bn-step-gap)
    + (var(--beats) - 1) * var(--bn-beat-gap) + 2rem + 2px);
  max-width: min(100%, calc(var(--label-w) + .6rem + var(--steps) * var(--bn-step-size) + (var(--steps) - 1) * var(--bn-step-gap)
    + (var(--beats) - 1) * var(--bn-beat-gap) + 2rem + 2px));
  scroll-margin-top: calc(var(--bn-sticky-stack, 0px) + .5rem); scroll-margin-bottom: calc(var(--bn-dock-h, 0px) + .5rem); }
.bn-grid-bar-now { --sheen: 1.8; }
/* On paper the deep brass glow reads as a smudge: the light theme keeps just the line. */
:root[data-theme="light"] .bn-grid-bar { --glow: 0%; }
.bn-grid-bar-out { opacity: .35; }
/* The practice measure (⋯ > Practise this measure): a brass "Practice" tag by its number (and in
   the slim row while playing), and a chip by Play that turns it off. The other bars dim (above). */
.bn-practice-badge { display: inline-flex; align-items: center; padding: .25rem .55rem; border: 2px solid var(--bn-brass); border-radius: 999px;
  color: var(--text); font: 700 .72rem/1 var(--bn-body); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.bn-focus-bar .bn-practice-badge { margin-right: -.2rem; }
.bn-practice-chip { gap: .45rem; cursor: pointer; font: 600 .85rem/1 var(--bn-body); color: var(--text); }
.bn-practice-chip-x { font-size: 1.05rem; line-height: 1; color: var(--muted); }
.bn-practice-chip:hover .bn-practice-chip-x { color: var(--text); }
.bn-grid-editable .bn-grid-bar-out:hover, .bn-grid-editable .bn-grid-bar-out:focus-within { opacity: 1; }
/* Measure header (Player): number and repeats, over the circles */
.bn-grid-bar-head { min-height: 30px; display: flex; align-items: center; gap: .45rem; margin-left: calc(var(--label-w) + .6rem);
  font: 600 .95rem/1 var(--bn-display); letter-spacing: .04em; color: var(--stage-muted); }
.bn-grid-bar-now .bn-grid-bar-num { color: var(--bn-brass); }
.bn-grid-bar-repeat { color: var(--bn-brass); }
/* Which time through a repeated measure is playing ("2 of 4"): an outlined pill by that bar's
   number only. Body font, numbers all one size, for reading at a glance. */
.bn-bar-pass { display: inline-flex; align-items: center; padding: .3rem .65rem; border: 2px solid var(--bn-brass); border-radius: 999px;
  white-space: nowrap; color: var(--text); font: 700 .95rem/1 var(--bn-body); font-variant-numeric: tabular-nums; }
/* Measure header (Scribe): number, Time, Grid, Plays on one line; ⋯ pinned to the right end */
.bn-bar-controls { margin: 0 0 .5rem; flex-wrap: nowrap; align-items: flex-start; gap: .6rem; }
.bn-bar-controls .bn-grid-bar-num { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--bn-control-line); color: var(--stage-text); font: 700 1rem/1 var(--bn-body); }
.bn-grid-bar-now .bn-bar-controls .bn-grid-bar-num { background: var(--bn-brass-fill); border-color: var(--bn-brass-fill); color: var(--bn-brass-ink); }
.bn-bar-fields { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; }
.bn-bar-menu { position: relative; margin-left: auto; flex: none; display: flex; align-items: center; gap: .1rem; }
/* The measure actions used most (loop, insert before / after, duplicate, delete), in one click.
   They go with the controls: on, they're always there; off (C, clean view, or hidden for a
   play), they come back while the pointer is over the measure, or one has the keyboard focus.
   Narrow windows use the ⋯ menu for all but the bin. */
.bn-bar-quick { min-width: 32px; min-height: var(--ctl-h); padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); }
.bn-bar-quick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Controls off: under the pointer, or when one of them is reached with Tab (not on any focus in
   the menu: a click would leave them showing after the pointer had gone). */
.bn-viewing:not(.bn-focus-controls) .bn-grid-bar:hover .bn-bar-quick,
.bn-viewing:not(.bn-focus-controls) .bn-bar-menu:has(.bn-bar-quick:focus-visible) .bn-bar-quick { visibility: visible; }
.bn-bar-quick:hover { color: var(--text); background: var(--quiet-hover); }
.bn-bar-delete { margin-left: .2rem; }
/* Loop this measure is a switch: on, it stays in sight, in gold, at any width. */
.bn-bar-practise { margin-right: .2rem; }
.bn-bar-practise[aria-pressed="true"] { color: var(--bn-brass); }
.bn-viewing:not(.bn-focus-controls) .bn-bar-practise[aria-pressed="true"] { visibility: visible; }
@media (max-width: 760px) { .bn-bar-quick-extra:not([aria-pressed="true"]) { display: none; } }
.bn-bar-menu-toggle { margin-left: .3rem; min-width: var(--ctl-h); min-height: var(--ctl-h); padding: 0 .55rem; cursor: pointer; letter-spacing: .1em;
  border: 1.5px solid var(--outline); border-radius: var(--r); background: transparent; color: var(--stage-text); font: 700 1rem/1 var(--bn-body); }
.bn-bar-menu-toggle:hover, .bn-bar-menu-toggle[aria-expanded="true"] { border-color: var(--text); }
/* Just cymbals, snare and kick (no toms or sticking row): the three rows get more air between them. */
.bn-grid-roomy { --bn-row-gap: var(--bn-row-gap-roomy); }
.bn-grid-bar-body { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); column-gap: .6rem; row-gap: var(--bn-row-gap); align-items: center; }
.bn-grid-label, .bn-count-label { display: flex; align-items: center; min-height: 1.6rem; font: 600 1.1rem/1 var(--bn-display);
  letter-spacing: .04em; color: var(--stage-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-count-label { font-size: .85rem; color: var(--stage-muted); }
@media (max-width: 600px) { .bn-grid-label { font-size: .9rem; } }
/* Each row's drum drawn beside its name, in brass; dropped where the label column is narrow. */
.bn-grid-label { gap: .5rem; }
.bn-grid-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bn-drum-icon { flex: none; width: 1.55rem; height: 1.55rem; color: var(--bn-brass); }
.bn-grid-narrow .bn-drum-icon { display: none; }
@media (max-width: 600px) { .bn-drum-icon { display: none; } }
.bn-grid-label-button { width: 100%; text-align: left; background: transparent; border: 0; padding: 0; cursor: pointer; }
.bn-grid-label-button:hover, .bn-grid-label-button[aria-expanded="true"] { color: var(--bn-brass); }
.bn-grid-row, .bn-count-row { display: flex; align-items: center; gap: var(--bn-step-gap); min-width: 0; }
.bn-grid-cell, .bn-count { flex: 1 1 0; min-width: 0; max-width: var(--bn-step-size); aspect-ratio: 1; display: grid; place-items: center; }

/* The step: an outline when empty, filled by instrument when it holds a note. */
.bn-grid-hit { --hit-scale: 1; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  border: var(--bn-step-border) solid var(--stage-ring); background: transparent; color: transparent;
  font: 700 clamp(.5rem, 1.6vw, .85rem)/1 var(--bn-display); transform: scale(var(--hit-scale)); transition: background .08s, transform .08s, filter .08s; }
/* Cymbals: the bare symbol (X hi-hat, o open, + close, * crash, ⊗ ride, ◆ bell, ringed * trash), no circle,
   as on a drum chart; accents and the crash in brass. */
.bn-grid-hit.on.bare { background: transparent; border-color: transparent; color: var(--hit-hat);
  font: 800 clamp(1.15rem, 3.6vw, 2rem)/1 var(--bn-display);
  /* ✕ and ✱ come from a symbol font with no bold: an outline thickens them. --bn-glyph-weight
     grows the whole visible line (glyph plus outline, about .155em) by that factor, not just the outline. */
  -webkit-text-stroke: calc(clamp(.6px, .25vw, 1.6px) + (var(--bn-glyph-weight) - 1) * .155em) currentColor; }
.bn-grid-hit.on.bare.accent { color: var(--bn-cymbal-tan); }
/* Hi-hat accent: the notation's accent mark (>) over the ✕. The ✕ stays where a plain hi-hat's is, so the two
   line up along the row; the mark sits above it, reaching a little past the top of the step. */
.bn-grid-hit.on.bare.hat.accent { position: relative; }
.bn-grid-hit.on.bare.hat.accent::before { content: ''; position: absolute; left: 50%; bottom: calc(50% + .53em); width: .44em; height: .34em;
  transform: translateX(-50%); background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%, 0 74%, 62% 50%, 0 26%); }
/* Open hi-hat: a thick ring the size of the ✕ (a letter o reads too small; a full-size ring looks like an empty step). */
.bn-grid-hit.on.bare.open::before { content: ''; width: .72em; height: .72em; box-sizing: border-box;
  border: calc(max(2.5px, .13em) * var(--bn-glyph-weight)) solid currentColor; border-radius: 50%; }
/* Ride: a ✕ in a ring (⊗), as big as the other symbols. Trash: a ✱ in a ring. Bell: a solid diamond (◆),
   as on a drum chart. Both pseudo-elements share the cell's one grid area, so they sit on top of each other, centred. */
.bn-grid-hit.on.bare:is(.ride, .trash)::before { content: ''; grid-area: 1 / 1; width: 1em; height: 1em; box-sizing: border-box;
  border: calc(max(2.5px, .1em) * var(--bn-glyph-weight)) solid currentColor; border-radius: 50%; }
.bn-grid-hit.on.bare.ride::after { content: '✕'; grid-area: 1 / 1; font-size: .6em; }
/* The ✱ is heavy already: without the outline its arms stay apart inside the ring. */
.bn-grid-hit.on.bare.trash::after { content: '✱'; grid-area: 1 / 1; font-size: .76em; -webkit-text-stroke-width: 0; }
.bn-grid-hit.on.bare.bell::before { content: ''; width: .64em; height: .64em; background: currentColor;
  transform: rotate(45deg); border-radius: 2px; }
/* Click: a metronome (a hollow case on a solid base, its scale inside), its arm swung to the right through a gap
   in the case; the accented click is the mirror image, arm to the left, in brass like the other accents.
   One drawing, used as a mask so it takes the cymbals' colour. */
.bn-grid-hit.on.bare.metronome::before { content: ''; width: 1.4em; height: 1.4em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><mask id='m'><rect width='32' height='32' fill='%23fff'/><path d='M13.3 6.4h5.4l3.9 16.6H9.4z' fill='%23000'/><path d='M19.4 17.7 25.2 9' stroke='%23000' stroke-width='4.4' stroke-linecap='butt'/></mask><path d='M12.2 4h7.6a1.6 1.6 0 0 1 1.56 1.24L26.4 26.6a1.2 1.2 0 0 1-1.17 1.4H6.77A1.2 1.2 0 0 1 5.6 26.6L10.64 5.24A1.6 1.6 0 0 1 12.2 4z' mask='url(%23m)'/><path d='M16 8.6v8.6M13.9 9.8h4.2M13.9 12.6h4.2M13.9 15.4h4.2' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/><path d='M8.9 22.4h14.2l1.3 5.2H7.6z'/><path d='M12.4 22.6a3.6 3.6 0 0 1 7.2 0z'/><path d='M16.8 21.6 25.2 9' stroke='%23000' stroke-width='1.9' stroke-linecap='round'/><rect x='23.3' y='5.6' width='4.2' height='6.6' rx='1.3' transform='rotate(33.7 25.4 8.9)'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><mask id='m'><rect width='32' height='32' fill='%23fff'/><path d='M13.3 6.4h5.4l3.9 16.6H9.4z' fill='%23000'/><path d='M19.4 17.7 25.2 9' stroke='%23000' stroke-width='4.4' stroke-linecap='butt'/></mask><path d='M12.2 4h7.6a1.6 1.6 0 0 1 1.56 1.24L26.4 26.6a1.2 1.2 0 0 1-1.17 1.4H6.77A1.2 1.2 0 0 1 5.6 26.6L10.64 5.24A1.6 1.6 0 0 1 12.2 4z' mask='url(%23m)'/><path d='M16 8.6v8.6M13.9 9.8h4.2M13.9 12.6h4.2M13.9 15.4h4.2' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/><path d='M8.9 22.4h14.2l1.3 5.2H7.6z'/><path d='M12.4 22.6a3.6 3.6 0 0 1 7.2 0z'/><path d='M16.8 21.6 25.2 9' stroke='%23000' stroke-width='1.9' stroke-linecap='round'/><rect x='23.3' y='5.6' width='4.2' height='6.6' rx='1.3' transform='rotate(33.7 25.4 8.9)'/></svg>") center / contain no-repeat; }
.bn-grid-hit.on.bare.metronome.accent::before { transform: scaleX(-1); }
.bn-grid-hit.on.snare { background: var(--bn-snare); border-color: var(--bn-snare); color: var(--bn-brass-ink); }
/* Snare variations, as in Groove Scribe's menu (the picker shows the same): an accent is the
   filled circle with a ring and a chevron; the rest are bare marks in the snare's colour, no circle. */
.bn-grid-hit.on.snare.accent { border: calc(var(--bn-step-border) + 2px) solid var(--bn-outline); }
.bn-grid-hit.on.snare.accent::before { content: ''; width: 24%; height: 24%; margin-left: -10%; box-sizing: border-box;
  border: solid currentColor; border-width: max(2px, .18em) max(2px, .18em) 0 0; transform: rotate(45deg); }
.bn-grid-hit.on.mark { background: transparent; border-color: transparent; color: var(--bn-snare); }
/* Ghost: (●), a small dot in brackets. */
.bn-grid-hit.on.mark.ghost { display: flex; justify-content: space-between; padding: 0 6%; box-sizing: border-box;
  background: radial-gradient(circle, currentColor 0 17%, transparent 18%); font: 600 clamp(.95rem, 2.8vw, 1.6rem)/1 var(--bn-body); }
.bn-grid-hit.on.mark.ghost::before { content: '('; }
.bn-grid-hit.on.mark.ghost::after { content: ')'; }
/* Cross-stick: a bold ✕. */
.bn-grid-hit.on.mark.cross::before, .bn-grid-hit.on.mark.cross::after { content: ''; grid-area: 1 / 1; width: 64%; height: 14%;
  border-radius: 2px; background: currentColor; transform: rotate(45deg); }
.bn-grid-hit.on.mark.cross::after { transform: rotate(-45deg); }
/* Buzz: ≡, three bars. */
.bn-grid-hit.on.mark.buzz::before { content: ''; width: 60%; height: 46%;
  background: repeating-linear-gradient(to bottom, currentColor 0 22%, transparent 22% 39%); }
/* Flam and drag: one or two grace notes slurred to the note. */
.bn-grid-hit.on.mark.flam::before, .bn-grid-hit.on.mark.drag::before { content: ''; width: 86%; height: 86%; background: currentColor;
  -webkit-mask: var(--grace) center / contain no-repeat; mask: var(--grace) center / contain no-repeat; }
.bn-grid-hit.on.mark.flam { --grace: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cellipse cx='6' cy='14' rx='2.4' ry='1.7' transform='rotate(-20 6 14)'/%3E%3Crect x='7.6' y='4' width='1.3' height='10'/%3E%3Cpath d='M8.9 4q3.6 1.6 2.6 5.8q-.3-2.9-2.6-3.6z'/%3E%3Cpath d='M4.6 11.6l6.8-4.4' stroke='black' stroke-width='1.2'/%3E%3Cellipse cx='16' cy='18' rx='3.4' ry='2.5' transform='rotate(-20 16 18)'/%3E%3Crect x='18.3' y='3' width='1.7' height='15'/%3E%3Cpath d='M5 18.5q5 5 9.5 3' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.bn-grid-hit.on.mark.drag { --grace: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cellipse cx='3.4' cy='14' rx='2.1' ry='1.5' transform='rotate(-20 3.4 14)'/%3E%3Cellipse cx='8.4' cy='14' rx='2.1' ry='1.5' transform='rotate(-20 8.4 14)'/%3E%3Crect x='4.8' y='4' width='1.2' height='10'/%3E%3Crect x='9.8' y='4' width='1.2' height='10'/%3E%3Crect x='4.8' y='4' width='6.2' height='1.5'/%3E%3Crect x='4.8' y='6.6' width='6.2' height='1.5'/%3E%3Cellipse cx='17' cy='18' rx='3.4' ry='2.5' transform='rotate(-20 17 18)'/%3E%3Crect x='19.3' y='3' width='1.7' height='15'/%3E%3Cpath d='M2.5 18.5q6 5.5 12.5 3' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.bn-grid-hit.on.kick { background: var(--hit-kick); border-color: var(--hit-kick); color: var(--stage); }
/* The hi-hat foot is written under the kick, as on a staff: a bold ✕ just below the step, so the kick circles
   stay in one line along the row and the ✕s in another beneath it. Alone, the step above it is blank; with a
   kick, the usual kick circle. The row keeps room below for the ✕ whenever the groove has one (every bar, so
   bars side by side stay level). */
.bn-grid-hit.on.kick:is(.foot, .both) { position: relative; }
.bn-grid-hit.on.kick.foot { background: transparent; border-color: transparent; }
.bn-grid-hit.on.kick:is(.foot, .both)::after { content: '✕'; position: absolute; left: 50%; top: calc(100% + .2em); transform: translateX(-50%);
  color: var(--hit-kick); font: 800 clamp(.8rem, 2.5vw, 1.4rem)/.8 var(--bn-display);
  -webkit-text-stroke: calc(clamp(.7px, .3vw, 1.9px) + (var(--bn-glyph-weight) - 1) * .155em) currentColor; }
/* (the row's label and M, beside it, take the same margin so they stay level with the circles) */
.bn-scribe:has(.bn-grid-hit.on.kick:is(.foot, .both)) :is(.bn-grid-row:has(.bn-grid-hit.kick), .bn-row-head:has(+ .bn-grid-row .bn-grid-hit.kick)) { margin-bottom: clamp(.9rem, 2.7vw, 1.5rem); }
.bn-grid-hit.on.tom { background: var(--hit-tom); border-color: var(--hit-tom); color: var(--stage); }
/* Sticking is lettering, not a drum: no circle; an empty cell shows a faint dot. */
.bn-grid-hit.sticking { border-color: transparent; border-radius: 4px; color: var(--stage-text); font: 700 clamp(.6rem, 1.8vw, 1rem)/1 var(--bn-display); }
.bn-grid-hit.bn-sticking-empty { color: var(--stage-muted); font-weight: 400; }
.bn-grid-editable .bn-grid-cell:hover .bn-grid-hit.sticking { background: var(--panel); }
/* Playhead: only the notes that sound light up -- each grows a little and glows in its own shape
   (drop-shadow follows the X of a hi-hat, the disc of a snare). No ring round them, and nothing
   on a muted or silenced row (player feedback: less animation, easier to follow). */
.bn-grid-cell.bn-now-hit .bn-grid-hit:not(.sticking) { transform: scale(calc(var(--hit-scale) * var(--bn-playhead-scale)));
  filter: var(--bn-playhead-glow); }
/* And a subtle band behind the playing column, fainter where nothing sounds (a rest, or only
   muted rows) so it keeps the place without drawing the eye. There's no column element, so each cell (and
   the count) paints its piece behind itself; each piece reaches down through the gap to the next
   row, which paints over it, so they join into one strip. Laid over the card's own colour so it's
   opaque where the pieces overlap. Only the strip's ends are rounded; nothing takes up space. */
.bn-grid-cell.bn-now, .bn-count-row .bn-count-now { position: relative; isolation: isolate; }
.bn-grid-cell.bn-now::before, .bn-count-row .bn-count-now::before { content: ''; position: absolute; z-index: -1; pointer-events: none;
  left: 0; right: 0; top: 0; bottom: calc(-1 * (var(--bn-row-gap) + 1rem));
  background: linear-gradient(var(--bn-playhead-band), var(--bn-playhead-band)), var(--card); }
.bn-count-row .bn-count-now::before,
.bn-grid-bar-body:not(:has(.bn-count-row)) .bn-grid-row:not(.bn-grid-row ~ .bn-grid-row) .bn-now::before {
  top: calc(var(--bn-row-gap) / -2); border-top-left-radius: 8px; border-top-right-radius: 8px; }
.bn-grid-row:not(:has(~ .bn-grid-row)) .bn-now::before {
  bottom: calc(var(--bn-row-gap) / -2); border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.bn-grid-cell.bn-now-quiet::before, .bn-count-row .bn-count-now.bn-now-quiet::before {
  background: linear-gradient(var(--bn-playhead-band-quiet), var(--bn-playhead-band-quiet)), var(--card); }
.bn-grid-cell.bn-now:not(.bn-now-quiet) .bn-grid-hit.sticking { color: var(--bn-brass); }
.bn-grid-muted .bn-grid-hit { opacity: .28; }
/* Settings > While playing, "Playing note: Glow": no band behind the playing column, no
   glow and no brass on the count or sticking; the sounding notes still grow (--bn-playhead-scale). */
.bn-no-highlight .bn-grid-cell.bn-now::before, .bn-no-highlight .bn-count-row .bn-count-now::before { content: none; }
.bn-no-highlight .bn-grid-cell.bn-now-hit .bn-grid-hit:not(.sticking) { filter: none; }
.bn-no-highlight .bn-count-row .bn-count-now { color: var(--stage-muted); }
.bn-no-highlight .bn-grid-cell.bn-now .bn-grid-hit.sticking { color: var(--stage-text); }
/* ...but each sounding note gets a soft yellow backlight: a disc of light behind it, the note keeps
   its own colour (teacher feedback: "the note stays black, but it's highlighted"). The cell's ::before is
   free here, the band being off. */
.bn-no-highlight .bn-grid-cell.bn-now-hit::before { content: ''; position: absolute; z-index: -1; inset: -18%; pointer-events: none;
  background: radial-gradient(closest-side, var(--bn-playhead-backlight) 0 20%, transparent 100%); opacity: .5; }
/* Settings > Grid, "Black notes": every note on the grid takes the text
   colour (black in light mode; near-white in dark, where black wouldn't show on the stage), accents
   and all; the marks inside filled notes turn the stage colour to stay legible. Always, playing or
   not, in the Studio and on the player screen, so nothing jumps from colour to ink on Play. */
.bn-ink-notes .bn-grid-hit.on { --hit-hat: var(--stage-text); --bn-cymbal-tan: var(--stage-text);
  --bn-snare: var(--stage-text); --hit-kick: var(--stage-text); --hit-tom: var(--stage-text);
  --stage-muted: var(--stage-text); --bn-brass: var(--stage-text); --bn-brass-ink: var(--stage); }
/* While it plays, in View (bn-focus: the playing layout), in the read-only grid and always on a
   live session's player screen (bn-session, a display), the notes stand out: an empty step is just
   a small faded dot (a hovered one shows its outline in full, to add a note). */
:is(.bn-playing, .bn-focus, .bn-session, .bn-grid-readonly) .bn-grid-cell:not(:hover) .bn-grid-hit:not(.on, .sticking) { border-color: transparent; }
:is(.bn-playing, .bn-focus, .bn-session, .bn-grid-readonly) .bn-grid-cell:not(:hover) .bn-grid-hit:not(.on, .sticking)::before {
  content: ''; width: max(5px, 12%); aspect-ratio: 1; border-radius: 50%; background: var(--stage-muted); opacity: .6; }
/* Row label with its M (practice mute) button */
.bn-row-head { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.bn-row-head .bn-grid-label { flex: 1 1 auto; min-width: 0; }
.bn-mute { flex: none; width: 26px; height: 26px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1.5px solid var(--outline); background: transparent; color: var(--muted); font: 700 .72rem/1 var(--bn-body); }
.bn-mute:hover { border-color: var(--text); color: var(--text); }
.bn-mute[aria-pressed="true"] { background: var(--bn-danger); border-color: var(--bn-danger); color: var(--bn-stage); }
.bn-row-silenced .bn-grid-hit { opacity: .38; }
/* Spotlight (practice; Highlight on the page): a brass line under the chosen steps; the rest
   fade, as they sound quieter or not at all. With Mute it's the chosen steps that fade.
   While choosing, the grid selects (a crosshair) instead of editing. */
.bn-spotlit:not(.bn-spot-muting) .bn-grid-cell.bn-spot-out .bn-grid-hit, .bn-spotlit:not(.bn-spot-muting) .bn-count.bn-spot-out,
.bn-spotlit.bn-spot-muting .bn-grid-cell.bn-spot-in .bn-grid-hit, .bn-spotlit.bn-spot-muting .bn-count.bn-spot-in { opacity: .4; }
.bn-spot-row { display: flex; min-width: 0; margin-top: calc(var(--bn-row-gap) / -2); }
/* The marks line up with the steps (the beats' own padding kept); a mark at a beat's edge reaches
   across the padding and divider, so the line runs on unbroken. */
.bn-spot-row .bn-beat + .bn-beat { border-left-color: transparent; }
.bn-spot-mark { flex: 1 1 0; min-width: 0; height: 4px; }
.bn-spot-row .bn-beat > .bn-spot-in:first-child { margin-left: -3px; }
.bn-spot-row .bn-beat > .bn-spot-in:last-child { margin-right: -4px; }
.bn-spot-mark.bn-spot-in { background: var(--bn-spotlight-line); }
.bn-spot-out + .bn-spot-in, .bn-beat:not(:has(.bn-spot-out)) > .bn-spot-in:first-child { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.bn-spot-in:has(+ .bn-spot-out) { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.bn-grid-editable.bn-choosing-spotlight .bn-grid-cell { cursor: crosshair; }
/* The tip under the Highlight switch while choosing (scribe_page.js): how to choose, with
   "Got it" and "Don't show again". Over the grid, not pushing it down. */
.bn-spotlight { position: relative; }
.bn-spotlight-tip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 19rem; max-width: calc(100vw - 2rem);
  padding: 1rem 1.1rem; border: 1px solid var(--bn-popover-line); border-radius: var(--bn-radius); background: var(--bn-popover-bg);
  box-shadow: 0 8px 24px var(--bn-popover-shadow); color: var(--bn-text); font: 500 .9rem/1.45 var(--bn-body); text-align: left; white-space: normal;
  text-transform: none; letter-spacing: normal; }
.bn-spotlight-tip-end { left: auto; right: 0; }
.bn-spotlight-tip p { margin: 0; }
/* The keys for choosing by keyboard, a key and what it does on each line: only where there's a
   keyboard to use them with. */
.bn-spotlight-keys { display: grid; grid-template-columns: max-content 1fr; gap: .45rem .9rem; align-items: center; margin: .8rem 0 0;
  padding-top: .8rem; border-top: 1px solid var(--bn-popover-line); color: var(--bn-muted); }
.bn-spotlight-keys dt, .bn-spotlight-keys dd { margin: 0; }
.bn-spotlight-keys kbd { display: inline-block; min-width: 1.5rem; padding: .2rem .4rem; border: 1px solid var(--bn-control-line); border-radius: 4px;
  color: var(--bn-text); font: 600 .8rem/1 var(--bn-body); text-align: center; }
@media (hover: none) { .bn-spotlight-keys { display: none; } }
.bn-spotlight-tip-actions { display: flex; align-items: center; justify-content: space-between; gap: .9rem; margin-top: .9rem; }
/* "Got it" is the tip's button, filled like the page's other main buttons; "Don't show again" a quiet link. */
.bn-spotlight-tip-ok { min-height: 36px; padding: .45rem 1.1rem; border: 0; border-radius: var(--bn-radius); background: var(--bn-btn-fill);
  color: var(--bn-btn-ink); font: 600 .9rem/1 var(--bn-body); cursor: pointer; }
.bn-spotlight-tip-ok:hover { background: var(--bn-btn-fill-hover); }
.bn-spotlight-tip-ok:focus-visible, .bn-spotlight-tip-never:focus-visible { outline: 3px solid var(--bn-brass); outline-offset: 2px; }
.bn-spotlight-tip-never { padding: .3rem 0; border: 0; background: none; color: var(--bn-muted); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.bn-spotlight-tip-never:hover { color: var(--bn-text); }
.bn-spotlight-change { padding-inline: .5rem; }
.bn-bar-menu-list .bn-menu-blocked { opacity: .55; }
/* Paint-to-fill: drag sideways across steps; vertical swipes still scroll the page on touch. */
.bn-grid-editable .bn-grid-row { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
/* Editable grid */
.bn-editor { position: relative; }
.bn-grid-editable .bn-grid-cell { appearance: none; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer;
  color: inherit; font: inherit; border-radius: 50%; }
.bn-grid-editable .bn-grid-cell:hover .bn-grid-hit:not(.on) { border-color: var(--text); }
.bn-grid-editable .bn-grid-cell:hover .bn-grid-hit.on { filter: brightness(1.12); }
.bn-grid-editable .bn-grid-cell:focus-visible { outline: none; }
/* The keyboard position: a gold ring in both themes (--bn-brass-fill, not --bn-brass, which is a
   dark line colour in light mode and turns to ink on a note under "Black notes"). */
.bn-grid-editable .bn-grid-cell:focus-visible .bn-grid-hit { outline: 3px solid var(--bn-brass-fill); outline-offset: 2px; }
/* Counting row: the same cells as the circles, so it stays aligned. */
.bn-count-row .bn-count { aspect-ratio: auto; height: auto; font: 500 clamp(.6rem, 1.4vw, .8rem)/1.3 var(--bn-body); color: var(--stage-muted); }
.bn-count-row .bn-count-beat { font: 700 clamp(.8rem, 1.9vw, 1rem)/1.2 var(--bn-display); color: var(--stage-text); }
.bn-count-row .bn-count-now { color: var(--bn-brass); }
.bn-add-bar { flex-basis: 100%; display: flex; }

/* ---------- Menus, pickers, dialogs, toast ---------- */
.bn-bar-menu-list, .bn-picker { position: absolute; z-index: 20; display: flex; flex-direction: column; min-width: 12rem; padding: .3rem;
  background: var(--panel); border: 1px solid var(--bn-control-line); border-radius: var(--r); box-shadow: 0 10px 30px var(--bn-shadow); }
.bn-bar-menu-list { right: 0; top: calc(100% + 4px); min-width: 15rem; }
.bn-bar-menu-list button, .bn-picker button { display: flex; align-items: center; gap: .6rem; text-align: left; background: transparent;
  color: var(--text); border: 0; border-radius: 4px; padding: .5rem .7rem; font: 500 .95rem/1.2 var(--bn-body); cursor: pointer; }
.bn-bar-menu-list button:hover:not(:disabled), .bn-bar-menu-list button:focus-visible, .bn-bar-menu-list a:hover, .bn-bar-menu-list a:focus-visible,
.bn-picker button:hover, .bn-picker button:focus-visible { background: var(--bn-hover); outline: none; }
.bn-picker-current { box-shadow: inset 3px 0 0 var(--bn-brass); }
.bn-picker-glyph { width: 22px; height: 22px; display: grid; place-items: center; }
.bn-picker .bn-grid-hit { width: 22px; height: 22px; }
.bn-picker .bn-grid-hit.on.snare.accent { border-width: 2px; }
.bn-picker .bn-grid-hit.on.snare.accent::before { width: 32%; height: 32%; border-width: 2px 2px 0 0; }
.bn-picker .bn-grid-hit.on.mark.ghost { padding: 0; font-size: .85rem; }
.bn-picker .bn-grid-hit.on.mark.flam::before, .bn-picker .bn-grid-hit.on.mark.drag::before { width: 110%; height: 110%; }
/* In the menu: a smaller circle, raised, so the ✕ under it stays inside the option's row. */
.bn-picker .bn-grid-hit.on.kick:is(.foot, .both) { width: 13px; height: 13px; margin: 0 4.5px 11px; }
.bn-picker .bn-grid-hit.on.kick:is(.foot, .both)::after { top: calc(100% + 3px); font-size: .62rem; -webkit-text-stroke-width: .7px; }
.bn-picker .bn-grid-hit.on.bare { font-size: 1.15rem; -webkit-text-stroke-width: calc(.8px + (var(--bn-glyph-weight) - 1) * .155em); }
.bn-row-menu { min-width: 15rem; }
.bn-menu-rule { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; width: 100%; }
.bn-check { margin-left: auto; color: var(--bn-brass); font-weight: 700; }
.bn-dialog { border: 1px solid var(--bn-control-line); border-radius: 8px; padding: 0; background: var(--panel); color: var(--text);
  width: min(30rem, calc(100vw - 2rem)); }
.bn-dialog::backdrop { background: var(--bn-backdrop); }
.bn-dialog-body { padding: 1.4rem; display: grid; gap: .9rem; }
.bn-dialog h2 { margin: 0; font: 700 1.6rem/1 var(--bn-display); }
.bn-dialog-hint { margin: 0; color: var(--muted); font-size: .92rem; }
.bn-dialog-hint a { color: var(--text); white-space: nowrap; }
.bn-field { display: grid; gap: .3rem; font-weight: 600; }
.bn-field input { min-height: var(--ctl-h-lg); font: 400 1rem/1.3 var(--bn-body); padding: .5rem .7rem; border-radius: var(--r);
  border: 1.5px solid var(--outline); background: var(--surface); color: var(--text); }
.bn-dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.bn-link-dialog { width: min(36rem, calc(100vw - 2rem)); }
.bn-link-dialog .bn-field input { width: 100%; }
.bn-share-dialog { width: min(34rem, calc(100vw - 2rem)); }
.bn-app .bn-share-dialog .bn-dialog-hint { margin: 0; }
.bn-share-dialog .bn-field textarea { width: 100%; resize: vertical; font: 400 .85rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: .5rem .7rem;
  border-radius: var(--r); border: 1.5px solid var(--outline); background: var(--surface); color: var(--text); word-break: break-all; }
.bn-preset-dialog { width: min(38rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
.bn-preset-dialog .bn-dialog-body { gap: 1.1rem; }
/* Each group: a bordered list, one row per preset -- name, then what it is */
.bn-preset-group h3 { margin: 0 0 .45rem; font: 700 .95rem/1.2 var(--bn-display); letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.bn-preset-group ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bn-preset-group li + li { border-top: 1px solid var(--line); }
.bn-preset { display: flex; align-items: baseline; gap: 1rem; width: 100%; text-align: left; padding: .6rem .85rem; cursor: pointer;
  background: transparent; color: var(--text); border: 0; border-radius: 0; font: inherit; }
.bn-preset:hover { background: var(--surface); }
.bn-preset:focus-visible { outline: 2px solid var(--bn-brass); outline-offset: -2px; background: var(--surface); }
.bn-preset-name { flex: 0 0 12rem; font-weight: 700; }
.bn-preset-note { flex: 1; font-size: .88rem; color: var(--muted); }
@media (max-width: 34rem) {
  .bn-preset { flex-direction: column; gap: .15rem; }
  .bn-preset-name { flex: none; }
}
.bn-export-notes h3 { margin: .2rem 0 .3rem; font: 700 1rem/1.2 var(--bn-display); }
.bn-export-notes ul { margin: 0 0 .8rem; padding-left: 1.2rem; color: var(--muted); }
.bn-export-notes li + li { margin-top: .25rem; }
.bn-export-same { color: var(--muted); }
.bn-toast:empty { display: none; }
.bn-toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: .8rem;
  width: max-content; max-width: calc(100vw - 2rem); padding: .55rem .6rem .55rem 1rem; border-radius: var(--r); /* max-content: left: 50% would halve the room */
  background: var(--bn-text); color: var(--bn-stage); font-weight: 600; box-shadow: 0 10px 30px var(--bn-shadow); }
.bn-toast .bn-tool { color: var(--bn-stage); border-color: color-mix(in srgb, var(--bn-stage) 55%, var(--bn-text)); text-decoration: none; } /* Undo, or a link (See Journal) */

/* ---------- Symbol key and shortcuts ---------- */
.bn-key { margin-top: .8rem; color: var(--text); }
.bn-key summary { cursor: pointer; color: var(--muted); font-size: .95rem; padding: .3rem 0; width: fit-content; }
.bn-key summary:hover { color: var(--text); }
/* The list: titled groups (Playback, View, Edit, In the grid), one line per shortcut, the keys
   in one column across every group; two groups side by side when there's room. */
.bn-shortcut-list { display: grid; gap: 1rem 1.6rem; margin: .5rem 0 0; padding: 1rem;
  background: var(--surface); color: var(--stage-text); border: 1px solid var(--line); border-radius: 8px; font-size: .92rem; }
.bn-shortcut-group h3 { margin: 0 0 .5rem; font: 700 .72rem/1 var(--bn-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bn-shortcut-group dl { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .45rem .9rem; margin: 0; align-items: baseline; }
.bn-shortcut-list dt, .bn-shortcut-list dd { white-space: nowrap; }
.bn-shortcut-list dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.bn-shortcut-list kbd { font: 600 .8rem/1 var(--bn-body); padding: .2rem .4rem; border: 1px solid var(--outline); border-radius: 4px; }
.bn-shortcut-list dd kbd { padding: .1rem .3rem; }
@media (min-width: 760px) { .bn-shortcut-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .bn-shortcuts-dialog .bn-dialog-body { padding: 1rem; }
  .bn-shortcut-list { padding: .75rem; }
  .bn-shortcut-group dl { gap: .45rem .6rem; }
}
.bn-shortcuts-note { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
/* Keyboard shortcuts (shortcuts_dialog.js): the list in a dialog, its key shown in More. */
.bn-shortcuts-dialog { width: min(48rem, calc(100vw - 2rem)); }
.bn-shortcuts-dialog .bn-shortcut-list { margin-top: .8rem; }
.bn-shortcuts-dialog .bn-shortcuts-note kbd { font: 600 .8rem/1 var(--bn-body); padding: .1rem .35rem; border: 1px solid var(--outline); border-radius: 4px; }
.bn-menu-key { margin-left: auto; padding: .1rem .4rem; border: 1px solid var(--outline); border-radius: 4px; font: 600 .78rem/1 var(--bn-body); color: var(--muted); }

/* ---------- Narrow screens ---------- */
@media (pointer: coarse) {
  .bn-tool, .bn-app-page select, .bn-add-meta { min-height: 44px; }
}
@media (max-width: 600px) {
  /* Controls bar: play beside tempo (the slider gives way), then the rest (Studio phones, below). */
  .bn-scribe-transport .bn-transport { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .45rem .6rem; }
  .bn-scribe-transport .bn-play { width: 44px; height: 44px; grid-row: span 2; }
  .bn-scribe-transport .bn-tempo-group { grid-column: 2 / 4; grid-row: 1; justify-self: start; max-width: 100%; }
  .bn-scribe-transport .bn-ramp-badge { grid-column: 1 / -1; justify-self: start; }
  .bn-controls-row { gap: .45rem .7rem; padding: .45rem 0; }
  .bn-tool-toggle { min-height: 30px; font-size: .95rem; }

  /* Measure cards: the header uses the full width; circles never go below 14px, a denser
     measure scrolls sideways in its card with the row labels pinned. */
  .bn-grid-bar { padding: .6rem .5rem .7rem; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
    scrollbar-color: var(--outline) transparent;
    background:
      linear-gradient(to left, var(--card) 30%, transparent) right / 2rem 100% no-repeat local,
      radial-gradient(farthest-side at 100% 50%, var(--bn-shadow), transparent) right / .9rem 100% no-repeat scroll,
      var(--card-sheen), var(--card); }
  .bn-grid-cell, .bn-count { min-width: 14px; }
  .bn-grid-bar-body { column-gap: .4rem; }
  .bn-mute { width: 22px; height: 22px; }
  .bn-row-head { gap: .25rem; }
  .bn-grid-bar-body .bn-row-head, .bn-count-label { position: sticky; left: 0; z-index: 1; background: var(--card);
    box-shadow: -.5rem 0 0 var(--card), 0 -.25rem 0 var(--card), 0 .25rem 0 var(--card); }
  /* Sticky makes the head its own stacking context, so its ⋯ menu's z-index only counts
     inside it: z-index 2 lifts head and menu over the bar's rows (and their sticky labels, z 1). */
  .bn-grid-bar-head { position: sticky; left: 0; z-index: 2; margin-left: 0; }
  .bn-bar-controls { flex-wrap: nowrap; }
  .bn-bar-field { gap: .3rem; padding-left: .55rem; }
  .bn-bar-field-grid { order: 1; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bn-grid-hit, .bn-switch input::after { transition: none; }
}

/* ---------- Print: just the title and the notation, black on white ---------- */
@media print {
  @page { margin: 14mm; }
  html, body, .bn-app-page { background: #fff !important; color: #000 !important; }
  .bn-topbar, .bn-scribe-actions, .bn-scribe-state, .bn-scribe-controls, .bn-scribe-main,
  .bn-notation-head, .bn-notice, .bn-toast, .bn-edit-icon, .bn-add-meta, .bn-meta-sep { display: none !important; }
  .bn-app-wrap { max-width: none; padding: 0; }
  .bn-scribe-head { padding: 0 0 4mm; }
  .bn-play-head { padding: 0 0 6mm; }
  .bn-play-head h1, .bn-play-head p { color: #000 !important; } /* not the screen theme's title colour: grey on paper */
  .bn-play-foot, .bn-play-page .bn-notices, body:has(.bn-play-page) .bn-footer { display: none !important; }
  .bn-title-input, .bn-artist-input, .bn-comments-input { color: #000 !important; border: 0 !important; }
  .bn-comments-input:placeholder-shown { display: none; }
  .bn-scribe-workspace { display: block; padding: 0; }
  .bn-scribe-side { position: static; }
  .bn-notation { background: none; border: 0; padding: 0; }
  .bn-notation-paper, .bn-scribe-side .bn-notation-paper { display: block !important; --ink: #000; background: #fff; border: 0;
    box-shadow: none; padding: 0; max-height: none; overflow: visible; }
  .bn-notation-svg { width: 100%; }
  .bn-notation-svg .bn-ph { display: none; }
}

/* ---------- Beat-aligned measures (Layer A), Scribe editor and Player grid ----------
   Every beat gets an equal share of the grid width, so beat N starts at the same x in
   every measure; a shorter bar (3/4 beside 4/4) is narrower by the beats it lacks.
   Circles are capped at --bn-step-size; their buttons (the hit area) stay >= 24px. */
.bn-grid-view .bn-grid-bars { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
/* Two measures per line (Show > Two per line, or −): two equal columns, in bar order; the
   "From the top" divider and "+ Add measure" run across both. */
.bn-grid-view.bn-grid-two .bn-grid-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.bn-grid-view.bn-grid-two .bn-loop-divider, .bn-grid-view.bn-grid-two .bn-add-bar { grid-column: 1 / -1; }
.bn-grid-view .bn-grid-bar { --fixed: calc(var(--label-w) + .6rem + 2rem + 2px); flex: none; max-width: 100%;
  width: calc(var(--fixed) + (100% - var(--fixed)) * var(--bar-share, 1)); }
.bn-grid-line + .bn-grid-line { margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.bn-grid-view .bn-grid-row, .bn-grid-view .bn-count-row { display: flex; gap: 0; align-items: stretch; }
.bn-beat { flex: var(--q, 1) 1 0; min-width: 0; display: flex; padding: 0 3px; }
.bn-beat + .bn-beat { border-left: 1px solid var(--line); }
.bn-grid-view .bn-grid-cell { flex: 1 1 0; min-width: 24px; max-width: none; aspect-ratio: auto; height: var(--bn-step-size);
  display: grid; place-items: center; border-radius: 6px; }
.bn-grid-view .bn-grid-cell .bn-grid-hit { width: min(100%, var(--bn-step-size)); height: auto; aspect-ratio: 1; }
.bn-grid-view .bn-grid-cell .bn-grid-hit.sticking { width: 100%; height: 100%; aspect-ratio: auto; }
/* In-between positions (the odd 32nds…): smaller and dimmer until they hold a note. */
.bn-grid-view .bn-grid-sub .bn-grid-hit:not(.on):not(.sticking) { width: min(100%, 26px); border-color: var(--bn-control-line); }
:is(.bn-playing, .bn-focus, .bn-session, .bn-grid-readonly) .bn-grid-sub:not(:hover) .bn-grid-hit:not(.on, .sticking) { border-color: transparent; } /* dots, as above */
.bn-grid-view .bn-count { flex: 1 1 0; min-width: 24px; max-width: none; aspect-ratio: auto; text-align: center; }
.bn-grid-view .bn-count-row .bn-count-sub { opacity: .55; }
/* Layer B: a bar too dense for its width wraps whole beats onto more lines (grid_editor
   measures the beat area; wrapBeats() keeps every cell >= 26px), so cells needn't hold a
   minimum here and nothing scrolls sideways. Narrow grids get short labels. */
.bn-grid-view .bn-grid-cell, .bn-grid-view .bn-count { min-width: 0; }
.bn-grid-view .bn-grid-bar { overflow-x: visible; }
.bn-grid-view.bn-grid-narrow { --label-w: 4.4rem; }
/* Settings > Grid, row labels off: no names (or "Counting"), just each row's drum drawing (kept
   here even where a narrow label column drops it) in a column wide enough for it and its M. */
.bn-grid-view.bn-grid-no-labels { --label-w: 4rem; }
.bn-grid-no-labels .bn-grid-label-text { display: none; }
.bn-grid-no-labels .bn-count-label { visibility: hidden; }
.bn-grid-no-labels .bn-drum-icon { display: block; }
@media (max-width: 600px) { .bn-grid-view.bn-grid-no-labels { --label-w: 3.3rem; } }
/* ...and pointing at a drawing (or tabbing to it) shows the row's name (data-tip) just above it. */
.bn-grid-no-labels .bn-grid-label { position: relative; overflow: visible; }
.bn-grid-no-labels .bn-grid-label[data-tip]:focus-visible::after { content: attr(data-tip); }
@media (hover: hover) { .bn-grid-no-labels .bn-grid-label[data-tip]:hover::after { content: attr(data-tip); } }
.bn-grid-no-labels .bn-grid-label[data-tip]::after { position: absolute; left: 0; bottom: calc(100% + 3px); z-index: 6; padding: .32rem .55rem;
  border-radius: 6px; background: var(--bn-text); color: var(--bn-surface); font: 600 .8rem/1 var(--bn-body); letter-spacing: .02em;
  white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px var(--bn-shadow); }
.bn-label-probe { position: absolute; visibility: hidden; height: 0; width: var(--label-w); pointer-events: none; }
.bn-grid-line { scroll-margin-top: calc(var(--bn-sticky-stack, 0px) + .5rem); scroll-margin-bottom: calc(var(--bn-dock-h, 0px) + .5rem); }

/* Layer C: a grid select above each beat (same beat boxes, so it lines up). */
.bn-beat-grid-label { font: 600 .74rem/1 var(--bn-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); align-self: center; }
.bn-beat-grids { display: flex; align-items: stretch; }

/* Practice view (Player) measure header, like the editor's: a round number badge (a "play
   from here" button), then the time signature and repeats. */
.bn-grid-readonly .bn-grid-bar-head { margin: 0 0 .5rem; gap: .6rem; font: 600 1rem/1 var(--bn-display); }
.bn-grid-readonly .bn-grid-bar-num { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--bn-control-line); color: var(--stage-text); font: 700 1rem/1 var(--bn-body); }
.bn-grid-readonly .bn-bar-play { cursor: pointer; }
.bn-grid-readonly .bn-bar-play:hover { border-color: var(--bn-brass); color: var(--bn-brass); }
.bn-grid-readonly .bn-grid-bar-now .bn-grid-bar-num { background: var(--bn-brass-fill); border-color: var(--bn-brass-fill); color: var(--bn-brass-ink); }
/* "4/4 · 16ths · ×1", in the Studio's header type (its fields, but not buttons). */
.bn-grid-bar-fields { display: inline-flex; align-items: center; gap: .15rem; padding: 0 .45rem; font: 600 1.1rem/1 var(--bn-display); letter-spacing: .03em; }
.bn-grid-readonly .bn-grid-bar-sig, .bn-grid-readonly .bn-grid-bar-grid { color: var(--text); }
.bn-grid-readonly .bn-grid-bar-fields .bn-bar-sep { margin: 0 .3rem; }
.bn-grid-readonly .bn-grid-bar-repeat { color: var(--muted); }
.bn-grid-readonly .bn-grid-bar-repeat-on { color: var(--bn-brass); }

/* ---------- Studio: quiet secondary controls ----------
   Only the primary actions keep a visible border (Save, Share, Tap, + Add measure). The
   rest -- labelled selects, switches, tools, the measure ⋯ and beat grids -- sit on a
   subtle fill instead; their text names them, and hover/focus still show. The Practice
   view keeps the bordered look. */
.bn-scribe {
  --quiet-fill: var(--panel);
  --quiet-hover: color-mix(in srgb, var(--text) 9%, var(--panel));
  --quiet-on: color-mix(in srgb, var(--bn-brass) 16%, var(--panel));
}
.bn-scribe .bn-pill, .bn-scribe .bn-bar-field, .bn-scribe .bn-switch,
.bn-scribe .bn-scribe-controls .bn-tool, .bn-scribe .bn-scribe-side .bn-tool,
.bn-scribe .bn-bar-menu-toggle, .bn-scribe .bn-app-btn-subtle {
  border-color: transparent; background: var(--quiet-fill);
}
.bn-scribe .bn-pill:hover, .bn-scribe .bn-bar-field:hover, .bn-scribe .bn-switch:hover,
.bn-scribe .bn-scribe-controls .bn-tool:hover:not(:disabled), .bn-scribe .bn-scribe-side .bn-tool:hover:not(:disabled),
.bn-scribe .bn-bar-menu-toggle:hover, .bn-scribe .bn-bar-menu-toggle[aria-expanded="true"],
.bn-scribe .bn-app-btn-subtle:hover, .bn-scribe .bn-app-btn-subtle[aria-expanded="true"] {
  border-color: transparent; background: var(--quiet-hover);
}
/* On (Loop set, Plays ×2…, a pressed tool): a brass tint and brass name, not a border. */
.bn-scribe .bn-pill-on, .bn-scribe .bn-bar-field-on,
.bn-scribe .bn-scribe-controls .bn-tool[aria-pressed="true"], .bn-scribe .bn-scribe-side .bn-tool[aria-pressed="true"] { background: var(--quiet-on); }
/* Tap stays outlined (a primary action). */
.bn-scribe .bn-scribe-controls .bn-tap { border-color: var(--outline); background: transparent; }
.bn-scribe .bn-scribe-controls .bn-tap:hover { border-color: var(--text); background: transparent; }
.bn-scribe .bn-scribe-controls .bn-tap.bn-tapping { border-color: var(--bn-brass); }
/* Row mute (M): quiet until pressed, when it stays red. */
.bn-scribe .bn-mute:not([aria-pressed="true"]) { border-color: var(--bn-mute-line); background: var(--bn-mute-fill); color: var(--bn-mute-text); }
.bn-scribe .bn-mute:not([aria-pressed="true"]):hover { border-color: var(--bn-mute-line-hover, transparent);
  background: var(--bn-mute-fill-hover, var(--quiet-hover)); color: var(--text); }

/* ---------- Studio: the Click button and its popover (click_control.js) ---------- */
.bn-popover-wrap { position: relative; }
.bn-click-toggle { cursor: pointer; padding-right: .6rem; font: 600 .95rem/1.2 var(--bn-body); color: var(--text); }
.bn-click-summary { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bn-click-caret { font-size: .7rem; color: var(--muted); }
.bn-popover { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; gap: .8rem;
  width: max-content; max-width: calc(100vw - 2rem); padding: .8rem .9rem .9rem; background: var(--panel);
  border: 1px solid var(--bn-control-line); border-radius: var(--r); box-shadow: 0 10px 30px var(--bn-shadow); }
/* A row of radio choices, as joined segments (real radios, visually hidden). */
.bn-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.bn-choice legend, .bn-app .bn-choice .bn-choice-legend { padding: 0; margin: 0 0 .4rem; font: 600 .74rem/1 var(--bn-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bn-choice-options { display: flex; flex-wrap: wrap; gap: 2px; }
.bn-choice label { position: relative; display: inline-flex; }
.bn-choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.bn-choice label span { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: .3rem .75rem; border-radius: 4px;
  background: var(--stage); color: var(--text); font: 600 .92rem/1 var(--bn-body); white-space: nowrap; }
.bn-choice label:hover span { background: var(--quiet-hover); }
.bn-choice input:checked + span { background: var(--bn-brass-fill); color: var(--bn-brass-ink); }
.bn-choice input:focus-visible + span { outline: 3px solid var(--bn-brass); outline-offset: 2px; }
.bn-choice:disabled { opacity: .45; }
.bn-choice:disabled input { cursor: not-allowed; }
.bn-choice:disabled label:hover span { background: var(--stage); }
.bn-click .bn-popover .bn-switch { align-self: flex-start; background: var(--stage); }
.bn-click .bn-popover .bn-switch:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.bn-click-note { margin: 0; max-width: 18rem; font-size: .85rem; color: var(--muted); }
.bn-choice-options > button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h); min-width: 2.6rem;
  padding: .3rem .75rem; border: 0; border-radius: 4px; background: var(--stage); color: var(--text); cursor: pointer;
  font: 600 .92rem/1 var(--bn-body); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bn-choice-options > button:hover:not(:disabled) { background: var(--quiet-hover); }
.bn-choice-options > button[aria-pressed="true"] { background: var(--bn-brass-fill); color: var(--bn-brass-ink); }
.bn-choice-options > button:disabled { opacity: .45; cursor: not-allowed; }
@media (pointer: coarse) { .bn-choice label span, .bn-choice-options > button { min-height: 44px; } }
.bn-popover-end { left: auto; right: 0; }
@media (max-width: 600px) {
  .bn-popover { left: auto; right: 0; }
  /* Beside swing on a phone: a long summary ("Quarters · on & · only") gives way with an ellipsis. */
  .bn-click-summary { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Studio: Show, Undo / Redo at the end of the playback row; + Toms / + Sticking ---------- */
.bn-transport-end { display: inline-flex; align-items: center; gap: .6rem; margin-left: auto; }
.bn-show-toggle, .bn-slim-show-toggle { gap: .45rem; }
.bn-count-badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; border-radius: 99px;
  background: var(--bn-brass-fill); color: var(--bn-brass-ink); font: 700 .78rem/1 var(--bn-body); font-variant-numeric: tabular-nums; }
.bn-show .bn-popover { gap: .2rem; padding: .5rem .9rem; min-width: 11rem; }
.bn-icon-btn { min-width: var(--ctl-h); padding: .3rem .5rem; }
.bn-icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bn-add-bar { flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; }
.bn-row-adders { display: inline-flex; flex-wrap: wrap; gap: .2rem .9rem; }
.bn-row-adder { display: inline-flex; align-items: center; gap: .35rem; min-height: var(--ctl-h); padding: 0 .2rem; border: 0; background: transparent;
  cursor: pointer; font: 600 .95rem/1 var(--bn-body); color: var(--muted); }
.bn-row-adder:hover { color: var(--bn-brass); }
.bn-row-adder[aria-pressed="true"] { color: var(--text); }
.bn-row-adder-x { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--panel);
  color: var(--muted); font-size: .95rem; line-height: 1; }
.bn-row-adder[aria-pressed="true"]:hover .bn-row-adder-x { background: var(--quiet-hover); color: var(--text); }
@media (pointer: coarse) { .bn-row-adder, .bn-icon-btn { min-height: 44px; } .bn-icon-btn { min-width: 44px; } }

/* ---------- Studio: compact tempo and swing (transport_bar.js stepper, swing_control.js) ----------
   TEMPO [− 90 +] BPM, a short slider, Tap | SWING 0%  CLICK Off ▾ */
.bn-tempo-group.bn-tempo-stepper { display: inline-flex; align-items: center; gap: .75rem; }
.bn-tempo-name, .bn-tempo-unit { font: 600 .74rem/1 var(--bn-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bn-stepper { display: inline-flex; align-items: stretch; min-height: var(--ctl-h-lg); border-radius: var(--r); background: var(--panel); }
.bn-stepper button { min-width: 2.5rem; padding: 0 .4rem; border: 0; border-radius: var(--r); background: transparent; cursor: pointer;
  color: var(--text); font: 600 1.2rem/1 var(--bn-body); }
.bn-stepper button:hover { background: var(--quiet-hover); }
.bn-app-page .bn-stepper .bn-tempo-number { width: 3.2rem; min-height: 0; padding: 0; border: 0; background: transparent;
  font: 700 1.4rem/1 var(--bn-display); -moz-appearance: textfield; appearance: textfield; }
.bn-stepper .bn-tempo-number::-webkit-inner-spin-button, .bn-stepper .bn-tempo-number::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.bn-app-page input.bn-tempo-slider[type="range"] { width: 130px; }
.bn-scribe .bn-scribe-controls .bn-tempo-stepper .bn-tap { min-height: var(--ctl-h-lg); padding: .3rem .9rem; font-size: 1rem; }
/* Swing and Click: quiet text buttons after a divider; a brass tint when on. */
.bn-scribe .bn-text-pill { background: transparent; padding-left: .55rem; }
.bn-swing-compact { padding-left: .9rem; border-left: 1px solid var(--line); }
.bn-swing-compact .bn-swing-value { min-width: 0; font-size: 1.05rem; }
.bn-swing-slider { display: flex; align-items: center; gap: .8rem; }
.bn-app-page .bn-swing-slider input[type="range"] { width: 180px; }
.bn-swing-slider output { min-width: 3ch; font: 700 1.05rem/1 var(--bn-body); font-variant-numeric: tabular-nums; }
.bn-swing-off .bn-swing-slider output { font-weight: 400; color: var(--muted); }
@media (pointer: coarse) { .bn-stepper button { min-width: 44px; } .bn-stepper { min-height: 44px; } }
@media (max-width: 600px) {
  .bn-scribe-transport .bn-tempo-group.bn-tempo-stepper { gap: .5rem; }
  .bn-app-page .bn-scribe-transport input.bn-tempo-slider[type="range"] { display: none; }
  .bn-stepper .bn-tempo-number { width: 2.8rem; }
  .bn-swing-compact { padding-left: 0; border-left: 0; }
  .bn-swing-compact .bn-popover { left: 0; right: auto; } /* swing starts its line: open rightwards */
}

/* ---------- Studio: Speed up as one block (speed_up_control.js) ----------
   SPEED UP [switch] Off  /  SPEED UP [switch] +5 BPM every 4 loops, up to 110 BPM ▾ (opens its settings) */
.bn-switch-pill { gap: .6rem; padding-right: .3rem; }
.bn-scribe .bn-switch-pill .bn-switch, .bn-scribe .bn-switch-pill .bn-switch:hover { min-height: 0; padding: 0; background: transparent; gap: .55rem; }
.bn-ramp-summary-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: calc(var(--ctl-h) - 6px); padding: .15rem .45rem;
  border: 0; border-radius: 4px; background: transparent; cursor: pointer; color: var(--text); font: 600 .95rem/1.2 var(--bn-body); text-align: left; }
.bn-ramp-summary-btn:hover, .bn-ramp-summary-btn[aria-expanded="true"] { background: var(--quiet-hover); }
.bn-ramp-summary-btn { justify-content: center; min-width: 1.9rem; padding: .15rem .35rem; }
.bn-ramp-summary-btn .bn-click-caret { font-size: .8rem; color: var(--text); }
.bn-switch-pill:focus-within { outline: none; } /* its switch (and Speed up's ▾) show their own focus */
.bn-switch-pill .bn-pill-name { white-space: nowrap; }
.bn-ramp-pill .bn-popover { width: 19rem; max-width: calc(100vw - 2rem); padding: 1rem 1.1rem; }
.bn-countin .bn-popover { width: max-content; max-width: calc(100vw - 2rem); } /* count_in_control.js: once, or every time round */
/* Highlight's ▾ (scribe_page.js): Loop, Solo, Spotlight or Mute, as Count-in's choices. */
.bn-spotlight .bn-popover { z-index: 45; width: max-content; max-width: calc(100vw - 2rem); } /* over the choosing tip (40) */
/* The settings as a short form: name, box, unit on each line, then the note under a rule. */
.bn-ramp-form { display: grid; grid-template-columns: max-content 4.2rem 1fr; align-items: center; gap: .65rem .8rem; }
.bn-ramp-form label { display: contents; color: var(--text); font-size: .95rem; }
.bn-ramp-form-name { font: 600 .74rem/1 var(--bn-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bn-app-page .bn-ramp-form .bn-ramp-number { width: 100%; min-height: var(--ctl-h-lg); font-size: 1.05rem; -moz-appearance: textfield; appearance: textfield; }
.bn-ramp-form .bn-ramp-number::-webkit-inner-spin-button, .bn-ramp-form .bn-ramp-number::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.bn-scribe .bn-ramp-form .bn-practice-note { grid-column: 1 / -1; margin: .35rem 0 0; padding-top: .75rem; border-top: 1px solid var(--line);
  font-size: .88rem; line-height: 1.45; }
@media (pointer: coarse) { .bn-ramp-summary-btn { min-height: 44px; min-width: 44px; } }
@media (max-width: 600px) { .bn-ramp-pill .bn-popover { left: auto; right: -1px; } }

/* ---------- Studio: measure header and beat grids as quiet text (grid_editor.js) ----------
   "4/4 · 16ths · ×1" and "16ths" above each beat: each a quiet button that opens its choices
   (choice_button.js); a fill on hover, brass where it stands out. */
.bn-scribe .bn-bar-fields { gap: 0 .15rem; flex-wrap: nowrap; }
.bn-scribe .bn-bar-field, .bn-scribe .bn-bar-field:hover, .bn-scribe .bn-bar-field-on { position: relative; min-height: 0; padding: 0;
  border: 0; background: transparent; }
.bn-bar-field-btn { display: inline-flex; align-items: center; min-height: 34px; padding: 0 .45rem; border: 0; border-radius: 4px;
  background: transparent; cursor: pointer; font: 600 1.1rem/1 var(--bn-display); letter-spacing: .03em; color: var(--text); white-space: nowrap; }
.bn-bar-field-btn:hover, .bn-bar-field-btn[aria-expanded="true"] { background: var(--quiet-hover); }
.bn-bar-field-plays .bn-bar-field-btn { color: var(--muted); }
.bn-bar-field-on .bn-bar-field-btn { color: var(--bn-brass); }
.bn-bar-sep { color: var(--muted); }
.bn-bar-field .bn-popover { min-width: 0; }
.bn-bar-field-time .bn-popover { width: 25rem; max-width: calc(100vw - 2rem); }
.bn-bar-field-time .bn-choice-options > button { min-width: 3.1rem; padding: .3rem .5rem; }
/* Repeats ×1–×16: an even 4 × 4 grid, every button the same size. */
.bn-bar-field-plays .bn-popover { width: max-content; }
.bn-bar-field-plays .bn-choice-options { display: grid; grid-template-columns: repeat(4, 3.4rem); gap: 4px; }
.bn-bar-field-plays .bn-choice-options > button { min-width: 0; padding: .3rem 0; }
/* Pass: a ▾ straight after ×N: brass once a pass differs, or while a pass is chosen to edit.
   In its choices, All passes has a line of its own, then the passes four to a row. */
.bn-bar-field-pass .bn-bar-field-btn { padding: 0 .35rem; margin-left: -.3rem; color: var(--muted); }
.bn-bar-field-pass.bn-bar-field-on .bn-bar-field-btn, .bn-bar-field-pass-changed .bn-bar-field-btn { color: var(--bn-brass); }
.bn-bar-pass-caret { font-size: .8em; }
.bn-bar-pass-name { margin-right: .3rem; white-space: nowrap; }
/* Loop the pass chosen: a small switch straight after "Pass 2 ▾", gold while on. On the player
   screen, the same arrows inside its Pass pill. */
.bn-bar-pass-loop { display: inline-grid; place-items: center; min-width: 30px; min-height: 34px; padding: 0; border: 0; border-radius: 4px;
  background: none; color: var(--muted); cursor: pointer; }
.bn-bar-pass-loop:hover { color: var(--text); background: var(--quiet-hover); }
.bn-bar-pass-loop[aria-pressed="true"] { color: var(--bn-brass); background: var(--quiet-hover); }
.bn-bar-pass-loop svg, .bn-bar-pass-looped { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bn-bar-pass-looped { margin-right: .35rem; color: var(--bn-brass); }
@media (pointer: coarse) { .bn-bar-pass-loop { min-width: 40px; min-height: 44px; } }
.bn-bar-field-pass.bn-bar-field-on .bn-bar-field-btn { margin-left: 0; }
.bn-bar-field-pass .bn-popover { width: max-content; }
.bn-bar-field-pass .bn-choice-options { display: grid; grid-template-columns: repeat(4, 4.6rem); gap: 4px; }
.bn-bar-field-pass .bn-choice-options > button { min-width: 0; padding: .3rem 0; }
.bn-bar-field-pass .bn-choice-options > button:first-child { grid-column: 1 / -1; }
.bn-scribe .bn-beat-grid-field { display: flex; width: 100%; }
.bn-beat-grid-btn { width: 100%; min-height: 24px; padding: 0 .2rem; border: 0; border-radius: 4px; background: transparent; cursor: pointer;
  font: 600 .74rem/1 var(--bn-body); letter-spacing: .04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-beat-grid-btn:hover, .bn-beat-grid-btn[aria-expanded="true"] { background: var(--quiet-hover); color: var(--text); }
.bn-beat-grid-own .bn-beat-grid-btn { color: var(--bn-brass); }
@media (pointer: coarse) { .bn-bar-field-btn { min-height: 44px; } .bn-beat-grid-btn { min-height: 32px; } }
@media (max-width: 600px) {
  .bn-bar-field-btn { padding: 0 .35rem; font-size: .95rem; }
  .bn-scribe .bn-bar-field-grid { order: 0; }
  .bn-beat-grid-btn { font-size: .68rem; }
}

/* ---------- Studio: All measures, the line above the first measure ----------
   ALL MEASURES  4/4 · 16ths: like a measure's header, for every measure at once. */
.bn-all-measures { display: flex; align-items: center; gap: 0 .15rem; margin: 0 0 .6rem; padding: 0 .9rem; }
.bn-all-measures-name { margin-right: .5rem; font: 600 .74rem/1 var(--bn-body); letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; }
/* "All measures 4/4 · 16ths": hidden in the focus layout, except in View with its controls on. */
.bn-focus:not(.bn-viewing.bn-focus-controls) .bn-all-measures { display: none; }
.bn-settings-toggle { display: none; }

/* ---------- Studio phones: the playback bar ----------
   Play beside tempo and Tap; then Swing and Click; then Show, Undo / Redo and Settings, which
   opens Speed up, Count-in and Spotlight below (so the pinned bar stays short). */
@media (max-width: 600px) {
  .bn-scribe .bn-scribe-transport .bn-transport { grid-template-columns: auto auto minmax(0, 1fr); }
  .bn-scribe .bn-scribe-transport .bn-tempo-group { grid-column: 2 / -1; grid-row: 1; }
  .bn-scribe .bn-scribe-transport .bn-swing-compact { grid-column: 2; grid-row: 2; }
  .bn-scribe .bn-scribe-transport .bn-click { grid-column: 3; grid-row: 2; justify-self: start; }
  .bn-scribe .bn-scribe-transport .bn-transport-end { grid-column: 1 / -1; grid-row: 3; justify-self: start; margin-left: 0; }
  .bn-all-measures { padding: 0 .5rem; }
  .bn-scribe .bn-scribe-transport .bn-ramp-pill { grid-column: 1 / -1; grid-row: 4; justify-self: start; }
  .bn-scribe .bn-scribe-transport .bn-countin { grid-column: 1 / -1; grid-row: 5; justify-self: start; }
  .bn-scribe .bn-scribe-transport .bn-spotlight { grid-column: 1 / -1; grid-row: 6; justify-self: start; }
  .bn-scribe .bn-scribe-transport .bn-ramp-badge { grid-column: 1 / -1; grid-row: 7; }
  .bn-settings-toggle { display: inline-flex; }
  .bn-scribe .bn-settings-toggle[aria-expanded="true"] { background: var(--quiet-on); color: var(--bn-brass); }
  .bn-scribe-controls:not(.bn-settings-open) :is(.bn-ramp-pill, .bn-countin, .bn-spotlight) { display: none; }
}
/* The narrowest phones (320px): the tempo line drops its TEMPO and BPM words so Tap still fits
   beside Play (the box and − / + keep their labels for screen readers). */
@media (max-width: 380px) {
  .bn-scribe-transport .bn-tempo-stepper :is(.bn-tempo-name, .bn-tempo-unit) { display: none; }
}

/* ---------- Touch: no hover, finger-sized targets ---------- */
@media (pointer: coarse) {
  /* M stays small to look at; the finger gets a 44px target. */
  .bn-mute { position: relative; }
  .bn-mute::after { content: ""; position: absolute; inset: -6px; }
}
/* Nothing to hover with: measures outside the loop stay readable, and a tapped note doesn't
   keep its hover glow. */
@media (hover: none) {
  .bn-grid-editable .bn-grid-bar-out { opacity: .6; }
  .bn-grid-editable .bn-grid-cell:hover .bn-grid-hit.on { filter: none; }
}

/* ---------- Touch tablets (iPad, portrait and landscape) ---------- */
@media (pointer: coarse) and (min-width: 601px) and (max-width: 1194px) {
  /* Bigger steps (over brand.css's 34px at ≤900px). Each circle is drawn 5px narrower than
     its cell so neighbours never touch; the whole cell stays the tap target. */
  :root { --bn-step-size: 42px; }
  .bn-grid-view .bn-grid-cell .bn-grid-hit { width: min(calc(100% - 5px), var(--bn-step-size)); }
  .bn-beat { padding: 0 2px; }
  .bn-mute { width: 32px; height: 32px; }
  /* Studio controls: play, tempo, Show and undo on the first line; the practice switches
     (Speed up, Swing, Click, Count-in, Spotlight) together on the second. */
  .bn-scribe-transport .bn-transport { row-gap: .55rem; }
  .bn-scribe-transport .bn-transport-end { order: 1; margin-left: auto; }
  .bn-scribe-transport .bn-transport::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .bn-scribe-transport .bn-transport > :is(.bn-ramp-pill, .bn-ramp-badge, .bn-swing, .bn-click, .bn-countin, .bn-spotlight) { order: 3; }
  .bn-scribe-transport .bn-swing-compact { padding-left: 0; border-left: 0; }
  .bn-scribe-transport .bn-swing-compact .bn-popover { left: 0; right: auto; } /* swing starts its line */
}
/* Portrait tablets: a slimmer name column (no drum drawing) so a bar of 16ths fits on one line. */
@media (pointer: coarse) and (min-width: 601px) and (max-width: 900px) {
  .bn-grid-view { --label-w: 6.6rem; }
  .bn-grid-bar { padding: .8rem .75rem 1rem; }
  .bn-drum-icon { display: none; }
  .bn-grid-label { font-size: 1.05rem; }
  .bn-app-page input.bn-tempo-slider[type="range"] { width: 90px; }
}
