/* Stage Mode: the full-window dark player (App/NowPlayingView.swift on the Mac, practiceHome on).
   Always dark (html.stage). Sizes are the Mac's points as CSS px. Two layouts: the window layout
   from 760 px (the player column, and Up Next in the other half), the phone's column below it.
   The pager's pages, the pills, the tempo bar, the transport and the volume read left to right in
   every language, as on the Mac. */

.stage-root {
  --st-accent: #FFB340;
  --st-ink: #1E1203;
  --st-label: rgba(255, 255, 255, 0.85);
  --st-label-2: rgba(255, 255, 255, 0.55);
  --st-clear: #FF5966;
  --st-top: calc(52px + env(safe-area-inset-top, 0px));
  --st-spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  position: absolute; inset: 0;
  left: var(--stage-inset, 0px);   /* beside the sidebar; the backdrop behind it is the layer's */
  transition: left 0.22s var(--snappy);
  overflow: hidden;
  color: #fff;
  background: transparent;
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.stage-root button { color: inherit; -webkit-tap-highlight-color: transparent; }
.stage-root .icon { width: 1em; height: 1em; }
.stage-spacer { flex: 1 1 0; min-width: 0; }

/* ---------------------------------------------------------------- backdrop
   The sleeve's palette: light → dark top to bottom, a black veil, a glow from the top-left corner.
   Two layers cross-fade (0.3 s) when the song changes. */

.stage-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; }
.stage-main { position: absolute; inset: 0; z-index: 2; }
.stage-topprobe { position: absolute; top: 0; left: 0; width: 1px; height: var(--st-top); visibility: hidden; pointer-events: none; }

/* ---------------------------------------------------------------- close (the window toolbar's corner) */

.stage-close {
  position: absolute; z-index: 20;
  top: calc(13px + env(safe-area-inset-top, 0px));
  inset-inline-end: calc(16px + env(safe-area-inset-right, 0px));
  width: 34px; height: 26px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transition: background 0.15s;
}
.stage-close:hover { background: rgba(255, 255, 255, 0.18); }
.stage-close:active { background: rgba(255, 255, 255, 0.24); }
.stage-close .icon { width: 20px; height: 20px; stroke-width: 2.4; }

/* ---------------------------------------------------------------- beat flash and the saved notice */

.stage-flash { position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: 0; overflow: hidden; }
.stage-flash svg { position: absolute; left: 0; top: 0; overflow: hidden; }

.stage-notice {
  position: absolute; z-index: 25; left: 50%;
  top: calc(56px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.25s var(--snappy), transform 0.25s var(--snappy);
}
.stage-notice.shown { opacity: 1; transform: translate(-50%, 0); }
.stage-notice .icon { width: 16px; height: 16px; flex: none; }
.stage-notice span { overflow: hidden; text-overflow: ellipsis; }

/* ================================================================= the window layout (≥ 760) */

.stage-wide { position: absolute; inset: 0; display: flex; }
.stage-player {
  position: relative;
  flex: 1 1 0; min-width: 0; height: 100%;
  display: flex; align-items: safe center; justify-content: center;
  overflow-y: auto;   /* a phone on its side: scroll rather than cut off the transport */
  padding: var(--st-top) 24px 24px;
}
.stage-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stage-pagerbox {
  position: relative; flex: none;
  border-radius: 12px;
  overflow: hidden;
  /* The shadow falls from what is drawn: the pager itself is transparent. */
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  transform: translateZ(0);
}
.stage-chrome { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stage-dotsrow { height: 36px; display: flex; align-items: center; justify-content: center; }
.stage-controls { display: flex; flex-direction: column; gap: 12px; max-width: 100%; }
.stage-col > .stage-tools { position: absolute; z-index: 4; top: 0; left: 50%; transform: translateX(-50%); }

/* A short window without Up Next (stage.js .landscape: a phone on its side): the tools, the visual
   and its page dots on the left, the controls beside them, all in view without scrolling. */
.stage-root.landscape .stage-player { padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: 16px; }
.stage-root.landscape .stage-col {
  display: grid; grid-template-columns: auto auto;
  grid-template-areas: "tools controls" "pager controls" "dots controls";
  align-items: center; column-gap: 24px; row-gap: 6px;
}
.stage-root.landscape .stage-chrome { display: contents; }
.stage-root.landscape .stage-col > .stage-tools { position: static; transform: none; grid-area: tools; justify-self: center; }
.stage-root.landscape .stage-pagerbox { grid-area: pager; justify-self: center; }
.stage-root.landscape .stage-dotsrow { grid-area: dots; }
.stage-root.landscape .stage-controls { grid-area: controls; gap: 8px; }
/* Safari's bars leave a phone on its side about 330 px: the click's own volume gives way (the
   phone's buttons set the volume). */
@media (max-height: 360px) { .stage-root.landscape .stage-volume { display: none; } }

/* Up Next: half the window, its list top-leading in the middle of its half. */
.stage-pane { position: relative; flex: none; width: 50%; height: 100%; overflow: hidden; opacity: 1; }
/* Its own width all through the pane's opening, so the list does not reflow as it slides in: half
   of what is beside the rail, not half the window, which ran its handles and Clear off the edge. */
.stage-pane > .stage-upnext { width: calc((100vw - var(--stage-inset, 0px)) / 2); height: 100%; padding: 70px 30px; }
.stage-wide:not(.with-queue) .stage-pane { width: 0; opacity: 0; visibility: hidden; }
.stage-wide.animate .stage-pane {
  transition: width 0.45s var(--st-spring), opacity 0.45s var(--st-spring), visibility 0s;
}
.stage-wide.animate:not(.with-queue) .stage-pane {
  transition: width 0.45s var(--st-spring), opacity 0.3s ease, visibility 0s 0.45s;
}
.stage-wide.animate .stage-pagerbox { transition: width 0.45s var(--st-spring), height 0.45s var(--st-spring); }
.stage-wide.animate .stage-controls,
.stage-wide.animate .stage-col > .stage-tools { transition: width 0.45s var(--st-spring); }

/* The transport, a little smaller than the phone's: 0.95 in a 60 tall row, 0.8 in 52 when the column is narrow. */
.stage-wide .stage-transport-wrap { height: 60px; }
.stage-wide .stage-transport { transform: scale(0.95); }
.stage-wide .stage-transport-wrap.small { height: 52px; }
.stage-wide .stage-transport-wrap.small .stage-transport { transform: scale(0.8); }

/* ================================================================= the phone's column (< 760) */

.stage-narrow {
  position: absolute; inset: 0;
  display: flex; justify-content: center;
  padding-top: var(--st-top);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.stage-ncol {
  position: relative;
  width: 100%; height: 100%;
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 0 26px 8px;
  min-height: 0;
}
.stage-ncol > .stage-tools { position: absolute; z-index: 4; top: 1px; inset-inline: 26px; }
.stage-nspacer { flex: none; height: 6px; }
/* With Up Next, the sleeve and the song's name sit under the tool indicators, not beneath them. */
.stage-ncol.queue .stage-nspacer { height: 52px; }
.stage-large-slot { flex: 1 1 0; min-height: 0; margin-bottom: 16px; }
.stage-root.short .stage-large-slot { margin-bottom: 10px; }
.stage-nhead { flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stage-root.short .stage-nhead { gap: 8px; }
.stage-nhead > .stage-titlerow { width: 100%; }
.stage-narrow .stage-pills { flex: none; margin-top: 14px; }
.stage-root.short .stage-ncol:not(.queue) .stage-pills { margin-top: 8px; }
.stage-ncol.queue .stage-pills { margin-top: 0; margin-bottom: 24px; }

/* With Up Next: the small sleeve beside the song, the list under the pills. */
.stage-nrow { flex: none; display: flex; align-items: center; gap: 16px; padding-bottom: 18px; min-width: 0; }
.stage-small-slot { flex: none; width: 84px; height: 84px; }
.stage-nrow > .stage-titlerow { flex: 1 1 auto; min-width: 0; justify-content: flex-start; }
.stage-nupnext { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.stage-nupnext > .stage-upnext { flex: 1 1 auto; min-height: 0; }

.stage-narrow .stage-tempo { flex: none; margin-top: 24px; }
.stage-ncol.queue .stage-tempo, .stage-root.short .stage-narrow .stage-tempo { margin-top: 14px; }
.stage-narrow .stage-transport-wrap { flex: none; padding: 18px 0; }
.stage-root.short .stage-narrow .stage-transport-wrap { padding: 10px 0; }
.stage-narrow .stage-volume { flex: none; margin-bottom: 22px; }
.stage-root.short .stage-narrow .stage-volume { margin-bottom: 12px; }
.stage-narrow .stage-bottom { flex: none; padding: 0 16px; }

/* The travelling card: one card between the small sleeve's place and the large artwork's. The
   pager inside is laid out once, at the large size, and scaled to the card. */
.stage-card {
  position: absolute; z-index: 1;
  border-radius: 14px;
  overflow: hidden;
  transform: translateZ(0);
  transition: box-shadow 0.2s ease-out;
}
.stage-card.on-art { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32); }
.stage-card.small { border-radius: 8px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18); }
.stage-card-pager {
  position: absolute; left: 50%; top: 50%;
  transform-origin: 50% 50%;
  opacity: 1;
}
.stage-card-sleeve { position: absolute; inset: 0; opacity: 0; pointer-events: none; cursor: pointer; }
.stage-card.small .stage-card-pager { opacity: 0; pointer-events: none; }
.stage-card.small .stage-card-sleeve { opacity: 1; pointer-events: auto; }
.stage-card.animate {
  transition: left 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), top 0.5s cubic-bezier(0.25, 0.9, 0.3, 1),
    width 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), height 0.5s cubic-bezier(0.25, 0.9, 0.3, 1),
    border-radius 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), box-shadow 0.3s ease-out;
}
.stage-card.animate .stage-card-pager { transition: transform 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), opacity 0.35s ease; }
.stage-card.animate .stage-card-sleeve { transition: opacity 0.35s ease; }

/* ================================================================= the pager and its pages */

.stage-pager {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  direction: ltr;
  touch-action: none;
  --pad: 28px;
}
.stage-strip { position: absolute; inset: 0; will-change: transform; }
.stage-page { position: absolute; inset: 0; }
.stage-page-in {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 22px;
  padding: var(--pad);
}
.stage-root.short .stage-page-in { gap: 12px; }
.stage-page-in.art { padding: 0; }
.stage-visual { position: relative; flex: 1 1 0; min-height: 0; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-page-in.rings .stage-canvas { cursor: pointer; }
.stage-page-in > .stage-bars { flex: none; }

/* Page dots: a button each on the Mac, 14 across. */
.stage-dots { display: flex; gap: 7px; direction: ltr; }
.stage-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.2s ease-out;
}
.stage-dot:hover:not(.current) { background: rgba(255, 255, 255, 0.45); }
.stage-dot.current { background: rgba(255, 255, 255, 0.9); }

/* ---------------------------------------------------------------- beat bars under the pendulum and the sweep */

.stage-bars {
  display: flex; align-items: center; justify-content: center;
  gap: var(--resetgap, 7.2px);
  direction: ltr;
}
.stage-bars-beats { display: flex; flex-direction: column; align-items: center; }
.stage-bars-row { display: flex; justify-content: center; height: var(--rowh, 67.2px); }
.stage-beat {
  width: var(--pitch, 44px); height: var(--rowh, 67.2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--seggap, 3.6px);
}
.stage-beat .seg {
  width: var(--segw, 22.8px); height: var(--segh, 18px);
  border-radius: var(--square, 3px);
  background: rgba(255, 255, 255, 0.085);
  transition: background 0.18s ease-out, transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.stage-beat .seg.top { border-top-left-radius: var(--round, 11.4px); border-top-right-radius: var(--round, 11.4px); }
.stage-beat .seg.bot { border-bottom-left-radius: var(--round, 11.4px); border-bottom-right-radius: var(--round, 11.4px); }
.stage-beat.lit .seg { background: rgba(255, 255, 255, 0.17); }
/* Filled from the bottom: accent 3, normal 2, soft 1, silent none. */
.stage-beat[data-e="3"] .seg,
.stage-beat[data-e="2"] .seg.mid, .stage-beat[data-e="2"] .seg.bot,
.stage-beat[data-e="1"] .seg.bot { background: rgba(255, 255, 255, 0.4675); }
.stage-beat.lit[data-e="3"] .seg,
.stage-beat.lit[data-e="2"] .seg.mid, .stage-beat.lit[data-e="2"] .seg.bot,
.stage-beat.lit[data-e="1"] .seg.bot { background: var(--st-accent); }
.stage-beat:active .seg { transform: scale(0.94); }

.stage-reset {
  flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.0595);
  color: var(--st-label-2);
  animation: stage-pop 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.stage-reset:hover { background: rgba(255, 255, 255, 0.1); }
.stage-reset .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.stage-circle-reset { position: absolute; z-index: 2; right: var(--pad); bottom: var(--pad); }
@keyframes stage-pop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- the large sleeve (SleeveArt) */

.stage-sleeve {
  position: absolute; inset: 0;
  overflow: hidden;
  background-color: var(--sl-dark, #4A2E0A);
}
.stage-sleeve-face { position: absolute; }
.stage-sleeve-frame { position: absolute; border-style: solid; border-color: rgba(255, 255, 255, 0.22); }
.stage-sleeve-mark {
  position: absolute;
  font-family: var(--font-serif); font-weight: 600; line-height: 1;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}
.stage-sleeve-figure {
  position: absolute;
  font-family: var(--font-serif); font-style: italic; font-weight: 400; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.32);
  white-space: nowrap;
}
.stage-sleeve-figure.symbol svg { width: 100%; height: 100%; stroke-width: 1.1; }

/* ================================================================= tool indicators */

.stage-tools { display: flex; align-items: stretch; height: 40px; pointer-events: none; }
.stage-tools > * { pointer-events: auto; }
.stage-tools-gap { flex: 1 1 0; pointer-events: none; }
.stage-tool {
  flex: none; width: 64px; height: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: rgba(255, 255, 255, 0.4);
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.15));
  transition: color 0.25s var(--snappy);
}
.stage-tool.timer { width: 76px; }
.stage-tool.on { color: rgba(255, 255, 255, 0.95); filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.3)); }
.stage-tool:hover { color: rgba(255, 255, 255, 0.7); }
.stage-tool.on:hover { color: #fff; }
.stage-tool-icon { width: 17px; height: 17px; display: grid; place-items: center; }
.stage-tool-icon > * { max-width: 17px; max-height: 17px; }
.stage-tool-icon svg { display: block; }
.stage-tool-icon .icon { width: 17px; height: 17px; stroke-width: 2; }
.stage-tool-text {
  font-size: 12px; font-weight: 600; line-height: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stage-tool-text.paused { opacity: 0.6; }

/* ================================================================= title row: the title menu, star, ⋯ */

.stage-titlerow {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  min-width: 0; max-width: 100%;
}
.stage-narrow .stage-titlerow { gap: 16px; }

/* The Mac's compact pull-down button: the first line and a chevron. */
.stage-title {
  flex: 0 1 auto; min-width: 0;
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.08);
  color: var(--st-label);
  font-size: 13px; line-height: 22px;
  transition: background 0.12s;
}
.stage-title:hover { background: rgba(255, 255, 255, 0.14); }
.stage-title[aria-expanded="true"], .stage-title:active { background: rgba(255, 255, 255, 0.18); }
.stage-title .marquee { flex: 0 1 auto; min-width: 0; line-height: 22px; }
.stage-title .stage-title-chev { width: 9px; height: 9px; flex: none; stroke-width: 3.4; opacity: 0.85; }

.stage-actions { display: flex; flex: none; }
.stage-star, .stage-more {
  width: 40px; height: 44px;
  display: grid; place-items: center;
  color: #fff;
  border-radius: 8px;
}
.stage-star:hover, .stage-more:hover { background: rgba(255, 255, 255, 0.06); }
.stage-star .icon { width: 32px; height: 32px; stroke-width: 1.35; }
.stage-star .icon.filled { stroke: none; }
.stage-star.kept { color: var(--st-accent); }
.stage-star.bounce .icon { animation: stage-bounce 0.3s ease-out; }
.stage-more .icon { width: 26px; height: 26px; }
@keyframes stage-bounce { 0% { transform: scale(1); } 45% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Two-line menu items (the title menu): the action over the name. */
.stage-mi { display: flex; flex-direction: column; line-height: 1.25; padding: 2px 0; }
.stage-mi-main { overflow: hidden; text-overflow: ellipsis; }
.stage-mi-sub { font-size: 11px; color: rgba(255, 255, 255, 0.55); overflow: hidden; text-overflow: ellipsis; }
.menu .item:hover:not(:disabled) .stage-mi-sub, .menu .item.active:not(:disabled) .stage-mi-sub { color: inherit; opacity: 0.75; }

/* ================================================================= the four pills */

.stage-pills {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  direction: ltr;
}
.stage-pill-wrap { min-width: 0; display: flex; }
.stage-pill-wrap.disabled { opacity: 0.4; }
.stage-pill {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: #fff;
}
.stage-pill[aria-disabled="true"] { cursor: default; }
.stage-pill-cap {
  width: 100%; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transition: background 0.2s ease, color 0.2s ease;
}
.stage-pill:not([aria-disabled="true"]):hover .stage-pill-cap { background: rgba(255, 255, 255, 0.17); }
.stage-pill:not([aria-disabled="true"]):active .stage-pill-cap { background: rgba(255, 255, 255, 0.22); }
.stage-pill.lit .stage-pill-cap, .stage-pill.lit:hover .stage-pill-cap { background: rgba(255, 255, 255, 0.72); color: rgba(0, 0, 0, 0.8); }
.stage-pill-cap .icon { width: 22px; height: 22px; stroke-width: 2; }
.stage-pill-cap.meter { font-family: var(--font-rounded); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stage-pill-name {
  width: calc(100% + 12px); margin: 0 -6px;
  font-size: 11px; font-weight: 600; line-height: 14px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center; white-space: nowrap; overflow: hidden;
}
.stage-pill.lit .stage-pill-name { color: rgba(255, 255, 255, 0.85); }
.stage-glyph { display: block; flex: none; overflow: visible; }

/* ================================================================= the bubbles (forced dark) */

.bubble.stage-bubble { color: rgba(255, 255, 255, 0.85); }
.bubble.stage-bubble.pad14 { padding: 14px; }
.stage-bubble-body { display: flex; flex-direction: column; gap: 10px; }
.stage-bubble-body.other { gap: 14px; }
.stage-bubble-body .bubble-title { margin: 0; font-size: 17px; font-weight: 700; text-align: center; color: rgba(255, 255, 255, 0.85); }
.stage-other-title { margin-bottom: -4px !important; }
.stage-grid4 { display: grid; grid-template-columns: repeat(4, 64px); gap: 6px; justify-content: center; }
.stage-family { display: flex; flex-direction: column; gap: 6px; }
.stage-caption { padding-inline-start: 2px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.55); }

.stage-chip {
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.068);
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.15s, color 0.15s;
}
.stage-chip:hover:not(.selected) { background: rgba(255, 255, 255, 0.12); }
.stage-chip.selected { background: var(--st-accent); color: var(--st-ink); }
.stage-chip.sub { height: 58px; border-radius: 14px; flex-direction: column; gap: 4px; padding: 0 4px; min-width: 0; }
.stage-chip.sub .g { height: 26px; display: flex; align-items: center; justify-content: center; max-width: 100%; }
.stage-chip.sub .g svg { max-width: 56px; height: auto; max-height: 22px; }
.stage-chip.sub .n { max-width: 100%; font-size: 10px; font-weight: 600; line-height: 12px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.stage-chip.meter { height: 40px; font-family: var(--font-rounded); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.stage-section { display: flex; flex-direction: column; gap: 6px; }
.stage-section-name { padding-inline-start: 2px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.55); }

/* Tap Tempo and Listen. */
.stage-finders { display: flex; gap: 8px; }
.stage-finder {
  flex: 1 1 0; min-width: 0;
  height: 38px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.085);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background 0.1s, color 0.15s;
}
.stage-finder:hover { background: rgba(255, 255, 255, 0.13); }
.stage-finder:active { background: rgba(255, 255, 255, 0.221); }
.stage-finder.lit { color: var(--st-accent); }
.stage-finder .icon { width: 16px; height: 16px; flex: none; stroke-width: 2; }
.stage-finder span { overflow: hidden; text-overflow: ellipsis; }
.stage-finder-outcome:empty { display: none; }
.stage-octaves { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.stage-octaves .bpm { font-family: var(--font-rounded); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stage-octave {
  min-width: 36px; height: 24px; padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
  font-size: 13px; font-weight: 500;
}
.stage-octave:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.stage-octave:disabled { opacity: 0.4; }
.stage-finder-message { margin: 0; font-size: 10px; line-height: 1.35; color: rgba(255, 255, 255, 0.55); }

/* The tool bubbles: the tools area's panel, in the dark bubble. */
.stage-bubble-body.tool { gap: 0; }

/* The keyboard's shortcuts (? in Stage Mode). */
.stage-keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 4px 2px 2px; align-items: center; font-size: 13px; }
.stage-keys dt { margin: 0; justify-self: end; }
.stage-keys dd { margin: 0; color: rgba(255, 255, 255, 0.85); }
.stage-keys kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  font: 600 12px/18px var(--font); text-align: center;
}

/* ================================================================= the tempo bar */

.stage-tempo { position: relative; display: flex; flex-direction: column; gap: 3px; direction: ltr; }
.stage-tempo-names { position: relative; height: 13px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease-out; }
.stage-tempo.revealed .stage-tempo-names { opacity: 1; pointer-events: auto; }
.stage-scale-label {
  position: absolute; top: 0;
  transform: translateX(-50%);
  height: 13px; padding: 0;
  font-size: 10px; font-weight: 600; line-height: 13px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  border-radius: 3px;
}
.stage-scale-label.num { font-weight: 500; font-variant-numeric: tabular-nums; }
.stage-scale-label.lit { color: var(--st-accent); }
.stage-scale-label:hover { color: #fff; }
.stage-scale-label.lit:hover { color: var(--st-accent); }

.stage-track-area {
  position: relative;
  height: 20px;
  display: flex; align-items: center;
  cursor: pointer;
  touch-action: none;
  border-radius: 6px;
}
.stage-track {
  position: relative;
  width: 100%; height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
  transition: height 0.2s var(--snappy);
}
.stage-track-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.2s var(--snappy);
}
.stage-tempo.grabbed .stage-track, .stage-volume.grabbed .stage-track { height: 12px; }
.stage-tempo.grabbed .stage-track-fill, .stage-volume.grabbed .stage-track-fill { background: rgba(255, 255, 255, 0.95); }

.stage-tempo-foot { position: relative; height: 21px; }
.stage-tempo-rest {
  position: absolute; inset: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  font-size: 13px; font-weight: 500; line-height: 16px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  transition: opacity 0.2s ease-out;
}
.stage-tempo-rest .mark { letter-spacing: 0.8px; }
.stage-tempo-scale {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.stage-tempo.revealed .stage-tempo-rest { opacity: 0; }
.stage-tempo.revealed .stage-tempo-scale { opacity: 1; pointer-events: auto; }
.stage-tempo-ticks { display: block; width: 100%; height: 6px; flex: none; }
.stage-tempo-numbers { position: relative; height: 13px; flex: none; }

/* ================================================================= transport, volume, bottom row */

.stage-transport-wrap { display: flex; align-items: center; justify-content: center; }
.stage-transport {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  direction: ltr;
  transform-origin: 50% 50%;
}
.stage-tbtn {
  flex: none; width: 76px; height: 64px;
  display: grid; place-items: center;
  color: #fff;
  border-radius: 14px;
  transition: opacity 0.15s, transform 0.12s;
}
.stage-tbtn:active:not(:disabled) { transform: scale(0.92); }
.stage-tbtn:disabled { color: rgba(255, 255, 255, 0.3); }
.stage-tbtn.side .icon { width: 48px; height: 48px; }
.stage-tbtn.play .icon { width: 56px; height: 56px; }
.stage-tbtn .icon.swap { animation: stage-swap 0.2s ease-out; }
@keyframes stage-swap { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }

.stage-volume { display: flex; align-items: center; gap: 14px; direction: ltr; }
.stage-volume .stage-track-area { flex: 1 1 0; min-width: 0; }
.stage-speaker { flex: none; display: grid; place-items: center; color: rgba(255, 255, 255, 0.55); }
.stage-speaker .icon { width: 16px; height: 16px; }

.stage-bottom { display: flex; align-items: center; }
.stage-lib {
  flex: none; width: 40px; height: 36px;
  display: grid; place-items: center;
  color: #fff; border-radius: 8px;
}
.stage-lib:hover { background: rgba(255, 255, 255, 0.06); }
.stage-lib .icon { width: 22px; height: 22px; stroke-width: 1.6; }
.stage-queue {
  flex: none; width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background 0.2s, color 0.2s;
}
.stage-queue:hover { background: rgba(255, 255, 255, 0.16); }
.stage-queue.on, .stage-queue.on:hover { background: rgba(255, 255, 255, 0.78); color: rgba(0, 0, 0, 0.75); }
.stage-queue .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.stage-narrow .stage-lib { width: 56px; height: 44px; }
.stage-narrow .stage-lib .icon { width: 27px; height: 27px; }
.stage-narrow .stage-queue { width: 52px; height: 52px; background: transparent; }
.stage-narrow .stage-queue:hover { background: rgba(255, 255, 255, 0.08); }
.stage-narrow .stage-queue.on { background: rgba(255, 255, 255, 0.78); }
.stage-narrow .stage-queue .icon { width: 24px; height: 24px; }

/* ================================================================= Up Next */

.stage-upnext { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.stage-upnext-head { flex: none; display: flex; align-items: baseline; margin-bottom: 10px; min-width: 0; }
.stage-upnext-head .stage-spacer { min-width: 12px; }
.stage-upnext-title { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; color: #fff; white-space: nowrap; }
.stage-upnext-save, .stage-upnext-clear {
  flex: none;
  font-size: 13px; font-weight: 600;
  padding: 2px 0;
}
.stage-upnext-save { color: var(--st-accent); margin-inline-end: 10px; }
.stage-upnext-clear { color: var(--st-clear); }
.stage-upnext-save:hover, .stage-upnext-clear:hover { filter: brightness(1.15); }

.stage-upnext-list {
  position: relative;   /* the rows' offsetParent, so drag positions compare in one frame */
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 86%, transparent 100%);
  padding-bottom: 12px;
}
.stage-upnext-list::-webkit-scrollbar { display: none; }
.stage-upnext-row {
  position: relative;
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 3px 0;
  border-radius: 10px;
}
.stage-upnext-row.dragging { background: rgba(255, 255, 255, 0.08); z-index: 2; }
.stage-upnext-song {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  text-align: start;
  border-radius: 8px;
}
.stage-upnext-song:hover .stage-upnext-name { color: #fff; }
.stage-upnext-cover { flex: none; width: 52px; height: 52px; }
.stage-upnext-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-upnext-name {
  font-size: 17px; line-height: 1.25;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-upnext-sum {
  font-size: 15px; line-height: 1.25;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.stage-upnext-handle {
  flex: none; width: 36px; height: 52px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.45);
  cursor: grab;
  touch-action: none;
  border-radius: 8px;
}
.stage-upnext-handle:hover { color: rgba(255, 255, 255, 0.7); }
.stage-upnext-row.dragging .stage-upnext-handle { cursor: grabbing; color: #fff; }
.stage-upnext-handle .icon { width: 22px; height: 22px; stroke-width: 1.6; }

.stage-upnext-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.stage-upnext-emptytext { margin: 0; font-size: 15px; line-height: 1.35; color: rgba(255, 255, 255, 0.6); -webkit-user-select: text; user-select: text; }
.stage-upnext-lib {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 15px; font-weight: 600;
}
.stage-upnext-lib:hover { background: rgba(255, 255, 255, 0.2); }
.stage-upnext-lib .icon { width: 19px; height: 19px; stroke-width: 1.7; }

/* In once everything above has moved out of its way (the phone's column). */
.stage-upnext.enter { animation: stage-rise 0.3s ease-out 0.22s both; }
@keyframes stage-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ================================================================= focus */

.stage-root :focus-visible { outline: 2px solid var(--st-accent); outline-offset: 2px; }
.stage-track-area:focus-visible { outline-offset: 0; }

@media (hover: none) {
  .stage-tool:hover { color: rgba(255, 255, 255, 0.4); }
  .stage-tool.on:hover { color: rgba(255, 255, 255, 0.95); }
  .stage-star:hover, .stage-more:hover, .stage-lib:hover { background: none; }
}
