/* Figtree by Erik Kennedy, SIL Open Font License 1.1 (assets/fonts/OFL.txt). */

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-ext-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-ext-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-ext-800.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Figtree";
  src: url("./assets/fonts/figtree-latin-800.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The channel ("mood") hue. Registered so switching channels cross-fades the whole screen instead of snapping. */
@property --active-hue {
  syntax: "<number>";
  inherits: true;
  initial-value: 16;
}

/* ------------------------------------------------------------------ */
/* Tokens: light and dark share every rule; only light-dark() values change. */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* brand: identity only, never a status colour */
  --accent: #ff6b3d;
  --accent-light: #ff9a79;
  --accent-ink: #2a0900;
  --accent-text: light-dark(#c2410c, #ff9a79);

  /* status: constant in both themes */
  --state-up: #2fd08a;
  --state-blocked: #ff9a3d;
  --state-checking: #8b93a3;

  /* chrome */
  --bg: light-dark(#e6e7ee, #0b0b0e);
  --text: light-dark(#15131f, #f6f3ed);
  --muted: light-dark(rgba(21, 19, 31, 0.6), #aaa6a0);
  --muted-strong: light-dark(rgba(21, 19, 31, 0.8), #cac6bf);
  --faint: light-dark(rgba(21, 19, 31, 0.4), #6f6b68);
  --line: light-dark(rgba(30, 28, 60, 0.09), rgba(255, 255, 255, 0.075));
  --line-strong: light-dark(rgba(30, 28, 60, 0.16), rgba(255, 255, 255, 0.16));

  /* card: lit top edge + soft lift */
  --card-bg: linear-gradient(180deg,
    light-dark(rgba(255, 255, 255, 0.86), rgba(30, 30, 35, 0.94)) 0%,
    light-dark(rgba(255, 255, 255, 0.74), rgba(20, 20, 24, 0.94)) 100%);
  --card-border: light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.085));
  --card-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.07)),
    0 1px 0 light-dark(rgba(30, 28, 60, 0.05), rgba(0, 0, 0, 0.35)),
    0 22px 48px -24px light-dark(rgba(30, 28, 60, 0.32), rgba(0, 0, 0, 0.8));

  /* secondary 3D button */
  --btn-bg: linear-gradient(180deg,
    light-dark(#fff, rgba(255, 255, 255, 0.11)),
    light-dark(rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.04)));
  --btn-border: light-dark(rgba(30, 28, 60, 0.1), rgba(255, 255, 255, 0.09));
  --btn-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.08)),
    0 2px 8px -4px light-dark(rgba(30, 28, 60, 0.18), rgba(0, 0, 0, 0.55));

  /* primary 3D button, in brand orange */
  --brand-btn-bg: linear-gradient(180deg, color-mix(in srgb, var(--accent) 74%, #fff), var(--accent) 62%, color-mix(in srgb, var(--accent) 90%, #000));
  --brand-btn-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(120, 30, 0, 0.2),
    0 2px 12px -2px color-mix(in srgb, var(--accent) 60%, transparent),
    0 12px 28px -12px color-mix(in srgb, var(--accent) 80%, transparent);

  /* recessed well (segmented controls, chips) */
  --well-bg: light-dark(rgba(30, 28, 60, 0.055), rgba(0, 0, 0, 0.3));
  --well-shadow:
    inset 0 1px 2px light-dark(rgba(30, 28, 60, 0.1), rgba(0, 0, 0, 0.45)),
    0 1px 0 light-dark(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.04));

  /* frosted glass sheets (dock, chips, toast) */
  --glass-bg: light-dark(rgba(255, 255, 255, 0.7), rgba(22, 22, 26, 0.72));
  --glass-border: light-dark(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.1));
  --glass-blur: blur(40px) saturate(1.6);
  --glass-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.08)),
    0 18px 50px -14px light-dark(rgba(30, 28, 60, 0.3), rgba(0, 0, 0, 0.65));

  --focus-ring: color-mix(in srgb, var(--accent) 65%, transparent);
  --hover-tint: light-dark(rgba(30, 28, 60, 0.04), rgba(255, 255, 255, 0.04));

  /* film grain: a tiny SVG noise tile that stops gradients from banding */
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.1 -.42'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.11'/></svg>");

  --radius-sm: 12px;
  --radius-md: 22px;
  --radius-lg: 32px;
  --font-ui: "Figtree", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-title: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --transport-size: clamp(46px, 4.25vw, 54px);
  --transport-icon: clamp(23px, 2.2vw, 27px);
  --card-action-size: clamp(38px, 3.4vw, 42px);
  --card-action-icon: clamp(20px, 1.8vw, 22px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* width of the right-hand column, shared by the hero's visualizer and the history beside the channels */
  --side-col: clamp(340px, 30vw, 390px);

  font-family: var(--font-ui);
  transition: --active-hue 700ms ease;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  isolation: isolate;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  /* soft ambient light: the channel hue up top, brand warmth at the corner, a cool fill below */
  background:
    radial-gradient(64rem 36rem at 92% -10%, light-dark(hsl(var(--active-hue) 80% 62% / 0.32), hsl(var(--active-hue) 85% 55% / 0.14)), transparent 70%),
    radial-gradient(42rem 26rem at 2% -4%, light-dark(rgba(255, 140, 100, 0.22), rgba(255, 107, 61, 0.07)), transparent 70%),
    radial-gradient(50rem 40rem at -8% 62%, light-dark(rgba(120, 112, 190, 0.2), rgba(61, 128, 255, 0.05)), transparent 70%),
    radial-gradient(46rem 36rem at 100% 100%, light-dark(rgba(100, 150, 160, 0.2), rgba(120, 90, 200, 0.04)), transparent 70%),
    linear-gradient(180deg, light-dark(#eceef4, #111115) 0%, light-dark(#dfe1e9, #0a0a0d) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 1rem;
  font-synthesis: none;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* grain + a faint sheen across the top, fixed behind all content */
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    var(--noise),
    linear-gradient(180deg, light-dark(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.035)) 0%, transparent 280px);
  content: "";
  pointer-events: none;
}

::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); }

button, input, output { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus { transform: translateY(0); }

.topbar,
main,
.player-inner {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

/* ------------------------------------------------------------------ */
/* Top bar                                                             */
/* ------------------------------------------------------------------ */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 80px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-radius: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-btn-bg);
  color: #fff;
  box-shadow: var(--brand-btn-shadow);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 3.2;
  filter: drop-shadow(0 1px 1px rgba(120, 30, 0, 0.35));
}

.brand-name {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
}

.brand-name::after { content: "."; margin-left: 0.07em; }

.brand-dot { margin-inline: 0.07em; }

.brand-dot,
.brand-name::after { color: var(--accent); }

.brand-divider {
  flex: none;
  width: 1px;
  height: 16px;
  background: var(--line-strong);
}

.brand small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--muted-strong);
  padding: 0 12px 0 10px;
  font-size: 0.76rem;
  white-space: nowrap;
  box-shadow: var(--btn-shadow);
  cursor: default;
}

.icon-button {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--btn-border);
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--muted-strong);
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: filter 160ms ease, transform 160ms ease, color 160ms ease;
}

.icon-button svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: opacity 260ms ease, transform 420ms var(--ease-out);
}

.icon-button:hover { color: var(--text); filter: brightness(1.08); }
.icon-button:active { transform: scale(0.95); }

/* show the theme you would switch TO */
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-60deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(60deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ */
/* Now playing hero                                                    */
/* ------------------------------------------------------------------ */

.now-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-col);
  min-height: 430px;
  overflow: hidden;
  overflow: clip;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 18% 120%, light-dark(hsl(var(--active-hue) 72% 60% / 0.2), hsl(var(--active-hue) 72% 48% / 0.14)), transparent 52%),
    linear-gradient(115deg, light-dark(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.035)), transparent 44%),
    var(--card-bg);
  box-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.08)),
    0 1px 0 light-dark(rgba(30, 28, 60, 0.05), rgba(0, 0, 0, 0.35)),
    0 40px 90px -40px light-dark(rgba(30, 28, 60, 0.4), rgba(0, 0, 0, 0.85));
}

/* big blurred mood light behind the copy */
.now-card::before {
  position: absolute;
  z-index: -1;
  inset: auto 22% -55% -18%;
  width: 650px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: light-dark(hsl(var(--active-hue) 85% 62% / 0.14), hsl(var(--active-hue) 88% 58% / 0.13));
  filter: blur(50px);
  content: "";
  pointer-events: none;
}

/* grain inside the card */
.now-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--noise);
  content: "";
  pointer-events: none;
}

.now-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 74px);
}

.eyebrow-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* a long channel name stays on one line */
.eyebrow { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal-state { flex: none; }

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent-text);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.signal-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--well-bg);
  color: var(--muted-strong);
  padding: 3px 10px 3px 8px;
  font-size: 0.74rem;
  line-height: 1.4;
  box-shadow: var(--well-shadow);
}

/* status dot: grey when idle, amber while tuning, green when on air */
.signal-state::before,
.np-label::before {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--state-checking);
  content: "";
  transition: background 260ms ease, box-shadow 260ms ease;
}

.loading .signal-state::before,
.loading .np-label::before {
  background: var(--state-blocked);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state-blocked) 22%, transparent);
  animation: blink 1s ease-in-out infinite alternate;
}

.playing .signal-state::before,
.playing .np-label::before {
  background: var(--state-up);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state-up) 22%, transparent);
  animation: live-dot 2s ease-out infinite;
}

@keyframes blink { to { opacity: 0.35; } }

@keyframes live-dot {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--state-up) 55%, transparent); }
  80%, 100% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--state-up) 0%, transparent); }
}

.now-copy h1 {
  max-width: 720px;
  margin: 0;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
  background: linear-gradient(180deg,
    var(--text) 35%,
    color-mix(in srgb, var(--text) 74%, light-dark(hsl(var(--active-hue) 70% 32%), hsl(var(--active-hue) 70% 72%))) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-title);
  font-size: clamp(2.55rem, 6vw, 5.4rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Persian/Arabic titles: tight tracking squeezes words together and the script needs taller lines */
.now-copy h1:dir(rtl) { letter-spacing: 0; line-height: 1.3; }
.genre h3:dir(rtl) { letter-spacing: 0; }

/* longer titles step down in size so they don't swallow the hero (set from app.js) */
.now-copy h1[data-length="medium"] { font-size: clamp(2.2rem, 4.6vw, 4.1rem); }
.now-copy h1[data-length="long"] { font-size: clamp(1.9rem, 3.5vw, 3.1rem); line-height: 1; }

.swap { animation: swap-in 520ms var(--ease-out) both; }
.hero-artist.swap { animation-delay: 60ms; }

@keyframes swap-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

.hero-artist {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  min-height: 1.6em;
  margin: 20px 0 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
}

.primary-play,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 999px;
  padding: 0 20px;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, color 160ms ease;
}

.primary-play {
  /* Wide enough for both "Listen live" and "Stop live", so toggling doesn't shift the buttons beside it. */
  min-width: 8.75em;
  border: 0;
  background: var(--brand-btn-bg);
  color: var(--accent-ink);
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  box-shadow: var(--brand-btn-shadow);
}

.primary-play:hover,
.text-button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.primary-play:active,
.text-button:active { transform: scale(0.98); }

.play-symbol {
  flex: none;
  width: 0;
  height: 0;
  border-top: clamp(5px, 0.5vw, 6px) solid transparent;
  border-bottom: clamp(5px, 0.5vw, 6px) solid transparent;
  border-left: clamp(8px, 0.8vw, 10px) solid currentColor;
  transform: translateX(1px);
}

.playing .play-symbol,
.loading .play-symbol {
  width: clamp(10px, 0.9vw, 12px);
  height: clamp(10px, 0.9vw, 12px);
  border: 0;
  border-radius: 2px;
  background: currentColor;
  transform: none;
}

.text-button {
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--muted-strong);
  box-shadow: var(--btn-shadow);
}

.text-button:hover { color: var(--text); }
.text-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---- visual panel: an inset, colour-filled tile ---- */

.signal-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  overflow: clip;
  min-height: 340px;
  margin: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: calc(var(--radius-lg) - 10px);
  background:
    var(--noise),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2), transparent 44%),
    radial-gradient(circle at 28% 10%, rgba(255, 255, 255, 0.28), transparent 38%),
    linear-gradient(150deg, hsl(var(--active-hue) 78% 58%), hsl(calc(var(--active-hue) + 18) 72% 36%));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -30px 60px -30px hsl(calc(var(--active-hue) + 18) 70% 12% / 0.45),
    0 1px 0 light-dark(rgba(30, 28, 60, 0.06), rgba(0, 0, 0, 0.4)),
    0 22px 44px -22px light-dark(hsl(var(--active-hue) 70% 40% / 0.7), hsl(var(--active-hue) 70% 20% / 0.7));
}

/* faint dot lattice, fading toward the edges */
.signal-visual::after {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1.2px);
  background-size: 18px 18px;
  content: "";
  opacity: 0.12;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 75%);
  mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 75%);
}

.visualizer-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.visualizer-footer {
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.listener-meta {
  flex: none;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.listener-meta strong { color: white; font-size: 0.92rem; font-variant-numeric: tabular-nums; }

.visualizer-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 12, 16, 0.2);
  padding: 3px;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  pointer-events: auto;
}

.visualizer-option {
  min-width: 58px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  padding: 0 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.visualizer-option[aria-pressed="true"] {
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.86));
  color: hsl(var(--active-hue) 45% 16%);
  box-shadow:
    inset 0 1px 0 #fff,
    0 1px 1px rgba(0, 0, 0, 0.12),
    0 4px 12px -2px rgba(7, 10, 12, 0.28);
}

.visualizer-option:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .visualizer-option:not([aria-pressed="true"]):hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
  }
}

/* The core is the "orb": a solid bead in the channel colour (lit cap on top, shade below,
   a halo ring and a glow) with white equalizer bars inside. */
.signal-core {
  --s: hsl(var(--active-hue) 62% 44%);
  --i: 0;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: clamp(96px, 10vw, 120px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(60% 40% at 50% 14%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--s) 70%, #fff) 0%, var(--s) 55%, color-mix(in srgb, var(--s) 60%, #000) 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -5px 10px color-mix(in srgb, var(--s) 75%, #000 25%),
    0 0 0 8px color-mix(in srgb, var(--s) 16%, transparent),
    0 6px 38px color-mix(in srgb, var(--s) 50%, transparent);
}

.signal-core::after {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  content: "";
  pointer-events: none;
  transition: opacity 500ms ease;
  opacity: 0.5;
}

.playing .signal-core::after { opacity: 1; }

/* The bars blend two motions instead of swapping animations: a slow breath (--breath) and an
   equalizer beat (--beat) both run all the time, and --eq says how much of the beat shows.
   --eq eases between states, so stopping fades the equalizer out rather than snapping. */
@property --eq { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --beat { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --breath { syntax: "<number>"; inherits: false; initial-value: 0; }

.signal-core,
.mini-wave { --eq: 0; transition: --eq 520ms ease; }
.loading .signal-core { --eq: 0.5; }
.playing .signal-core,
.playing .mini-wave { --eq: 1; }

/* bars: brightest in the middle, softer toward the sides (like the 1 / .7 / .4 rings) */
.signal-core span {
  --o: 1;
  --tint: color-mix(in srgb, var(--s) 22%, #fff);
  position: relative;
  z-index: 1;
  width: 4px;
  height: clamp(16px, 1.7vw, 22px);
  border-radius: 99px;
  /* solid end to end: white at the top easing into a light channel tint at the bottom */
  background: linear-gradient(180deg, #fff 0%, #fff 40%, var(--tint) 100%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  opacity: var(--o);
  transform-origin: center;
  /* resting: breathes between 0.8 and 1.06 · on air: beats between 1 and 0.36 */
  transform: scaleY(calc(
    (1 - var(--eq)) * (0.8 + 0.26 * var(--breath)) +
    var(--eq) * (1 - 0.64 * var(--beat))
  ));
  animation:
    bar-breath 3.2s ease-in-out infinite,
    bar-beat 760ms ease-in-out infinite alternate;
  /* negative delays: every bar is already mid-motion, so nothing waits or jumps */
  animation-delay: calc(var(--i) * -0.18s), 0s;
}

.signal-core span:nth-child(1),
.signal-core span:nth-child(7) { --i: 3; --o: 0.4; box-shadow: none; }
.signal-core span:nth-child(2),
.signal-core span:nth-child(6) { --i: 2; --o: 0.68; height: clamp(26px, 2.8vw, 34px); }
.signal-core span:nth-child(3),
.signal-core span:nth-child(5) { --i: 1; --o: 0.88; height: clamp(34px, 3.7vw, 46px); }
.signal-core span:nth-child(4) { --i: 0; height: clamp(42px, 4.6vw, 56px); }

/* each bar beats on its own tempo so the equalizer never looks mechanical */
.signal-core span:nth-child(1) { animation-duration: 3.2s, 640ms; animation-delay: -0.54s, -200ms; }
.signal-core span:nth-child(2) { animation-duration: 3.2s, 820ms; animation-delay: -0.36s, -450ms; }
.signal-core span:nth-child(3) { animation-duration: 3.2s, 560ms; animation-delay: -0.18s, -120ms; }
.signal-core span:nth-child(4) { animation-duration: 3.2s, 900ms; animation-delay: 0s, -380ms; }
.signal-core span:nth-child(5) { animation-duration: 3.2s, 600ms; animation-delay: -0.18s, -520ms; }
.signal-core span:nth-child(6) { animation-duration: 3.2s, 760ms; animation-delay: -0.36s, -60ms; }
.signal-core span:nth-child(7) { animation-duration: 3.2s, 680ms; animation-delay: -0.54s, -300ms; }

@keyframes bar-breath {
  0%, 100% { --breath: 0; }
  50% { --breath: 1; }
}

@keyframes bar-beat {
  from { --beat: 0; }
  to { --beat: 1; }
}

/* the dock's small equalizer uses the same blend: still when idle, fading into the beat */
.mini-wave i {
  transform: scaleY(calc(1 - 0.64 * var(--eq) * var(--beat)));
  animation: bar-beat 700ms ease-in-out infinite alternate;
}
.mini-wave i:nth-child(2n) { animation-delay: -310ms; }
.mini-wave i:nth-child(3n) { animation-delay: -520ms; }

/* ------------------------------------------------------------------ */
/* Channels                                                            */
/* ------------------------------------------------------------------ */

/* channels and history sit side by side: browse on the left, context on the right */
.browse {
  display: grid;
  /* 9px narrower than the hero's column: the visualizer sits 10px inside the card's 1px border,
     so this puts the history's left edge exactly under the visualizer's */
  grid-template-columns: minmax(0, 1fr) calc(var(--side-col) - 9px);
  align-items: start;
  gap: 28px;
  padding: 22px 0 56px;
}

.section-note kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.6em;
  border: 1px solid var(--btn-border);
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--muted-strong);
  padding: 0 5px;
  font: inherit;
  font-size: 0.72rem;
  box-shadow: var(--btn-shadow);
}

.section-heading,
.panel-heading {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--noise), var(--card-bg);
  padding: 16px 22px 18px;
  box-shadow: var(--card-shadow);
}

/* the heading boxes are underlined by a neutral grey line that fades out at both ends */
.section-heading::after,
.panel-heading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.5px;
  background: linear-gradient(90deg,
    transparent,
    light-dark(rgba(20, 24, 32, 0.3), rgba(255, 255, 255, 0.34)) 30%,
    light-dark(rgba(20, 24, 32, 0.3), rgba(255, 255, 255, 0.34)) 70%,
    transparent);
}

.section-heading h2,
.panel-heading h2 {
  margin: 4px 0 0;
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.section-note { margin: 0; color: var(--muted); font-size: 0.82rem; }

.genres {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.genre,
.skeleton-card {
  min-height: 168px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
}

.genre {
  --hue: 16;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow: clip;
  width: 100%;
  appearance: none;
  border-color: hsl(var(--hue) 70% 78% / 0.26);
  padding: 18px 20px;
  background:
    var(--noise),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(145deg, transparent 38%, rgba(4, 6, 10, 0.32) 100%),
    radial-gradient(
      circle at 15% 22%,
      hsl(var(--hue) 66% 45%) 0,
      hsl(var(--hue) 58% 29%) 44%,
      light-dark(hsl(var(--hue) 50% 19%), hsl(var(--hue) 50% 14%)) 100%
  );
  /* After the shorthand, which would otherwise reset it: keeps the gradient out from under the translucent border. */
  background-clip: padding-box;
  color: #fff;
  text-align: left;
  touch-action: manipulation;
  cursor: pointer;
  /* A shadow that hugs the card: lit top edge · selection ring · contact line under the edge ·
     a short close lift · a softer wider lift · an even glow. Every state below keeps these six
     layers in this order, so hover and selection animate smoothly instead of swapping. */
  --lift: light-dark(hsl(var(--hue) 45% 22% / 0.3), rgba(0, 0, 0, 0.45));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 0 0 hsl(var(--hue) 75% 62% / 0),
    0 1px 2px light-dark(rgba(30, 28, 60, 0.14), rgba(0, 0, 0, 0.5)),
    0 4px 10px -4px var(--lift),
    0 12px 22px -12px var(--lift),
    0 0 0 hsl(var(--hue) 80% 55% / 0);
  transition: border-color 280ms ease, box-shadow 320ms ease, filter 280ms ease, transform 420ms var(--ease-out);
}

/* concentric rings, like ripples on a dial */
.genre::before {
  content: "";
  position: absolute;
  top: -8rem;
  left: -5rem;
  width: 21rem;
  height: 21rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 3.25rem rgba(255, 255, 255, 0.05),
    0 0 0 7rem rgba(255, 255, 255, 0.026);
  pointer-events: none;
  transition: border-color 320ms ease;
}

.genre::after {
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: calc(var(--radius-md) - 2px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 34%, rgba(3, 5, 10, 0.22));
  content: "";
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .genre:hover {
    z-index: 1;
    transform: translateY(-4px);
    border-color: hsl(var(--hue) 70% 82% / 0.42);
    filter: brightness(1.05) saturate(1.05);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 0 0 0 hsl(var(--hue) 75% 62% / 0),
      0 1px 2px light-dark(rgba(30, 28, 60, 0.14), rgba(0, 0, 0, 0.5)),
      0 8px 16px -6px var(--lift),
      0 18px 30px -14px var(--lift),
      0 0 0 hsl(var(--hue) 80% 55% / 0);
  }

  /* the rings stay put on hover; only the inner ring brightens */
  .genre:hover::before { border-color: rgba(255, 255, 255, 0.34); }

  .genre:hover .genre-icon { transform: scale(1.06); }
}

.genre:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-color: rgba(255, 255, 255, 0.4);
  transform: none;
}

.genre:active {
  z-index: 1;
  transform: scale(0.985);
  filter: brightness(0.97);
}

.genre.active {
  border-color: hsl(var(--hue) 80% 82% / 0.8);
  /* selected: the ring and an even glow all the way round, centred on the card */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 0 0 3px hsl(var(--hue) 75% 62% / 0.34),
    0 1px 2px light-dark(rgba(30, 28, 60, 0.14), rgba(0, 0, 0, 0.5)),
    0 4px 10px -4px var(--lift),
    0 12px 22px -12px var(--lift),
    0 0 22px light-dark(hsl(var(--hue) 80% 55% / 0.4), hsl(var(--hue) 80% 55% / 0.32));
}

.genre.active::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 38%, rgba(3, 5, 10, 0.18));
}

.genre-top,
.genre-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.genre-index {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.genre-live {
  display: none;
  align-items: center;
  gap: 7px;
  margin-right: auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: hsl(var(--hue) 62% 22%);
  padding: 3px 10px 3px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.35);
}

.playing .genre.active .genre-index,
.loading .genre.active .genre-index { display: none; }
.playing .genre.active .genre-live,
.loading .genre.active .genre-live { display: inline-flex; }

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.eq i {
  width: 2px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform-origin: bottom;
  transform: scaleY(0.45);
}

.playing .eq i { animation: eq 900ms ease-in-out infinite alternate; }
.playing .eq i:nth-child(2) { animation-delay: -300ms; animation-duration: 700ms; }
.playing .eq i:nth-child(3) { animation-delay: -600ms; animation-duration: 1100ms; }

@keyframes eq {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}

/* small 3D glass button */
.genre-icon {
  display: grid;
  place-items: center;
  width: var(--card-action-size);
  height: var(--card-action-size);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 12px -4px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 320ms var(--ease-out), background 220ms ease, color 220ms ease, box-shadow 220ms ease;
}

.genre-icon svg {
  display: block;
  width: var(--card-action-icon);
  height: var(--card-action-icon);
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.genre-icon .glyph-play { transform: none; }
.genre-icon .glyph-stop { transform: scale(1.12); transform-origin: center; }

.genre.active .genre-icon {
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.86));
  color: hsl(var(--hue) 62% 22%);
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 5px rgba(255, 255, 255, 0.12),
    0 8px 22px -6px rgba(0, 0, 0, 0.4);
}

.genre.active .genre-icon svg { filter: none; }

.genre h3 {
  position: relative;
  z-index: 1;
  margin: 14px 0 2px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.2);
}

.genre h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.genre-track {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 1.5em;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.18);
}

/* the song first, then the artist, so a long artist name can't hide the title */
.genre-song,
.genre-artist,
.track-title,
.track-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.genre-artist { color: rgba(255, 255, 255, 0.64); font-size: 0.86em; }

/* names that don't fit glide across on hover/focus (see startMarquee), pausing at each end */
.marquee { text-overflow: clip; }
.marquee-text {
  display: inline-block;
  animation: marquee var(--marquee-time, 6s) ease-in-out infinite alternate;
}

@keyframes marquee {
  0%, 18% { transform: translateX(0); }
  82%, 100% { transform: translateX(var(--marquee-shift, 0)); }
}

.genre-meta {
  margin-top: auto;
  padding-top: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.78rem;
}

.genre-meta strong { color: rgba(255, 255, 255, 0.94); font-weight: 700; font-variant-numeric: tabular-nums; }

@media (min-width: 901px) {
  .now-card { min-height: 360px; }
  .now-copy { padding-block: 52px; }
  .genre-index { font-size: 0.82rem; }
  .genre h3 { font-size: 1.55rem; }
  .genre-track { font-size: 1rem; }
  .genre-meta { font-size: 0.86rem; }
}

.skeleton-card {
  background:
    linear-gradient(105deg, transparent 34%, var(--hover-tint) 48%, transparent 62%) 0 0 / 220% 100%,
    var(--card-bg);
  box-shadow: var(--card-shadow);
  animation: skeleton 1.4s linear infinite;
}

@keyframes skeleton { to { background-position-x: -220%, 0; } }

/* ------------------------------------------------------------------ */
/* Track history                                                       */
/* ------------------------------------------------------------------ */

/* side by side, both columns share a heading row and a content row, so the heading boxes and
   what follows them line up exactly (the sections are subgrids of .browse) */
@media (min-width: 1041px) {
  .browse { grid-template-rows: auto 1fr; row-gap: 14px; }
  .channel-section,
  .history-panel { grid-row: 1 / 3; display: grid; grid-template-rows: subgrid; }
  .section-heading,
  .panel-heading { margin-bottom: 0; }
  /* the history never grows past the channels beside it: its frame fills the row without adding to
     the row's height (size containment), and a longer list scrolls inside the box */
  .history-frame { min-height: 0; contain: size; }
  .history {
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }

  /* in the side column, the time drops under the track so names aren't cut short */
  .history-panel .history li {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas: "num track" "num time";
    row-gap: 0;
    align-content: center;
    min-height: 58px;
    padding-block: 8px;
  }
  .history-panel .history-number { grid-area: num; }
  .history-panel .history-track { grid-area: track; }
  .history-panel .history-time { grid-area: time; font-size: 0.74rem; }
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  max-width: 170px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--muted-strong);
  padding: 5px 11px 5px 9px;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--btn-shadow);
}

.panel-tag::before {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(var(--active-hue) 70% 52%);
  box-shadow: 0 0 0 3px hsl(var(--active-hue) 70% 52% / 0.2);
  content: "";
}

.panel-tag:empty { display: none; }

.history {
  margin: 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--noise), var(--card-bg);
  padding: 12px 22px;
  list-style: none;
  box-shadow: var(--card-shadow);
}

.history li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-inline: -10px;
  border-radius: 12px;
  /* hairline separator, inset so it stays straight against the rounded hover state */
  background: linear-gradient(var(--line), var(--line)) 50% 0 / calc(100% - 20px) 1px no-repeat;
  color: var(--muted);
  padding-inline: 10px;
  font-size: 0.86rem;
  transition: background-color 160ms ease;
}

.history li:first-child { background-image: none; }

@media (hover: hover) and (pointer: fine) {
  .history li:not(.empty):hover { background: var(--hover-tint); }
  .history li:not(.empty):hover + li { background-image: none; }
}

.history-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 8px;
  background: var(--well-bg);
  color: var(--faint);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--well-shadow);
}

.history-track { display: grid; min-width: 0; color: var(--muted-strong); line-height: 1.35; }
.track-artist { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.history-time { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history .empty { display: flex; color: var(--muted); }

/* the current track leads the list: a channel-tinted gradient with a lit top edge,
   whose glow drifts slowly across the row while the stream plays */
/* li.history-now: outranks the hairline reset on li:first-child, which would wipe the gradient */
.history li.history-now,
.history li.history-now:not(.empty):hover {
  margin-bottom: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(90% 180% at 0% 0%, hsl(var(--active-hue) 78% 60% / 0.42), transparent 70%),
    linear-gradient(100deg,
      hsl(var(--active-hue) 72% 52% / 0.34) 0%,
      hsl(calc(var(--active-hue) + 34) 72% 58% / 0.08) 50%,
      hsl(calc(var(--active-hue) - 20) 72% 55% / 0.26) 100%);
  background-size: 100% 100%, 100% 100%, 220% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px hsl(var(--active-hue) 70% 64% / 0.34),
    0 10px 22px -16px hsl(var(--active-hue) 70% 40% / 0.8);
}

.playing .history li.history-now { animation: now-row-drift 9s ease-in-out infinite alternate; }

@keyframes now-row-drift {
  from { background-position: 0 0, 0 0, 0% 0; }
  to { background-position: 0 0, 0 0, 100% 0; }
}

.history-now + li { background-image: none; }
.history-now .history-number { background: hsl(var(--active-hue) 70% 50%); color: #fff; box-shadow: none; }
.history-now .history-track { color: var(--text); font-weight: 700; }
.history-now .history-time { color: light-dark(hsl(var(--active-hue) 70% 30%), hsl(var(--active-hue) 70% 72%)); font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Stream quality: a recessed well with a raised, tier-tinted pill     */
/* ------------------------------------------------------------------ */

.quality {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--well-bg);
  padding: 5px;
  box-shadow: var(--well-shadow);
}

.quality button {
  --q: 255, 107, 61;
  --q-light: 255, 154, 121;
  --q-dark: 184, 56, 15;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  transition: background 260ms ease, color 260ms ease, box-shadow 260ms ease;
}

/* Each quality tier gets its own tint when selected. */
.quality button[data-quality="128"] { --q: 72, 146, 250; --q-light: 147, 190, 253; --q-dark: 29, 88, 190; }
.quality button[data-quality="64"] { --q: 38, 196, 133; --q-light: 110, 231, 183; --q-dark: 8, 118, 74; }

@media (hover: hover) and (pointer: fine) {
  .quality button:not([aria-pressed="true"]):hover { color: var(--text); background: var(--hover-tint); }
}

.quality button[aria-pressed="true"] {
  background:
    linear-gradient(180deg, light-dark(rgba(var(--q), 0.16), rgba(var(--q), 0.34)), light-dark(rgba(var(--q), 0.1), rgba(var(--q), 0.18))),
    light-dark(#fff, transparent);
  color: light-dark(rgb(var(--q-dark)), rgb(var(--q-light)));
  box-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.16)),
    inset 0 0 0 1px light-dark(rgba(var(--q-light), 0.55), rgba(var(--q-light), 0.38)),
    0 3px 10px -4px rgba(var(--q), 0.7);
}

.hero-quality {
  flex: 0 0 auto;
  min-width: 300px;
  gap: 3px;
  border-radius: 999px;
  padding: 3px;
}

.hero-quality button {
  min-height: 40px;
  border-radius: 999px;
  padding-inline: 12px;
  white-space: nowrap;
  font-size: 0.78rem;
}

/* ------------------------------------------------------------------ */
/* Player dock                                                         */
/* ------------------------------------------------------------------ */

.connection-icon {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0;
  border-radius: 50%;
  background: var(--state-up);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state-up) 20%, transparent);
}

.demo-mode .connection-icon {
  background: var(--state-blocked);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state-blocked) 20%, transparent);
}

.player {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  border-top: 1px solid var(--glass-border);
  background:
    var(--noise),
    linear-gradient(180deg, light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.025)), transparent 70%),
    light-dark(rgba(246, 247, 251, 0.72), rgba(14, 14, 17, 0.74));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow:
    inset 0 1px 0 light-dark(#fff, rgba(255, 255, 255, 0.05)),
    0 -18px 50px -30px light-dark(rgba(30, 28, 60, 0.35), rgba(0, 0, 0, 0.8));
  padding-bottom: env(safe-area-inset-bottom);
}

/* a thin line of the channel colour across the top of the dock while on air */
.player::before {
  position: absolute;
  top: -1px;
  left: 50%;
  width: min(760px, 70%);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, hsl(var(--active-hue) 85% 62%), transparent);
  content: "";
  opacity: 0;
  transition: opacity 500ms ease;
  pointer-events: none;
}

.playing .player::before { opacity: 0.9; }

.player-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 86px;
}

/* channel "artwork": the channel colour with its initial */
.np-art {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid hsl(var(--active-hue) 70% 80% / 0.35);
  border-radius: 13px;
  background:
    var(--noise),
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.3), transparent 55%),
    linear-gradient(150deg, hsl(var(--active-hue) 70% 52%), hsl(calc(var(--active-hue) + 18) 66% 28%));
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 16px -6px hsl(var(--active-hue) 70% 25% / 0.7);
}

.np-art:empty { display: none; }

/* the transport button is a brand-coloured bead */
.play {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--transport-size);
  height: var(--transport-size);
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(60% 40% at 50% 12%, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(circle at 36% 30%, color-mix(in srgb, var(--accent) 65%, #fff) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 72%, #000) 100%);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 -4px 8px color-mix(in srgb, var(--accent) 60%, #000 40%),
    0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent),
    0 8px 26px -4px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform 160ms ease, filter 160ms ease;
}

.playing .play::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  animation: halo 2.4s ease-out infinite;
}

@keyframes halo {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@media (hover: hover) and (pointer: fine) {
  .play:hover { filter: brightness(1.08); transform: translateY(-1px); }
}

.play:active { transform: scale(0.96); }

.play svg {
  grid-area: 1 / 1;
  width: var(--transport-icon);
  height: var(--transport-icon);
  fill: currentColor;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.3));
}

.play .icon-play { transform: none; }
.play .icon-stop,
.play .icon-load { display: none; }
.playing .play .icon-play,
.loading .play .icon-play { display: none; }
.playing .play .icon-stop { display: block; }
.loading .play .icon-load { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 32 60; animation: spin 800ms linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.np {
  display: grid;
  min-width: 0;
  flex: 1;
}

.np-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.np-label::before { width: 6px; height: 6px; }

.np-title, .np-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-title { margin-top: 1px; font-size: 0.95rem; }
.np-artist { color: var(--muted); font-size: 0.8rem; }

.mini-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 88px;
  height: 28px;
}

.mini-wave i {
  width: 3px;
  height: var(--bar, 16px);
  border-radius: 10px;
  background: var(--faint);
  opacity: 0.7;
  transform-origin: center;
  transition: background 300ms ease, opacity 300ms ease;
}

.mini-wave i:nth-child(2), .mini-wave i:nth-child(7) { --bar: 24px; }
.mini-wave i:nth-child(3), .mini-wave i:nth-child(6) { --bar: 12px; }
.mini-wave i:nth-child(4) { --bar: 20px; }

.playing .mini-wave i {
  background: linear-gradient(180deg, light-dark(hsl(var(--active-hue) 85% 55%), hsl(var(--active-hue) 85% 70%)), light-dark(hsl(var(--active-hue) 70% 40%), hsl(var(--active-hue) 70% 50%)));
  opacity: 1;
}

.controls { display: flex; align-items: center; }

.volume {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--muted-strong);
  padding: 6px 14px 6px 12px;
  box-shadow: var(--btn-shadow);
  transition: color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.volume:focus-within {
  box-shadow:
    var(--btn-shadow),
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.mute {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px -6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.mute:hover { background: var(--hover-tint); color: var(--text); }

.volume .vol-x { display: none; }
.volume[data-level="low"] .vol-wave-2 { display: none; }
.volume[data-level="muted"] .vol-wave-1,
.volume[data-level="muted"] .vol-wave-2 { display: none; }
.volume[data-level="muted"] .vol-x { display: inline; }
.volume[data-level="muted"] { color: var(--muted); }

.volume svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.volume-readout {
  min-width: 3.2ch;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.volume input {
  --volume-progress: 90%;
  --volume-fill: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
  --volume-rail: light-dark(rgba(30, 28, 60, 0.14), rgba(255, 255, 255, 0.16));
  width: 128px;
  height: 28px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.volume input::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  /* the fill is sized to the level so the translucent rail never shows it through */
  background:
    var(--volume-fill) 0 0 / var(--volume-progress) 100% no-repeat,
    var(--volume-rail);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

.volume input::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -6px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #f0f0f3);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.22),
    0 3px 9px rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.volume input::-moz-range-track {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--volume-rail);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

.volume input::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--volume-fill);
}

.volume input::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #f0f0f3);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.22),
    0 3px 9px rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .volume:hover { color: var(--text); filter: brightness(1.04); }

  .volume input:hover::-webkit-slider-thumb { transform: scale(1.08); }
  .volume input:hover::-moz-range-thumb { transform: scale(1.08); }
}

.volume input:active::-webkit-slider-thumb {
  transform: scale(0.94);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.36);
}

.volume input:active::-moz-range-thumb {
  transform: scale(0.94);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.36);
}

.volume input:focus-visible { outline: none; }

@media (forced-colors: active) {
  .volume input {
    appearance: auto;
    -webkit-appearance: auto;
  }
}

.toast {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 110px;
  transform: translateY(12px) scale(0.98);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-bg);
  color: var(--text);
  padding: 11px 15px;
  box-shadow: var(--glass-shadow);
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  transition: opacity 180ms ease, transform 260ms var(--ease-out);
}

.toast.show { transform: none; opacity: 1; }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1040px) {
  .browse { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .genres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* positioned and lifted so the selected channel's glow passes under the panel, not over it */
  .history-panel { position: relative; z-index: 1; }
}

@media (max-width: 900px) {
  .now-card { grid-template-columns: minmax(0, 1fr) 300px; }
  .now-copy { padding: 42px; }
  .genres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  body { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .connection-chip { padding-inline: 10px; }
  .topbar, main, .player-inner { width: min(100% - 28px, 1180px); }
  .topbar { min-height: 78px; }
  .brand small, .brand-divider { display: none; }
  .now-card { grid-template-columns: 1fr; min-height: auto; border-radius: 28px; }
  .now-copy { min-height: 316px; padding: 28px 22px 30px; }
  .now-copy h1 { font-size: clamp(2.3rem, 12vw, 3.7rem); line-height: 0.98; }
  .now-copy h1[data-length="medium"] { font-size: clamp(2rem, 9vw, 3rem); }
  .now-copy h1[data-length="long"] { font-size: clamp(1.7rem, 7.4vw, 2.4rem); }
  .hero-artist { margin-top: 16px; }
  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
  }
  .hero-actions > .primary-play,
  .hero-actions > .text-button { width: 100%; padding-inline: 12px; font-size: 0.86rem; }
  .hero-quality { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .signal-visual { min-height: 252px; margin: 0 8px 8px; border-radius: 20px; }
  .visualizer-footer { right: 12px; bottom: 12px; left: 12px; gap: 10px; }
  .visualizer-option { min-width: 56px; min-height: 38px; padding-inline: 10px; }
  .signal-core { width: 90px; }
  .browse { padding-top: 20px; gap: 30px; }
  .section-heading, .panel-heading { padding: 14px 18px 16px; }
  .section-note { display: none; }
  /* channels become a swipeable row instead of a long stack */
  .genres {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    gap: 12px;
    /* a scroller clips vertically too, so leave room for the lift, the selected ring and the
       soft shadow underneath, and take it back with negative margins so spacing is unchanged */
    margin: -24px -14px -30px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 24px 14px 44px;
    scroll-padding-inline: 14px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .genres::-webkit-scrollbar { display: none; }
  /* each swipe settles on exactly one card, centred, with its neighbours peeking in on both sides */
  .genre { min-height: 176px; padding: 18px; scroll-snap-align: center; scroll-snap-stop: always; }
  .genre::before {
    top: 50%;
    left: -40%;
    width: calc(100% + 3rem);
    height: auto;
    aspect-ratio: 1;
    transform: translateY(-50%);
    border-color: rgba(255, 255, 255, 0.27);
    box-shadow:
      0 0 0 2.75rem rgba(255, 255, 255, 0.065),
      0 0 0 5.5rem rgba(255, 255, 255, 0.036);
  }
  .genre h3 { margin-top: 18px; font-size: 1.3rem; }
  .history { padding: 8px 16px; }
  .history li { grid-template-columns: 28px minmax(0, 1fr); }
  .history-time { display: none; }
  .player {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    overflow: visible;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding-bottom: 0;
  }
  .player::before { width: 60%; }
  .player-inner { width: 100%; min-height: 72px; gap: 12px; padding: 10px 12px; }
  .mini-wave, .controls, .np-art { display: none; }
  .toast { right: 14px; bottom: calc(104px + env(safe-area-inset-bottom)); left: 14px; text-align: center; }
}

@media (max-width: 440px) {
  .eyebrow-row { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (max-width: 350px) {
  .hero-actions { grid-template-columns: 1fr; }
  .hero-quality { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .signal-core span,
  .playing .play::after,
  .playing .eq i,
  .swap,
  .playing .signal-state::before,
  .playing .np-label::before,
  .marquee-text {
    animation: none !important;
    transform: none !important;
  }

  .genre:hover, .genre:active { transform: none; }
}
