:root {
  --page: #15141b;
  --card: #1a1a1d;
  --card-edge: rgba(255, 255, 255, 0.07);
  --panel: #0b0b0d;
  --fg: #ecebef;
  --muted: #8b8a92;
  --faint: rgba(255, 255, 255, 0.08);
  /* Accent colors follow the playing track's cover (app.js sets them). These are the
     defaults: champagne, from the design mockup. */
  --accent: #ebd1b6;
  --glow: #f0b88c;     /* warmer peach for halos */
  --accent-light: #fff3e2;
  --accent-dim: #58504a; /* opaque: the glow behind must not show through the ring */
  /* Light comes from the left: rings and arcs fade from bright to dim. */
  --ring: linear-gradient(100deg, var(--accent-light) 0%, var(--accent) 40%, var(--accent-dim) 100%);
  --breath: 3s;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  /* A new track color fades in over 3s. If another one arrives mid-fade, the browser
     continues from the color shown at that moment: no jumps. */
  transition: --accent 3s ease, --glow 3s ease, --accent-light 3s ease, --accent-dim 3s ease;
}

/* Registered, so the browser can animate them (unregistered custom properties jump). */
@property --accent       { syntax: "<color>"; inherits: true; initial-value: #ebd1b6; }
@property --glow         { syntax: "<color>"; inherits: true; initial-value: #f0b88c; }
@property --accent-light { syntax: "<color>"; inherits: true; initial-value: #fff3e2; }
@property --accent-dim   { syntax: "<color>"; inherits: true; initial-value: #58504a; }

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }
/* Touch: tapping a control must not flash a highlight or start a text selection (Android
   WebView does both). The player's areas are controls, not text to copy. */
html { -webkit-tap-highlight-color: transparent; }
button, [role="slider"], [role="radio"], .header, .stage, .timeline, .controls, .volume {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  min-width: 320px;
  /* Fabric: two tiled weaves of different sizes over one large cloudy shadow image that
     never repeats, so neither tile's repeat shows. All generated (bin/gen-textures.py). */
  background:
    url("img/weave.png") 0 0 / 276px 276px repeat,
    url("img/weave2.png") 0 0 / 332px 332px repeat,
    url("img/mottle.jpg") center / cover no-repeat fixed,
    var(--page);
  background-blend-mode: soft-light, soft-light, normal, normal;
  color: var(--fg);
  font: 300 15px/1.4 var(--font);
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

/* --- card ------------------------------------------------------------- */
.card {
  width: min(860px, 100%);
  /* Brushed metal: horizontal streaks over the dark body, a soft light falling from
     the top left, and a faint sheen band across. */
  background:
    linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.035) 38%, transparent 55%),
    radial-gradient(120% 90% at 15% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    url("img/brushed.png") 0 0 / 512px 512px repeat,
    linear-gradient(180deg, #202024 0%, var(--card) 40%, #151518 100%);
  background-blend-mode: normal, normal, soft-light, normal;
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.8),
    0 14px 32px rgba(0, 0, 0, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
  padding: 14px 24px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-areas:
    "header   header"
    "stage    upnext"
    "timeline upnext"
    "controls volume";
  column-gap: 28px;
}

.header {
  grid-area: header;
  position: relative;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.logo {
  font-weight: 200;
  font-size: 20px;
  letter-spacing: 0.42em;
  padding-left: 0.42em; /* balance the trailing letter-spacing */
  color: var(--fg);
}
.mood-picker {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
.mood {
  display: block;
  padding: 6px 4px 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}
.mood:hover, .mood[aria-expanded="true"] { color: var(--fg); background: rgba(255, 255, 255, 0.04); }
.mood:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 2px; }
.mood::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: 1px;
  transition: background 2s ease;
}

/* --- mood menu: a small card in the player's style --------------------- */
.mood-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 132px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: linear-gradient(180deg, #1e1e22 0%, var(--card) 100%);
  border: 1px solid var(--card-edge);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.mood-menu[hidden] { display: none; }
.mood-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg);
  opacity: 0.4;
  filter: grayscale(1);
  transition: opacity 0.2s ease, background 0.2s ease;
}
.mood-item::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.mood-item:hover { opacity: 0.6; background: rgba(255, 255, 255, 0.04); }
.mood-item:focus-visible { outline: 1.5px solid var(--fg); outline-offset: -1.5px; }
.mood-item.is-selected { opacity: 1; filter: none; color: var(--accent); }
.mood-item.is-selected:hover { background: rgba(255, 255, 255, 0.04); }

/* --- stage ------------------------------------------------------------ */
.stage {
  grid-area: stage;
  position: relative;
  touch-action: pan-y; /* sideways swipes switch displays (app.js), not scroll */
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(ellipse at 40% 10%, #1d1d22 0%, var(--panel) 65%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6), 0 0 0 1.5px rgba(0, 0, 0, 0.5);
  container: stage / inline-size;
  transition: box-shadow 1.2s ease;
}
/* The lit screen throws its colour onto the case around it. */
.card:not(.is-idle) .stage {
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.6),
    0 0 0 1.5px rgba(0, 0, 0, 0.5),
    0 0 46px -4px color-mix(in srgb, var(--glow) 30%, transparent);
}

/* --- glass over the display ------------------------------------------------
   Undistorted, over everything on the stage (title included), never clickable. */
.glass {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  background:
    /* broad diagonal glare from a light up and to the left */
    linear-gradient(118deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.03) 28%, transparent 41%),
    /* curved specular streak along the top, like light on convex glass */
    radial-gradient(70% 18% at 38% -4%, rgba(255, 255, 255, 0.14), transparent 70%),
    /* backlight falls off toward the corners */
    radial-gradient(120% 110% at 50% 45%, transparent 58%, rgba(0, 0, 0, 0.38) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 0 10px rgba(0, 0, 0, 0.4);
}
/* pixel grid: barely there, only noticeable up close */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  opacity: 0.05;
}

/* --- now-playing visual ---------------------------------------------------
   A record over a slowly flowing gradient made from the cover art. The record
   itself stays put; only the light and color around it move. Everything
   breathes at the mood's --breath. Sizes use container units, so the scene
   scales with the stage. */
/* Set by app.js on .groove-progress itself, so the transition restyles one element. */
@property --progress { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

.visual {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  position: absolute;
  inset: 0;
  container-type: size;
  opacity: 0;
  transition: opacity 1.2s ease, filter 1.2s ease;
}
.card:not(.is-idle) .visual { opacity: 1; }
/* Paused: the scene freezes and loses its color. The label and the palette
   keep their (one-shot) animations, so a track change while paused still
   shows the new cover. */
.card:not(.is-playing) .visual { filter: saturate(0.5) brightness(0.75); }
.card:not(.is-playing) .visual *:not(.label, .visual-palette),
.card:not(.is-playing) .visual *::before,
.card:not(.is-playing) .visual *::after { animation-play-state: paused; }

/* --- background ------------------------------------------------------------
   Five layers, bottom to top:
   1. cover:   the album art, blurred into a base wash that slowly zooms;
   2. palette: four blobs, each showing a zoomed-in corner of the cover, so
               they carry the cover's own colors; they wander on long,
               unrelated loops, which reads as a living mesh gradient;
   3. mesh:    three soft color pools whose centers glide on their own x/y
               timers (registered custom properties), blended soft-light to
               warm and deepen what is under them;
   4. veil:    a wide band of warm light that drifts slowly across and back;
   5. dust.                                                                   */
/* The shader canvas (background.js) replaces layers 1–4 when WebGL works. */
.visual-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.visual.has-shader .visual-canvas { display: block; }
.visual.has-shader :is(.visual-cover, .visual-palette, .visual-mesh, .visual-veil) { display: none; }

.visual-cover {
  position: absolute;
  inset: -20%;
  background:
    var(--cover, none) center / cover no-repeat,
    radial-gradient(circle at 30% 30%, #4a3424, #0b0b0d 70%);
  filter: blur(50px) saturate(1.35) brightness(0.62);
  animation: cover-breathe calc(var(--breath) * 8) ease-in-out infinite alternate;
}
@keyframes cover-breathe {
  from { transform: scale(1) rotate(0deg); }
  to   { transform: scale(1.12) rotate(4deg); }
}

.visual-palette { position: absolute; inset: -15%; }
.card.track-in .visual-palette { animation: fade-in 2.4s ease both; }
@keyframes fade-in { from { opacity: 0; } }

.blob {
  position: absolute;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  /* 700% zoom: each blob sees only a small patch of the cover around (--sx, --sy).
     --tint stands in when there is no cover. */
  background: var(--cover, none) var(--sx) var(--sy) / 700% no-repeat, var(--tint);
  filter: blur(48px) saturate(1.5);
  opacity: 0.72;
  animation: var(--path) var(--dur) ease-in-out infinite alternate;
}
.blob-1 { --sx: 15%; --sy: 15%; --tint: #7a4a36; --path: wander-1; --dur: 34s; left: -6%;  top: -12%; }
.blob-2 { --sx: 85%; --sy: 20%; --tint: #5e3350; --path: wander-2; --dur: 41s; right: -8%; top: -2%; }
.blob-3 { --sx: 20%; --sy: 85%; --tint: #2f3560; --path: wander-3; --dur: 47s; left: 4%;   bottom: -14%; }
.blob-4 { --sx: 80%; --sy: 80%; --tint: #8a5a3c; --path: wander-4; --dur: 38s; right: -2%; bottom: -6%; }
@keyframes wander-1 {
  0%   { translate: 0 0;       scale: 1; }
  35%  { translate: 22% 14%;   scale: 1.18; }
  70%  { translate: 8% 30%;    scale: 0.9; }
  100% { translate: 30% 6%;    scale: 1.06; }
}
@keyframes wander-2 {
  0%   { translate: 0 0;       scale: 1.05; }
  30%  { translate: -20% 22%;  scale: 0.88; }
  65%  { translate: -34% 6%;   scale: 1.15; }
  100% { translate: -12% 28%;  scale: 1; }
}
@keyframes wander-3 {
  0%   { translate: 0 0;       scale: 0.95; }
  40%  { translate: 26% -18%;  scale: 1.15; }
  75%  { translate: 40% -4%;   scale: 1; }
  100% { translate: 14% -26%;  scale: 1.1; }
}
@keyframes wander-4 {
  0%   { translate: 0 0;       scale: 1.1; }
  30%  { translate: -24% -12%; scale: 0.92; }
  60%  { translate: -10% -30%; scale: 1.12; }
  100% { translate: -32% -16%; scale: 0.98; }
}

/* Each pool center has its own x and y timer, with periods that never line
   up, so the pools trace slow, non-repeating curves. */
@property --p1x { syntax: "<percentage>"; inherits: false; initial-value: 18%; }
@property --p1y { syntax: "<percentage>"; inherits: false; initial-value: 28%; }
@property --p2x { syntax: "<percentage>"; inherits: false; initial-value: 82%; }
@property --p2y { syntax: "<percentage>"; inherits: false; initial-value: 22%; }
@property --p3x { syntax: "<percentage>"; inherits: false; initial-value: 40%; }
@property --p3y { syntax: "<percentage>"; inherits: false; initial-value: 88%; }
.visual-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(55% 65% at var(--p1x) var(--p1y),
      color-mix(in srgb, var(--glow) 75%, transparent), transparent 100%),
    radial-gradient(50% 60% at var(--p2x) var(--p2y),
      rgba(196, 98, 132, 0.6), transparent 100%),
    radial-gradient(65% 55% at var(--p3x) var(--p3y),
      rgba(88, 108, 184, 0.55), transparent 100%);
  mix-blend-mode: soft-light;
  animation:
    p1x 23s ease-in-out infinite alternate,
    p1y 29s ease-in-out infinite alternate,
    p2x 31s ease-in-out infinite alternate,
    p2y 19s ease-in-out infinite alternate,
    p3x 37s ease-in-out infinite alternate,
    p3y 27s ease-in-out infinite alternate,
    mesh-breathe calc(var(--breath) * 2) ease-in-out infinite alternate;
}
@keyframes p1x { to { --p1x: 62%; } }
@keyframes p1y { to { --p1y: 70%; } }
@keyframes p2x { to { --p2x: 38%; } }
@keyframes p2y { to { --p2y: 64%; } }
@keyframes p3x { to { --p3x: 86%; } }
@keyframes p3y { to { --p3y: 36%; } }
@keyframes mesh-breathe { from { opacity: 0.7; } to { opacity: 1; } }

.visual-veil {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255, 236, 214, 0.06) 42%,
    rgba(255, 236, 214, 0.13) 50%,
    rgba(255, 236, 214, 0.06) 58%,
    transparent 70%);
  mix-blend-mode: screen;
  animation: veil calc(var(--breath) * 9) ease-in-out infinite;
}
@keyframes veil {
  0%, 100% { translate: -20% -5%; opacity: 0.35; }
  50%      { translate: 20% 5%;   opacity: 1; }
}

/* Dust: five dot tiles with prime-ish sizes, so the grid never shows. Each
   layer rises by a whole tile per loop, at its own speed (depth). */
.visual-dust {
  position: absolute;
  inset: 0;
  --dot: rgba(255, 243, 226, 0.9);
  --dot-warm: rgba(240, 184, 140, 0.8);
  background-image:
    radial-gradient(circle at 23% 41%, var(--dot) 0 0.8px, transparent 1.6px),
    radial-gradient(circle at 71% 17%, var(--dot) 0 0.6px, transparent 1.3px),
    radial-gradient(circle at 44% 83%, var(--dot-warm) 0 1.1px, transparent 2px),
    radial-gradient(circle at 87% 62%, var(--dot) 0 0.5px, transparent 1.1px),
    radial-gradient(circle at 12% 9%, var(--dot-warm) 0 1.4px, transparent 2.6px);
  background-size: 97px 113px, 151px 139px, 211px 173px, 67px 79px, 263px 241px;
  mask-image: linear-gradient(to top, transparent, #000 20%, #000 55%, transparent 95%);
  mix-blend-mode: screen;
  animation:
    dust 26s linear infinite,
    twinkle calc(var(--breath) * 1.5) ease-in-out infinite alternate;
}
@keyframes dust {
  to { background-position: 97px -226px, -151px -139px, 0 -173px, 67px -158px, -263px -241px; }
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.8; } }

/* --- the orbit: halo, ripples, radial equalizer, record, tonearm -----------
   Centered in the stage, as large as it can be while the bars (which reach
   46% of --s from the center) still fit with 8px to spare. The record is 62%
   of --s, so it sits with equal gaps above and below; the title overlays its
   lower part. */
.orbit {
  --s: min(calc((100cqh - 16px) / 0.92), 80cqw);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--s);
  height: var(--s);
  translate: -50% -50%;
}

.orbit-fx {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease 0.25s;
}
.card:not(.is-idle) .orbit-fx { opacity: 1; }

.orbit-halo {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--glow) 60%, transparent) 0%,
    color-mix(in srgb, var(--accent) 22%, transparent) 55%,
    transparent 100%);
  filter: blur(14px);
  animation: halo var(--breath) ease-in-out infinite;
}
@keyframes halo {
  0%, 100% { scale: 0.9;  opacity: 0.5; }
  50%      { scale: 1.08; opacity: 1; }
}

.ripple {
  position: absolute;
  inset: 19%;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  opacity: 0;
  animation: ripple calc(var(--breath) * 2) cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
  animation-delay: calc(var(--breath) * var(--k) * -2 / 3);
}
@keyframes ripple {
  0%   { scale: 1;    opacity: 0.7; }
  100% { scale: 1.62; opacity: 0; }
}

/* Radial equalizer. Each .bar is an arm from the center; its ::before is the
   bar at the far end. Bars are brighter on the left, like the rest of the UI
   (light comes from the left): sin() of the arm angle sets the opacity. */
.bars {
  position: absolute;
  inset: 0;
  --w: max(1.5px, 0.7cqmin);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--glow) 70%, transparent));
}
.bar {
  position: absolute;
  left: 50%;
  top: 0;
  width: 0;
  height: 50%;
  transform-origin: 50% 100%;
  rotate: var(--a);
}
.bar::before {
  content: "";
  position: absolute;
  left: calc(var(--w) / -2);
  bottom: 68%;          /* 34% of the orbit: just outside the record */
  width: var(--w);
  height: 24%;          /* up to 12% of the orbit */
  border-radius: 99px;
  background: linear-gradient(to top,
    var(--accent-light),
    color-mix(in srgb, var(--accent) 75%, transparent) 60%,
    transparent);
  transform-origin: 50% 100%;
  opacity: calc(0.58 - 0.42 * sin(var(--a)));
  animation: eq var(--d) ease-in-out var(--delay) infinite alternate;
}
@keyframes eq {
  from { scale: 1 var(--lo); }
  to   { scale: 1 var(--hi); }
}

/* --- the record ---------------------------------------------------------- */
.disc-wrap {
  position: absolute;
  inset: 19%;
  opacity: 0;
  transition: opacity 1s ease;
}
.card:not(.is-idle) .disc-wrap { opacity: 1; }

.disc-shadow {
  position: absolute;
  inset: 4% 2% -10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.8), transparent);
  filter: blur(12px);
  translate: 0 4%;
}

.disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 50px -8px color-mix(in srgb, var(--glow) 55%, transparent);
}
/* Rim light, bright on the left: the same gradient as the play button ring. */
.disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1.5px;
  background: var(--ring);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.85;
}

.vinyl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    /* two quiet gaps between tracks */
    radial-gradient(closest-side, transparent 0 63%, rgba(255, 255, 255, 0.06) 63.5%,
      transparent 64.5% 81%, rgba(255, 255, 255, 0.05) 81.5%, transparent 82.5%),
    /* grooves */
    repeating-radial-gradient(closest-side, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 2.5px),
    /* body: dark lead-in ring, deep grooved area, glossy outer edge */
    radial-gradient(closest-side, #17171b 0 38%, #070708 38.5% 40%, #111114 41%,
      #0b0b0d 96%, #26262b 98%, #060607 100%);
  animation: spin 6s linear infinite;
}

.label {
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background:
    var(--cover, none) center / cover no-repeat,
    radial-gradient(circle at 35% 30%, var(--accent-light), var(--accent) 45%, #7d604a);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 0 0 3px rgba(255, 255, 255, 0.04),
    inset 0 0 14px rgba(0, 0, 0, 0.5);
}
.label::after { /* spindle */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #c9c7cc 35%, #4b4b50 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.6);
}
.card.track-in .label { animation: label-in 1.1s var(--ease-out); }
@keyframes label-in {
  from { scale: 0.3; opacity: 0; filter: blur(8px) brightness(2); }
}

/* Light on the vinyl stays put while the record turns under it. */
.sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 300deg,
      transparent 0deg, rgba(255, 243, 226, 0.17) 16deg, transparent 40deg,
      transparent 180deg, rgba(255, 243, 226, 0.1) 196deg, transparent 220deg),
    conic-gradient(from 90deg,
      rgba(240, 184, 140, 0.07), rgba(160, 200, 255, 0.04), rgba(235, 209, 182, 0.08),
      rgba(200, 160, 255, 0.04), rgba(240, 184, 140, 0.07)),
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.09), transparent 45%);
  mix-blend-mode: screen;
  mask: radial-gradient(closest-side, transparent 38%, #000 39.5%);
  pointer-events: none;
}

/* Track progress, drawn as a thin ring around the label. */
.groove-progress {
  position: absolute;
  inset: 28.5%;
  border-radius: 50%;
  background: conic-gradient(var(--accent-light), var(--accent) var(--progress),
    rgba(255, 255, 255, 0.07) var(--progress));
  mask: radial-gradient(closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px),
    #000 calc(100% - 0.5px), transparent 100%);
  filter: drop-shadow(0 0 3px var(--glow));
  /* no transition: app.js updates it only when the ring would visibly move */
}

/* --- tonearm: rests off the record, swings onto it while playing --------- */
.tonearm {
  position: absolute;
  left: 92%;
  top: 9%;
  width: 0;
  height: 0;
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}
.card:not(.is-idle) .tonearm { opacity: 1; }
.tonearm-base {
  position: absolute;
  width: calc(var(--s) * 0.11);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background:
    radial-gradient(circle, #9a98a0 0 12%, #121214 14% 24%, transparent 26%),
    conic-gradient(from 20deg, #3a3a40, #a9a7af, #2a2a2e, #77757d, #2f2f34, #b4b2ba, #3a3a40);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.tonearm-arm {
  position: absolute;
  left: calc(var(--s) * -0.009);
  top: 0;
  width: calc(var(--s) * 0.018);
  height: calc(var(--s) * 0.48);
  border-radius: 99px;
  background: linear-gradient(90deg, #3e3e44, #e4e2e8 42%, #77757d 62%, #2a2a2e);
  box-shadow: 8px 10px 12px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 0;
  rotate: -5deg;
  transition: rotate 1.6s var(--ease-out);
  will-change: rotate; /* own layer: turning it never repaints the stage below */
}
/* While playing, the arm follows the track: outer groove at the start (13.5deg),
   innermost groove at the end (29deg). --arm is the progress 0..1, set by app.js about
   once a second. Those small steps move linearly ("arm-follow"); swinging on, seeking and
   a new track use the eased glide. A transition always continues from the current
   angle, so nothing jumps. */
.card.is-playing .tonearm-arm {
  rotate: calc(13.5deg + 15.5deg * var(--arm, 0));
  transition-delay: 0.15s;
}
.card.is-playing .tonearm-arm.arm-follow { transition: rotate 1s linear; }
.tonearm-head {
  position: absolute;
  left: 50%;
  top: calc(100% - var(--s) * 0.01);
  width: calc(var(--s) * 0.05);
  height: calc(var(--s) * 0.085);
  translate: -50% 0;
  rotate: 22deg;
  transform-origin: 50% 0;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(90deg, #2a2a2e, #c9c7ce 45%, #55545a 70%, #2a2a2e);
  box-shadow: 6px 8px 10px rgba(0, 0, 0, 0.55);
}
.tonearm-head::after { /* a hint of champagne on the cartridge */
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 12%;
  height: 18%;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.8;
}

/* --- finish: vignette, bottom shade for the title, film grain ------------ */
.visual-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 50%, rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.6) 100%);
}
.visual-grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.08;
  mix-blend-mode: overlay;
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0%   { translate: 0 0; }
  20%  { translate: -4% 3%; }
  40%  { translate: 3% -5%; }
  60%  { translate: -2% 6%; }
  80%  { translate: 5% 2%; }
  100% { translate: 0 0; }
}

@keyframes spin { to { rotate: 360deg; } }

.idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.6s ease;
}
.card:not(.is-idle) .idle { opacity: 0; pointer-events: none; }
.idle-label {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
}
.idle-rule { width: 36px; height: 1px; background: rgba(255, 255, 255, 0.18); }

.connect {
  margin-top: 6px;
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s ease;
}
.connect:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }


.now {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 24px;
  transition: opacity 0.6s ease;
}
.card.is-idle .now { opacity: 0; }

.now-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow-off, .card:not(.is-playing) .eyebrow-on { display: none; }
.card:not(.is-playing) .eyebrow-off { display: inline; color: var(--muted); }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.eq i {
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
  animation: eq-mini 0.9s ease-in-out infinite alternate;
}
.eq i:nth-child(2) { animation-duration: 0.6s; animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -0.7s; }
.eq i:nth-child(4) { animation-duration: 0.75s; animation-delay: -0.2s; }
.card:not(.is-playing) .eq i { animation: none; scale: 1 0.25; color: var(--muted); }
@keyframes eq-mini { from { scale: 1 0.2; } to { scale: 1 1; } }

/* The title is gradient-clipped text, so a highlight can sweep across it. */
.now-title {
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 300;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background:
    linear-gradient(100deg, var(--fg) 0 40%, var(--accent-light) 47%, #fff 50%,
      var(--accent-light) 53%, var(--fg) 60% 100%)
    100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.5));
}
.now-artist {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Like (Liked Songs) for the track on the stage: bottom right, on the artist line, right
   next to what it acts on and away from the transport buttons.
   The two states differ in more than the fill, so a glance is enough:
     not liked  thin white outline, almost transparent (it is there, but "off")
     liked      solid heart in the track's accent color, full strength, soft glow
     unknown    while checking: barely visible (still clickable) */
.now { padding-right: 56px; }
.like {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--fg);
  opacity: 0.32;
  cursor: pointer;
  transition: opacity 0.3s ease, color 0.3s ease, background 0.2s ease;
}
.like:hover { opacity: 0.7; background: rgba(255, 255, 255, 0.06); }
.like.is-unknown { opacity: 0.14; }
.like svg {
  width: 24px;
  height: 24px;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: fill 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}
.like.is-liked { color: var(--accent); opacity: 1; }
.like.is-liked:hover { background: rgba(255, 255, 255, 0.06); }
.like.is-liked svg {
  fill: currentColor;
  stroke-width: 0;
  filter:
    drop-shadow(0 0 8px color-mix(in srgb, var(--glow) 55%, transparent))
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
.like.pop svg { animation: like-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
.like:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 2px; opacity: 0.8; }
@keyframes like-pop { 50% { scale: 1.28; } }
@media (prefers-reduced-motion: reduce) { .like.pop svg { animation: none; } }

/* Small stage (phones): lift and shrink the record, tighten the text. */
@container stage (max-width: 480px) {
  .now { left: 20px; right: 20px; bottom: 16px; padding-right: 48px; }
  .now-eyebrow { margin-bottom: 6px; font-size: 9px; }
  .now-title { font-size: 21px; }
  .now-artist { margin-top: 5px; font-size: 11px; letter-spacing: 0.24em; }
}

/* On every new track the text blurs in, then a highlight sweeps the title. */
.card.track-in .now-eyebrow { animation: rise-in 0.9s var(--ease-out, ease) both; }
.card.track-in .now-title {
  animation:
    rise-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both,
    sheen 2.2s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}
.card.track-in .now-artist { animation: rise-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both; }
@keyframes rise-in {
  from { opacity: 0; translate: 0 14px; filter: blur(10px); }
}
@keyframes sheen {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

.status {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 14px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.status:empty { display: none; }
.status.error { color: #ff9a9a; }

/* --- timeline: plain fill, no thumb, no transitions --------------------- */
.timeline { grid-area: timeline; padding: 18px 2px 0; }

/* --- display picker ----------------------------------------------------------
   One dot per .visual-mode (built by app.js); the lit one is shown. */
.visual-mode { position: absolute; inset: 0; filter: url(#panel); }
.visual-mode[hidden] { display: none; }

/* Lama: an inline SVG whose purples are oklch(... var(--lama-h)). app.js sets --lama-h on
   the root; it eases here over 8s, then the picture is still. No screen filter: a filtered
   layer would cost memory and repaint the whole filter while the colour fades. */
@property --lama-h { syntax: "<number>"; inherits: true; initial-value: 290; }
.visual-mode[data-display="lama"] { filter: none; background: #0f0a22; }
.lama { position: absolute; inset: 0; transition: --lama-h 8s ease; }
.lama svg { display: block; width: 100%; height: 100%; }
.stage[data-display="lama"] :is(.now-eyebrow, .now-title, .now-artist) {
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
/* Retro displays: one canvas each, drawn by retro.js. */
.rt-stage { position: absolute; inset: 0; background: var(--d0); }
.rt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.display-picker {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: -8px 0 6px;
}
.display-dot {
  width: 18px; height: 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.display-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.display-dot:hover::before { background: rgba(255, 255, 255, 0.4); }
.display-dot[aria-checked="true"]::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
}
.display-dot:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; border-radius: 50%; }
.progress { position: relative; padding: 8px 0; cursor: pointer; }
.progress-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  box-shadow:
    0 0 6px color-mix(in srgb, var(--glow) 80%, transparent),
    0 0 18px color-mix(in srgb, var(--glow) 45%, transparent);
}
.progress-hover {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 2px;
  margin-left: -1px;
  left: 0;
  background: var(--fg);
  opacity: 0;
  pointer-events: none;
}
.progress:hover .progress-hover { opacity: 0.75; }
.card.is-idle .progress { cursor: default; }
.card.is-idle .progress:hover .progress-hover { opacity: 0; }
.times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* --- transport controls --------------------------------------------------- */
.controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 7vw, 56px);
  padding-top: 18px;
}
.ctl {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #2b2b30 0%, #151518 75%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: color 0.2s ease, transform 0.15s ease;
}
.ctl svg { width: 18px; height: 18px; fill: currentColor; }
.ctl:active:not(:disabled) { transform: scale(0.96); }
/* Disabled: the button stays solid; only its symbol goes dark, as if unlit. */
.ctl:disabled { color: #4a4950; cursor: default; }

.play {
  width: 78px;
  height: 78px;
  border: 1.5px solid transparent;
  transition: border-color 0.6s ease, color 0.2s ease, transform 0.15s ease;
}
.play svg { width: 26px; height: 26px; }
.play .icon-pause { display: none; }
.play.playing .icon-play { display: none; }
.play.playing .icon-pause { display: block; }
.play.playing {
  /* gradient border: the button's own fill inside, the ring gradient on the border */
  background:
    radial-gradient(circle at 50% 30%, #2b2b30 0%, #151518 75%) padding-box,
    var(--ring) border-box;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.5),
    0 0 10px color-mix(in srgb, var(--glow) 55%, transparent),
    0 0 26px color-mix(in srgb, var(--glow) 25%, transparent),
    inset 0 0 12px color-mix(in srgb, var(--glow) 22%, transparent);
}
.play.loading { animation: wait 1s ease-in-out infinite; }

/* The breathing light is its own layer behind the button. Only opacity and transform
   are animated, so the browser composites it on the GPU without repainting the blur. */
.play-wrap {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.play-wrap .play { position: relative; z-index: 1; }
.play-glow {
  position: absolute;
  /* Reaches 28px beyond the 78px button: the button edge sits at ~58% of the radius. */
  inset: -28px;
  border-radius: 50%;
  /* Centered and sized to the box (closest-side), so it fades out fully before any
     edge. The bright core ends inside the button (its edge is at ~58% of the radius), so
     the ring of light around it stays soft and fairly transparent. */
  background: radial-gradient(circle closest-side,
    color-mix(in srgb, var(--glow) 60%, transparent) 0%,
    color-mix(in srgb, var(--glow) 60%, transparent) 44%,
    color-mix(in srgb, var(--glow) 30%, transparent) 60%,
    color-mix(in srgb, var(--glow) 10%, transparent) 76%,
    color-mix(in srgb, var(--glow) 3%, transparent) 88%,
    transparent 100%);
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  will-change: opacity, transform;
  transition: opacity 0.8s ease;
}
.play-wrap:has(.play.playing) .play-glow {
  animation: breathe var(--breath) ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.35; transform: scale(0.88); }
  50%      { opacity: 0.95; transform: scale(0.97); } /* peak: ~26px past the button (was 32) */
}
@keyframes wait {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

.ctl:focus-visible, .progress:focus-visible, .knob:focus-visible {
  outline: 1.5px solid var(--fg);
  outline-offset: 4px;
}

/* --- up next ------------------------------------------------------------- */
.upnext { grid-area: upnext; padding-top: 10px; min-width: 0; }
.upnext-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 8px 4px;
  border-bottom: 1px solid var(--faint);
}
.upnext h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--fg);
}
.refresh {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.refresh svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.refresh:hover:not(:disabled) { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.refresh:disabled { color: #4a4950; cursor: default; }
.refresh:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 2px; }
.refresh.spin svg { animation: spin-once 0.6s cubic-bezier(0.3, 0.7, 0.4, 1); }
@keyframes spin-once { to { transform: rotate(360deg); } }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--faint);
  min-width: 0;
}
.queue li.current {
  margin: 4px -6px;
  padding: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}
.q-cover {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #2a2a2f center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.current .q-cover::after {
  /* static "now playing" bars */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    linear-gradient(var(--fg), var(--fg)) 13px 22px / 2px 7px no-repeat,
    linear-gradient(var(--fg), var(--fg)) 19px 16px / 2px 13px no-repeat,
    linear-gradient(var(--fg), var(--fg)) 25px 19px / 2px 10px no-repeat,
    rgba(0, 0, 0, 0.55);
}
.q-text { min-width: 0; }
.q-title {
  font-size: 14px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-new { color: var(--accent); font-size: 11px; margin-left: 4px; }
.q-meta {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.queue li.skeleton .q-title,
.queue li.skeleton .q-meta {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.queue li.skeleton .q-title { width: 90px; margin-bottom: 8px; }
.queue li.skeleton .q-meta { width: 40px; }

/* Loading rows: one soft highlight sweeps across. Only transform is animated, so it
   runs on the compositor and costs next to nothing. Rows are staggered via --i. */
.queue li.skeleton { position: relative; overflow: hidden; }
.queue li.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    transparent 25%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 75%);
  transform: translateX(-100%);
  animation: shimmer 1.8s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.15s);
  will-change: transform;
  pointer-events: none;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* Rows that just arrived fade in. */
.queue li.arrived { animation: row-in 0.45s ease both; }
@keyframes row-in { from { opacity: 0; transform: translateY(3px); } }

@media (prefers-reduced-motion: reduce) {
  .queue li.loading::after, .queue li.arrived, .refresh.spin svg { animation: none; }
}

/* --- volume knob ------------------------------------------------------- */
.volume {
  grid-area: volume;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0 0 26px;
  border-left: 1px solid var(--faint);
  margin-top: 18px;
}
.knob {
  position: relative;
  width: 118px;
  height: 118px;
  flex: none;
  cursor: grab;
  touch-action: none;
  border-radius: 50%;
}
.knob:active { cursor: grabbing; }
.knob-arc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.knob-arc circle { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.arc-track { stroke: rgba(255, 255, 255, 0.08); }
.arc-value { stroke: url(#arc-gradient); filter: url(#arc-glow); }
.knob-body {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.07), transparent 60%),
    conic-gradient(from 0deg, #242428, #1a1a1d, #2a2a2e, #18181b, #26262a, #1a1a1d, #242428);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 6px rgba(0, 0, 0, 0.5);
}
/* A short line near the rim, rotated around the knob's center. */
.knob-mark {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 2px;
  height: 20%;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--accent);
  transform-origin: 50% 210%; /* (50% - 8%) / 20% = the knob's center */
  transform: rotate(var(--angle, 0deg));
  box-shadow:
    0 0 6px color-mix(in srgb, var(--glow) 75%, transparent),
    0 0 14px color-mix(in srgb, var(--glow) 35%, transparent);
}
.vol-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vol-label span:first-child { letter-spacing: 0.2em; text-transform: uppercase; font-size: 11px; }

/* --- narrow screens: one column -------------------------------------------- */
@media (max-width: 760px) {
  body { padding: 12px; place-items: start center; }
  .card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "header" "stage" "timeline" "controls" "volume" "upnext";
    padding: 10px 16px 18px;
  }
  .mood { font-size: 9px; letter-spacing: 0.2em; }
  .logo { font-size: 17px; }
  /* Knob centered under the play button; the label sits to its right. */
  .volume {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 18px;
    border-left: 0;
    padding-left: 0;
  }
  .volume .knob { grid-column: 2; }
  .volume .vol-label { grid-column: 3; justify-self: start; }
  .knob { width: 96px; height: 96px; }
  .knob-body { inset: 10px; }
  .upnext { padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .eq i,
  .visual *, .visual *::before, .visual *::after,
  .card.track-in .now-eyebrow, .card.track-in .now-title, .card.track-in .now-artist {
    animation: none !important;
  }
  .play-wrap:has(.play.playing) .play-glow { animation: none; opacity: 0.7; transform: none; }
}

/* Up next fades out: the next track is clear, the later ones recede. */
.queue li:nth-child(1) { opacity: 1; }
.queue li:nth-child(2) { opacity: 0.5; }
.queue li:nth-child(3) { opacity: 0.25; }
.queue li:nth-child(n + 4) { opacity: 0.1; }

/* --- Family Mix popup: same card as the mood menu, movable by its header --- */
.family {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 50%;
  width: min(340px, calc(100vw - 32px));
  padding: 6px 6px 10px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1e1e22 0%, var(--card) 100%);
  border: 1px solid var(--card-edge);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.family[hidden] { display: none; }
.family-head {
  padding: 12px 12px 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.family-head:active { cursor: grabbing; }
.family-head h2 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.family-head p { margin: 0; font-size: 12px; color: var(--muted); }

.family-list {
  list-style: none;
  margin: 0;
  padding: 2px;
  max-height: calc(6 * 38px);   /* about six people visible, then it scrolls */
  overflow-y: auto;
  border-top: 1px solid var(--faint);
  border-bottom: 1px solid var(--faint);
  scrollbar-width: thin;
}
.family-list li { margin: 0; }
.family-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.family-row:hover { background: rgba(255, 255, 255, 0.04); }
.family-row input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.family-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-row .count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.family-row.me { cursor: default; opacity: 0.6; }
.family-empty { padding: 12px 10px; font-size: 12px; color: var(--muted); }

.family-invite { padding: 8px 6px 2px; }
.family-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 400 12px var(--font);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
}
.family-link:hover { color: var(--fg); background: rgba(255, 255, 255, 0.04); }
.family-hint { margin: 0 6px 4px; font-size: 11px; line-height: 1.45; color: var(--muted); }

.family-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 6px 0; }
.family-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--faint);
  background: transparent;
  color: var(--fg);
  font: 400 12px var(--font);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.family-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.family-btn.primary { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent); }
.family-btn:disabled, .family-btn.primary:disabled { color: #4a4950; cursor: default; }
.family-btn:focus-visible, .family-link:focus-visible { outline: 1.5px solid var(--fg); outline-offset: 2px; }

/* Like burst (app.js heartBurst): a layer over the visual, under the title. */
.heart-burst {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.stage .now { z-index: 2; } /* the title stays readable above the hearts */
.heart-burst svg {
  position: absolute;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
