/* ───────── Tokens ───────── */
:root {
  /* "Groovy": 1970s cream, burnt orange, mustard, teal and plum. */
  --bg-l: #fbefdc;        --bg-d: #1a1220;
  --surface-l: #fffaf1;   --surface-d: #251a2c;
  --sunken-l: #f3e3c9;    --sunken-d: #33253c;
  --text-l: #2b1a12;      --text-d: #fbefe3;
  --muted-l: #7c6352;     --muted-d: #bca8b9;
  --border-l: #ead6b8;    --border-d: #45334f;
  --accent-l: #c9461a;    --accent-d: #ff8a4c;
  --on-accent-l: #ffffff; --on-accent-d: #2b0f02;
  --glow-a-l: #ffd7ad;    --glow-a-d: #4a1f33;
  --glow-b-l: #c6ebe4;    --glow-b-d: #12353b;
  --wall-l: #f7dcb4;      --wall-d: #2b1d33;
  --shadow-l: 90 45 20;   --shadow-d: 0 0 0;

  --bg: var(--bg-l); --surface: var(--surface-l); --sunken: var(--sunken-l);
  --text: var(--text-l); --muted: var(--muted-l); --border: var(--border-l);
  --accent: var(--accent-l); --on-accent: var(--on-accent-l);
  --glow-a: var(--glow-a-l); --glow-b: var(--glow-b-l); --wall: var(--wall-l); --shadow: var(--shadow-l);

  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-d); --surface: var(--surface-d); --sunken: var(--sunken-d);
    --text: var(--text-d); --muted: var(--muted-d); --border: var(--border-d);
    --accent: var(--accent-d); --on-accent: var(--on-accent-d);
    --glow-a: var(--glow-a-d); --glow-b: var(--glow-b-d); --wall: var(--wall-d); --shadow: var(--shadow-d);
  }

  @supports (color: light-dark(white, black)) {
    --bg: light-dark(var(--bg-l), var(--bg-d));
    --surface: light-dark(var(--surface-l), var(--surface-d));
    --sunken: light-dark(var(--sunken-l), var(--sunken-d));
    --text: light-dark(var(--text-l), var(--text-d));
    --muted: light-dark(var(--muted-l), var(--muted-d));
    --border: light-dark(var(--border-l), var(--border-d));
    --accent: light-dark(var(--accent-l), var(--accent-d));
    --on-accent: light-dark(var(--on-accent-l), var(--on-accent-d));
    --glow-a: light-dark(var(--glow-a-l), var(--glow-a-d));
    --glow-b: light-dark(var(--glow-b-l), var(--glow-b-d));
    --wall: light-dark(var(--wall-l), var(--wall-d));
  }

  /* The four racing stripes on the wall */
  --s1: #f2b134; --s2: #e8692a; --s3: #c8324a; --s4: #1f8a8a;
  --danger: #d93a3a;

  --radius: 18px;
  --radius-lg: 28px;
  --target: 36px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Futura", "Avenir Next", "Trebuchet MS", "Century Gothic", system-ui, sans-serif;

  color-scheme: light dark;
  accent-color: var(--accent);

  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; --shadow: var(--shadow-d); }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; --shadow: var(--shadow-l); }
}

@media (pointer: coarse) { :root { --target: 44px; } }

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-block-size: 100dvh;
  padding-block-end: max(1.5rem, env(safe-area-inset-bottom, 0px));
  font: 1rem/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(60rem 40rem at 110% -10%, var(--glow-a), transparent 60%),
    radial-gradient(50rem 36rem at -20% 110%, var(--glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { text-wrap: balance; line-height: 1.2; margin: 0; }
h2 { font-size: 1.05rem; }
p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { inline-size: 1.4em; block-size: 1.4em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); }
.muted, .help { color: var(--muted); font-size: 0.9rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86em; }

/* ───────── Shell ───────── */
.topbar {
  position: sticky; inset-block-start: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(0.6rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.6rem max(1rem, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.logo { inline-size: 1.9rem; block-size: 1.9rem; stroke: none; }
.logo-label { fill: var(--accent); }
.brand-wrap { display: grid; justify-items: start; }
.credit { margin: 0; padding-inline-start: 2.45rem; font-size: 0.75rem; font-weight: 500; line-height: 1.3; color: var(--muted); }
.credit a { color: var(--accent); font-weight: 600; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.apps-link { display: block; inline-size: fit-content; margin-block-start: 0.15rem; white-space: nowrap; }
.apps-link svg { display: inline; inline-size: 1.05em; block-size: 1.05em; margin-inline-end: 0.25em; vertical-align: -0.18em; stroke-width: 2.2; }

.header-actions { display: flex; gap: 0.5rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  inline-size: 44px; block-size: 44px;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface);
  transition: background-color 0.15s, scale 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn:active { scale: 0.94; }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.icon-btn.small { inline-size: 36px; block-size: 36px; }

.layout {
  display: grid; gap: 1.25rem;
  inline-size: min(100%, 1500px); margin-inline: auto;
  padding: 0.5rem max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
}
.listening { display: grid; gap: 1.25rem; min-inline-size: 0; align-content: start; }

@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
  .crate {
    position: sticky; inset-block-start: 5.2rem;
    max-block-size: calc(100dvh - 6.2rem); overflow-y: auto; overscroll-behavior: contain;
  }
}

/* ───────── The stage: wall, speakers, turntable ───────── */
.stage {
  /* Wood and panel colors for the chosen finish (shared by the speakers and plinth) */
  --wood: #6b3f24; --wood-hi: #8a5636; --grain: rgb(0 0 0 / 0.28);
  --plate-hi: #dfe0e3; --plate-lo: #a8abb1; --maker-ink: #4a4d53; --baffle: #2d2320;
  --cab-edge: #3d2314;

  position: relative;
  scroll-margin-block-start: 5rem;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 3fr) minmax(0, 1.15fr);
  align-items: end; gap: clamp(0.4rem, 2vw, 1.6rem);
  padding: clamp(1.2rem, 4vw, 3rem) clamp(0.6rem, 3vw, 2.4rem) clamp(1.1rem, 2.4vw, 1.8rem);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(to bottom, transparent 26%,
      var(--s1) 26% 31.5%, transparent 31.5% 33%,
      var(--s2) 33% 38.5%, transparent 38.5% 40%,
      var(--s3) 40% 45.5%, transparent 45.5% 47%,
      var(--s4) 47% 52.5%, transparent 52.5%),
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, white 30%, var(--wall)), var(--wall));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent), 0 24px 60px -36px rgb(var(--shadow) / 0.6);
  overflow: hidden;
  isolation: isolate;
}
/* The sideboard everything sits on */
.stage::after {
  content: ""; position: absolute; z-index: -1;
  inset-inline: 0; inset-block-end: 0; block-size: clamp(1.1rem, 2.4vw, 1.8rem);
  background: linear-gradient(to bottom, #5a341f, #3b2112);
  box-shadow: 0 -6px 14px -6px rgb(0 0 0 / 0.35);
}
.stage[data-finish="teak"] { --wood: #b0662e; --wood-hi: #c98142; --grain: rgb(70 25 0 / 0.28); --plate-hi: #2f2f33; --plate-lo: #1a1a1d; --maker-ink: #c9a77c; --baffle: #1f2b2b; --cab-edge: #6e3a15; }
.stage[data-finish="mod"] { --wood: #f6f2ea; --wood-hi: #ffffff; --grain: transparent; --plate-hi: #ece8df; --plate-lo: #d3cdc1; --maker-ink: #c9461a; --baffle: #e8692a; --cab-edge: #c9c1b2; }
.stage[data-finish="midnight"] { --wood: #1d1c22; --wood-hi: #2b2a32; --grain: rgb(255 255 255 / 0.04); --plate-hi: #2d2c35; --plate-lo: #16151a; --maker-ink: #f2b134; --baffle: #121116; --cab-edge: #0b0a0e; }

/* Speakers: .speaker sets the size (and is the container for cqw); .cab is the cabinet. */
.speaker { container-type: inline-size; min-inline-size: 0; margin-block-end: clamp(0.2rem, 0.6vw, 0.5rem); }
.cab {
  position: relative;
  aspect-ratio: 0.58;
  display: grid; grid-template-rows: auto auto auto 1fr; justify-items: center; align-content: start;
  gap: 6cqw;
  padding: 10cqw 8cqw 9cqw;
  border-radius: 7cqw;
  background: var(--baffle);
  border: 5cqw solid var(--wood);
  border-image: none;
  box-shadow:
    inset 0 0 0 1cqw var(--cab-edge),
    inset 0 2cqw 6cqw rgb(0 0 0 / 0.35),
    0 16px 26px -14px rgb(0 0 0 / 0.55);
  background-clip: padding-box;
}
/* Wood grain and light on the cabinet frame */
.cab::before {
  content: ""; position: absolute; inset: -5cqw; border-radius: inherit; pointer-events: none;
  border: 5cqw solid transparent;
  background:
    linear-gradient(100deg, rgb(255 255 255 / 0.14), transparent 40%, rgb(0 0 0 / 0.2)) border-box,
    repeating-linear-gradient(92deg, var(--grain) 0 1px, transparent 1px 7px) border-box;
  mask: linear-gradient(#000 0 0) border-box, linear-gradient(#000 0 0) padding-box;
  mask-composite: exclude;
  -webkit-mask-composite: xor;
}
.cab .badge {
  font-family: var(--display); font-style: italic; font-weight: 800;
  font-size: max(7px, 7.5cqw); letter-spacing: 0.02em;
  padding: 0.5cqw 4cqw; border-radius: 2cqw;
  color: #2b1a12;
  background: linear-gradient(#f4f5f7, #a9adb4);
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.4);
}
.driver {
  position: relative; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, #1a1a1d 62%, #6b6f77 64%, #f2f3f5 68%, #8e929a 72%, #3a3b40 76%);
  box-shadow: 0 1cqw 2cqw rgb(0 0 0 / 0.45);
}
.tweeter { inline-size: 38cqw; aspect-ratio: 1; }
.woofer { inline-size: 84cqw; aspect-ratio: 1; }
.cone {
  inline-size: 70%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle, #4a4b52 0 16%, #1b1b1f 18% 22%, transparent 23%),
    repeating-radial-gradient(circle, #2a2a2f 0 3%, #232327 3% 6%),
    #26262b;
  box-shadow: inset 0 0 0 1.2cqw #111, inset 0 -3cqw 6cqw rgb(0 0 0 / 0.5), inset 0 3cqw 6cqw rgb(255 255 255 / 0.06);
  will-change: transform;
}
.tweeter .cone { background: radial-gradient(circle at 40% 35%, #f2f3f5, #9da1a8 40%, #3d3f45 70%); }
.port { inline-size: 40cqw; block-size: 7cqw; border-radius: 4cqw; background: #0e0e10; box-shadow: inset 0 1cqw 2cqw rgb(0 0 0 / 0.8), 0 0.5cqw 0 rgb(255 255 255 / 0.08); align-self: end; }

/* Turntable */
.deck-wrap { min-inline-size: 0; }
.deck {
  container-type: inline-size;
  position: relative;
  aspect-ratio: 100 / 70;
  user-select: none; -webkit-user-select: none;
  filter: drop-shadow(0 18px 18px rgb(0 0 0 / 0.3));
}
.deck-base, .deck-arm { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; stroke: none; overflow: visible; }
.deck-arm { pointer-events: none; }
.plinth { fill: var(--wood); }
.maker { font: 700 1.5px/1 var(--display); letter-spacing: 0.35px; fill: var(--maker-ink); }
.ctl-label { font: 700 1.25px/1 var(--display); letter-spacing: 0.2px; fill: var(--maker-ink); text-anchor: middle; }
.led { fill: #4a1a14; transition: fill 0.3s, filter 0.3s; }
.led.on { fill: #ff4a2a; filter: drop-shadow(0 0 0.8px #ff6a3a); }
.strobe, .arm, .arm-shadow { transform-box: view-box; }
.strobe { transform-origin: 38px 35.4px; }
.arm, .arm-shadow { transform-origin: 82px 13px; }
.arm-shadow { filter: blur(0.5px); }
.headshell { fill: #1c1c1f; stroke: #6b7078; stroke-width: 0.3; }

/* The record */
.record {
  container-type: inline-size;
  --vinyl: #111113;
  --label: #e8572a; --label-ink: #fffaf2;
  --gaps: none;
  position: absolute;
  left: 8.7%; top: 8.714%;
  inline-size: 58.6%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--vinyl);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.45), inset 0 0 0 0.5cqw rgb(0 0 0 / 0.6);
  will-change: rotate;
}
.record.ghost { opacity: 0; }
.record .grooves {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    var(--gaps),
    radial-gradient(circle closest-side, transparent 35.5%, rgb(0 0 0 / 0.35) 36.2%, transparent 37.5%),
    repeating-radial-gradient(circle closest-side, rgb(255 255 255 / 0.045) 0 0.22%, transparent 0.3% 0.62%),
    radial-gradient(circle closest-side, transparent 96.5%, rgb(255 255 255 / 0.18) 97.5%, transparent 99%);
}
.record[data-vinyl="match"] { --vinyl: color-mix(in srgb, var(--vinyl-tint) 78%, #120a10); }
.record[data-vinyl="clear"] { --vinyl: rgb(225 232 255 / 0.28); box-shadow: 0 2px 4px rgb(0 0 0 / 0.25), inset 0 0 0 0.5cqw rgb(255 255 255 / 0.25); }
.record[data-vinyl="splatter"] {
  --vinyl: color-mix(in srgb, var(--vinyl-tint) 75%, #120a10);
  background:
    radial-gradient(circle at 24% 30%, #fff8 0 2.2%, transparent 2.6%),
    radial-gradient(circle at 70% 22%, #0009 0 3%, transparent 3.5%),
    radial-gradient(circle at 80% 64%, #fffa 0 1.6%, transparent 2%),
    radial-gradient(circle at 36% 78%, #f2b134cc 0 2.6%, transparent 3%),
    radial-gradient(circle at 58% 86%, #fff9 0 1.2%, transparent 1.5%),
    radial-gradient(circle at 14% 58%, #000a 0 1.8%, transparent 2.2%),
    radial-gradient(circle at 62% 40%, #1f8a8acc 0 1.4%, transparent 1.8%),
    radial-gradient(circle at 88% 42%, #f2b134bb 0 1.1%, transparent 1.4%),
    radial-gradient(circle at 42% 12%, #fffb 0 0.9%, transparent 1.2%),
    var(--vinyl);
}
.record .label {
  position: absolute; inset: 0; margin: auto;
  inline-size: 33%; aspect-ratio: 1; border-radius: 50%;
  display: grid; grid-template-rows: 1fr auto 1fr auto; justify-items: center; align-items: center;
  padding: 3.2cqw 3.4cqw 2.6cqw;
  background:
    radial-gradient(circle, transparent 60%, rgb(0 0 0 / 0.12) 61%, transparent 62%),
    radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%),
    var(--label);
  color: var(--label-ink);
  text-align: center; line-height: 1.05;
  box-shadow: 0 0 0 0.35cqw rgb(0 0 0 / 0.35);
  overflow: hidden;
}
.label-artist { align-self: end; font: 800 2.15cqw/1.05 var(--display); text-transform: uppercase; letter-spacing: 0.06em; max-inline-size: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-title { align-self: start; font: 600 1.9cqw/1.1 var(--font); font-style: italic; max-inline-size: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-side { font: 700 1.2cqw/1 var(--display); letter-spacing: 0.12em; opacity: 0.8; }
.label-hole {
  inline-size: 2.4cqw; aspect-ratio: 1; border-radius: 50%; margin-block: 1cqw;
  background: radial-gradient(circle at 40% 35%, #fff, #9aa0a8 55%, #555a61);
  box-shadow: 0 0 0 0.3cqw rgb(0 0 0 / 0.35);
}
.sheen {
  position: absolute; left: 8.7%; top: 8.714%; inline-size: 58.6%; aspect-ratio: 1; border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 25deg, transparent 0 6%, rgb(255 255 255 / 0.16) 11%, transparent 18% 50%, rgb(255 255 255 / 0.11) 61%, transparent 68%);
  mask: radial-gradient(circle closest-side, transparent 34%, #000 35.5% 97%, transparent 98%);
}
.record[data-vinyl="clear"] + .sheen { opacity: 0.6; }

/* An old-school 7-inch 45: smaller, a big label, and a yellow spindle adapter ("spider")
   in the wide center hole. Positions are the deck's units: center (38, 35.4), radius 17.1. */
.record[data-size="7"], .sheen[data-size="7"] { left: 20.9%; top: 26.143%; inline-size: 34.2%; }
.record[data-size="7"] .grooves {
  background:
    var(--gaps),
    radial-gradient(circle closest-side, transparent 52.5%, rgb(0 0 0 / 0.4) 53.5%, transparent 55.5%),
    radial-gradient(circle closest-side, transparent 60.5%, rgb(255 255 255 / 0.08) 61.5%, transparent 62.5%),
    repeating-radial-gradient(circle closest-side, rgb(255 255 255 / 0.05) 0 0.35%, transparent 0.45% 0.95%),
    radial-gradient(circle closest-side, transparent 95.5%, rgb(255 255 255 / 0.2) 97%, transparent 99%);
}
.record[data-size="7"] .label {
  inline-size: 51%;
  padding: 4.2cqw 5cqw 3.4cqw;
  background:
    radial-gradient(circle, transparent 47%, rgb(0 0 0 / 0.14) 48%, transparent 49.5%),
    radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.25), transparent 55%),
    var(--label);
}
.record[data-size="7"] .label-artist { font-size: 3.5cqw; -webkit-line-clamp: 1; }
.record[data-size="7"] .label-title { font-size: 3cqw; }
.record[data-size="7"] .label-side { font-size: 2cqw; }
.record[data-size="7"] .label-hole {
  inline-size: 21.5cqw; margin-block: 0.8cqw;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Ccircle r='49' fill='%23141416'/%3E%3Ccircle r='43.5' fill='none' stroke='%23c98a12' stroke-width='11'/%3E%3Ccircle r='43.5' fill='none' stroke='%23f2b134' stroke-width='8'/%3E%3Cg fill='%23f2b134' stroke='%23c98a12' stroke-width='1.2'%3E%3Cpath d='M-5 -12 L-7.5 -40 L7.5 -40 L5 -12Z'/%3E%3Cpath d='M-5 -12 L-7.5 -40 L7.5 -40 L5 -12Z' transform='rotate(120)'/%3E%3Cpath d='M-5 -12 L-7.5 -40 L7.5 -40 L5 -12Z' transform='rotate(240)'/%3E%3Ccircle r='15'/%3E%3C/g%3E%3Ccircle r='11' fill='none' stroke='%23ffd57a' stroke-width='1.5' opacity='0.8'/%3E%3Ccircle r='5' fill='%23c7cad0' stroke='%235c6168' stroke-width='1'/%3E%3Ccircle r='1.6' cx='-1.5' cy='-1.5' fill='%23fff'/%3E%3C/svg%3E") center / 100% no-repeat;
  box-shadow: none;
}
.sheen[data-size="7"] { mask: radial-gradient(circle closest-side, transparent 50%, #000 52% 96%, transparent 98%); }

/* In the crate, singles peek out as 45s too */
.card-sleeve.seven .card-peek {
  inset: 14%;
  background:
    radial-gradient(circle closest-side, #f2b134 0 7%, #141416 7.5% 15%, #f2b134 15.5% 20.5%, #e8572a 21.5% 51%, #111 52%),
    #111;
}

/* Controls on the plinth */
.deck-ctl { position: absolute; padding: 0; border: 0; background: none; touch-action: manipulation; }
.deck-ctl.cue {
  left: 89.4%; top: calc(26.4 / 70 * 100%); inline-size: 4.4%; block-size: calc(7 / 70 * 100%);
  border-radius: 1cqw; background: #18181b; box-shadow: inset 0 0.3cqw 0.6cqw rgb(0 0 0 / 0.7);
}
.deck-ctl.cue span {
  position: absolute; inset-inline: -18%; block-size: 38%; inset-block-start: 4%;
  border-radius: 0.6cqw; background: linear-gradient(#f4f5f7, #9aa0a8); box-shadow: 0 0.4cqw 0.6cqw rgb(0 0 0 / 0.5);
  transition: inset-block-start 0.25s;
}
body[data-mode="paused"] .deck-ctl.cue span, body[data-mode="busy"] .deck-ctl.cue span { inset-block-start: 58%; }
.deck-ctl.speed {
  left: 88.6%; top: calc(39.4 / 70 * 100%); inline-size: 6%;
  display: grid; gap: 0.6cqw;
}
.deck-ctl.speed button {
  block-size: 3.8cqw; padding: 0; border: 0; border-radius: 0.8cqw;
  font: 800 1.6cqw/1 var(--display); color: #2b2b30;
  background: linear-gradient(#f4f5f7, #a9adb4); box-shadow: 0 0.35cqw 0 #6b7078, 0 0.6cqw 0.8cqw rgb(0 0 0 / 0.35);
  transition: translate 0.1s, box-shadow 0.1s, color 0.15s;
}
.deck-ctl.speed button[aria-pressed="true"] { translate: 0 0.3cqw; box-shadow: 0 0.05cqw 0 #6b7078; color: #c9461a; }
.deck-ctl.start {
  left: 88.4%; top: calc(56.3 / 70 * 100%); inline-size: 6.4%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #c7cad0 50%, #7d828a);
  box-shadow: 0 0.5cqw 0.9cqw rgb(0 0 0 / 0.45);
}
.deck-ctl.start span { position: absolute; inset: 24%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff8a5c, #c9461a); box-shadow: inset 0 -0.3cqw 0.4cqw rgb(0 0 0 / 0.3); }
.deck-ctl:active { scale: 0.95; }
.deck-ctl:focus-visible, .deck-ctl.speed button:focus-visible { outline-width: 2px; }

/* On narrow screens, slimmer speakers */
@media (max-width: 640px) {
  .stage { grid-template-columns: minmax(0, 0.8fr) minmax(0, 3.2fr) minmax(0, 0.8fr); }
  .cab { aspect-ratio: 0.5; gap: 9cqw; padding-block-start: 14cqw; }
  .cab .badge { display: none; }
}

/* ───────── Now playing ───────── */
.now {
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 18px 40px -30px rgb(var(--shadow) / 0.6);
}
.now-empty { display: grid; place-items: center; min-block-size: 3.5rem; text-align: center; }
.now-hint { color: var(--muted); }
.now-hint strong { color: var(--text); }
.now-full { display: grid; gap: 0.85rem; }
.now-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.now-sleeve {
  padding: 0; border: 0; background: none; border-radius: 6px;
  inline-size: clamp(4.5rem, 12vw, 6.5rem); aspect-ratio: 1;
  box-shadow: 0 10px 18px -10px rgb(0 0 0 / 0.6);
  transition: rotate 0.2s, scale 0.2s;
}
.now-sleeve:hover { rotate: -2deg; scale: 1.03; }
.now-sleeve img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; border-radius: 6px; }
.now-kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.now-meta h2 { font-family: var(--display); font-size: clamp(1.15rem, 1rem + 1vw, 1.55rem); line-height: 1.15; }
.now-artist { font-weight: 600; }
.now-track { color: var(--muted); font-size: 0.92rem; }

.progress { display: grid; grid-template-columns: auto 1fr auto; gap: 0.7rem; align-items: center; font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--muted); }
input[type="range"] { inline-size: 100%; min-inline-size: 0; margin: 0; accent-color: var(--accent); }

.transport { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.t-btn {
  display: inline-grid; place-items: center;
  inline-size: 46px; block-size: 46px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--sunken);
  transition: scale 0.12s, background-color 0.15s;
}
.t-btn:hover { background: color-mix(in srgb, var(--accent) 14%, var(--sunken)); }
.t-btn:active { scale: 0.93; }
.t-btn.big { inline-size: 58px; block-size: 58px; background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 22px -10px var(--accent); }
.t-btn.big svg { inline-size: 1.7em; block-size: 1.7em; }
.t-btn .i-pause { display: none; }
.t-btn.is-playing .i-play { display: none; }
.t-btn.is-playing .i-pause { display: block; }
.volume { display: flex; align-items: center; gap: 0.4rem; flex: 1 1 8rem; min-inline-size: 7rem; color: var(--muted); padding-inline: 0.4rem; }
#eject { margin-inline-start: auto; }

.tracklist summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; padding-block: 0.2rem; }
.tracklist ol { margin-block-start: 0.4rem; max-block-size: 16rem; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 1px; padding-inline-end: 0.25rem; }
.tracklist button {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center;
  inline-size: 100%; min-block-size: 2.5rem; padding: 0.3rem 0.6rem;
  border: 0; border-radius: 10px; background: none; text-align: start;
}
.tracklist button:hover { background: var(--sunken); }
.tracklist button.current { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 700; }
.tracklist button.current .tl-n { color: var(--accent); }
.tl-n, .tl-d { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.tl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explicit { display: inline-grid; place-items: center; inline-size: 1.1rem; block-size: 1.1rem; border-radius: 3px; background: var(--muted); color: var(--surface); font-size: 0.65rem; font-weight: 800; text-decoration: none; vertical-align: 0.1em; }
.attribution a { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.attribution a:hover { color: var(--text); }
.spotify-mark { inline-size: 1.25em; block-size: 1.25em; }
.spotify-mark.big { inline-size: 2.4rem; block-size: 2.4rem; }

/* ───────── The crate ───────── */
.crate {
  display: grid; gap: 0.9rem; align-content: start;
  padding: 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--text) 3%, transparent) 46px 48px),
    var(--surface);
}
.crate-title { font-family: var(--display); font-size: 1.35rem; }
.search {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.3rem 0.3rem 0.85rem;
  border: 2px solid var(--border); border-radius: 999px; background: var(--bg);
  transition: border-color 0.15s;
}
.search:focus-within { border-color: var(--accent); }
.search > svg { color: var(--muted); }
.search input { flex: 1; min-inline-size: 0; border: 0; background: none; padding: 0.45rem 0; outline: none; font-size: 1rem; }
.search-go {
  min-block-size: 40px; padding: 0.3rem 1rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 700;
}
.connect {
  display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 0.8rem; align-items: center;
  padding: 0.9rem; border-radius: var(--radius);
  background: color-mix(in srgb, #1ed760 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #1ed760 35%, var(--border));
}
.connect .primary-btn { grid-column: 1 / -1; min-block-size: 2.8rem; font-size: 1rem; background: #1db954; color: #08130b; box-shadow: none; }
.connect-title { font-weight: 700; line-height: 1.3; }
.connect.nudge { animation: nudge 0.5s ease; }
@keyframes nudge { 30% { translate: -6px 0; } 60% { translate: 5px 0; } }
.crate-status:empty { display: none; }
.crate-status { color: var(--muted); font-size: 0.92rem; }
.crate-sub { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.crate-sub:empty { display: none; }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.25rem), 1fr)); gap: 1.1rem 0.9rem; }
.album-card {
  display: grid; gap: 0.5rem; inline-size: 100%; padding: 0; border: 0; background: none; text-align: start;
  border-radius: 8px;
}
.card-sleeve { position: relative; display: block; aspect-ratio: 1; }
.card-sleeve img {
  position: relative; display: block; inline-size: 100%; block-size: 100%; object-fit: cover;
  border-radius: 4px; background: var(--sunken);
  box-shadow: 0 10px 16px -10px rgb(0 0 0 / 0.6);
  transition: translate 0.3s, rotate 0.3s;
}
.card-peek {
  position: absolute; inset: 4%; border-radius: 50%;
  background:
    radial-gradient(circle, #e8572a 0 15%, #111 16%),
    #111;
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.4);
  transition: translate 0.35s cubic-bezier(.3, .7, .3, 1.2);
}
.card-peek::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgb(255 255 255 / 0.06) 0 1px, transparent 1px 3px);
}
.album-card:hover .card-peek, .album-card:focus-visible .card-peek { translate: 28% 0; }
.album-card:hover .card-sleeve img, .album-card:focus-visible .card-sleeve img { translate: -4% 0; rotate: -2deg; }
.album-card.wiggle { animation: nudge 0.45s ease 2; }
.card-meta { display: grid; gap: 0.1rem; min-inline-size: 0; }
.card-title { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 0.84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-type { justify-self: start; margin-block-start: 0.15rem; padding: 0 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; background: var(--sunken); color: var(--muted); }
.more { justify-self: center; }

/* ───────── The flying sleeve and record ───────── */
.fly-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.fly-layer > * { position: absolute; }
.fly-sleeve { transform-origin: 0 0; border-radius: 3px; box-shadow: 0 30px 40px -18px rgb(0 0 0 / 0.6); z-index: 2; }
.fly-sleeve img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; border-radius: 3px; }
.fly-sleeve::after {
  content: ""; position: absolute; inset: 0; border-radius: 3px;
  background: linear-gradient(120deg, rgb(255 255 255 / 0.22), transparent 35%, transparent 70%, rgb(0 0 0 / 0.15));
  box-shadow: inset -0.25rem 0 0.35rem -0.2rem rgb(0 0 0 / 0.5);
}
.fly-vinyl { transform-origin: 50% 50%; z-index: 1; }

/* ───────── Lyrics ───────── */
.lyrics {
  position: fixed; z-index: 20;
  inset-inline-end: max(1rem, env(safe-area-inset-right, 0px));
  inset-block: 5.4rem 1rem;
  inline-size: min(26rem, calc(100vw - 2rem));
  display: grid; grid-template-rows: auto 1fr auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
  animation: lyrics-in 0.25s ease-out;
}
@keyframes lyrics-in { from { opacity: 0; translate: 24px 0; } }
.lyrics-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: start; padding: 1rem 1rem 0.4rem 1.25rem; }
.lyrics-head h2 { font-family: var(--display); font-size: 1.2rem; }
.lyrics-body {
  display: grid; align-content: start; gap: 0.15rem;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0.6rem 1rem 40%;
  mask: linear-gradient(transparent, #000 1.5rem, #000 calc(100% - 3rem), transparent);
}
.lyric {
  padding: 0.3rem 0.4rem; border: 0; border-radius: 10px; background: none; text-align: start;
  font-size: 1.2rem; font-weight: 750; line-height: 1.3; color: var(--muted);
  opacity: 0.75; transition: color 0.25s, opacity 0.25s, scale 0.25s;
  transform-origin: left center;
}
.lyric:hover { background: var(--sunken); }
.lyric.past { opacity: 0.5; }
.lyric.current { color: var(--accent); opacity: 1; scale: 1.04; }
.plain-lyrics { white-space: pre-wrap; font-size: 1.05rem; line-height: 1.6; padding-inline: 0.4rem; }
.lyrics-msg { color: var(--muted); padding: 1rem 0.4rem; }
.lyrics-credit { padding: 0.5rem 1.25rem 0.9rem; font-size: 0.78rem; color: var(--muted); }
@media (max-width: 999px) {
  .lyrics { inset-inline: 0.5rem; inset-block: auto 0.5rem; inline-size: auto; block-size: min(55dvh, 30rem); }
  @keyframes lyrics-in { from { opacity: 0; translate: 0 24px; } }
  body.lyrics-open { padding-block-end: min(56dvh, 31rem); }
}

/* ───────── Buttons and forms ───────── */
.primary-btn {
  min-block-size: 3rem; padding: 0.6rem 1.5rem;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 10px 24px -12px var(--accent);
  transition: scale 0.15s, filter 0.15s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { scale: 0.98; }
.soft-btn {
  min-block-size: 44px; padding: 0.4rem 1rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--sunken); font-weight: 600; font-size: 0.92rem;
}
.soft-btn:hover { background: color-mix(in srgb, var(--accent) 12%, var(--sunken)); }
.soft-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.soft-btn.tiny { min-block-size: 28px; padding: 0.1rem 0.6rem; font-size: 0.8rem; border-radius: 8px; vertical-align: middle; }
.link-btn { display: inline-grid; place-items: center; color: var(--text); text-decoration: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ───────── Dialogs ───────── */
dialog {
  inline-size: min(100vw - 1.5rem, 32rem);
  max-block-size: min(100dvh - 2rem, 48rem);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
}
dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.22s ease-out; }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgb(25 10 5 / 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes dialog-in { from { opacity: 0; translate: 0 16px; scale: 0.98; } }
.dialog-head { padding: 1.2rem 1.25rem 0.4rem; }
.dialog-head h2 { font-family: var(--display); font-size: 1.35rem; }
.dialog-body { display: grid; gap: 1.3rem; padding: 0.8rem 1.25rem 1.2rem; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.6rem; padding: 0.9rem 1.25rem max(0.9rem, env(safe-area-inset-bottom, 0px)); border-block-start: 1px solid var(--border); }
.dialog-foot .primary-btn { min-block-size: 2.75rem; font-size: 1rem; }

.field { display: grid; gap: 0.6rem; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.field > legend { padding: 0; margin-block-end: 0.5rem; font-weight: 800; font-family: var(--display); font-size: 1.02rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.row label { flex: 1 1 10rem; font-weight: 600; }
.row select, .row input[type="text"] { flex: 1 1 14rem; max-inline-size: 100%; min-block-size: 42px; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.account { font-size: 0.92rem; }
.howto { font-size: 0.9rem; border: 1px solid var(--border); border-radius: 14px; padding: 0.6rem 0.9rem; background: var(--bg); }
.howto summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.howto ol { list-style: decimal; padding-inline-start: 1.25rem; display: grid; gap: 0.45rem; margin: 0.6rem 0 0.4rem; }
.howto code { padding: 0.1rem 0.35rem; border-radius: 6px; background: var(--sunken); overflow-wrap: anywhere; }

.check {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.9rem; border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; transition: border-color 0.15s, background-color 0.15s;
}
.check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.check input { flex: none; inline-size: 1.15rem; block-size: 1.15rem; margin: 0; }
.check span { font-weight: 600; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--sunken); }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
.segmented label { position: relative; display: grid; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-block-size: 40px; padding: 0.3rem 0.4rem; border-radius: 10px; text-align: center; font-size: 0.86rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }

/* About */
.about { gap: 1.15rem; line-height: 1.55; }
.about h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.about ul { display: grid; gap: 0.4rem; padding-inline-start: 1.25rem; list-style: disc; }
.about li::marker { color: var(--accent); }

/* Album info */
#album-info { inline-size: min(100vw - 1.5rem, 28rem); }
.ai-top { padding: 1.25rem 1.25rem 0; }
.ai-top img { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; box-shadow: 0 20px 30px -18px rgb(0 0 0 / 0.6); }
.ai-body { gap: 0.6rem; }
.ai-body h2 { font-family: var(--display); font-size: 1.4rem; }
.ai-artist { font-weight: 600; color: var(--muted); }
.ai-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-block: 0.4rem; }
.ai-facts div { padding: 0.55rem 0.75rem; border-radius: 12px; background: var(--sunken); }
.ai-facts dt { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ai-facts dd { font-weight: 700; }

/* ───────── Toast, footer ───────── */
.toast {
  position: fixed; z-index: 40;
  inset-inline: 0; inset-block-end: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  inline-size: fit-content; max-inline-size: calc(100vw - 2rem); margin-inline: auto;
  padding: 0.6rem 1rem; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 0.9rem; font-weight: 600; text-align: center;
  opacity: 0; translate: 0 8px; pointer-events: none;
  transition: opacity 0.2s, translate 0.2s;
}
.toast.show { opacity: 1; translate: 0; }
.toast:empty { display: none; }
.copyright { margin: 0; padding: 2rem 1rem 0; text-align: center; font-size: 0.8rem; color: var(--muted); }
.load-error { padding: 2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  dialog[open], .lyrics, .connect.nudge, .album-card.wiggle { animation: none; }
  .card-peek, .card-sleeve img { transition: none; }
}
