/* Player layout. Tokens and primitives (.glass, .chip, .pill-btn, .toggle…) come from base.css. */

:root { --cover-max: 520px; }

body {
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
/* Shown when WebGL is unavailable: a soft gradient from the current palette. */
.backdrop-fallback {
  position: fixed;
  inset: -10%;
  z-index: 0;
  display: none;
  background:
    radial-gradient(60% 50% at 30% 30%, var(--accent) 0%, transparent 70%),
    radial-gradient(50% 50% at 70% 70%, var(--accent-2) 0%, transparent 70%),
    var(--bg);
  filter: blur(60px) saturate(120%);
  opacity: 0.55;
  transition: background 2s var(--ease);
}
body.no-webgl .backdrop-fallback, body.viz-off .backdrop-fallback { display: block; }
body.no-webgl #scene, body.viz-off #scene { display: none; }
body.viz-off .cover-wrap { transform: none; }

/* ---------- layout ---------- */
.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + var(--gutter)) calc(var(--safe-b) + 16px) calc(var(--safe-l) + var(--gutter));
}

/* Three columns with equal sides, so the waves switcher sits in the true centre of the page. */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 48px;
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; grid-column: 1; }
.topbar .waves-bar { grid-column: 2; }
.topbar .top-actions { grid-column: 3; justify-self: end; }
.brand-mark { width: 30px; height: 30px; } /* the logo itself: base.css */
.app[data-state='playing'] .bm-glint { animation-duration: 2.2s; } /* livelier while on air */
.brand-name {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-short { display: none; }
/* Phones: the short name (first word by default, or STATION_SHORT_NAME) instead of the full one. */
@media (max-width: 520px) {
  .bn-full { display: none; }
  .bn-short { display: inline; }
}
.top-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- waves ---------- */
.waves-bar {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: min(100%, 720px);
  min-width: 0;
}
.waves-bar::-webkit-scrollbar { display: none; }
.wave-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  max-width: min(240px, 70vw);
  transition: background 0.35s var(--ease), color 0.35s;
}
.wave-pill .wp-art { flex: none; }
.wp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wave-pill.wave-back { padding: 0 14px; }
@media (hover: hover) {
  .wave-pill:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
  .play-btn:hover { transform: scale(1.04); }
}
.wave-pill[aria-current='true'] { color: var(--fg); background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.wave-pill .wp-art {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--c);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent), 0 0 14px color-mix(in srgb, var(--c) 60%, transparent);
}
.wave-pill:not([aria-current='true']) .wp-art { filter: saturate(0.6) brightness(0.8); }
.topbar:has(.waves-bar:not([hidden])) .brand-name { display: none; }
/* Phones: brand + actions on one row (the name shortens, never wraps), waves on the second. */
@media (max-width: 760px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'brand actions' 'waves waves';
    row-gap: 10px;
  }
  .brand { grid-area: brand; }
  .topbar .top-actions { grid-area: actions; }
  .topbar .waves-bar { grid-area: waves; max-width: 100%; }
  .topbar:has(.waves-bar:not([hidden])) .brand-name { display: inline; }
}
@media (max-width: 760px) and (pointer: coarse) {
  #btn-fullscreen { display: none; }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d6d;
  box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.6);
  animation: live 2s infinite;
}
.app:not([data-state='playing']) .live-dot { animation: none; background: var(--fg-3); box-shadow: none; }
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(255, 77, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
}
.listeners { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-2); letter-spacing: 0.02em; padding-left: 8px; border-left: 1px solid var(--glass-line); }
.listeners svg { width: 13px; height: 13px; fill: currentColor; }
.listeners b { font-weight: 600; }

/* ---------- stage ---------- */
.stage {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  gap: clamp(14px, 3svh, 32px);
  padding-top: 8px;
}
/* The artwork is sized from the space actually left by the top bar and the card,
   so it never slides under the card on any screen (phones, tablets, car displays). */
.cover-zone { container-type: size; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; min-height: 0; width: 100%; height: 100%; }
/* A one-finger move here is the page's own (the waves swipe, main.js): the browser does not pan or
   bounce and so never cancels it halfway. Zooming with two fingers stays. */
.cover-zone { touch-action: pinch-zoom; }
.cover-zone > * { --cover: min(100cqw - 8px, 100cqh - 8px, var(--cover-max)); }

.cover-wrap {
  position: relative;
  width: var(--cover);
  aspect-ratio: 1;
  border-radius: clamp(18px, calc(var(--cover) * 0.06), 30px);
  transform: scale(var(--pulse, 1)) translate3d(0, 0, 0);
  will-change: transform;
}
.cover-shadow {
  position: absolute;
  inset: 8% 6% -6%;
  border-radius: inherit;
  background: var(--glow);
  filter: blur(40px);
  opacity: calc(0.6 + var(--energy, 0) * 0.3);
  transition: background 2s var(--ease);
  /* Its own layer: the blur is drawn once, the per-frame opacity change is just compositing. */
  will-change: opacity;
}
.cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  opacity: 0;
  transform: scale(1.04);
  /* --cover-dim: a pale cover is dimmed a little (main.js, applyPalette). The same functions in both
     states, so the filter eases between them. */
  filter: blur(14px) saturate(120%) brightness(var(--cover-dim, 1));
  transition: opacity 1.4s var(--ease), transform 1.6s var(--ease), filter 1.4s var(--ease);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  background: rgba(255, 255, 255, 0.04);
}
.cover.shown { opacity: 1; transform: scale(1); filter: blur(0) saturate(100%) brightness(var(--cover-dim, 1)); }
.cover-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  mix-blend-mode: screen;
}

/* The artwork is the play / pause control: no overlay, just the pointer and a soft press. */
.cover-wrap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cover-wrap:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 6px; }
.cover-wrap:active .cover-sheen { background-color: rgba(0, 0, 0, 0.1); }

/* ---------- now playing card ---------- */
.now {
  position: relative;
  container: now / inline-size;
  width: min(100%, 560px);
  padding: clamp(18px, 2.6vw, 28px);
  display: grid;
  /* minmax(0, …): a long name is cut inside the card; an auto column grew with it past the card. */
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  transition: background 0.8s var(--ease), border-color 0.8s var(--ease), box-shadow 0.8s var(--ease), backdrop-filter 0.8s;
}
.now-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 4px;
}
.eyebrow-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -8px -8px 0 0; }
.eyebrow-row .eyebrow { margin-bottom: 0; }
.reactions { display: flex; gap: 2px; flex: none; transition: opacity 0.4s var(--ease), visibility 0.4s; }
.reactions.off { opacity: 0; visibility: hidden; pointer-events: none; }
/* Rating buttons: outline = not set, filled = set (tap again to take it back). */
.react { color: var(--fg-2); transition: color 0.3s, transform 0.25s var(--ease), background 0.3s; }
.react svg { transition: fill 0.25s; }
.react[aria-pressed='true'] svg { fill: currentColor; }
.react[aria-pressed='true'] { color: #fff; }
.react.like[aria-pressed='true'] { color: #ff6b8b; }
@media (hover: hover) {
  .react:hover { color: var(--fg); }
}
.react.pop { animation: pop 0.45s var(--ease); }
@keyframes pop { 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@media (hover: none), (pointer: coarse) {
  .app.immersive .reactions { opacity: 0; pointer-events: none; }
}
/* "Sound is on" equaliser: dim bars while paused, dancing while playing (still bars without motion). */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.eq i { width: 2px; height: 100%; border-radius: 1px; background: var(--accent); transform-origin: bottom; transform: scaleY(var(--h)); opacity: 0.45; transition: opacity 0.4s; }
.eq i:nth-child(1) { --h: 0.55; }
.eq i:nth-child(2) { --h: 1; animation-delay: -0.3s !important; }
.eq i:nth-child(3) { --h: 0.75; animation-delay: -0.6s !important; }
.app[data-state='playing'] .eq i { opacity: 1; animation: eq 0.9s ease-in-out infinite alternate; }
@keyframes eq { from { transform: scaleY(0.2); } to { transform: scaleY(1); } }

.title-row { --tl: clamp(22px, 3.2vw + 8px, 36px); display: flex; align-items: flex-start; gap: 4px; min-width: 0; }
/* ⓘ: details of the track; centred on the title's first line. */
.info-btn { flex: none; width: 32px; height: 32px; margin-top: calc(var(--tl) * 0.58 - 16px); color: var(--fg-3); transition: color 0.3s, opacity 0.6s var(--ease); }
.info-btn svg { width: 20px; height: 20px; }
@media (hover: hover) {
  .info-btn:hover { color: var(--fg); }
}
@media (hover: none), (pointer: coarse) {
  .app.immersive .info-btn { opacity: 0; pointer-events: none; }
}
.title {
  margin: 0;
  min-width: 0;
  font-size: var(--tl);
  line-height: 1.16;
  /* The two-line clamp hides overflow. Room around the text (taken back by the margins) keeps
     descenders (g, y, р) whole and lets the glow of new letters fade out instead of ending in a box. */
  padding: 0.3em 0.4em 0.1em;
  margin: -0.3em -0.4em -0.1em;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.artist {
  margin: 0;
  font-size: clamp(15px, 1vw + 10px, 19px);
  color: var(--fg-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-note { margin: 2px 0 0; font-size: 12px; font-weight: 600; color: var(--fg-3); }
.title, .artist, .agent-note, .chips { transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), filter 0.6s var(--ease); }
/* Track change: the old lines drift up and blur away… */
.now.swapping .title, .now.swapping .artist, .now.swapping .agent-note, .now.swapping .chips { opacity: 0; transform: translateY(-8px); filter: blur(6px); transition-duration: 0.36s; }
/* …the new title condenses letter by letter with a glint running through, then the rest follows. */
.now.revealing .title, .now.revealing .artist, .now.revealing .agent-note, .now.revealing .chips { transition: none; }
.now.revealing .title:not(.long) { overflow: visible; }
.title .w { display: inline-block; max-width: 100%; } /* stays whole while it fits: a longer word breaks */
.title .l { display: inline-block; animation: letter-in 0.8s var(--ease) both; transition: none; } /* the margin main.js sets stands at once */
@keyframes letter-in {
  0% { opacity: 0; transform: translateY(0.4em); filter: blur(10px); }
  45% { text-shadow: 0 0 22px var(--glow); }
  100% { opacity: 1; transform: none; filter: none; }
}
.now.revealing .artist, .now.revealing .agent-note { animation: rise 0.7s var(--ease) 0.25s both; }
.now.revealing .chip { animation: rise 0.55s var(--ease) both; animation-delay: calc(0.35s + var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); filter: blur(6px); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; min-width: 0; }
/* A block: the three dots of a long album name do not work on a flex box. */
.chips .chip { display: block; line-height: 24px; min-width: 0; }
.chips:empty { display: none; }

.progress { display: grid; gap: 6px; }
.wave {
  position: relative;
  height: 28px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
/* Drawn by wave.js in device pixels. */
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; font-weight: 600; }

.controls { display: flex; align-items: center; gap: 14px; min-width: 0; }
.transport { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.play-btn {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #0b0c10;
  background: #fff;
  box-shadow: 0 10px 30px -8px var(--glow), 0 0 0 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.25s var(--ease), box-shadow 0.4s;
}
.play-btn:active { transform: scale(0.95); }
.play-btn svg { position: absolute; width: 26px; height: 26px; fill: currentColor; transition: opacity 0.25s, transform 0.35s var(--ease); }
.play-btn .i-stop, .play-btn .i-spin { opacity: 0; transform: scale(0.6); }
/* Softly rounded corners on the play triangle. */
.play-btn .i-play { fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.play-btn .i-spin { width: 60px; height: 60px; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 40 200; }
.app[data-state='playing'] .play-btn .i-play { opacity: 0; transform: scale(0.6); }
.app[data-state='playing'] .play-btn .i-stop { opacity: 1; transform: none; }
.app[data-state='connecting'] .play-btn .i-play { opacity: 0.35; }
.app[data-state='connecting'] .play-btn .i-spin { opacity: 1; transform: none; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.volume { display: flex; align-items: center; gap: 4px; flex: none; }
.volume svg { stroke-width: 1.7; }
.volume .x { display: none; }
.volume.muted .w1, .volume.muted .w2 { display: none; }
.volume.muted .x { display: block; }
.volume.low .w2 { display: none; }
body.ios .volume input { display: none; }
/* On a narrow card "Далее" keeps its room: the slider gives way (device volume keys still work). */
@container now (max-width: 400px) { .volume { display: none; } }

.next-up {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px 6px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12px;
}
.next-up img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; background: rgba(255, 255, 255, 0.06); }
.next-up > div { display: grid; min-width: 0; }
.next-up .label { color: var(--fg-3); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 10px; }
.next-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--fg-2); max-width: 220px; }

/* ---------- no network / station unreachable ---------- */
.unavailable-msg { display: none; justify-items: start; gap: 6px; }
.app.unavailable .unavailable-msg { display: grid; animation: rise 0.6s var(--ease) both; }
.app.unavailable .now > :not(.unavailable-msg) { display: none; }
.app.unavailable .cover-wrap { opacity: 0.45; filter: saturate(0.5); transition: opacity 0.8s var(--ease), filter 0.8s var(--ease); }
.um-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--glass-line); color: var(--fg-2); }
.um-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.um-icon circle { fill: currentColor; stroke: none; }
/* Reconnecting: the waves keep trying; offline: crossed out. */
.unavailable-msg[data-reason='down'] .um-slash { display: none; }
.unavailable-msg[data-reason='down'] .um-icon svg path { animation: um-try 1.8s ease-in-out infinite; }
@keyframes um-try { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.um-title { margin: 0; font-size: clamp(20px, 2vw + 10px, 26px); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.um-text { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--fg-2); }

/* Status ("connecting…", "weak network…") sits in the card's bottom padding, out of the flow:
   it comes and goes without changing the card's height. */
.status-line {
  position: absolute;
  left: clamp(18px, 2.6vw, 28px);
  right: 96px;
  bottom: 3px;
  margin: 0;
  font-size: 11px;
  line-height: 14px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.lyrics-btn[aria-pressed='true'] { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ---------- synced lyrics ---------- */
.cover-zone > * { grid-area: 1 / 1; }
.cover-wrap { transition: opacity 0.7s var(--ease), scale 0.7s var(--ease); }
.lyrics-view {
  /* The mask cuts everything outside the box, so the box reaches past the text on both sides
     (taken back by the margins): the glow of the sung line fades out instead of ending in an edge. */
  --lx: 44px;
  --lw: min(92vw, max(var(--cover), 520px));
  width: calc(var(--lw) + 2 * var(--lx));
  padding-inline: var(--lx);
  margin-inline: calc(-1 * var(--lx));
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease), visibility 0.7s;
  -webkit-mask: linear-gradient(180deg, transparent 0%, #000 22%, #000 70%, transparent 100%);
  mask: linear-gradient(180deg, transparent 0%, #000 22%, #000 70%, transparent 100%);
}
.app.lyrics-mode:not([data-state='idle']) .lyrics-view { opacity: 1; visibility: visible; }
.app.lyrics-mode:not([data-state='idle']) .cover-wrap { opacity: 0; scale: 0.88; pointer-events: none; }
.lyrics-lines { display: grid; gap: 0.55em; will-change: transform; transition: transform 0.9s var(--ease); }
.lyric {
  font-size: clamp(22px, 2.2vw + 12px, 42px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.26);
  filter: blur(1.4px);
  transform-origin: 0 50%;
  transition: color 0.6s var(--ease), filter 0.6s var(--ease), transform 0.6s var(--ease), text-shadow 0.6s;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.lyric.past { color: rgba(255, 255, 255, 0.38); filter: blur(0.6px); }
.lyric.next { color: rgba(255, 255, 255, 0.62); filter: blur(0.3px); } /* what is about to be sung, half way to the sung line */
/* --lyric-pulse, --lyric-flash: the sung line on an accent (main.js). `scale`, apart from `transform`,
   escapes the slow transition: a jolt that eases in over 0.6 s is no jolt. */
.lyric.active { color: #fff; filter: brightness(var(--lyric-flash, 1)); transform: scale(1.03); scale: var(--lyric-pulse, 1); text-shadow: 0 0 34px var(--glow); }
/* A break in the singing: the notes sway only while it lasts. */
.lyric.pause { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.16em; line-height: 1; }
.lyric.pause.active { text-shadow: none; filter: brightness(var(--lyric-flash, 1)) drop-shadow(0 0 12px var(--glow)); }
.nt { position: relative; flex: none; width: 0.82em; height: 0.82em; }
.nt svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nt path { fill: none; }
/* The coloured note on top of the plain one, uncovered like a sung word. */
.nt svg:last-child { color: var(--accent); clip-path: inset(0 100% 0 0); }
.lyric.pause.active .nt.done svg:last-child { clip-path: none; }
.lyric.pause.active .nt.sweep svg:last-child { clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0); }
/* Starts and ends in the note's own place; its length comes from the note's time (lyrics.js). The
   curves make one sine out of the three parts: it slows at the turns and never stands still. */
.lyric.pause.active .nt.sweep { animation: note-sway 1.6s linear infinite; }
@keyframes note-sway {
  0% { transform: none; animation-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1); }
  25% { transform: translateY(-0.08em) rotate(5deg); animation-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95); }
  75% { transform: translateY(0.05em) rotate(-5deg); animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .lyric.pause.active .nt.sweep { animation: none; } }
/* Karaoke: words light up as they are sung, a colour edge running through the one on the voice. */
/* No glow on karaoke words: painted over the word with the colour edge, it dimmed it, and each word
   brightened and dimmed again as the edge moved on. */
.lyric.active .kw { text-shadow: none; }
.lyric.active .kw.done { color: var(--accent); }
.lyric.active .kw.sweep { background: linear-gradient(90deg, var(--accent) var(--p, 0%), #fff var(--p, 0%)); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Equalizer: the fill runs from the middle, a band's zero. */
.eq-bands { display: grid; gap: 2px; transition: opacity 0.25s; }
.eq-bands.off { opacity: 0.45; } /* still there: the sheet does not jump, and a slider turns it on */
.eq-band { display: grid; grid-template-columns: 52px minmax(0, 1fr) 26px; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--fg-2); }
.eq-band output { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-3); }
.eq-band input { width: 100%; }
.eq-band input::-webkit-slider-runnable-track { background: linear-gradient(90deg, rgba(255, 255, 255, 0.18) var(--from), #fff var(--from), #fff var(--to), rgba(255, 255, 255, 0.18) var(--to)); }
.eq-band input::-moz-range-track { background: linear-gradient(90deg, rgba(255, 255, 255, 0.18) var(--from), #fff var(--from), #fff var(--to), rgba(255, 255, 255, 0.18) var(--to)); }
.eq-band input::-moz-range-progress { background: none; }
.karaoke-voice { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.karaoke-voice[hidden] { display: none; }
.karaoke-voice input { flex: 1; min-width: 0; accent-color: var(--accent); }
.karaoke-voice b { min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; }
.karaoke-list { display: grid; gap: 10px; }
.karaoke-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 10px; text-align: left; color: inherit; font: inherit; cursor: pointer; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.karaoke-card[aria-current='true'] { border-color: var(--c, var(--accent)); }
.karaoke-card img, .karaoke-card .wp-art { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--c, rgba(255, 255, 255, 0.1)); }
.karaoke-name { display: grid; min-width: 0; }
.karaoke-name b, .karaoke-name small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.karaoke-name small { color: var(--fg-3); }
#karaoke-limited { margin: 12px 0 0; }
#karaoke-leave { margin-top: 14px; }
.karaoke-go { font-size: 13px; font-weight: 700; color: var(--fg-2); }
.lyrics-view.plain .lyric { filter: none; color: rgba(255, 255, 255, 0.8); font-size: clamp(18px, 1.2vw + 12px, 26px); font-weight: 700; }
.lyrics-note { display: none; align-self: end; justify-self: center; margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--fg-3); pointer-events: none; }
.app.lyrics-mode:not([data-state='idle']) .lyrics-view.plain + .lyrics-note { display: block; }
.lyrics-view.plain .lyrics-lines { transition: transform 2.5s linear; }
.app.lyrics-mode.immersive .lyrics-view { -webkit-mask: linear-gradient(180deg, transparent 0%, #000 18%, #000 80%, transparent 100%); mask: linear-gradient(180deg, transparent 0%, #000 18%, #000 80%, transparent 100%); }

/* ---------- immersive (UI fades away while you just listen) ---------- */
.app.immersive { cursor: none; }
.app.immersive .topbar { opacity: 0; transform: translateY(-10px); pointer-events: none; }
/* Desktop: while you just listen, the buttons fade out with the top bar; the track itself stays. */
@media (hover: hover) and (pointer: fine) {
  .transport { transition: opacity 0.8s var(--ease); }
  .app.immersive .transport, .app.immersive .reactions, .app.immersive .info-btn { opacity: 0; pointer-events: none; }
}
/* Touch screens: the card melts into the artwork too. With a mouse (desktop) the track card stays
   as it is — only the top bar (waves, buttons) fades away. */
@media (hover: none), (pointer: coarse) {
  .app.immersive .now { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .app.immersive .controls, .app.immersive .progress, .app.immersive .chips, .app.immersive .status-line { opacity: 0; pointer-events: none; }
  .app.immersive .eyebrow { opacity: 0.6; }
  /* Without the glass the title sits right on the artwork: a soft shadow keeps it readable. Cast by
     the whole head, not text-shadow on the lines: they clip their overflow, and a clipped
     text-shadow shows as a hard box. */
  .now-head { transition: filter 0.8s var(--ease); }
  .app.immersive .now-head { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5)); }
}
/* While the interface fades back in after a tap, nothing in it reacts yet. */
.app.waking .topbar, .app.waking .controls, .app.waking .reactions, .app.waking .progress, .app.waking .chips { pointer-events: none; }
.controls, .progress, .eyebrow { transition: opacity 0.8s var(--ease); }

/* ---------- landscape / desktop / car screens ---------- */
@media (min-aspect-ratio: 5/4) and (min-width: 700px) {
  :root { --cover-max: 680px; }
  .stage {
    grid-template-rows: minmax(0, 1fr);
    /* The artwork keeps most of its share on narrower screens instead of giving it all to the card. */
    grid-template-columns: minmax(min(40vw, 640px), min(44vw, 700px)) minmax(320px, 500px);
    justify-content: center;
    column-gap: clamp(32px, 6vw, 96px);
    padding-bottom: 4svh;
  }
  .now { align-self: center; }
  .lyrics-view { --lw: min(100cqw, max(var(--cover), 380px)); }
}
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
  /* Phones in landscape and short car displays */
  .stage { grid-template-columns: minmax(0, min(42vw, 520px)) minmax(280px, 1fr); column-gap: 28px; padding-top: 0; }
  .topbar { min-height: 40px; }
  .now { padding: 16px 18px; gap: 10px; }
  .title { font-size: clamp(20px, 3.4vh + 8px, 28px); }
  .progress .wave { height: 20px; }
  .play-btn { width: 52px; height: 52px; }
}
@media (max-width: 420px) {
  .next-title { max-width: 150px; }
  .live-badge { padding: 0 11px; }
}
@media (max-height: 640px) and (max-aspect-ratio: 5/4) {
  .now { padding: 16px; gap: 10px; }
  .progress .wave { height: 20px; }
}
@media (min-width: 1600px) and (min-height: 900px) {
  :root { --cover-max: 760px; }
  .now { max-width: 560px; }
}

/* ---------- sheet ---------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.4s; }
.sheet-scrim.open { opacity: 1; }
.sheet {
  position: fixed;
  z-index: 5;
  right: calc(var(--safe-r) + 12px);
  top: calc(var(--safe-t) + 12px);
  bottom: calc(var(--safe-b) + 12px);
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(22, 24, 34, 0.72), rgba(12, 13, 20, 0.66));
  transform: translateX(calc(100% + 40px));
  transition: transform 0.55s var(--ease);
  user-select: text;
  -webkit-user-select: text;
}
.sheet.open { transform: none; }
.sheet-grip { display: none; }
.sheet .tabs { margin: 16px 18px 0; flex: none; }
.sheet[data-mode='track'] #sheet-tabs { display: none; }
/* Wave tab */
.wave-title { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.wave-title .dot { width: 10px; height: 10px; }
.code-rows { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; margin: 4px 0 14px; font-size: 14px; }
.code-rows dt { color: var(--fg-3); font-weight: 600; }
.code-rows dd { margin: 0; display: grid; gap: 6px; font-weight: 600; }
.meter { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); position: relative; overflow: hidden; }
.meter::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--v); border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
/* Desktop: track details are short, the panel hangs from the top and fits its content. */
@media (min-width: 641px) {
  .sheet[data-mode='track'] { bottom: auto; max-height: calc(100svh - var(--safe-t) - var(--safe-b) - 24px); }
}
#track-head .media-row { padding: 0 0 4px; }
#track-head .media-row img { width: 56px; height: 56px; border-radius: 12px; }
#track-head .media-row { grid-template-columns: 56px minmax(0, 1fr); }
#sheet-tabs .tab { flex: 1 1 0; }
.tab-panel { display: grid; gap: 26px; }
.plain-lyrics { margin: 0; font: inherit; font-size: 14px; line-height: 1.75; color: var(--fg-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.search-box { position: relative; margin-bottom: 8px; }
.list .media-row .mr-action { display: flex; align-items: center; gap: 6px; }
.vote-btn { min-width: 54px; }
.vote-btn.down { min-width: 32px; padding: 0 9px; color: var(--fg-3); }
.vote-btn[aria-pressed='true'] { background: linear-gradient(120deg, var(--accent), var(--accent-2)) border-box; color: #111; border-color: transparent; }
.vote-btn.down[aria-pressed='true'] { background: rgba(255, 107, 129, 0.18); color: var(--danger); border-color: rgba(255, 107, 129, 0.35); }
.vote-btn svg { width: 12px; height: 12px; fill: currentColor; }
/* "Not found?" is a button that opens the form: its + folds into − while the form is open. */
.manual-request summary { list-style: none; }
.manual-request summary::-webkit-details-marker { display: none; }
.manual-request[open] summary { background: rgba(255, 255, 255, 0.14); }
.plus { position: relative; flex: none; width: 10px; height: 10px; }
.plus::before, .plus::after { content: ''; position: absolute; left: 0; top: 4px; width: 10px; height: 2px; border-radius: 1px; background: var(--accent); transition: transform 0.3s var(--ease); }
.plus::after { transform: rotate(90deg); }
.manual-request[open] .plus::after { transform: rotate(0deg); }
.manual-form { display: grid; gap: 8px; padding-top: 10px; }
.manual-request[open] .manual-form { animation: rise 0.35s var(--ease); }
/* The toggle stays a small control in the flow; "Suggest" is the form's action and spans it like the fields. */
.manual-form .pill-btn { height: 42px; margin-top: 4px; }
.list-empty { font-size: 13px; color: var(--fg-3); padding: 6px; }
.sheet-scroll { overflow-y: auto; padding: 20px 22px 28px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; flex: 1; }
.details { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 16px; font-size: 14px; }
.details dt { color: var(--fg-3); font-weight: 600; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.details a { color: var(--accent); text-decoration: none; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.list li.current { background: rgba(255, 255, 255, 0.07); }
.list time { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ios-hint { margin-top: 14px; }

@media (max-width: 640px) {
  .sheet {
    left: calc(var(--safe-l) + 8px);
    right: calc(var(--safe-r) + 8px);
    top: auto;
    bottom: calc(var(--safe-b) + 8px);
    width: auto;
    /* A fixed height: switching tabs never resizes the sheet (the tabs would jump up and down). */
    height: min(82svh, 720px);
    transform: translateY(calc(100% + 40px));
  }
  /* Track details have no tabs to keep steady: the sheet takes only the room it needs. */
  .sheet[data-mode='track'] { height: auto; max-height: min(82svh, 720px); }
  .sheet.open { transform: none; }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); margin: 10px auto 0; flex: none; }
}

/* Phones: a lighter frosted glass. Every frame the browser re-blurs whatever moves behind each
   glass panel; over the already soft backdrop the smaller radius looks the same and costs less. */
@media (pointer: coarse) {
  .glass { backdrop-filter: blur(16px) saturate(145%); -webkit-backdrop-filter: blur(16px) saturate(145%); }
  .glass-pill, .waves-bar { backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%); }
}

.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 9; }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .eq i, .um-icon svg path { animation: none !important; }
  /* Less motion, not none: a new track still cross-fades (no blur, no drift), the logo glint stays slow. */
  .title, .artist, .chips { transition: opacity 0.45s ease !important; transform: none !important; filter: none !important; }
  .now.revealing .artist, .now.revealing .chip { animation: none; }
  .cover-wrap { transform: none !important; }
}
