/* The palette, from Polish stoneware: cobalt navy (the ink -- text, the
   dark surfaces), royal blue and coral (the accents), forest green (the
   nav bar), on warm cream (the page itself, and text on the dark
   surfaces). Around each, a few close relations for depth, never a
   sixth color: its lift (lighter, warmer, richer -- the cream's a
   peach, toward the coral) and its shade (darker, cooler), for the
   light falling from the top left across the dithered shadows and the
   buttons' and cards' relief (relief/, from scripts/build_relief.py),
   and its dim and muted forms, for what's set back. Worked out in
   OKLCH in static/lab/microhue.html, and fixed here as hex.

   --near-black and --cream are what index.html's keyboard reads (via
   getComputedStyle) for its key colors, so they stay plain hex.
   --near-black-rgb is the same navy as an R,G,B triplet, for
   rgba(var(--near-black-rgb), <alpha>). */
:root {
  --navy: #15203c;
  --royal: #294d8e;
  --coral: #d35836;
  --forest: #27442a;
  --cream: #e1ddcf;
  --cream-dark: #d4c6c0;
  /* Each color's lift and shade, and the same three quarters of the way
     from the color (-m), for the relief's gentler gradients. The cream,
     nearly colorless, shades warm instead of cool: a little darker,
     richer, and toward orange -- sand, where turning it cool and dark
     would gray it. */
  --navy-lift: #342555;
  --navy-shade: #00152a;
  --navy-lift-m: #312553;
  --navy-shade-m: #00162c;
  /* The cards' navy, and its lift and shade: the navy's own, a step
     lighter (OKLCH, L + 0.1), so a page of them doesn't glare off the
     cream. */
  --card: #2d3958;
  --card-lift: #4e4072;
  --card-shade: #152e44;
  --card-lift-m: #4b3f70;
  --card-shade-m: #152f47;
  --royal-lift: #6346b9;
  --royal-shade: #004475;
  --royal-lift-m: #5e47b5;
  --royal-shade-m: #004578;
  --cream-lift: #ffddc9;
  --cream-shade: #e3d3bb;
  --cream-lift-m: #ffdeca;
  --cream-shade-m: #e3d5be;
  --forest-lift: #485213;
  --forest-shade: #053627;
  --forest-lift-m: #455017;
  --forest-shade-m: #093727;
  /* The nav's green, a dark gray teal at the window's edges (--nav-lift:
     a little darker than retro's navy-button lift, at a hue a quarter of
     the way from it to the green's, grayed): fading over --edge-fade into the green, half of
     it out past the flower at the left and the setup button at the
     right, and half of it in over them; and between them, the green
     rising gradually to a lighter, warmer glow in the middle. In retro,
     in 1px dots (relief/edge-<side>.svg and relief/glow.svg, from
     scripts/build_relief.py, its EDGE_FADE). Where each fade starts is
     measured across the green's layers (as wide as the window, centered
     on it) from their middle, by the nav's column: its padding, or its
     padding and the gutter, less half the fade; the glow spans the
     column inside its padding. */
  --nav-lift: #253f3b;
  --forest-glow: #334d2b;
  --edge-fade: 256px;
  --nav-column: min(100vw, calc(var(--page-width) + 2 * var(--page-padding-x)));
  --edge-left: calc(50% - var(--nav-column) / 2 + var(--page-padding-x) - var(--edge-fade) / 2);
  --edge-right: calc(50% + var(--nav-column) / 2 - var(--page-padding-x) - var(--stream-gutter) + var(--edge-fade) / 2);
  --edge-left-image: url("relief/edge-left.svg");
  --edge-right-image: url("relief/edge-right.svg");
  --glow-image: url("relief/glow.svg");
  --glow-width: calc(var(--nav-column) - 2 * var(--page-padding-x));
  --coral-lift: #f56500;
  --coral-shade: #be3e52;
  --coral-lift-m: #f26400;
  --coral-shade-m: #c04150;
  /* Set back: the navy, lightened and grayed (folded groups' and hints'
     ink), and the cream, dimmed and grayed (their dither). */
  --navy-muted: #687186;
  --cream-dim: #d0cdc5;
  /* The checkerboards' dot: 2px, or as near as a whole number of the
     display's own pixels comes to it (index.html's snapDither sets it),
     so at any zoom or display scale every dot, and every repeat of the
     checkerboard, is drawn the same and the pattern runs on seamlessly. */
  --dither-cell: 2px;
  /* A quiet fill on the page: the dimmed cream, every other dot. */
  --quiet-dither: conic-gradient(var(--cream-dim) 25%, transparent 0 50%, var(--cream-dim) 0 75%, transparent 0) 0 0 / calc(2 * var(--dither-cell)) calc(2 * var(--dither-cell));
  /* The relief, baked per color (scripts/build_relief.py). */
  --relief-navy: url("relief/navy.svg");
  --relief-card: url("relief/card.svg");
  --relief-royal: url("relief/royal.svg");
  --relief-cream: url("relief/cream.svg");
  --relief-forest: url("relief/forest.svg");
  --relief-coral: url("relief/coral.svg");
  /* The colors' roles, where one color plays two: the page (and the
     panels set on it) and its ink, royal as ink on it, the setup
     panel's ink, and the sand that sets things back. Today each is the
     palette color itself; the dark look (under Themes, below) pulls them apart
     from the surfaces and their ink, which keep the palette's names. */
  --page: var(--cream);
  --ink: var(--navy);
  --accent-ink: var(--royal);
  --panel-ink: var(--forest);
  /* Text in the cream, on the dark surfaces and, in dark, the page. */
  --cream-ink: var(--cream);
  /* What's set back: the cream's sand (--cream-shade), a step deeper
     (OKLCH L - 0.04) to stand off the page. */
  --sand-light: #d7c6ac;
  --sand: var(--sand-light);
  /* The sand's own dark color, for the shadows of things on it. */
  --sand-shade: #bfac90;
  --near-black: #15203c;
  --near-black-rgb: 21, 32, 60;
  /* Cream in light, for a field set into the page (the search box). */
  --cream-light: color-mix(in srgb, var(--cream), #fff 45%);
  /* A halftone: royal dots on the cream, two to every 4px square, as
     the teapot's own shading is -- a tinted fill (the search results').
     Text of less importance is set in royal on the page, or the muted
     ink where it's set back, and smaller or lighter in cream on the dark
     surfaces. */
  --halftone:
    conic-gradient(at 1px 1px, transparent 75%, var(--royal) 0) 0 0 / 4px 4px,
    conic-gradient(at 1px 1px, transparent 75%, var(--royal) 0) 2px 2px / 4px 4px;
  /* The ring that stands things off whatever they're over: in cream,
     the MIDI tip's. */
  --cream-ring: 2.25px;
  /* The edge-to-edge layers (the nav's green, the search area's cream
     and green): a little wider than the window, so rounding at a
     browser's zoom or display scale never leaves a hairline of page at
     either edge. The page clips what runs past (html, below). */
  --full-bleed: calc(100vw + 1rem);
  --radius: 10px;
  /* Every playhead (the player's strip, a playing card's, the radio's
     deck): a coral line this wide, its right edge the current position,
     and one pixel of navy just behind it, the moment before. */
  --playhead-width: 2px;
  --playhead-shadow: -1px 0 0 var(--navy);
  --radius-sm: 6px;
  --font: "Space Grotesk", system-ui, sans-serif;
  /* The column everything lines up in: the nav, the lists, the player. */
  --page-width: 68rem;
  --page-padding-x: 2rem;
  --nav-height: 5.5rem;
  /* On a page with a search bar the nav's own box is shorter, ending
     where the bar's band of green begins; its row sits at the same
     height either way. */
  --nav-height-searching: calc(var(--nav-height) - 15px);
  --nav-gap: 1.25rem;
  /* Reserved right of every stream card for .stream-item.selected's
     note -- the dock reserves it too, keeping the fingerprint aligned
     with the cards rather than with their gutter. */
  --stream-gutter: 28px;
  /* #now-playing-dock's fixed height -- tall enough for its tallest
     state (the transport over an 88px strip) so switching sections or
     streams never resizes it. The page's bottom padding clears it. */
  --dock-height: 10.5rem;
  /* What's already been heard, in the dock's strip and the playing
     card's thumbnail (#progress-played, .card-played): fully grayscale,
     so the part still to come is the only color. */
  --played-filter: saturate(0);
  /* Outlines the position lines and markers over the fingerprints, whose
     background runs from dark to near-white along their length: a crisp
     dark edge either side plus a soft glow, so the cream reads over
     bright notes as well as dark gaps. A filter, not a box-shadow, so it
     follows each dash's own shape. */
  --line-halo:
    drop-shadow(1px 0 0 rgba(0, 0, 0, 0.55))
    drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 2.5px rgba(0, 0, 0, 0.8));
}

/* Clip, not hidden, so the sticky nav and search area still stick. No
   rubber-band bounce at the page's ends, which would drag the sticky nav
   along with the content. */
html {
  overflow-x: clip;
  overscroll-behavior-y: none;
}
/* Pages without the app shell (e.g. admin_piece_types.html) are a plain
   centered column. */
body {
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}
button, input, select, textarea { font-family: inherit; }
/* Some browsers draw an open <select>'s popup through a native path that
   doesn't resolve `inherit`; naming the stack sidesteps it. */
option { font-family: var(--font); }

/* The player page (index.html): the top nav, then one section's content
   below it -- and on Perform, the player fixed across the bottom, which
   the page clears. */
body.app-shell {
  max-width: none;
  margin: 0;
  padding: 0 0 3rem;
}
body.app-shell.mode-welcome { padding-bottom: 0; }

/* --- Top nav ---------------------------------------------------------- */

#top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--nav-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--nav-gap);
  max-width: calc(var(--page-width) + 2 * var(--page-padding-x));
  margin: 0 auto;
  /* The lists and the player stop short of the column's right edge, by
     the gutter their playhead marker sits in; the nav ends where they do. */
  /* A little more below than above: the row sits a touch high, the
     search bar (on pages with one) carrying the green on down. */
  padding: 0 calc(var(--page-padding-x) + var(--stream-gutter)) 8px var(--page-padding-x);
  background: var(--forest);
}
/* One solid green bar, edge to edge, though its contents keep to the
   page's column. Its buttons are the same green, so they read as plain
   cream text on the bar until hovered (see below). Over the search
   area, it runs a little past the nav's bottom edge onto the area's
   green: at a fractional display scale that edge falls mid-pixel, and
   the two layers' half-covered pixels would leave a light seam. */
#top-nav { --nav-overlap: 0px; }
#top-nav::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 50%;
  width: var(--full-bleed);
  height: calc(100% + var(--nav-overlap));
  transform: translateX(-50%);
  /* Like the search bar's green (#search-box::before), as wide as the
     window and centered on it, so their edges meet seamlessly. */
}
/* The green's layers, the nav's and the search bar's: each side's navy
   sized to reach from the window's edge to the end of its fade. Retro's
   dots are drawn --edge-y down, --edge-height tall, so the search bar's
   keep in step with the nav's. */
#top-nav::after, #search-box::before {
  background:
    var(--edge-left-image) 0 var(--edge-y, 0px) / calc(var(--edge-left) + var(--edge-fade)) var(--edge-height, 100%) no-repeat,
    var(--edge-right-image) 100% var(--edge-y, 0px) / calc(100% - var(--edge-right) + var(--edge-fade)) var(--edge-height, 100%) no-repeat,
    var(--glow-image) 50% var(--edge-y, 0px) / var(--glow-width) var(--edge-height, 100%) no-repeat,
    var(--forest);
}
/* A chamomile flower in dots, its colors the theme's, on the bar. */
/* Over everything around it: nothing in the nav, or under it
   (#search-area, a lower layer than the nav), may cover it. */
#logo-link { position: relative; z-index: 60; display: block; flex: none; line-height: 0; }
/* Small enough to clear the search bar under it, on the pages with one.
   Its alt text is for screen readers only, never drawn in its place
   while the image loads. */
.logo { width: 60px; height: 60px; color: transparent; }
#logo-link { color: transparent; text-decoration: none; }
/* Three stacked images: retro rests on the coarse pixels, flat on the
   photograph, and hovering crossfades in two quick steps through the
   fine pixels to the other end -- coarse, fine, photo in retro; photo,
   fine, coarse in flat -- and back the same way. The fine pixels show
   only in between: they fade in by opacity and out by filter, two
   properties so each step can have its own delay. Each state's rule
   holds the delays for transitions into it, so the step order reverses
   when the pointer leaves. */
#logo-link { --logo-step: 90ms; }
#logo-link .logo + .logo { position: absolute; inset: 0; }
#logo-link .logo { transition: opacity var(--logo-step) ease-out; }
#logo-link .logo-fine {
  opacity: 0;
  filter: opacity(1);
  transition: opacity var(--logo-step) ease-out var(--logo-step), filter var(--logo-step) ease-out;
}
#logo-link:hover .logo-fine {
  opacity: 1;
  filter: opacity(0);
  transition: opacity var(--logo-step) ease-out, filter var(--logo-step) ease-out var(--logo-step);
}
/* The resting image fades in on the second step back; the hovered end
   fades in on the second step there. */
:root:not([data-look~="flat"]) #logo-link .logo-coarse,
:root[data-look~="flat"] #logo-link .logo-photo { opacity: 1; transition-delay: var(--logo-step); }
:root:not([data-look~="flat"]) #logo-link .logo-photo,
:root[data-look~="flat"] #logo-link .logo-coarse { opacity: 0; transition-delay: 0s; }
:root:not([data-look~="flat"]) #logo-link:hover .logo-coarse,
:root[data-look~="flat"] #logo-link:hover .logo-photo { opacity: 0; transition-delay: 0s; }
:root:not([data-look~="flat"]) #logo-link:hover .logo-photo,
:root[data-look~="flat"] #logo-link:hover .logo-coarse { opacity: 1; transition-delay: var(--logo-step); }
@media (prefers-reduced-motion: reduce) {
  #logo-link .logo, #logo-link:hover .logo { transition: none; }
}
/* Over the search bar's row (counting it gone from the moment it starts
   closing -- see showSearchArea), the bar sits shorter and a touch
   lower. Its height eases between that, its own, and its grown height
   under the open setup panel, as quickly as the panel and the search
   bar open and close. */
#top-nav { transition: height 220ms ease, padding 220ms ease; }
@media (prefers-reduced-motion: reduce) {
  #top-nav { transition: none; }
}
body:has(#search-area:not([hidden], [data-leaving])) #top-nav {
  --nav-overlap: 2px;
  height: var(--nav-height-searching);
  padding-top: 7px;
  padding-bottom: 0;
}
/* The sections' row scrolls sideways rather than wrapping, its
   scrollbar hidden behind the arrows (updateNavScroll); padded out above
   and below, and pulled back by as much, so the scroll's clip leaves
   room for a focused section's outline. Not at the ends: there the clip
   is the arrows' outer edges. */
#nav-scroller { position: relative; flex: 1; min-width: 0; display: flex; }
#top-nav nav {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 0;
  margin: -8px 0;
}
#top-nav nav::-webkit-scrollbar { display: none; }
/* Under the arrows (while each shows), the row fades out into the bar:
   masked, not painted over, so the bar's own fades show through. */
#top-nav nav {
  --fade-start: 0px;
  --fade-end: 0px;
  mask-image: linear-gradient(to right,
    transparent calc(var(--fade-start) * 0.55), #000 var(--fade-start),
    #000 calc(100% - var(--fade-end)), transparent calc(100% - var(--fade-end) * 0.55));
}
#nav-scroller:has(> .nav-scroll[data-dir="-1"]:not([hidden])) nav { --fade-start: 2.25rem; }
#nav-scroller:has(> .nav-scroll[data-dir="1"]:not([hidden])) nav { --fade-end: 2.25rem; }
/* Over the row's ends. */
.nav-scroll {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 2.25rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--cream-ink);
  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
.nav-scroll[data-dir="-1"] { left: 0; text-align: left; }
.nav-scroll[data-dir="1"] { right: 0; text-align: right; }
.nav-scroll[hidden] { display: none; }
/* The scroll chevrons have no body: hovered, their shadow is the L that
   would show past one, in the nav's sand. */
.nav-scroll span {
  display: inline-grid;
  place-items: center;
  width: 0.8em;
  height: 1.1em;
  border-radius: 3px;
  transition: box-shadow 120ms ease;
}
.nav-scroll:hover span { box-shadow: 2px 2px 0 var(--cream-shade); }
/* Every button on the site: one color,
   cream on royal blue, and nothing else -- no change of hue on hover, for
   the current section, or for a call to action. Those are marked instead
   by its depth: the button stands out from the page over a plain shadow
   dropped below and to the right -- on hover, and kept for as long as the
   button is the current
   one (the nav's section, the open menu) or the thing to press next
   (enabling MIDI, in the menu). The hero's own Enable is the one
   exception to the single color: coral, the page's call to action.

   Light falls from the top left. The button's body is warm plastic in
   it -- its color's relief (--button-relief), in dots: a soft highlight
   up at its top left, falling through the color to its shade at the far
   corner, under a lit hairline of the color's lift along its top and a
   darker 2px lip of its shade along its bottom (--button-lift,
   --button-shade) -- and its shadow is its own dark color (--shadow), a
   quarter of its --drop deep.

   The button paints nothing itself. Its fill (--button-fill, royal but
   for the nav's own green), and the shadow with it, is its ::after,
   under its text, and isolation keeps them in
   the button's own stacking context -- above whatever it sits on, cream
   page or navy panel. :where() keeps these rules at no specificity, so
   any rule for one button or one state overrides them. */
:root {
  --shadow: var(--royal-shade);
  --button-fill: var(--royal);
  --button-relief: var(--relief-royal);
  --button-lift: var(--royal-lift);
  --button-shade: var(--royal-shade);
  --drop: 12px;
}
/* The nav's buttons have no body at all -- they're words on the bar --
   so one never covers a neighbour's shadow. Their shadow hugs the word,
   inset from the button's generous click area, drops a shorter way, in
   the nav's sand. */
#top-nav {
  --button-fill: transparent;
  --button-relief: none;
  --button-lift: transparent;
  --button-shade: transparent;
  --shadow: var(--cream-shade);
  --drop: 8px;
}
#top-nav :is(.nav-item, #setup-toggle, #nav-play-pause)::after {
  inset: 0.45rem 0.3rem;
  border-radius: 3px;
}
/* Pressed, and while it's the current section (or the open menu's
   toggle), a nav button turns over: a cream body around the word, in
   green, over its whole shadow. */
#top-nav :is(.nav-item.active, #setup-toggle[aria-expanded="true"], .nav-item:active, #setup-toggle:active, #nav-play-pause:active) {
  --button-fill: var(--cream);
  --button-relief: var(--relief-cream);
  --button-lift: var(--cream-lift);
  --button-shade: var(--cream-shade);
  color: var(--forest);
}
:where(.nav-item, #setup-toggle, #nav-play-pause, .btn, .midi-trigger, #live-state-controls button, #stream-list button[hx-get]) {
  position: relative;
  isolation: isolate;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--cream-ink);
  cursor: pointer;
}
:where(.nav-item, #setup-toggle, #nav-play-pause, .btn, .midi-trigger, #live-state-controls button, #stream-list button[hx-get])::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
/* The fill: the color, under its relief, drawn to the button's size,
   and its shadow while it stands out. */
:where(.nav-item, #setup-toggle, #nav-play-pause, .btn, .midi-trigger, #live-state-controls button, #stream-list button[hx-get])::after {
  z-index: -1;
  background: var(--button-relief) 0 0 / 100% 100% no-repeat, var(--button-fill);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--button-lift) 70%, transparent),
    inset 0 -2px 0 color-mix(in oklab, var(--button-shade) 60%, transparent),
    var(--drop-shadow, 0 0 transparent);
  transition: box-shadow 120ms ease;
}
:where(.nav-item, #setup-toggle, #nav-play-pause, .btn, .midi-trigger, #live-state-controls button, #stream-list button[hx-get]):not(:disabled):hover,
:where(#top-nav .nav-item.active, #setup-toggle[aria-expanded="true"], #top-nav :is(.nav-item, #setup-toggle, #nav-play-pause):active) {
  --drop-shadow: calc(var(--drop) / 4) calc(var(--drop) / 4) 0 var(--shadow);
}
.nav-item {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:focus-visible,
#setup-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

/* What's playing: the link to Now Playing, its note swelling and
   settling while there's music, and a pause/play beside it. */
#nav-now-playing { display: flex; align-items: center; gap: 0.25rem; }
#nav-now-playing[hidden] { display: none; }
#now-playing-link { gap: 0.5rem; }
.nav-note { display: inline-block; font-size: 1rem; line-height: 1; letter-spacing: 0; }
#nav-now-playing.playing .nav-note { animation: nav-note-pulse 1s ease-in-out infinite; }
@keyframes nav-note-pulse {
  50% { transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  #nav-now-playing.playing .nav-note { animation: none; }
}
/* Play/pause beside it: drawn shapes, not text glyphs, so they sit at
   the words' middle rather than on their baseline. Its hover shadow is
   the nav's own; play and pause simply swap, without a bounce. */
#nav-play-pause {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  line-height: 0;
}
#nav-play-pause .pp-icon { display: block; transition: none; }
#nav-play-pause .pp-icon svg { display: block; width: 0.85rem; height: 0.85rem; fill: currentColor; }

/* --- Setup menu ------------------------------------------------------- */

/* Opened, the hamburger turns the bar over: a cream panel growing out
   to its left, as tall as the hamburger, so the bar never grows and
   nothing under it moves; it shoves the sections along. In it, two
   tabs stacked on its right edge beside the hamburger, MIDI I/O and
   Themes, the one showing joined to a well of its controls to their
   left (showSetupTab): the MIDI setup's three triggers, or the look's
   two. All of it runs right to left, out from the hamburger: the tabs
   first, then each control in the markup's order, Enable nearest. Each control cycles through its
   choices on a click, and says so with a caret, its next choice popping
   down into place (setTriggerLabel). The controls keep fixed sizes, so
   the panel's width is known ahead (--setup-panel-width) and doesn't
   jump as their labels change. The menu stays laid out while closed,
   clipped away to its right edge, so it can grow out of it. */
:root {
  /* Each just its longest label, its caret, and its padding: "Enabled",
     and "→ Out: Port 0". */
  --midi-mode-width: 5.6rem;
  --midi-port-width: 7.9rem;
  --setup-tabs-width: 4.9rem;
  --setup-pad: 4px;
  --setup-col-gap: 0.3rem;
  --setup-panel-width: calc(2 * var(--setup-pad) + var(--setup-tabs-width) + var(--midi-mode-width) + 2 * var(--midi-port-width) + 4 * var(--setup-col-gap) + 0.4rem + 3rem + 8px);
  --midi-trigger-height: 1.9rem;
  /* The tabs' well: the bar's own green, the panel turned back over. */
  --setup-well: var(--forest);
}
#setup {
  position: relative;
  flex: none;
  display: flex;
  justify-content: flex-end;
  width: 3rem;
  transition: width 220ms ease;
}
#setup:has(#setup-menu:not([hidden])) {
  width: var(--setup-panel-width);
  --button-fill: var(--forest);
  --button-relief: var(--relief-forest);
  --button-lift: var(--forest-lift);
  --button-shade: var(--forest-shade);
  --shadow: var(--forest-shade);
}
/* Styled with the nav's buttons, above; standing out while its menu is open,
   like the current section, in the panel's green. Over the panel. */
#setup-toggle {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  transition: margin-right 220ms ease;
}
/* Open, on the panel's cream, it turns all the way over from the nav's
   cream-on-green: a green body, in the green's relief, its lines in
   cream -- and steps in from the panel's edge, giving its shadow room. */
#top-nav #setup-toggle[aria-expanded="true"] {
  margin-right: 8px;
  --button-fill: var(--forest);
  --button-relief: var(--relief-forest);
  --button-lift: var(--forest-lift);
  --button-shade: var(--forest-shade);
  color: var(--cream-ink);
}
#setup-menu {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--setup-panel-width);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--panel-ink);
  clip-path: inset(0 0 0 0 round var(--radius));
  transition: clip-path 220ms ease, visibility 220ms;
}
#setup-menu[hidden] {
  display: block;
  visibility: hidden;
  clip-path: inset(0 0 0 100% round var(--radius));
}
/* The hamburger's room, the tabs, and the well, over the panel. */
#midi-panel {
  display: flex;
  flex-direction: row-reverse;
  height: 3rem;
  box-sizing: border-box;
  padding: var(--setup-pad);
  padding-right: calc(var(--setup-pad) + 0.4rem + 3rem + 8px);
  white-space: nowrap;
}
#setup-tabs { flex: none; width: var(--setup-tabs-width); display: flex; flex-direction: column; }
/* Small words, rounded on the right only: the one showing in the well's
   green, its word in cream, running on into it; the other set back on
   the panel, a hint of the green under it on hover. */
.setup-tab {
  flex: 1;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  padding: 0 0.45rem;
  color: var(--panel-ink);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.6;
  cursor: pointer;
  transition: background-color 120ms ease, opacity 120ms ease;
}
.setup-tab:hover { opacity: 0.85; background: color-mix(in oklab, var(--setup-well) 15%, transparent); }
.setup-tab[aria-selected="true"] { opacity: 1; background: var(--setup-well); color: var(--cream-ink); cursor: default; }
.setup-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
/* The well squares off the corner its tab runs into. On its green the
   controls are the nav's buttons turned over, as the current section
   is: cream bodies, their words in green, their shadows the sand as on
   the bar, but half as deep, to stay in the well. */
#setup-well {
  --button-fill: var(--cream);
  --button-relief: var(--relief-cream);
  --button-lift: var(--cream-lift);
  --button-shade: var(--cream-shade);
  --shadow: var(--cream-shade);
  --drop: 4px;
  color: var(--cream-ink);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: var(--setup-col-gap);
  padding: 0 var(--setup-col-gap);
  border-radius: var(--radius-sm);
  background: var(--setup-well);
}
#midi-panel[data-tab="midi"] #setup-well { border-top-right-radius: 0; }
#midi-panel[data-tab="themes"] #setup-well { border-bottom-right-radius: 0; }
/* Showing Themes, its choices take the MIDI triggers' place. */
#midi-panel[data-tab="themes"] #setup-well > :is(.midi-trigger, #midi-status-icon),
#midi-panel:not([data-tab="themes"]) #theme-choices { display: none; }
#theme-choices { display: flex; flex-direction: row-reverse; gap: var(--setup-col-gap); }
#setup-well .midi-trigger { color: var(--forest); flex: none; width: var(--midi-port-width); height: var(--midi-trigger-height); padding-block: 0; font-size: 0.85rem; }
#setup-well #midi-mode-trigger { width: var(--midi-mode-width); }
#theme-choices .midi-trigger { width: 6rem; }
#midi-status-icon { cursor: help; font-size: 1rem; }
.midi-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.6rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.midi-trigger.inactive { opacity: 0.45; }
/* Its label, clipped to its own line (setTriggerLabel), so a choice
   arriving drops in from above it and the one leaving falls out below;
   then its caret, the hint there's another. */
.trigger-label {
  flex: 1;
  min-width: 0;
  display: grid;
  overflow: hidden;
}
.trigger-word {
  grid-area: 1 / 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The list's sort button (#list-sort) changes icon the same way. */
:is(.trigger-word, .sort-icon).arriving { animation: trigger-arrive 260ms cubic-bezier(0.3, 1.35, 0.5, 1); }
:is(.trigger-word, .sort-icon).leaving { animation: trigger-leave 180ms ease-in forwards; }
@keyframes trigger-arrive { from { transform: translateY(-110%); } }
@keyframes trigger-leave { to { transform: translateY(110%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  :is(.trigger-word, .sort-icon):is(.arriving, .leaving) { animation: none; }
}
.trigger-caret { flex: none; width: 0.6rem; height: 0.6rem; margin-left: 0.4rem; opacity: 0.75; }
/* The real port lists, never shown -- the triggers cycle through them. */
.port-list.disabled { pointer-events: none; }

/* Royal blue tips hanging under the hamburger, pointing up at it: the
   enable-MIDI nudge, and in Perform the pointer to choosing an input
   (see updateMidiHints). */
.theme-tooltip {
  position: absolute;
  top: calc(100% + 0.9rem);
  right: 0;
  z-index: 50;
  width: 15rem;
  padding: 1rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--royal);
  color: var(--cream-ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  /* Clicked, it opens the menu at MIDI I/O (index.html's openMidiSetup). */
  cursor: pointer;
  /* A cream ring, standing it off whatever it's over. */
  box-shadow: 0 0 0 var(--cream-ring) var(--cream);
}
.theme-tooltip::before,
.theme-tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 1rem;
  border: 0.5rem solid transparent;
  border-bottom-color: var(--royal); /* the arrow behind the tooltip */
}
/* The pointer's ring: the same triangle grown the ring's width out from
   each side (times sqrt 2 along the 45-degree ones). */
.theme-tooltip::before {
  right: calc(1rem - var(--cream-ring) * 1.414);
  border-width: calc(0.5rem + var(--cream-ring) * 1.414);
  border-bottom-color: var(--cream);
}
/* The open menu covers the spot. */
#setup:has(#setup-menu:not([hidden])) .theme-tooltip { display: none; }

/* --- Themes ---------------------------------------------------------- */

/* Two knobs (Setup -> Themes, toggleLook), each a word in <html>'s
   data-look: "flat" or not (retro), and "dark" or not (light) -- four
   looks in all. Light retro is everything above. */

/* Retro: the relief's steps bolder than flat's gradients -- each
   color's lift and shade twice as far off it (the lab's --mh-dl 0.13
   against flat's 0.06) and its lift a little richer (--mh-sat 1.6). */
:root:not([data-look~="flat"]) {
  --navy-lift: #46376c;
  --navy-shade: #000519;
  --navy-lift-m: #413567;
  --navy-shade-m: #00081c;
  --royal-lift: #7759d6;
  --royal-shade: #003160;
  --royal-lift-m: #7058cf;
  --royal-shade-m: #003365;
  --cream-lift: #ffe2cc;
  --cream-lift-m: #ffe2cd;
  --forest-lift: #5b6624;
  --forest-shade: #002416;
  --forest-lift-m: #566225;
  --forest-shade-m: #002718;
  --coral-lift: #ff7800;
  --coral-shade: #a6263f;
  --coral-lift-m: #ff7500;
  --coral-shade-m: #ab2c3f;
  --card-lift: #61538a;
  --card-shade: #0d1b32;
  --card-lift-m: #5c5085;
  --card-shade-m: #0f1f35;
}

/* Dark: the cream's page goes dark -- the cream's own warm hue, nearly
   black -- and the cream turns to ink on it; the sand that sets things
   back is a step up from the page, and the search suggestions' field
   half a step. The royal and the green keep under a third of their
   chroma (OKLCH, C x 0.3) at their own lightness and hue; the navy,
   still the cards' surface, is drained and lifted a step off the page
   so a card still stands up from it, its lift and shade worked out from
   there as the lab does (static/lab/microhue.html); the coral keeps
   three quarters of its chroma, still the thing to press. Royal as ink,
   the gray, and the dimmed cream of the quiet dots are pitched to the
   dark. The cream itself -- the nav's current section, the search box,
   the open setup panel (still the bar turned over, green on cream) --
   steps down to the dark cream, its peach and sand
   carried along with it (the same steps in OKLCH from the light cream's). Retro's relief and
   edges are baked from these colors too, into relief/dark/
   (scripts/build_relief.py); flat, below, paints over them. */
:root[data-look~="dark"] {
  color-scheme: dark;
  --page: #1a1814;
  /* Text keeps the light palette's cream, a step brighter than the
     dark cream that surfaces take. */
  --cream-ink: #e1ddcf;
  --ink: var(--cream-ink);
  --accent-ink: #9cb2d8;
  --sand: #2e2b25;
  --sand-shade: #0d0b08;
  --cream-light: #26241f;
  --navy-muted: #858991;
  --cream-dim: #3a362f;
  --cream: var(--cream-dark);
  --cream-lift: #ebc6ce;
  --cream-shade: #d7bab5;
  --cream-lift-m: #ebc7ce;
  --cream-shade-m: #d7bcb7;
  --navy: #242b3b;
  --navy-lift: #3c3650;
  --navy-shade: #101e2a;
  --navy-lift-m: #3a354e;
  --navy-shade-m: #12202c;
  /* The cards' navy, as in light: the dark navy a step lighter (OKLCH,
     L + 0.1), standing them up off the page. */
  --card: #3d4556;
  --card-lift: #57516c;
  --card-shade: #283744;
  --card-lift-m: #55506a;
  --card-shade-m: #2a3946;
  --royal: #455063;
  --forest: #363f37;
  --nav-lift: #374846;
  --forest-glow: #40473e;
  --royal-lift: #605b7c;
  --royal-shade: #354352;
  --royal-lift-m: #5d5a7a;
  --royal-shade-m: #364553;
  --forest-lift: #4b4e3e;
  --forest-shade: #25302b;
  --forest-lift-m: #484c3d;
  --forest-shade-m: #26312c;
  --coral: #c2674e;
  --coral-lift: #e07745;
  --coral-shade: #ae505a;
  --coral-lift-m: #de7544;
  --coral-shade-m: #b05359;
  --relief-navy: url("relief/dark/navy.svg");
  --relief-card: url("relief/dark/card.svg");
  --relief-royal: url("relief/dark/royal.svg");
  --relief-cream: url("relief/dark/cream.svg");
  --relief-forest: url("relief/dark/forest.svg");
  --relief-coral: url("relief/dark/coral.svg");
  --edge-left-image: url("relief/dark/edge-left.svg");
  --edge-right-image: url("relief/dark/edge-right.svg");
  --glow-image: url("relief/dark/glow.svg");
}
/* Dark retro: the same bolder steps, worked out from the dark colors
   as the dark block's own are. */
:root[data-look~="dark"]:not([data-look~="flat"]) {
  --navy-lift: #4f4865;
  --navy-shade: #030e19;
  --navy-lift-m: #4a4560;
  --navy-shade-m: #05111c;
  --royal-lift: #746f93;
  --royal-shade: #273240;
  --royal-lift-m: #6f6c8e;
  --royal-shade-m: #293443;
  --forest-lift: #5e6250;
  --forest-shade: #171f1b;
  --forest-lift-m: #595e4d;
  --forest-shade-m: #19221d;
  --coral-lift: #eb874b;
  --coral-shade: #973c47;
  --coral-lift-m: #eb854a;
  --coral-shade-m: #9b4048;
  --cream-lift: #edcace;
  --cream-lift-m: #edcacf;
  --card-lift: #6b6482;
  --card-shade: #172531;
  --card-lift-m: #66617d;
  --card-shade-m: #1b2935;
}

/* Retro is the buttons' and cards' relief in dots. Flat has no dots but
   the hero teapot's. Its fills are the micro-hue
   lab's G4, warm plastic: a soft warm highlight up at the top left,
   falling through the color to its shade at the far corner, under a lit
   hairline along the top and a darker 2px lip along the bottom; the
   nav's navy edges fade smoothly into its green. What's set back sits on
   sand (--sand), or on nothing at all in the gray ink. */
:root[data-look~="flat"] {
  --relief-navy: radial-gradient(120% 100% at 15% 0%, var(--navy-lift-m), var(--navy) 55%, var(--navy-shade-m));
  --relief-card: radial-gradient(120% 100% at 15% 0%, var(--card-lift-m), var(--card) 55%, var(--card-shade-m));
  --relief-royal: radial-gradient(120% 100% at 15% 0%, var(--royal-lift-m), var(--royal) 55%, var(--royal-shade-m));
  --relief-cream: radial-gradient(120% 100% at 15% 0%, var(--cream-lift-m), var(--cream) 55%, var(--cream-shade-m));
  --relief-forest: radial-gradient(120% 100% at 15% 0%, var(--forest-lift-m), var(--forest) 55%, var(--forest-shade-m));
  --relief-coral: radial-gradient(120% 100% at 15% 0%, var(--coral-lift-m), var(--coral) 55%, var(--coral-shade-m));
}
:root[data-look~="flat"] #top-nav::after, :root[data-look~="flat"] #search-box::before {
  background: linear-gradient(in oklab to right,
    var(--nav-lift) var(--edge-left),
    var(--forest) calc(var(--edge-left) + var(--edge-fade)),
    var(--forest-glow) 50%,
    var(--forest) calc(var(--edge-right) - var(--edge-fade)),
    var(--nav-lift) var(--edge-right));
}
/* The field and view chips: sand. */
:root[data-look~="flat"] :is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip)::after { background: var(--sand); }
/* A folded group's name: just the gray ink. Search results: sand. */
:root[data-look~="flat"] .group > h2 button[aria-expanded="false"] > span:not(.group-count) { background: none; }
:root[data-look~="flat"] .search-result { background: var(--sand); }

/* --- Hero page -------------------------------------------------------- */

/* Fills the window under the nav: the full teapot faded into the page
   behind, the copy and the call to action over it. */
#hero {
  position: relative;
  min-height: calc(100dvh - var(--nav-height));
  box-sizing: border-box;
  display: grid;
  align-items: center;
  max-width: calc(var(--page-width) + 2 * var(--page-padding-x));
  margin: 0 auto;
  padding: clamp(1rem, 4dvh, 2rem) var(--page-padding-x);
  overflow: hidden;
}
#hero[hidden] { display: none; }
#hero-art {
  position: absolute;
  top: 50%;
  right: -8%;
  width: min(68rem, 92%);
  height: auto;
  /* Mirrored, spout to the left: pushed off to the right, it faces
     into the page. */
  transform: translateY(-50%) scaleX(-1);
  opacity: 0.2;
  pointer-events: none;
  user-select: none;
}
#hero-copy { position: relative; max-width: 42rem; }
#hero-kicker {
  margin: 0 0 1rem;
  color: var(--coral);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
#hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, min(6.5vw, 10dvh), 5.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
#hero-lede {
  margin: 1.75rem 0 0;
  max-width: 34rem;
  font-size: 1.35rem;
  line-height: 1.5;
}
#hero-midi-status {
  margin: clamp(1.25rem, 3.5dvh, 2.5rem) 0 1rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-ink);
}
#hero-midi-status a { color: inherit; text-underline-offset: 0.2em; }
/* The copy reads clear of the teapot behind on a wide, soft glow of
   cream: an ellipse reaching far past it on every side, under 0.6 at
   its heart and easing out to nothing, with no edge to be seen. */
#hero-copy { isolation: isolate; }
#hero-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -10rem -18rem;
  pointer-events: none;
  background: radial-gradient(farthest-side,
    color-mix(in srgb, var(--page) 55%, transparent) 0%,
    color-mix(in srgb, var(--page) 53%, transparent) 20%,
    color-mix(in srgb, var(--page) 46%, transparent) 38%,
    color-mix(in srgb, var(--page) 35%, transparent) 54%,
    color-mix(in srgb, var(--page) 22%, transparent) 68%,
    color-mix(in srgb, var(--page) 11%, transparent) 80%,
    color-mix(in srgb, var(--page) 4%, transparent) 90%,
    transparent 100%);
}
#hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
#hero-outputs { display: contents; }
#hero-outputs[hidden] { display: none; }

/* Big buttons: the hero's calls to action. */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 1rem 1.75rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.btn[hidden] { display: none; }
#hero-enable { --button-fill: var(--coral); --button-relief: var(--relief-coral); --button-lift: var(--coral-lift); --button-shade: var(--coral-shade); --shadow: var(--coral-shade); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* --- Content column --------------------------------------------------- */

#content-column {
  max-width: calc(var(--page-width) + 2 * var(--page-padding-x));
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0 var(--page-padding-x);
}
#content-column[hidden] { display: none; }
#content { margin: 0; }
/* Now Playing: the piece in large type, the player docked below. */
#player-page { padding: 4rem 0 2rem; }
#player-kicker {
  margin: 0 0 1rem;
  color: var(--coral);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
#player-title {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
#player-composer { margin: 1rem 0 0; font-size: 1.4rem; color: var(--accent-ink); }
/* Sign in and account: one column of short forms, each a label over
   its field and button. */
.account-form-page { max-width: 36rem; padding: 2rem 0 3rem; }
.account-form-page[hidden] { display: none; }
.account-form-page h1 { margin: 0 0 0.5rem; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.1; }
.account-form-page h2 { margin: 2rem 0 0.6rem; font-size: 1.15rem; }
.account-form-page label { display: block; margin: 1.25rem 0 0.4rem; font-weight: 700; }
.account-form-page form[hidden], .account-form-page [hidden] { display: none; }
.account-lede, .account-detail { color: var(--accent-ink); }
.field-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.text-field {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
}
.text-field:focus-visible { outline: 3px solid var(--royal); outline-offset: 2px; }
.account-form-page .text-chip { margin-top: 0.75rem; font-size: 0.85rem; text-decoration: none; display: inline-block; }
.account-form-page .text-chip.danger, .performer-edit .text-chip.danger, .radio-card .text-chip.danger { color: var(--coral-shade); }
#signin-alternatives { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.form-error { margin: 1rem 0 0; padding: 0.6rem 0.9rem; border-left: 4px solid var(--coral); background: color-mix(in srgb, var(--coral) 12%, var(--page)); }
.account-list { margin: 0; padding: 0; list-style: none; }
.account-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid color-mix(in srgb, var(--navy) 15%, transparent); }
.account-list .text-chip { margin: 0 0 0 auto; }
.account-item-detail { color: var(--accent-ink); font-size: 0.9rem; }
/* The sign-out buttons, one to a line. */
.account-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; margin-top: 1rem; }
.account-actions :is(.text-chip, .account-call) { margin: 0; }
/* The account page's parts, each on a navy card like a stream card's,
   standing still: cream text, its details a softer cream, its rules
   faint cream lines. */
.account-card {
  --accent-ink: color-mix(in oklab, var(--cream-ink) 72%, var(--card));
  margin-top: 1.25rem;
  padding: 1rem 1.25rem 1.25rem;
  border-radius: var(--radius);
  background: var(--relief-card) 0 0 / 100% 100% no-repeat, var(--card);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--card-lift) 70%, transparent),
    inset 0 -2px 0 color-mix(in oklab, var(--card-shade) 60%, transparent),
    0 0 0 1.5px color-mix(in oklab, var(--card) 40%, var(--page));
  color: var(--cream-ink);
}
.account-card h2 { margin: 0 0 0.75rem; }
.account-card h2 label { display: inline; margin: 0; font-weight: inherit; }
.account-card .account-detail { margin: 0.75rem 0 0; }
.account-card .account-detail:empty { display: none; }
.account-card .account-list li { border-bottom-color: color-mix(in oklab, var(--cream-ink) 18%, transparent); }
.account-card .account-list li:last-child { border-bottom: none; }
/* A numbered list: each item's number in navy on a cream circle. */
.account-list.numbered { counter-reset: account-item; }
.account-list.numbered > li:not(.empty) { counter-increment: account-item; }
.account-list.numbered > li:not(.empty)::before {
  content: counter(account-item);
  flex: none;
  align-self: center;
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* A passkey: its number, then its name and dates, with Remove under
   them, lined up at their left. */
.account-list li.passkey-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0.4rem 0.75rem; }
.account-list.numbered > li.passkey-item::before { grid-row: 1 / span 2; align-self: start; }
.passkey-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.account-list li.passkey-item .text-chip { grid-column: 2; justify-self: start; margin: 0; }
/* The page's call to action, in coral like the hero's Enable. */
.account-call {
  --button-fill: var(--royal);
  --button-relief: var(--relief-royal);
  --button-lift: var(--royal-lift);
  --button-shade: var(--royal-shade);
  --shadow: var(--royal-shade);
  margin-top: 1rem;
}
/* Add passkey is offered, not urged: in the plain buttons' royal. */
#account-add-passkey {
  --button-fill: var(--royal);
  --button-relief: var(--relief-royal);
  --button-lift: var(--royal-lift);
  --button-shade: var(--royal-shade);
  --shadow: var(--royal-shade);
}
.account-form-page .btn:disabled { opacity: 0.45; cursor: default; }

/* History: the filter, then its cards in the flat list's layout. */
#history-page { padding: 0.5rem 0 2rem; }
#history-page[hidden] { display: none; }
#history-filter[hidden] { display: none; }
#history-filter { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; }
#history-filter button { padding-block: 0.2rem; font-size: 0.85rem; line-height: 1.2; white-space: nowrap; }
.history-note { color: var(--navy-muted); }
#coming-soon { margin: 1.5rem 0 3rem; font-size: 2rem; font-weight: 700; color: var(--accent-ink); }

/* The search box and its tips, spanning the stream cards, not their
   right-hand gutter, pinned just under the nav. A speech bubble spoken
   by the current section: #search-bubble draws the box's shape and a
   tail rising from its top edge up into the nav, under that section's
   button, and #search-bubble-tail the whole tail again, in the nav,
   over its green (placeSearchBubble).
   Hidden where there's nothing to search (setNavMode) -- no display
   override on #search-area, which would beat [hidden]. */
#search-area {
  position: sticky;
  top: var(--nav-height-searching);
  z-index: 20;
  width: calc(100% - var(--stream-gutter));
  /* Just clear of the nav's row, the tail bridging the gap. */
  --bubble-gap: 5px;
  padding: var(--bubble-gap) 0 1.25rem;
  margin-bottom: 1rem;
}
/* The cream the lists scroll under, edge to edge. */
#search-area::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 50%;
  width: var(--full-bleed);
  transform: translateX(-50%);
  background: var(--page);
}
/* Behind the box (which comes after it, and is positioned too): the
   box's fill, one path with the tail. */
#search-bubble {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}
/* Over the nav's green, under its buttons (which come after it); an
   SVG clips to its own box, which ends at the box's top edge. */
#search-bubble-tail {
  position: absolute;
  pointer-events: none;
}
#search-bubble-tail[hidden] { display: none; }
:is(#search-bubble, #search-bubble-tail) path {
  fill: var(--cream);
  transition: d 200ms ease;
}
/* Looks like one text field, one line high: the chips (see the search
   box script in index.html), then the real, borderless input filling
   the rest, scrolling sideways together when they outrun it, behind a
   magnifying glass -- a background image, so it never catches a
   click; its stroke is the navy, written out, since a data: URL can't
   read a custom property. */
#search-box {
  position: relative;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 3.5rem;
  padding: 0.4rem 0.75rem 0.4rem 3rem;
  /* Room for #search-bubble's outline, which is drawn there instead. */
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2315203c' stroke-width='1.8' stroke-linecap='round'><circle cx='6.75' cy='6.75' r='4.75'/><path d='M10.25 10.25 L14 14'/></svg>") 1rem 50% / 1.2rem 1.2rem no-repeat;
  cursor: text;
}
/* The nav's green carried on down around the bar, edge to edge, so the
   bar sits within the nav; the tips and view switch under it are back
   on the page's cream. */
#search-box::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-2px - var(--bubble-gap));
  bottom: calc(-2px - 1rem);
  left: 50%;
  width: var(--full-bleed);
  /* Centered on the page's column, which runs on past the bar by the
     cards' gutter. */
  transform: translateX(calc(-50% + var(--stream-gutter) / 2));
  /* The nav's edges, their dots in step with the nav's: this layer
     starts right at the nav's bottom edge (it reaches up past the box by
     the box's own border, which it's set inside), so its images are
     drawn the nav's height up, to the dither's 8px repeat, and tall
     enough to still cover it. */
  --edge-y: calc(-1 * mod(var(--nav-height-searching), 8px));
  --edge-height: calc(100% + 8px);
}
/* Scrolled by a drag, a trackpad, or the caret; no scrollbar of its own. */
#search-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}
#search-scroll::-webkit-scrollbar { display: none; }
#search-chips { display: contents; }
.search-chip { flex: none; }
#search-input {
  flex: 1 0 10rem;
  min-width: 10rem;
  padding: 0.35rem 0;
  border: none;
  outline: none;
  background: none;
  color: var(--navy);
  font-size: 1.15rem;
}
#search-input::placeholder { color: var(--royal); }
/* A finished field:value token: a royal chip, the field in bold, with an
   x to drop it. */
.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.2rem 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--royal);
  color: var(--cream-ink);
  font-size: 1rem;
  white-space: nowrap;
}
.search-chip b { font-weight: 700; }
.search-chip button {
  border: none;
  background: none;
  padding: 0 0.35rem;
  color: inherit;
  opacity: 0.7;
  font: inherit;
  cursor: pointer;
}
.search-chip button:hover { opacity: 1; }
/* Under the box: what the field names are, each one a button that
   starts that filter in the box. */
/* The row under the box: the tips at the left, Browse's view switch at
   the right. */
#list-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.75rem; }
#search-tips { margin: 0; font-size: 0.95rem; color: var(--ink); }
/* The same under a theme's box, on the radio's navy card. */
.chip-input-tips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0; font-size: 0.85rem; }
/* The grouping options (order, sort, fold all), then a whole button's
   width apart each, the three groupings (setGrouping) and the three
   views (setStreamView): chips, side by side. */
#list-controls { display: flex; align-items: center; gap: calc(18px + 2 * 0.45rem); margin-left: auto; }
#list-controls[hidden] { display: none; }
#group-options, #group-mode, #view-toggle { display: flex; gap: 0.4rem; }
#group-options[hidden] { display: none; }
#list-controls button { display: grid; place-items: center; line-height: 0; }
#list-controls svg { width: 18px; height: 18px; }
/* The grouping options: words rather than icons, on the same chips. */
#list-controls button.text-chip { padding-block: 0.2rem; font-size: 0.85rem; line-height: 1.2; white-space: nowrap; }
#list-controls button:disabled { opacity: 0.45; cursor: default; }
/* A group (groupResultList): across the whole row in every view, its
   heading -- a button folding the group away, a
   triangle pointing down into it while it's open, along the heading
   while it's shut, then its name and how many it holds -- and under
   it, its body, a step in, holding its cards and subgroups laid out
   like the results themselves. */
.plain-list {
  --group-step: 1.5rem;
  /* Where the tree's lines run: under the heading's triangle. In the
     muted ink, set back, out of the way of what they connect. */
  --line-x: calc(0.35rem - 1px);
  --tree-line: var(--navy-muted);
}
.group > h2 {
  margin: 0 var(--stream-gutter) 0 0;
  font-size: 1.15rem;
}
.group[data-depth="1"] > h2 { font-size: 1rem; }
.group[data-depth="2"] > h2 { font-size: 0.9rem; }
.group > h2 button {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  padding: 0 0 0.35rem;
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
/* A piece's title, as it's written. */
.group[data-field="title"] > h2 button { text-transform: none; letter-spacing: 0; }
.group > h2 button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.group-caret {
  flex: none;
  width: 0.7em;
  height: 0.7em;
  fill: currentColor;
  transform: rotate(90deg);
  transition: transform 150ms ease;
}
.group > h2 button[aria-expanded="false"] .group-caret { transform: none; }
/* Folded away, a group's heading steps back: set in the muted ink, its
   count too, its name on the quiet dither the search tips' chips sit
   on. */
.group > h2 button[aria-expanded="false"],
.group > h2 button[aria-expanded="false"] .group-count { color: var(--navy-muted); }
.group > h2 button[aria-expanded="false"] > span:not(.group-count) {
  margin: -0.15rem -0.2rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--quiet-dither);
}
@media (prefers-reduced-motion: reduce) {
  .group-caret { transition: none; }
}
.group-count { color: var(--accent-ink); font-size: 0.95rem; font-weight: 500; letter-spacing: 0; }
/* Laid out and painted only near the screen (content-visibility), so a
   list of hundreds of cards costs about what the few in view do. That
   clips whatever draws past the body, so it's padded out above and
   below (and pulled back by as much) for its cards' shadows and focus
   rings; the tree's lines and the cards' right-hand gutter are already
   inside it. */
.group-body {
  --body-gap: 0.75rem;
  position: relative;
  margin: calc(var(--body-gap) - 14px) 0 -14px;
  padding: 14px 0 14px var(--group-step);
  list-style: none;
  content-visibility: auto;
  contain-intrinsic-block-size: auto 600px;
}
#content .group-body[hidden] { display: none; }

/* The tree's lines: from each heading, down under its triangle, a line
   reaching across to each of its rows -- a subgroup's heading, or the
   first card of a row of them -- turning into the last in a rounded
   corner. Each row draws its own stretch: an elbow, from the row (or
   heading) above down into its tick, and below that, but for the last
   row, the line running on down past it. All borders, on whole pixels,
   so every line is drawn the same crisp width. A subgroup draws them in
   its own ::after and ::before; a card in its ::after and its button's
   ::after. --reach is how far in from the
   line's body the row starts; --tick-y, how far down its tick meets it. */
[data-grouping="tree"] {
  --group-step: 24px;
  --line-x: 6px;
}
[data-grouping="tree"] .group-body { --body-gap: 8px; }
[data-grouping="tree"] .group-body > li {
  --reach: var(--group-step);
  --gap-above: var(--row-gap);
  --tick-y: 22px;
  /* Set below on the rows the line reaches, and on the last of them;
     reset here, so a subgroup's own rows don't inherit its. */
  --line: none;
  --last: 0;
  position: relative;
  isolation: isolate;
}
[data-grouping="tree"] .group-body > li:first-child { --gap-above: var(--body-gap); }
[data-grouping="tree"] .group-body > .group { --tick-y: 10px; }
#content.view-list [data-grouping="tree"] .group-body > li[id^="stream-item-"] { --tick-y: 17px; }
/* Which rows the line reaches: every subgroup, and every card that
   starts a row -- each one in the wide cards and the flat list, the
   first of each three in tiles. */
[data-grouping="tree"] .group-body > .group,
#content:not(.view-wide, .view-list) [data-grouping="tree"] .group-body > li[id^="stream-item-"]:nth-child(3n + 1 of li[id^="stream-item-"]),
#content:is(.view-wide, .view-list) [data-grouping="tree"] .group-body > li[id^="stream-item-"] {
  --line: 2px solid var(--tree-line);
}
/* The elbow. */
[data-grouping="tree"] .group-body > li::after {
  content: "";
  position: absolute;
  z-index: -2;
  top: calc(-1 * var(--gap-above));
  left: calc(var(--line-x) - var(--reach));
  width: calc(var(--reach) - var(--line-x) - 5px);
  height: calc(var(--gap-above) + var(--tick-y) + 1px);
  box-sizing: border-box;
  border-left: var(--line);
  border-bottom: var(--line);
  border-bottom-left-radius: calc(var(--last) * 8px);
  pointer-events: none;
}
/* The line running on below the tick: from a subgroup's ::before, or a
   card's button's ::after (the button fills the card). */
[data-grouping="tree"] .group-body > .group::before,
[data-grouping="tree"] .group-body > li[id^="stream-item-"] > .stream-item::after {
  content: "";
  position: absolute;
  z-index: -2;
  top: calc(var(--tick-y) + 1px);
  bottom: 0;
  left: calc(var(--line-x) - var(--reach));
  border-left: var(--line);
  opacity: calc(1 - var(--last));
  pointer-events: none;
}
/* The last row: the line turns into it in a rounded corner, and ends.
   In tiles, the first card of the last row, with no subgroup after it. */
[data-grouping="tree"] .group-body > .group:last-child,
#content:not(.view-wide, .view-list) [data-grouping="tree"] .group-body > li[id^="stream-item-"]:nth-child(3n + 1 of li[id^="stream-item-"]):nth-last-child(-n + 3 of li[id^="stream-item-"]):not(:has(~ .group)),
#content:is(.view-wide, .view-list) [data-grouping="tree"] .group-body > li[id^="stream-item-"]:last-child {
  --last: 1;
}
/* Each field name, and each view, a little cream chip; hover stands it
   out a little from the page over a plain shadow, like the site's
   buttons (see .nav-item), instead of changing its color -- and the view
   in use keeps it. */
:is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip) {
  position: relative;
  isolation: isolate;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  padding: 0.1rem 0.45rem;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
:is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
/* The body: the quiet dither on the solid page; hovered, and while it's
   the view in use, its shadow, 2px deep (half the chips' --drop: a
   quarter is too slight), in the sand's dark color; the navy's, on a
   chip turned over (below). */
:is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip)::after {
  z-index: -1;
  background: var(--quiet-dither), var(--page);
  box-shadow: var(--drop-shadow, 0 0 transparent);
  transition: box-shadow 120ms ease;
}
:is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip) {
  --drop: 4px;
  --shadow: var(--sand-shade);
}
/* In the dark, the chips' shadow is the day's sand, standing them up off
   the page. */
:root[data-look~="dark"] :is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip) { --shadow: var(--sand-light); }
:is(#list-controls, #history-filter) button:is([aria-pressed="true"], :not(:disabled):active) { --shadow: var(--navy-shade); }
:is(:is(#search-tips, #list-controls, #history-filter, .chip-input-tips) button, .account-form-page .text-chip, .player-devices-card .text-chip, .performer-edit .text-chip, .radio-card .text-chip):not(:disabled):hover,
:is(#list-controls, #history-filter) button:is([aria-pressed="true"], :not(:disabled):active) {
  --drop-shadow: calc(var(--drop) / 2) calc(var(--drop) / 2) 0 var(--shadow);
}
/* Pressed, and while it's the view in use, a view chip turns over, as
   the nav's buttons do: a navy body, its lines in cream. */
:is(#list-controls, #history-filter) button:is([aria-pressed="true"], :not(:disabled):active) { color: var(--cream-ink); }
:is(#list-controls, #history-filter) button:is([aria-pressed="true"], :not(:disabled):active)::after { background: var(--navy); }
/* Completions for the token at the caret (see the search box script),
   hanging just under the box, over the results: eight and a half rows
   tall at most -- the half row says there's more -- scrolling to the
   rest. */
#search-suggest {
  --suggest-row: calc(0.8rem + 1rem * 1.45);
  position: absolute;
  top: calc(100% + 6px);
  left: -2px;
  z-index: 5;
  min-width: 18rem;
  max-width: 100%;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--cream-light);
  cursor: default;
  max-height: calc(8.5 * var(--suggest-row));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}
#search-suggest li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  line-height: 1.45;
  cursor: pointer;
}
#search-suggest li.active { background: var(--navy); color: var(--cream-ink); }
#search-suggest .suggest-count { opacity: 0.6; font-size: 0.85rem; }

h1 { margin-bottom: 0; }
.subtitle { color: var(--accent-ink); margin-top: 0.25rem; }
section { margin-top: 2rem; }
/* The app's own pages (Radio, History, Now Playing, ...) are sections
   too, but each sets its own space from the nav -- its padding, or its
   own margin -- so this gives them none on top. Kept as weak as
   `section`, so a page's own margin (Perform's) still wins. */
:where(#content-column) > section { margin-top: 0; }
.card { border: 2px solid var(--ink); border-radius: var(--radius); padding: 1rem; }
.card h2 { margin-top: 0; }
#stream-list, #extra-streams { list-style: none; padding: 0; }
#stream-list li, #extra-streams li { margin-bottom: 0.9rem; }
/* The li's padding-right reserves the gutter .stream-item.selected's
   note sits in, on every row, so selecting a card doesn't narrow it. */
li.stream-card { padding-right: var(--stream-gutter); }
/* Browse's results: tiles, three to a row, each with its gutter for the
   playing note; anything that isn't a card (no matches) spans the row. */
:is(#content > .plain-list, #content .group-body) {
  --row-gap: 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--row-gap) 0;
}
#content > .plain-list { margin: 0; }
:is(#content > .plain-list, #content .group-body) > li { margin: 0; min-width: 0; }
:is(#content > .plain-list, #content .group-body) > li:not(.stream-card) { grid-column: 1 / -1; }
/* The flat list: one card a row, all its text on one line -- title,
   composer, then when and by whom -- over a fingerprint a third the
   tiles' height. The right end is left to the Play button. */
/* Wide cards: the tiles as they are, one to a row. */
:is(#content.view-wide > .plain-list, #content.view-wide .group-body) { grid-template-columns: minmax(0, 1fr); }
:is(#content.view-list > .plain-list, #content.view-list .group-body) { --row-gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }
#content.view-list .stream-item {
  --thumb-height: 16px;
  --thumb-inset-bottom: 0.5rem;
  row-gap: 0.4rem;
  padding: 0.5rem 0.9rem;
}
#content.view-list .stream-item-content {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-right: calc(var(--play-size) + 0.5rem + var(--note-size) + 0.75rem);
  white-space: nowrap;
}
#content.view-list .stream-item-heading { display: contents; }
#content.view-list :is(.piece-title, .composer-name, .stream-item-credit) { flex: 0 1 auto; min-width: 0; margin-right: 0; overflow: hidden; text-overflow: ellipsis; }
#content.view-list :is(.piece-title, .composer-name) { font-size: 1rem; }
/* Centered on the row's height. */
#content.view-list .card-actions { top: 0; bottom: 0; }
.plain-list li.stream-card { margin-bottom: 0.9rem; }

/* --- Stream cards ----------------------------------------------------- */

/* Navy cards: the text, then the fingerprint under it. Browse lays
   them out as tiles, three to a row, as wide cards (#content.view-wide),
   one to a row, or (#content.view-list, see setStreamView) as a flat
   list, one compact row each. Hovered, and while it's the one chosen, a
   card stands out from the page over a plain shadow, 3px deep, in its
   navy's shade, like the site's buttons. */
.stream-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* A tile as tall as the tallest in its row, the fingerprint kept at
     the bottom. */
  grid-template-rows: auto 1fr;
  row-gap: 0.6rem;
  width: 100%;
  flex: 1;
  box-sizing: border-box;
  padding: 0.75rem 0.9rem;
  border: none;
  border-radius: var(--radius);
  background: var(--relief-navy) 0 0 / 100% 100% no-repeat, var(--navy);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--navy-lift) 70%, transparent),
    inset 0 -2px 0 color-mix(in oklab, var(--navy-shade) 60%, transparent),
    var(--card-ring),
    var(--drop-shadow, 0 0 transparent);
  transition: box-shadow 120ms ease;
  color: var(--cream-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stream-item:focus-visible { outline: 3px solid var(--royal); outline-offset: 6px; }
li.stream-card { position: relative; isolation: isolate; display: flex; flex-direction: column; }
/* Inside a card, the navy is the card's, a step lighter (--card), and
   the card's edge eases into the page through a ring halfway between
   them -- given up while its shadow shows, for it to meet it. */
li.stream-card {
  --navy: var(--card);
  --navy-lift: var(--card-lift);
  --navy-shade: var(--card-shade);
  --navy-lift-m: var(--card-lift-m);
  --navy-shade-m: var(--card-shade-m);
  --relief-navy: var(--relief-card);
  --card-ring: 0 0 0 1.5px color-mix(in oklab, var(--card) 40%, var(--page));
}
li.stream-card:is(.chosen, :has(> .stream-item:hover)) { --card-ring: 0 0 transparent; }
li.stream-card:is(.chosen, :has(> .stream-item:hover)) > .stream-item { --drop-shadow: 3px 3px 0 var(--navy-shade); }
/* The chosen card (chooseStream) shows its actions over its top right
   corner, where the title and composer leave room for them; on a short
   card they may run down over the fingerprint. */
li.stream-card { --play-size: 2.25rem; --note-size: 1rem; }
.card-actions {
  --button-fill: var(--coral);
  --button-relief: var(--relief-coral);
  --button-lift: var(--coral-lift);
  --button-shade: var(--coral-shade);
  --shadow: var(--coral-shade);
  --drop: 8px;
  position: absolute;
  top: 0.75rem;
  right: calc(var(--stream-gutter) + 0.9rem);
  display: none;
  align-items: center;
  gap: 0.5rem;
}
/* Shown on the card chosen, and on the one playing. */
li:is(.chosen, :has(> .stream-item.selected)) .card-actions { display: flex; }
/* Play, or on the card playing, Pause (index.html's markChosenStream),
   crossfading in one grid cell as the nav's does. */
.card-actions .btn { display: inline-grid; place-items: center; width: var(--play-size); height: var(--play-size); padding: 0; }
/* The card playing is marked by a cream eighth note right of its
   Pause. While music is playing (#content-column.playing, see index.html's
   updatePlayPauseButton) it pulses steadily, swelling and settling about
   once a second; paused, it holds still. */
/* Its room is kept on every card, so Play sits in the same place
   whether or not the note shows. */
.card-note {
  display: inline-block;
  visibility: hidden;
  width: var(--note-size);
  font-size: var(--note-size);
  line-height: 1;
  text-align: center;
  color: var(--cream-ink);
}
li:has(> .stream-item.selected) .card-note { visibility: visible; }
#content-column.playing .card-note { animation: note-pulse 1s ease-in-out infinite; }
@keyframes note-pulse {
  50% { transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  #content-column.playing .card-note { animation: none; }
}
/* The selected card's copy of the dock's playhead and played stretch
   (index.html's markSelectedStream adds both; syncCardPlayhead keeps
   --progress, 0-100, in step with #progress-bar): display only, over
   the card's fingerprint band -- .fingerprint-thumb's height at the
   bottom of the card's padding. */
.stream-item { --thumb-inset-x: 0.9rem; --thumb-inset-bottom: 0.75rem; --thumb-height: 48px; }
.card-playhead,
.card-played {
  position: absolute;
  bottom: var(--thumb-inset-bottom);
  height: var(--thumb-height);
  pointer-events: none;
}
.card-played {
  left: var(--thumb-inset-x);
  width: calc((100% - 2 * var(--thumb-inset-x)) * var(--progress, 0) / 100);
  z-index: 0;
  backdrop-filter: var(--played-filter);
}
/* The playhead, as everywhere: a 2px coral line ending at the current
   position, a 1px navy shadow just behind it (--playhead-*). */
.card-playhead {
  left: calc(var(--thumb-inset-x) + (100% - 2 * var(--thumb-inset-x)) * var(--progress, 0) / 100);
  width: var(--playhead-width);
  transform: translateX(-100%);
  z-index: 1;
  background: var(--coral);
  box-shadow: var(--playhead-shadow);
}
/* Card text, scoped here since .piece-title/.composer-name/the badges
   are shared with _search_result.html's rows. */
.stream-item-credit { color: var(--cream-ink); }
.stream-item .piece-title,
.stream-item .composer-name,
.stream-item .live-badge { color: var(--cream-ink); }
/* fill, not just color: the note glyph's head/flag are filled shapes. */
.stream-item .live-note { color: var(--cream-ink); fill: currentColor; }
.piece-title { font-weight: 700; font-size: 1.15rem; }
.composer-name { color: var(--accent-ink); font-size: 0.95rem; font-weight: normal; }
/* Title, then its composer on the same line -- the same size and cream,
   a lighter weight -- stopping short of the Play button in the corner; the credit
   under them runs the card's full width. */
.stream-item-heading { margin-right: calc(var(--play-size) + 0.5rem + var(--note-size) + 0.6rem); }
.stream-item .piece-title { margin-right: 0.45em; }
.stream-item .composer-name { font-size: 1.15rem; font-weight: 500; }
.stream-item-credit { margin-top: 0.35rem; font-size: 0.85rem; }
/* Under the text, across the card's full width at a fixed height: a
   thumbnail is never scrubbed by column, so there's no position to
   preserve. */
.fingerprint-thumb { grid-row: 2; align-self: end; width: 100%; height: var(--thumb-height, 48px); object-fit: fill; z-index: 0; pointer-events: none; border-radius: 3px; }
/* Unselected thumbnails are a little dimmed (darker, not grayer -- each
   key keeps its color) so a page of them stays calm; full brightness
   on hover and once selected. */
.stream-item .fingerprint-thumb { filter: brightness(0.75); transition: filter 0.15s ease, opacity 0.4s ease; }
/* Invisible until loadImageWhenReady (index.html) marks it .loaded,
   then faded in -- before that the navy behind it is the whole
   placeholder, with no empty frame or broken-image icon. */
.fingerprint-thumb,
#progress-fingerprint { opacity: 0; transition: opacity 0.4s ease; }
.fingerprint-thumb.loaded,
#progress-fingerprint.loaded { opacity: 1; }
.stream-item:hover .fingerprint-thumb { filter: none; }
.stream-item.selected .fingerprint-thumb { filter: none; }
.stream-item-content { grid-row: 1; min-width: 0; }
.stream-item-credit .live-badge { margin-left: 0; }
/* A performance's tags (practice, snippet, ...): small outlined chips,
   in the dock -- where its performer's are toggles (pressed: applied)
   -- and on its card in the Wide view only, after the composer.
   Admin-only tags are dashed. */
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.stream-item .tag-chips { display: none; }
#content.view-wide .stream-item .tag-chips { display: inline-flex; margin: 0 0 0 0.35em; vertical-align: 0.15em; }
/* Marks an admin session: a star beside the account's name in the nav,
   and on the account page (auth.is_admin). */
.admin-badge {
  color: var(--coral-lift);
  font-size: 0.9em;
  line-height: 1;
}

/* A tag: a solid chip like the search box's, in the tag's own color
   (db.tag_color: --tag-hue, --tag-sat, set on each chip), dark ink on a
   light fill in every theme. A
   toggle (the dock's, a card form's) is outlined until it's on. */
.tag-chip {
  --tag-fill: hsl(var(--tag-hue, 225) var(--tag-sat, 20%) 76%);
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border: 1.5px solid var(--tag-fill);
  border-radius: var(--radius-sm);
  background: var(--tag-fill);
  color: #1d2238;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
:is(button.tag-chip, .tag-toggle) { cursor: pointer; background: transparent; color: inherit; opacity: 0.8; }
:is(button.tag-chip, .tag-toggle):hover { opacity: 1; }
:is(button.tag-chip[aria-pressed="true"], .tag-toggle:has(input:checked)) { background: var(--tag-fill); color: #1d2238; opacity: 1; }
.tag-toggle { gap: 0.3em; }
.tag-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.tag-toggle:has(input:focus-visible) { outline: 2px solid var(--cream-ink); outline-offset: 2px; }
.tag-toggle:has(input:disabled) { cursor: default; }
/* One line in the fixed-height dock; #now-playing-piece clips the rest. */
#now-playing-tags { margin-top: 0.25rem; flex-wrap: nowrap; }
#now-playing-tags[hidden] { display: none; }
.live-badge { font-size: 0.95rem; margin-left: 0.4em; }
.live-badge { display: inline-flex; align-items: center; gap: 0.3em; color: var(--ink); }

/* search.html's filter form: four labeled fields in a row, wrapping on
   narrow viewports. */
#search-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
#search-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9em; color: var(--accent-ink); }

/* search_results.html / admin_piece_types.html's plain lists. */
.plain-list { list-style: none; padding: 0; }
.plain-list li { margin-bottom: 0.5rem; }
.search-result { display: block; padding: 0.75rem; border: 2px solid transparent; border-radius: var(--radius); background: var(--halftone); text-decoration: none; color: inherit; }
.search-result:hover { border-color: var(--ink); }
.live-note { color: var(--ink); animation: live-note-pulse 1.4s ease-in-out infinite; }
@keyframes live-note-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}
#stream-list button[hx-get] { width: 100%; text-align: center; padding: 0.6rem; font: inherit; font-weight: 700; }

/* --- The player ------------------------------------------------------- */

/* Fixed to the bottom of the viewport, edge to edge, ruled off from the
   page above like the nav is from below; its contents keep to the
   page's column, the fingerprint spanning exactly the stream cards'
   width above it. overflow: hidden keeps #scrub-hover-time, which sits
   just under the strip, inside the dock. */
#now-playing-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: var(--dock-height);
  box-sizing: border-box;
  padding: 0.75rem 0 0;
  border-top: 2px solid var(--ink);
  background: var(--page);
  overflow: hidden;
}
#now-playing-dock[hidden] { display: none; }
/* On Now Playing the player is the page: no longer docked and ruled off
   at the bottom, but set in it, right under the piece's name. */
body.mode-now-playing #now-playing-dock { position: static; border-top: none; }
/* The page names the piece already, large. */
body.mode-now-playing #now-playing-piece { display: none; }
#now-playing-center {
  width: 100%;
  max-width: calc(var(--page-width) + 2 * var(--page-padding-x));
  margin: 0 auto;
  box-sizing: border-box;
  padding: 0 calc(var(--page-padding-x) + var(--stream-gutter)) 0 var(--page-padding-x);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* The transport row, directly on top of the strip below it. Only the
   buttons get a backing; the rest of the row is open page, with the
   playing piece's title in it. */
#transport-block {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  position: relative;
}
#transport-block[hidden] { display: none; }
/* Rewind/back, play/pause, forward, plus #drift-warning riding along, on
   a navy tab joined to the navy strip below. */
#transport-keys {
  height: 2.5rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--navy);
}
/* The playing piece's title and composer, pinned to the row's left
   edge, truncated rather than reaching under the transport. */
#now-playing-piece {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  max-width: calc(50% - 8rem);
  line-height: 1.2;
  font-size: 1rem;
}
#now-playing-piece[hidden] { display: none; }
#now-playing-piece > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#now-playing-piece .composer-name { font-size: 0.9rem; }
.transport-btn {
  background: none;
  border: none;
  color: var(--cream-ink);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}
.transport-btn:hover { color: var(--coral); }
/* Nothing chosen to play (see updateNowPlayingCenter): dimmed, though
   still pressable -- pressing flashes the empty strip's instructions. */
#transport-keys.idle .transport-btn { opacity: 0.4; }
/* Play and pause share one grid cell, so the button is always as wide
   as the wider of the two and the bar never resizes; .playing (set by
   updatePlayPauseButton) crossfades between them. */
#play-pause-btn { display: inline-grid; }
.pp-icon { grid-area: 1 / 1; text-align: center; transition: opacity 120ms ease, transform 120ms ease; }
#play-pause-btn.playing .pp-play,
#play-pause-btn:not(.playing) .pp-pause,
.card-play.playing .pp-play,
.card-play:not(.playing) .pp-pause,
#nav-play-pause.playing .pp-play,
#nav-play-pause:not(.playing) .pp-pause { opacity: 0; transform: scale(0.6); }
.icon-btn { font-size: 1.1rem; line-height: 1; padding: 0.3rem 0.5rem; }
#drift-warning { cursor: help; }

/* Roman numerals on/off (see index.html's toggleRomanNumerals), pinned
   inside #scrub-wrap's top-right corner, above the fingerprint and every
   overlay on it (#progress-playhead is z-index 3). A serif "V", so it
   reads as a numeral, not a letter. Off: navy ringed in cream; on
   (aria-pressed): solid cream. */
#roman-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 1.5px solid var(--cream);
  border-radius: 50%;
  background: var(--navy);
  color: var(--cream-ink);
  font: bold 0.75rem/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
#roman-toggle[aria-pressed="true"] { background: var(--cream); color: var(--navy); }
#roman-toggle:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

#keyboard { margin: 0.5rem 0 1rem; cursor: pointer; }
/* Scales to the dock's width via the SVG's own viewBox, so all 88 keys
   show at once. Edges are left to normal anti-aliasing, not crispEdges:
   at a fractional scale, crispEdges can snap a hairline out to two
   device pixels. */
#keyboard svg { display: block; width: 100%; height: auto; }
#keyboard svg rect[data-note]:hover { opacity: 0.85; }

/* One 88px row in #scrub-wrap's exact footprint (it stands in for the
   fingerprint while a stream is still recording), so a live stream
   doesn't make the dock's contents any taller than a finished one. */
#live-state-controls:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center; gap: 0.4rem 0.5rem; height: 88px; margin-bottom: 1rem; border-radius: var(--radius); background: var(--navy); color: var(--cream-ink); }
#live-state-controls button {
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
}
#live-seek-controls:not([hidden]) { display: flex; align-items: center; gap: 0.5rem; }
/* .loud: the stream finished and its chunks are already swept -- the
   live view has nothing left to show. */
#lifecycle-notice:not([hidden]) { display: flex; flex-basis: 100%; justify-content: center; align-items: baseline; gap: 0.5rem; font-size: 0.95rem; opacity: 0.8; }
#lifecycle-notice.loud { opacity: 1; font-weight: 700; color: var(--coral); }
#lifecycle-notice a { color: inherit; }
#live-btn:disabled { opacity: 0.5; cursor: default; }

/* The stand-in for #scrub-wrap while there's no performance chosen, in
   its exact footprint: a navy block saying what to do -- choose one,
   then (see updateIdleMidiNudge) whatever MIDI setup is still missing
   for it to reach an instrument. .nudge flashes it when play or rewind
   is pressed with nothing to play. */
#fingerprint-placeholder:not([hidden]) {
  height: 88px;
  margin-bottom: 1rem;
  box-sizing: border-box;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--cream-ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  padding: 0 1rem;
  text-align: center;
}
#fingerprint-placeholder .idle-title { font-size: 1.1rem; font-weight: 500; }
#fingerprint-placeholder .idle-midi { font-size: 0.9rem; opacity: 0.7; }
#fingerprint-placeholder.nudge { animation: idle-nudge 0.6s ease; }
@keyframes idle-nudge {
  30% { background: var(--royal); }
}

/* --- The fingerprint strip -------------------------------------------- */

/* Fingerprint (fingerprint.py's HEIGHT=88, one row per piano key) fills
   this box at a 1:1 pixel mapping vertically, so no key row blurs into
   its neighbors. #progress-bar is stacked on top, same box, fully
   transparent, with #progress-playhead's coral line as the visible
   playhead, and the hover-only overlays (see index.html's onScrubHover)
   above that. The fingerprint PNG's quiet pixels are transparent, so
   the navy behind it is what silence reads as. margin-bottom reserves
   room for #scrub-hover-time below the strip. */
#scrub-wrap { position: relative; width: 100%; height: 88px; margin-bottom: 1rem; border-radius: var(--radius); background: var(--navy); }
/* The part of the fingerprint already played, from the left edge to the
   playhead (--progress, 0-100, set alongside it in setProgressBarValue),
   desaturated in place by filtering what's behind it. Above the image,
   below the playhead and every other overlay; never takes the pointer. */
#progress-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--progress, 0) * 1%);
  border-radius: var(--radius) 0 0 var(--radius);
  backdrop-filter: var(--played-filter);
  pointer-events: none;
  transition: opacity 150ms ease;
}
/* Hovering the strip -- looking back through the performance -- brings
   the played stretch's color back, and a lens around the pointer lifts
   saturation further, over past and future alike: up to
   --lens-saturation at the pointer (the ceiling), fading out over about
   --lens-radius either side. --lens-x is set by index.html's
   onScrubHover. */
#scrub-wrap {
  --lens-saturation: 1.6;
  --lens-radius: 30px;
}
#scrub-wrap:hover #progress-played { opacity: 0; }
#scrub-lens {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backdrop-filter: saturate(var(--lens-saturation));
  -webkit-mask-image: radial-gradient(ellipse var(--lens-radius) 150% at var(--lens-x, -999px) 50%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse var(--lens-radius) 150% at var(--lens-x, -999px) 50%, #000 20%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
#scrub-wrap:hover #scrub-lens { opacity: 1; }
#progress-fingerprint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  /* No outline of its own -- #scrub-wrap's rounded box is the edge --
     just the same rounding, so the image's corners don't poke out
     square past it. */
  border-radius: var(--radius);
}
#progress-bar {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  accent-color: var(--near-black);
}
#progress-bar::-webkit-slider-runnable-track { background: transparent; }
/* The native thumb is made fully invisible, not removed -- #progress-bar
   itself stays the full-box drag surface exactly as before (inset:0),
   so hit-testing/dragging is untouched; only its own visible rendering
   is replaced by #progress-playhead's coral line below, drawn the
   strip's full height over the fingerprint. */
#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 2px;
  height: 88px;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
}
#progress-bar::-moz-range-track { background: transparent; border: none; height: 88px; }
#progress-bar::-moz-range-thumb {
  width: 2px;
  height: 88px;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
}
/* The playhead: a coral line the strip's full height at the current
   position, as on the radio's deck -- positioned via left (a JS-set
   percentage, see setProgressBarValue in index.html), its right edge on
   that point, with --playhead-shadow's navy just behind. Above
   #scrub-hover-line/#key-region-layer (z-index 1/2 below), so the real
   playback position is never hidden by a hover preview; pointer-events:
   none so it never takes the drag from #progress-bar underneath.
   #progress-line, kept in step with it by setProgressBarValue, draws
   nothing of its own. */
#progress-line { display: none; }
#progress-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--playhead-width);
  transform: translateX(-100%);
  background: var(--coral);
  box-shadow: var(--playhead-shadow);
  pointer-events: none;
  z-index: 3;
}

/* Hover scrub-preview line: a dashed vertical line at the cursor's own
   x position (see index.html's onScrubHover), spanning #scrub-wrap's
   full height -- "over the fingerprint" (z-index above the image/
   #progress-bar's own stacking, both un-indexed/0) but under the
   key regions (#key-region-layer's own z-index is higher, below). Hidden
   (opacity 0) except while actually hovering -- .visible is what
   onScrubHover/onScrubLeave toggle. pointer-events: none throughout --
   #progress-bar underneath stays the only interactive surface. */
#scrub-hover-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-left: 1.5px dashed rgba(239, 233, 211, 0.85); /* --cream at 85% */
  filter: var(--line-halo);
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.1s ease;
}
#scrub-hover-line.visible { opacity: 1; }

/* Elapsed-time readout at the bottom of the hover line, outside the
   fingerprint entirely (top: 100% -- see #scrub-wrap's own
   margin-bottom, which reserves the room this needs below the strip).
   Tracks the same cursorX the line itself does. */
#scrub-hover-time {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.2rem;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: var(--accent-ink);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transition: opacity 0.1s ease;
}
#scrub-hover-time.visible { opacity: 1; }

/* Key-change regions (see index.html -- fetchKeyChanges/
   renderKeyRegions): one borderless box per detected key, spanning its
   full extent left-to-right (from its own key change to the next) and
   #scrub-wrap's full height, filled with the key's color at 50% alpha
   (set inline). Hidden except for whichever region the cursor is over
   (.visible, toggled by onScrubHover/onScrubLeave). The layer and
   regions are pointer-events:none so #progress-bar underneath stays
   draggable everywhere; only the label opts back in, for click-to-seek.
   Above #scrub-hover-line in stacking order, below #progress-playhead. */
#key-region-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.key-region {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.key-region.visible { opacity: 1; }
/* The key's name, pinned to the very bottom of the strip at the region's
   left edge (where the key begins) -- white-on-black.
   Allowed to overflow a region narrower than its own text rather than
   wrapping or truncating. */
.key-region-label {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 0.05rem 0.3rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--cream-ink);
  background: var(--navy);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}

/* --- Perform ------------------------------------------------------------ */

/* Two halves of the window, each a card as tall as it: on the left the
   Record card (the record button, and after a stop "What did you just
   play?"); on the right the keyboard and the live fingerprint under it
   (#perform-stage). Narrow, one above the other. */
#perform-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.75rem;
  height: calc(100vh - var(--nav-height) - 3rem);
  min-height: 26rem;
  margin: 1.25rem 0 0;
}
#perform-page[hidden] { display: none; }
.perform-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  box-sizing: border-box;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--relief-card) 0 0 / 100% 100% no-repeat, var(--card);
  color: var(--cream-ink);
}
#record-card { overflow-y: auto; }

/* Each card's few words of welcome: what it's for. */
.card-intro h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.card-intro p { margin: 0.3rem 0 0; font-size: 0.95rem; opacity: 0.8; }

/* The record button: the card's whole width. */
#record-btn { justify-content: center; gap: 0.7em; width: 100%; padding: 1.1rem 1.4rem; font-size: 1.15rem; }
#record-btn:disabled { opacity: 0.6; cursor: default; }
.record-dot { width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--coral); }
#record-btn.recording { --button-fill: var(--coral); --button-relief: var(--relief-coral); --button-lift: var(--coral-lift); --button-shade: var(--coral-shade); --shadow: var(--coral-shade); }
#record-btn.recording .record-dot { border-radius: 2px; background: currentColor; animation: record-pulse 1.2s ease-in-out infinite; }
@keyframes record-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { #record-btn.recording .record-dot { animation: none; } }
#record-status { min-height: 1.3em; margin-top: -0.4rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* The jingle: a word on how to play it, and its two switches. */
.jingle-hint { margin: -0.3rem 0 0; font-size: 0.85rem; opacity: 0.8; line-height: 1.45; }
.jingle-settings { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }
.jingle-settings label { display: inline-flex; align-items: center; gap: 0.45em; cursor: pointer; }
.jingle-settings input { margin: 0; accent-color: var(--coral); }

/* "Lovely! What was that?": the artist and title, stacked in the
   card's half-width; Save (orange, once something's typed) under them. */
#just-played:empty { display: none; }
.just-played h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.just-played .performer-edit-fields { grid-template-columns: minmax(0, 1fr); }
.just-played-later { font-size: 0.85rem; opacity: 0.75; }
.just-played-saved { margin: 0; line-height: 1.5; }
.just-played-saved a { color: inherit; font-weight: 700; }

/* The keyboard, and the playing falling away under it over the
   soundboard's glow (index.html's drawImpulses): the rest of the card.
   The canvas fills its frame, so its own pixel size never feeds back
   into the layout. */
#perform-stage #keyboard { flex: none; margin: 0; }
#impulses-frame { position: relative; flex: 1 1 auto; min-height: 6rem; margin-top: -0.9rem; }
#impulses { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

@media (max-width: 56rem) {
  #perform-page { grid-template-columns: minmax(0, 1fr); height: auto; }
  #impulses-frame { flex: none; height: 14rem; }
}

/* --- Edit -------------------------------------------------------------- */

/* The performer's own recordings: Browse's list and Browse's controls --
   grouping, view, and sort, each remembered apart from Browse's
   (index.html's listGrouping, chosenStreamView, listSort) -- but no
   performer: (that's you), nor Live. */
body.mode-edit #search-tips [data-field="performer"] { display: none; }

/* Edit's tab counts the recordings made since it was last opened: a
   cream number on an orange disc (showEditCount). */
.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.35em;
  margin-left: 0.35em;
  padding: 0 0.3em;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--coral);
  color: var(--cream);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
  vertical-align: 0.1em;
}
.nav-count[hidden] { display: none; }

/* The list's sort: one icon for the sort in force, on a chip like its
   neighbours', the same size whichever it is. */
/* Always the sort in force, so drawn like a chip in use (the views'
   aria-pressed, above): a navy body, its icon in cream, its shadow. */
#list-controls #list-sort { --shadow: var(--navy-shade); --drop-shadow: calc(var(--drop) / 2) calc(var(--drop) / 2) 0 var(--shadow); color: var(--cream-ink); }
#list-controls #list-sort::after { background: var(--navy); }
/* Its icons overlap in one cell, clipped, so the one arriving and the
   one leaving pass each other (animateListSort). */
#list-sort .sort-icons { display: grid; overflow: hidden; }
#list-sort .sort-icon { display: none; grid-area: 1 / 1; }
#list-sort .sort-icon.leaving { display: block; }
#list-sort:is([data-sort="count"]) .sort-count,
#list-sort:is([data-sort="name"]) .sort-name,
#list-sort:is([data-sort="recent"]) .sort-recent { display: block; }

/* Edit's cards are Browse's, in #content; a click on one opens its edit
   form in its place (_stream_item.html, editable). A word above the
   list says so. */
.page-help { margin: 0 0 1.25rem; font-size: 0.95rem; opacity: 0.85; }
.page-help[hidden] { display: none; }
.performer-cards-empty { padding: 1rem 0; opacity: 0.75; }

/* The edit form takes its card's place, as wide as the list whatever the
   view: Cancel and Save on top, then the artist (a third) and title (the
   rest) and Original composition, the tags, and at the bottom its
   signature, when it was played over the signature's corner. */
li.stream-card.editing { grid-column: 1 / -1; }
.performer-edit {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--relief-navy) 0 0 / 100% 100% no-repeat, var(--navy);
  color: var(--cream-ink);
}
.performer-edit-signature { position: relative; min-height: var(--thumb-height, 48px); margin-top: 0.9rem; }
.performer-edit-signature .fingerprint-thumb { display: block; }
.performer-edit-when {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  margin: 0;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--navy) 72%, transparent);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.performer-edit .form-error { margin: 0 0 0.6rem; color: var(--ink); }
.performer-edit-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0.6rem 0.9rem; }
@media (max-width: 34rem) { .performer-edit-fields { grid-template-columns: minmax(0, 1fr); } }
.performer-edit-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 700; }
.performer-edit-field .text-field { width: 100%; box-sizing: border-box; padding: 0.5rem 0.7rem; font-size: 1rem; font-weight: 400; }
.piece-suggest { position: relative; display: block; }
.piece-suggest-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  font-weight: 400;
}
.piece-suggest-list:empty { display: none; }
.piece-suggest-list li { padding: 0.35rem 0.55rem; border-radius: var(--radius-sm); cursor: pointer; }
.piece-suggest-list li[aria-selected="true"], .piece-suggest-list li:hover { background: var(--navy); color: var(--cream-ink); }
.piece-suggest-list .composer-name { margin-left: 0.4em; opacity: 0.7; font-size: 0.85em; }
.performer-edit-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0; padding: 0; border: none; }
.performer-edit-tags legend { float: left; width: 100%; margin-bottom: 0.35rem; padding: 0; font-size: 0.85rem; font-weight: 700; }
/* Save and Cancel last: Save in orange, and only once something's
   changed; Cancel a plain (royal) button. */
.performer-edit-actions { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.just-played .performer-edit-actions { margin: 0.9rem 0 0; }
.performer-edit-original { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.performer-edit-original input { width: 1.05em; height: 1.05em; margin: 0; accent-color: var(--coral); }
.performer-edit-actions .btn { padding: 0.55rem 1.15rem; font-size: 0.85rem; }
/* Delete, at the actions' far end, styled like the account page's
   "Delete my account"; its "Are you sure?", Yes and No beside it once
   pressed (askToDelete). */
/* The size set on the area: the chips' shared rule (with
   "Delete my account"'s) has them inherit their font. */
.performer-edit-delete-area { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; font-size: 0.85rem; }
.performer-edit-confirm { display: flex; align-items: center; gap: 0.5rem; }
.performer-edit-confirm[hidden] { display: none; }
.performer-edit-save { --button-fill: var(--coral); --button-relief: var(--relief-coral); --button-lift: var(--coral-lift); --button-shade: var(--coral-shade); --shadow: var(--coral-shade); }

/* --- Radio ------------------------------------------------------------ */

/* Browse's alone: Edit's list is the performer's own recordings. */
body:is(.mode-edit, .mode-history) #live-toggle { display: none; }

#radio-page { padding: 1.5rem 0 2rem; }
#radio-page[hidden] { display: none; }

/* A piece type's chip, in its own hue (db.piece_type_hues), wherever
   chips are drawn. */
.search-chip.typed { background: hsl(var(--type-hue) 45% 36%); color: #f3efe4; }
.search-chip.unresolved { outline: 2px dashed var(--coral); outline-offset: 1px; }

/* The radio's faceplate, across the top: the button bank centered, and
   what's playing beside it at the left, its title over its composer --
   in the bank's own row, so its arriving moves nothing; then the dial
   window; then any word from the radio. */
#radio-deck {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "piece controls ." "window window window" "status status status";
  align-items: center;
  column-gap: 1rem;
  margin-bottom: 1.75rem;
}
#radio-deck-now { display: contents; }
#radio-deck-now[hidden], #radio-deck-idle[hidden] { display: none; }
.radio-deck-piece { grid-area: piece; align-self: start; min-width: 0; line-height: 1.3; }
.radio-deck-piece > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#radio-deck-title { font-weight: 700; }
#radio-deck-composer { font-size: 0.92rem; opacity: 0.8; }
#radio-status { grid-area: status; margin: 0.35rem 0 0; font-size: 0.9rem; }
#radio-status:empty { display: none; }

/* The button bank: three rounded .btn's (each with the look's relief --
   dithered, or flat -- and its drop shadow on hover), back and on in
   navy tucked behind start/pause at either side, just far enough
   (--tuck) that their navy fills the rounded corners start/pause leaves
   at its ends. Hovered or focused, back or on comes out in front, its
   shadow with it. Their words cream, in capitals. */
#radio-deck .radio-controls {
  grid-area: controls;
  justify-self: center;
  display: inline-flex;
  align-items: stretch;
  --tuck: calc(var(--radius-sm) + 2px);
  margin-bottom: 1.25rem;
}
.radio-ctl {
  justify-content: center;
  min-height: 3rem;
  padding: 0 0.9rem;
  --button-fill: var(--navy);
  --button-relief: var(--relief-navy);
  --button-lift: var(--navy-lift);
  --button-shade: var(--navy-shade);
  --shadow: var(--navy-shade);
  z-index: 1;
}
/* Back and on: their inner ends under start/pause, padded so their
   arrows stay centered in what shows. */
#radio-prev { margin-right: calc(-1 * var(--tuck)); padding-right: calc(0.9rem + var(--tuck)); }
#radio-next { margin-left: calc(-1 * var(--tuck)); padding-left: calc(0.9rem + var(--tuck)); }
#radio-toggle { z-index: 2; }
:is(#radio-prev, #radio-next):not(:disabled):is(:hover, :focus-visible) { z-index: 3; }
/* A subtler drop on hover than .btn's: half as far. */
.radio-ctl:not(:disabled):hover { --drop-shadow: calc(var(--drop) / 8) calc(var(--drop) / 8) 0 var(--shadow); }
.radio-ctl:focus-visible { outline: 2px solid var(--coral-lift); outline-offset: 2px; }
.radio-ctl:disabled { color: rgba(225, 221, 207, 0.35); cursor: default; }
.radio-ctl svg { width: 1.3rem; height: 1.3rem; flex: none; }
/* One width for START RADIO and PAUSE RADIO, so the bank never shifts as
   it toggles. */
#radio-toggle { width: 11rem; padding: 0 1rem; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.95rem; }
/* START RADIO: the whole button coral, the call; once it plays, PAUSE
   RADIO in the bank's quieter navy. */
#radio-toggle:not(.playing) {
  --button-fill: var(--coral);
  --button-relief: var(--relief-coral);
  --button-lift: var(--coral-lift);
  --button-shade: var(--coral-shade);
  --shadow: var(--coral-shade);
}

/* The dial window: the fingerprint's 88px navy strip once the radio's
   picked something, and before that the same window empty -- a tuning
   scale along its foot (short ticks, a longer one every fifth), a coral
   needle resting near the left, and what to do. */
.radio-dial-window { grid-area: window; position: relative; height: 88px; border-radius: var(--radius); background: var(--navy); overflow: hidden; }
#radio-deck-idle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  color: var(--cream-ink);
  background:
    repeating-linear-gradient(90deg, rgba(225, 221, 207, 0.35) 0 1px, transparent 1px 60px) 0 100% / 100% 22px no-repeat,
    repeating-linear-gradient(90deg, rgba(225, 221, 207, 0.2) 0 1px, transparent 1px 12px) 0 100% / 100% 12px no-repeat,
    var(--navy);
}
.radio-dial-needle { position: absolute; top: 0; bottom: 0; left: 8%; width: var(--playhead-width); background: var(--coral); box-shadow: var(--playhead-shadow); }
.radio-dial-hint { position: relative; font-size: 0.95rem; opacity: 0.8; text-align: center; }
#radio-deck-fingerprint { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; opacity: 0; transition: opacity 0.4s ease; }
#radio-deck-fingerprint.loaded { opacity: 1; }
.radio-deck-live { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--cream-ink); opacity: 0.75; }
.radio-deck-live[hidden] { display: none; }
.radio-deck-played { position: absolute; inset: 0 auto 0 0; width: calc(var(--progress, 0) * 1%); backdrop-filter: var(--played-filter); pointer-events: none; }
.radio-deck-playhead { position: absolute; top: 0; bottom: 0; left: calc(var(--progress, 0) * 1%); width: var(--playhead-width); transform: translateX(-100%); background: var(--coral); box-shadow: var(--playhead-shadow); pointer-events: none; }
#radio-deck-strip:not(.current) .radio-deck-playhead { background: var(--cream); opacity: 0.7; }
#radio-deck-bar { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#radio-deck-bar:disabled { cursor: default; }

/* Two halves: the radio on the left, every theme on the right. */
.radio-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2rem; align-items: stretch; }
@media (max-width: 760px) { .radio-split { grid-template-columns: minmax(0, 1fr); } }
.radio-left, .radio-right { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
/* The radio, one big navy card holding the rest -- Start/Stop, the
   themes on it, what it's just played -- and all of it where a dragged
   theme drops. */
/* The themes, the same: a navy card of their own. */
.radio-left, .radio-right {
  box-sizing: border-box;
  min-height: 24rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--cream-ink);
  transition: box-shadow 0.15s;
}
/* Each half's title, big, and a word on what to do there. */
.radio-intro { display: flex; flex-direction: column; gap: 0.35rem; }
.radio-intro h2 { margin: 0; font-size: 1.9rem; line-height: 1.1; }
.radio-intro p { margin: 0; font-size: 0.92rem; line-height: 1.45; opacity: 0.8; }

.radio-history-title { margin: 0; font-size: 1.9rem; line-height: 1.1; }

.radio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--relief-card) 0 0 / 100% 100% no-repeat, var(--card);
  color: var(--cream-ink);
}
.radio-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
.radio-chips[hidden] { display: none; }
.radio-chips .search-chip { padding-right: 0.65rem; }

/* On the radio: the themes moved onto it, one under another. Either
   pane takes a card dragged from the other. */
.radio-pick { display: flex; flex-direction: column; gap: 0.75rem; }
#radio-cards { min-height: 6rem; }
/* Either half lights up as a theme's dragged over it. */
#radio-left.drop-target, #radio-right.drop-target { box-shadow: 0 0 0 3px var(--coral); }
.radio-card[draggable="true"] { cursor: grab; }
.radio-card.dragging { opacity: 0.45; }
.radio-card :is(button, a, input, form) { cursor: auto; }
.radio-card :is(button, a) { cursor: pointer; }
/* Playing from this theme: a coral radio just after its name, saying so on hover. */
.radio-playing-icon { display: none; flex: none; position: relative; color: var(--coral); line-height: 0; }
/* Only on the radio: a theme taken off it shows none, playing or not. */
.radio-card.playing[data-enabled="1"] .radio-playing-icon { display: inline-block; }
.radio-playing-icon svg { width: 1.35rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.radio-pick-empty { margin: 0; padding: 1rem; border: 2px dashed rgba(255, 255, 255, 0.2); border-radius: var(--radius); font-size: 0.95rem; opacity: 0.8; }

/* Every theme, one under another, as on the left. */
.radio-cards { display: flex; flex-direction: column; gap: 0.75rem; }
/* The card's top line: the theme's name, cut short with an ellipsis if
   it must be, then a built-in theme's "Suggested" -- clear of the move
   arrow in its corner (right on the radio, left among the themes). The
   name gives way to the form's Name field while it's being edited. */
.radio-card-top { display: flex; align-items: center; gap: 0.5rem; min-height: 1.4rem; }
.radio-card[data-enabled="1"] .radio-card-top { padding-right: 3rem; }
.radio-card[data-enabled="0"] .radio-card-top { padding-left: 3rem; }
.radio-card-name { flex: 0 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; font-weight: 700; }
.radio-card.editing .radio-card-name { visibility: hidden; }
.radio-card-kind { flex: none; margin-left: auto; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; }
/* A form's Name: a plain field in the search box's style, its
   placeholder the name its search would make. */
.radio-name-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 700; }
.radio-name {
  padding: 0.5rem 0.6rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: normal;
}
.radio-name::placeholder { color: var(--ink); opacity: 0.55; }
.radio-name:focus { outline: 3px solid var(--royal); outline-offset: 2px; }
/* The move arrow: a short, broad orange arrow, its corners rounded, in
   the corner toward the other pane -- top right, pointing right, on the
   radio; top left, pointing left, among the themes -- on a royal drop
   shadow that deepens to navy on hover. */
.radio-move {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  padding: 0.25rem;
  border: none;
  background: none;
  color: var(--coral-lift);
  line-height: 0;
  cursor: pointer;
}
.radio-move svg {
  width: 1.75rem;
  height: 1.25rem;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 0 var(--royal));
  transition: transform 0.15s ease, filter 0.15s ease;
}
.radio-move:hover svg { filter: drop-shadow(0 2px 0 var(--navy)); }
.radio-card[data-enabled="0"] .radio-move { right: auto; left: 0.7rem; }
.radio-card[data-enabled="0"] .radio-move svg { transform: scaleX(-1); }
.radio-card[data-enabled="1"] .radio-move:hover svg { transform: translateX(1.5px); }
.radio-card[data-enabled="0"] .radio-move:hover svg { transform: scaleX(-1) translateX(1.5px); }
.radio-move:focus-visible { outline: 2px solid var(--coral-lift); outline-offset: 2px; border-radius: var(--radius-sm); }
/* Its label, and the playing radio's, at once on hover or focus: no
   waiting on a title's delay. */
:is(.radio-move, .radio-playing-icon)::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--cream);
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}
/* The arrows' beside them, level with them, on the side away from the
   corner: to the left on the radio, to the right among the themes. The
   playing radio's under it. */
.radio-move::after { top: 50%; right: calc(100% + 0.4rem); transform: translateY(-50%); }
.radio-card[data-enabled="0"] .radio-move::after { right: auto; left: calc(100% + 0.4rem); }
.radio-playing-icon::after { right: auto; left: 0; }
:is(.radio-move, .radio-playing-icon):is(:hover, :focus-visible)::after { opacity: 1; }
/* A listener's own theme opens on a click (openRadioCard) to Edit and
   Delete at its foot, together, never split across lines. */
.radio-own-actions { display: none; align-self: flex-start; gap: 0.5rem; white-space: nowrap; }
.radio-card.open .radio-own-actions { display: inline-flex; }
.radio-card.editing .radio-own-actions { display: none; }
/* As small as the move button beside them. */
#radio-page .radio-own-actions .text-chip { margin: 0; padding: 0.45rem 0.8rem; font-size: 0.85rem; line-height: 1.2; }
/* "14 performances · See matching performances in /browse". */
.radio-card-foot { margin: 0; font-size: 0.95rem; }
.radio-card-foot .radio-see { color: inherit; font-size: 0.9rem; }
.radio-edit { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-edit[hidden] { display: none; }
.radio-edit-actions { display: flex; gap: 0.4rem; }
/* Save and Cancel: the hero's big .btn cut down to the size of the
   card's own Edit and Delete. */
.radio-edit-actions .btn { padding: 0.45rem 0.8rem; font-size: 0.85rem; line-height: 1.2; }

/* Creating a theme: just its name and the box, Add once anything's in it
   (a chip, or text). */
.radio-add { gap: 0.55rem; padding-block: 0.8rem; }
.radio-add:not(:has(.chip-input-chips .search-chip)):not(:has(.chip-input-text:not(:placeholder-shown))) .radio-add-submit { display: none; }
.radio-add h3 { margin: 0; font-size: 1.05rem; }
/* Until it's used -- focus in it, or anything entered -- just the empty
   search box: no field chips, no Name. */
.radio-add:not(:focus-within):not(:has(.chip-input-chips .search-chip, .chip-input-text:not(:placeholder-shown), .radio-name:not(:placeholder-shown))) :is(.chip-input-tips, .radio-name-field) { display: none; }
.radio-add .btn { align-self: flex-start; }
.radio-card .form-error[hidden] { display: none; }
.radio-card .form-error { margin: 0; font-size: 0.85rem; }
/* The count as it's typed, opening to the pieces: a plain, scrolling
   list of title and artist. */
.chip-input-count { margin: 0; font-size: 0.85rem; }
.chip-input-count[hidden] { display: none; }
.chip-input-count summary { cursor: pointer; opacity: 0.85; }
.chip-input-count.unresolved summary { color: var(--coral); opacity: 1; cursor: default; list-style: none; }
.chip-input-count.unresolved summary::-webkit-details-marker { display: none; }
.chip-input-pieces { max-height: 14rem; overflow-y: auto; margin: 0.4rem 0 0; padding: 0.4rem 0.6rem; list-style: none; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.18); line-height: 1.5; }
.chip-input-pieces:empty { display: none; }
/* A long one wraps under itself, indented, so each piece starts at the edge. */
.chip-input-pieces li { padding-left: 1.2em; text-indent: -1.2em; }

/* A theme's search, typed as chips (setupChipInput): the search box's
   look, in a field. */
.chip-input {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.45rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  cursor: text;
}
.chip-input:focus-within { outline: 3px solid var(--royal); outline-offset: 2px; }
.chip-input-chips { display: contents; }
.chip-input .search-chip { font-size: 0.9rem; padding-block: 0.15rem; }
.chip-input-text { flex: 1 1 8rem; min-width: 0; padding: 0.3rem 0.2rem; border: none; background: none; color: inherit; font: inherit; font-size: 1rem; outline: none; }
.chip-input-suggest {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.chip-input-suggest[hidden] { display: none; }
/* Each a name, and its count of performances at the right, as
   /browse's (#search-suggest). */
.chip-input-suggest li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0.7rem; cursor: pointer; }
.chip-input-suggest .suggest-count { opacity: 0.6; font-size: 0.85rem; }
.chip-input-suggest li.active { background: var(--royal); color: var(--cream-ink); }

/* Just played: a brief list, each its title and artist, in navy links. */
#radio-history-area[hidden] { display: none; }
/* Its own navy card, the full width under Radio and Themes. */
#radio-history-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--cream-ink);
}
/* The playlist, newest first: up next on top, then what's playing, set
   apart, then what's played, quieter. */
/* Every row the list's full width, the width of what's playing, however
   long its words. */
#radio-history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; font-size: 0.95rem; }
#radio-history li { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; box-sizing: border-box; width: 100%; min-width: 0; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm); }
/* What's playing, set apart; and any row while it's hovered, the same --
   its words at full strength, as they are on what's playing. */
#radio-history :is(.radio-stack-now, li:hover) { background: rgba(255, 255, 255, 0.1); }
/* What's playing: a coral edge, over its thumbnail. */
#radio-history .radio-stack-now::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--coral); z-index: 2; }
/* Each row's fingerprint thumbnail fills it, behind the text, darkened
   so the cream text stays legible on it; the row stays its slim height.
   Faded in once loaded (.fingerprint-thumb's way). */
.radio-history-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 0; pointer-events: none; filter: brightness(0.55); opacity: 0; transition: filter 0.15s ease, opacity 0.4s ease; }
.radio-history-thumb.loaded { opacity: 1; }
/* Hovered, its fingerprint comes up to full brightness, as a card's does
   in /browse; the words keep their backing. */
#radio-history li:hover .radio-history-thumb { filter: none; }
/* Its words each on a soft navy backing, feathered in at the edges, so
   they read over any fingerprint. */
#radio-history li > :not(.radio-history-thumb) {
  position: relative;
  z-index: 1;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 0.3rem;
  border-radius: 0.5rem;
  background: rgba(0, 21, 42, 0.55);
  box-shadow: 0 0 6px 3px rgba(0, 21, 42, 0.55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
#radio-history .radio-stack-past { opacity: 0.7; transition: opacity 0.15s ease; }
#radio-history .radio-stack-past:hover { opacity: 1; }
.radio-stack-tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.8; }
.radio-stack-now .radio-stack-tag { color: var(--coral); opacity: 1; }
/* On the radio's navy card, the card's own cream. */
/* One line: the title cut short with an ellipsis, so the composer
   after it always shows whole. */
.radio-history-link { display: flex; min-width: 0; color: var(--cream-ink); white-space: nowrap; }
.radio-play-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.radio-play-composer { flex: none; }

/* On air: a coral dot by the nav's Radio while it plays. */
.radio-on-air {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.35em;
  border-radius: 50%;
  background: var(--coral);
  vertical-align: middle;
  animation: radio-on-air 1.6s ease-in-out infinite;
}
.radio-on-air[hidden] { display: none; }
.radio-on-air.paused { box-sizing: border-box; background: none; border: 1.5px solid var(--cream); animation: none; }
/* On the selected Radio button's cream, the ring in its words' green. */
#top-nav .nav-item.active .radio-on-air.paused { border-color: var(--forest); }
@keyframes radio-on-air { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .radio-on-air { animation: none; } }
/* Once there are chips, the example's in the way. */
.chip-input:has(.chip-input-chips .search-chip) .chip-input-text::placeholder { color: transparent; }

/* /admin/logs (admin_logs.html): the search box, the when: buttons
   under it, then the matching lines, newest first, one per row: time,
   source, then the text, wrapped. Wider than the other pages, for the
   lines. */
body.logs-page { max-width: 90rem; }
#logs-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--cream-light);
  cursor: text;
}
#logs-chips { display: contents; }
#logs-input {
  flex: 1 0 12rem;
  padding: 0.35rem 0;
  border: none;
  outline: none;
  background: none;
  color: var(--ink);
  font-size: 1.05rem;
}
#logs-when { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.75rem; }
#logs-when button {
  padding: 0.2rem 0.65rem;
  border: 2px solid var(--royal);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--royal);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
#logs-when button[aria-pressed="true"] { background: var(--royal); color: var(--cream-ink); }
#logs-reload { margin-left: auto; }
.logs-tips { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--accent-ink); }
#logs-lines {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}
.log-line {
  display: grid;
  grid-template-columns: 11rem 5.5rem 1fr;
  gap: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-left: 3px solid transparent;
}
.log-line:nth-child(even) { background: color-mix(in srgb, var(--sand) 35%, transparent); }
.log-line time { color: var(--navy-muted); white-space: nowrap; }
.log-source { color: var(--royal); }
.log-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line.level-warning { border-left-color: var(--royal); }
.log-line.level-error { border-left-color: var(--coral); }
.log-line.level-error .log-text { color: var(--coral-shade); }
#logs-more { margin-top: 0.75rem; font: inherit; cursor: pointer; }

/* --- The shared player (signed in) ------------------------------------ */

/* Now Playing's Devices (_player_devices.html): under the player, a
   card like the account page's passkeys (.account-card, .account-list,
   .passkey-item), a reading width rather than the page's -- the device
   handling the MIDI output with its number, and the words saying so,
   in coral. */
#player-devices-section {
  max-width: calc(var(--page-width) + 2 * var(--page-padding-x));
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0.5rem calc(var(--page-padding-x) + var(--stream-gutter)) 3rem var(--page-padding-x);
}
#player-devices-section[hidden] { display: none; }
.player-devices-heading { margin: 0 0 0.4rem; }
.player-devices-summary { max-width: 34rem; margin: 0 0 0.75rem; }
.player-devices-card { max-width: 34rem; margin-top: 0; }
.account-list.numbered > li.sounding::before { background: var(--coral); color: var(--navy); }
.player-devices-card li.sounding .account-item-detail { color: var(--coral); font-weight: 700; }
.player-devices-card .account-list li.passkey-item .text-chip { margin-top: 0.15rem; }
/* How much softer, on its own card under the devices: a box to tick,
   then a bar from Softer to As played -- its right end the recording's
   own dynamics, not a louder setting -- a hash under each of its nine
   stops, inset by half the thumb so they line up with it. */
.player-velocity { max-width: 34rem; margin-top: 1rem; }
.player-velocity-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-weight: 700; cursor: pointer; }
.player-velocity-bar { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; font-size: 0.85rem; color: var(--accent-ink); }
.player-velocity-track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.player-velocity-track input { width: 100%; margin: 0; accent-color: var(--coral); }
.player-velocity-track input:disabled, .player-velocity-track input:disabled + .player-velocity-ticks { opacity: 0.45; }
.player-velocity-ticks {
  height: 6px;
  margin: 0 8px;
  background: repeating-linear-gradient(to right, currentColor 0 1px, transparent 1px calc((100% - 1px) / 8));
}
.player-velocity-note { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--accent-ink); }

/* The nav's Now playing, on a remote: "Playing remotely", and on hover
   or focus, at once, which device is playing -- a navy label under it,
   in plain words rather than the nav's capitals. */
#now-playing-link .nav-remote-tip {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--cream);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 40;
}
#now-playing-link:not(.remote) .nav-remote-tip { display: none; }
#now-playing-link.remote:is(:hover, :focus-visible) .nav-remote-tip { opacity: 1; }
