/* ═══════════════════════════════════════════════════════════
   sera's library ♡ — styles.css
   Cute, soft pink/lavender glassmorphism. Mobile-first.
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Design tokens ─────────────────────────────────────── */
:root {
  --pink-100: #fff0f6;
  --pink-200: #ffd6e8;
  --pink-300: #ffb3d1;
  --pink-400: #f48fb1;
  --pink-500: #e872a2;
  --lavender: #e6d9f5;
  --lavender-deep: #c9b0e4;
  --plum: #5d3a56;
  --plum-soft: #8a6283;
  --white: #ffffff;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.65);

  --surface-hover: rgba(255, 255, 255, 0.55);
  --surface-hover-strong: rgba(255, 255, 255, 0.65);
  --cover-grad: linear-gradient(135deg, var(--pink-200), var(--lavender));
  --danger: #c2447c;

  /* page background (body uses this so dark mode can swap it) */
  --bg-page:
    radial-gradient(ellipse at 20% 0%, var(--lavender) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, var(--pink-300) 0%, transparent 50%),
    linear-gradient(160deg, var(--pink-100) 0%, var(--pink-200) 45%, var(--lavender) 100%);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --shadow-soft: 0 8px 24px rgba(93, 58, 86, 0.10);
  --shadow-lift: 0 12px 32px rgba(93, 58, 86, 0.16);

  --font-head: 'Comfortaa', cursive;
  --font-body: 'Quicksand', sans-serif;

  --player-h: 148px; /* approx desktop player bar height, used for main padding */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Dark theme ───────────────────────────────────────────── */
body.dark {
  color-scheme: dark;

  --pink-100: #241428;
  --pink-200: #2e1a33;
  --pink-300: #4a2a4a;
  --pink-400: #e88ab4;
  --pink-500: #f0a0c4;
  --lavender: #3a2547;
  --lavender-deep: #a789d6;
  --plum: #f3e3f1;
  --plum-soft: #c9a3c4;

  --glass-bg: rgba(46, 26, 51, 0.55);
  --glass-bg-strong: rgba(38, 21, 43, 0.82);
  --glass-border: rgba(255, 255, 255, 0.14);

  --surface-hover: rgba(255, 255, 255, 0.10);
  --surface-hover-strong: rgba(255, 255, 255, 0.16);
  --cover-grad: linear-gradient(135deg, #4a2a4a, #3a2547);

  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.45);

  --bg-page:
    radial-gradient(ellipse at 20% 0%, rgba(167, 137, 214, 0.20) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(232, 138, 180, 0.16) 0%, transparent 50%),
    linear-gradient(160deg, #1d1020 0%, #241428 45%, #2b1836 100%);
}

body.dark .float-item { filter: none; opacity: 0.7; }
body.dark ::-webkit-scrollbar-thumb { border-color: #241428; }
body.dark .noscript-msg { background: #241428; }

/* ── 2. Base / reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--plum);
  min-height: 100vh;
  background: var(--bg-page);
  background-attachment: fixed;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input { font-family: inherit; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visibility (a11y) */
:focus-visible {
  outline: 3px solid var(--plum-soft);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--pink-400), var(--lavender-deep));
  border-radius: var(--r-pill);
  border: 2px solid var(--pink-100);
}
::-webkit-scrollbar-thumb:hover { background: var(--pink-500); }
html {
  scrollbar-width: thin;
  scrollbar-color: var(--pink-400) transparent;
}

.noscript-msg {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-size: 1.2rem;
  background: var(--pink-100);
  z-index: 100;
}

/* ── 3. Floating background layer ─────────────────────────── */
.bg-float {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-item {
  position: absolute;
  bottom: -8vh;
  font-size: var(--size, 1.4rem);
  opacity: 0;
  animation: floatUp var(--dur, 14s) linear var(--delay, 0s) infinite;
  filter: drop-shadow(0 2px 4px rgba(93, 58, 86, 0.12));
}

.bg-float.is-paused .float-item { animation-play-state: paused; }

@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: var(--op, 0.6); }
  85%  { opacity: var(--op, 0.6); }
  100% { transform: translateY(-115vh) translateX(var(--drift, 30px)) rotate(var(--spin, 40deg)); opacity: 0; }
}

/* ── 4. Glass card primitive ──────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
}

/* ── 5. Lock screen ───────────────────────────────────────── */
.lock-screen {
  position: fixed; inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  transition: opacity 0.5s ease, visibility 0.5s;
  overflow: hidden; /* contain absolutely-positioned children */
}

.lock-screen.is-unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  width: min(92vw, 400px);
  padding: 44px 32px 36px;
  text-align: center;
}

.lock-emoji {
  font-size: 3.2rem;
  animation: bobble 2.6s ease-in-out infinite;
  color: var(--pink-500);
  display: grid;
  place-items: center;
}

.lock-emoji .ic { width: 1em; height: 1em; stroke-width: 1.6; }

/* inline SVG icons inside titles / search */
.title-ic { display: inline-grid; place-items: center; vertical-align: -3px; color: var(--pink-500); }
.title-ic .ic { width: 1.05em; height: 1.05em; }
.search-icon { display: inline-grid; place-items: center; opacity: 0.7; }
.search-icon .ic { width: 16px; height: 16px; }
.np-cover .ic { width: 26px; height: 26px; color: var(--pink-500); }

@keyframes bobble {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-10px) rotate(4deg); }
}

.lock-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.7rem;
  margin-top: 12px;
  letter-spacing: 0.5px;
}

.lock-subtitle {
  color: var(--plum-soft);
  font-weight: 500;
  margin: 8px 0 24px;
}

#lockForm { display: flex; flex-direction: column; gap: 14px; }

.code-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--plum);
  text-align: center;
  letter-spacing: 2px;
  background: var(--glass-bg-strong);
  border: 2px solid var(--pink-300);
  border-radius: var(--r-pill);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.code-input::placeholder { color: var(--plum-soft); opacity: 0.6; letter-spacing: 1px; }
.code-input:focus { border-color: var(--pink-500); box-shadow: 0 0 0 4px rgba(244, 143, 177, 0.25); }
.code-input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  padding: 14px 18px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
  border-radius: var(--r-pill);
  box-shadow: 0 6px 18px rgba(232, 114, 162, 0.35);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); box-shadow: 0 10px 24px rgba(232, 114, 162, 0.45); }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.lock-error {
  min-height: 1.4em;
  margin-top: 16px;
  font-weight: 600;
  color: var(--danger);
}

.lock-attempts { margin-top: 4px; font-size: 0.85rem; color: var(--plum-soft); }

.lock-countdown {
  margin-top: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--pink-500);
}

/* Shake animation on wrong code */
.is-shaking { animation: shake 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px) rotate(-1deg); }
  30% { transform: translateX(10px) rotate(1deg); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
  90% { transform: translateX(3px); }
}

/* ── 6. App layout ────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 18px calc(var(--player-h) + 40px);
  animation: fadeSlideIn 0.5s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-header { text-align: center; margin-bottom: 22px; position: relative; }

/* theme toggle: moon shown in light mode, sun in dark */
.theme-toggle { color: var(--plum-soft); }
.theme-toggle-lock { position: absolute; top: 18px; right: 18px; }
.theme-toggle-app { position: absolute; top: 0; right: 0; }
body.dark .theme-toggle .ic-moon { display: none; }
body:not(.dark) .theme-toggle .ic-sun { display: none; }

.app-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 2.3rem);
}

.app-subtitle { color: var(--plum-soft); font-weight: 500; margin-top: 6px; }

.section-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 26px 4px 12px;
}

/* Search */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
}

.search-icon { opacity: 0.7; }

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--plum);
}

.search-input::placeholder { color: var(--plum-soft); opacity: 0.6; }

/* Filter chips */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chip {
  padding: 9px 18px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--plum);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease-bounce), background 0.2s, color 0.2s, border-color 0.2s;
}

.chip:hover { transform: translateY(-2px); }
.chip.is-active {
  color: var(--white);
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
  border-color: transparent;
}

.chip-fav.is-active { background: linear-gradient(135deg, var(--pink-500), var(--pink-400)); }

/* library genre chips dim while the favorites view is active (still clickable = exit) */
.chip.is-dimmed { opacity: 0.45; }

/* favorites genre sub-filter */
.fav-sub-row { margin-top: 10px; }

.chip-sm { padding: 6px 13px; font-size: 0.8rem; }

.chip-count { font-size: 0.85em; font-weight: 500; opacity: 0.75; margin-left: 2px; }

/* Recently played strip */
.recent-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 12px;
  scroll-snap-type: x proximity;
}

.recent-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s;
  text-align: left;
}

.recent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.recent-emoji {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  font-size: 1.3rem;
  background: var(--cover-grad);
  border-radius: var(--r-sm);
}

.recent-name { font-weight: 600; font-size: 0.9rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-genre { font-size: 0.75rem; color: var(--plum-soft); text-transform: capitalize; }

/* Track list */
.track-list { display: flex; flex-direction: column; gap: 10px; }

.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s, border-color 0.2s;
  text-align: left;
}

.track-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.track-row.is-playing {
  border-color: var(--pink-400);
  background: var(--glass-bg-strong);
}

.track-emoji {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 50px; height: 50px;
  font-size: 1.5rem;
  background: var(--cover-grad);
  border-radius: var(--r-sm);
}

.track-main { flex: 1; min-width: 0; }

.track-title {
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-meta {
  display: flex;
  gap: 10px;
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--plum-soft);
  font-weight: 500;
}

.track-genre { text-transform: capitalize; }

.track-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--plum-soft);
  font-weight: 500;
}

/* Queue section */
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-ghost {
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--plum-soft);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  transition: color 0.2s, transform 0.2s;
}

.btn-ghost:hover { color: var(--plum); transform: translateY(-1px); }

.queue-list { display: flex; flex-direction: column; gap: 8px; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
}

.queue-pos {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--pink-500);
  width: 22px;
  text-align: center;
}

.queue-title { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.queue-btns { display: flex; gap: 2px; }

/* ── 7. Icon buttons / pills ──────────────────────────────── */
.btn-icon {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  font-size: 1.05rem;
  border-radius: var(--r-pill);
  transition: transform 0.18s var(--ease-bounce), background 0.2s, color 0.2s;
  user-select: none;
}

.btn-icon:hover { transform: scale(1.12); background: var(--surface-hover); }
.btn-icon:active { transform: scale(0.94); }

.btn-icon[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(232, 114, 162, 0.35);
}

.btn-icon.is-faved { color: var(--pink-500); }
.btn-icon.is-faved .ic-stroke path { fill: currentColor !important; }

/* favorite hearts: bare shape only — never a pill/ball, even when pressed */
.fav-btn,
.fav-btn:hover,
.fav-btn[aria-pressed="true"],
.fav-btn[aria-pressed="true"]:hover {
  background: none !important;
  box-shadow: none !important;
}
.fav-btn { color: var(--plum-soft); }
.fav-btn:hover .ic { color: var(--pink-500); }
.fav-btn.is-faved,
.fav-btn.is-faved[aria-pressed="true"] { color: var(--pink-500); }
.fav-btn .ic { transition: transform 0.18s var(--ease-bounce); }
.fav-btn.is-faved .ic { transform: scale(1.12); }

/* ── Inline SVG icons ─────────────────────────────────────── */
.ic {
  width: 20px;
  height: 20px;
  flex: none;
  pointer-events: none;
}

/* default paint for artwork that carries no fill/stroke of its own */
.ic :not([fill]) { fill: currentColor; }

.ic-sm { width: 15px; height: 15px; }

/* user-supplied icons carry their own fill/stroke attrs — respect explicit none */
.ic [fill="none"] { fill: none; }
.ic [stroke="none"] { stroke: none; }

/* stroked artwork (JS-rendered rows): thin paths drawn, not filled */
.ic-stroke,
.ic .ic-stroke path,
.ic .ic-stroke circle {
  fill: none !important;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* number glyphs inside skip / repeat icons */
.ic text {
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 700;
}

.btn-icon:hover .ic { color: var(--pink-500); }
.btn-icon[aria-pressed="true"]:hover .ic { color: inherit; }

/* play/pause button: icon always white on the pink gradient, every state */
.btn-play .ic,
.btn-play:hover .ic,
.btn-play:active .ic { color: var(--white); }

.btn-play .ic { width: 24px; height: 24px; }

/* repeat: no pressed pill — a small active dot under the icon instead */
#repeatBtn { position: relative; }
#repeatBtn[aria-pressed="true"] {
  background: none;
  box-shadow: none;
  color: var(--pink-500);
}
#repeatBtn[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pink-500);
}
#sleepBtn { display: inline-flex; align-items: center; gap: 5px; }
#sleepLabel:empty { display: none; }


.btn-pill {
  padding: 8px 14px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--r-pill);
  transition: transform 0.18s var(--ease-bounce), background 0.2s;
}

.btn-pill:hover { transform: scale(1.06); background: var(--surface-hover); }

.btn-pill.has-timer {
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
  color: var(--white);
}

.btn-play {
  width: 56px; height: 56px;
  font-size: 1.5rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
  box-shadow: 0 6px 18px rgba(232, 114, 162, 0.4);
}

.btn-play:hover { background: linear-gradient(135deg, var(--pink-500), var(--lavender-deep)); transform: scale(1.08); }

/* ── 8. Now playing bar ───────────────────────────────────── */
.player-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 32px rgba(93, 58, 86, 0.14);
  animation: slideUpBar 0.4s var(--ease-bounce);
}

@keyframes slideUpBar {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.visualizer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 26px;
  pointer-events: none;
}

.player-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "info controls secondary"
    "progress progress progress";
  align-items: center;
  gap: 6px 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 12px; /* top padding clears the visualizer strip */
}

.np-info { grid-area: info; display: flex; align-items: center; gap: 12px; min-width: 0; }

.np-cover {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  font-size: 1.6rem;
  background: var(--cover-grad);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}

.np-text { min-width: 0; }

.np-title {
  font-weight: 700;
  font-size: 0.98rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.np-genre { font-size: 0.78rem; color: var(--plum-soft); text-transform: capitalize; }

.np-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  gap: 2px;
}

.np-progress {
  grid-area: progress;
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--plum-soft);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.progress-buffered {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  height: 6px;
  width: 0%;
  background: color-mix(in srgb, var(--lavender-deep) 55%, transparent);
  border-radius: var(--r-pill);
  pointer-events: none;
}

.np-secondary {
  grid-area: secondary;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.vol-group { display: flex; align-items: center; gap: 4px; }

/* ── 9. Custom range inputs ───────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.seek-bar { position: relative; width: 100%; height: 22px; z-index: 1; }
.volume-bar { width: 90px; height: 22px; }

/* WebKit track + thumb */
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(
    to right,
    var(--pink-400) 0%,
    var(--lavender-deep) var(--fill, 0%),
    var(--surface-hover-strong) var(--fill, 0%)
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  margin-top: -5px;
  background: var(--white);
  border: 3px solid var(--pink-400);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(93, 58, 86, 0.25);
  transition: transform 0.15s var(--ease-bounce);
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb { transform: scale(1.3); }

/* Firefox track + thumb */
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-hover-strong);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--pink-400), var(--lavender-deep));
}

input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--white);
  border: 3px solid var(--pink-400);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(93, 58, 86, 0.25);
}

/* ── 10. Popovers (speed / sleep) ─────────────────────────── */
.popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  min-width: 140px;
  z-index: 45;
  animation: popIn 0.22s var(--ease-bounce);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  padding-bottom: 6px;
  color: var(--plum-soft);
}

.popover-item {
  padding: 9px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--r-md);
  transition: background 0.15s, transform 0.15s;
  text-align: center;
}

.popover-item:hover { background: var(--surface-hover); transform: scale(1.03); }

.popover-item.is-active {
  color: var(--white);
  background: linear-gradient(135deg, var(--pink-400), var(--lavender-deep));
}

.popover-cancel { color: var(--danger); }

/* ── 11. Responsive ───────────────────────────────────────── */

/* expand/collapse handle + mini-bar quick controls: mobile only */
.np-handle { display: none; }
.np-mini-btns { display: none; }

@media (max-width: 768px) {
  /* ═══ Mobile player: mini bar ⇄ full-screen now-playing ═══ */
  .player-bar {
    display: flex;
    flex-direction: column;
    transition: transform 0.32s var(--ease-bounce), border-radius 0.32s;
  }

  .player-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: none;
    padding: 26px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* handle: chevron strip across the top */
  .np-handle {
    display: grid;
    place-items: center;
    align-self: center;
    width: 64px;
    height: 20px;
    margin: -16px 0 2px;
    color: var(--plum-soft);
  }
  .np-handle .ic-handle-down { display: none; }
  .player-bar.is-expanded .np-handle .ic-handle-up { display: none; }
  .player-bar.is-expanded .np-handle .ic-handle-down { display: block; }

  /* mini mode: info row + quick controls only */
  .np-info { width: 100%; }
  .np-mini-btns { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
  .btn-play-mini { width: 42px; height: 42px; }
  .btn-play-mini .ic { width: 19px; height: 19px; }
  .np-controls, .np-progress, .np-secondary { display: none; }

  /* expanded mode: full now-playing sheet */
  .player-bar.is-expanded {
    top: 0;
    bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .player-bar.is-expanded .player-inner { padding-top: 30px; }
  .player-bar.is-expanded .np-info {
    flex-direction: column;
    text-align: center;
    gap: 14px;
    padding: 12px 0 4px;
  }
  .player-bar.is-expanded .np-cover { width: min(56vw, 230px); height: min(56vw, 230px); font-size: 4rem; border-radius: var(--r-lg); }
  .player-bar.is-expanded .np-cover .ic { width: 64px; height: 64px; }
  .player-bar.is-expanded .np-title { font-size: 1.15rem; }
  .player-bar.is-expanded .np-mini-btns { display: none; }
  .player-bar.is-expanded .np-progress { display: flex; width: 100%; margin-top: 18px; }
  .player-bar.is-expanded .np-controls { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 10px; width: 100%; }
  /* 7 transport buttons must fit small phones: play stays dominant, the rest shrink */
  .player-bar.is-expanded .np-controls .btn-icon { min-width: 40px; height: 40px; }
  .player-bar.is-expanded .np-controls .btn-icon .ic { width: 19px; height: 19px; }
  .player-bar.is-expanded .np-controls .btn-play { width: 54px; height: 54px; flex: 0 0 auto; }
  .player-bar.is-expanded .np-controls .btn-play .ic { width: 23px; height: 23px; }

  @media (max-width: 400px) {
    .player-bar.is-expanded .np-controls { gap: 2px; }
    .player-bar.is-expanded .np-controls .btn-icon { min-width: 36px; height: 36px; padding: 0 4px; }
    .player-bar.is-expanded .np-controls .btn-icon .ic { width: 17px; height: 17px; }
    .player-bar.is-expanded .np-controls .btn-play { width: 50px; height: 50px; }
  }
  .player-bar.is-expanded .np-secondary { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
  .player-bar.is-expanded .vol-group .volume-bar { display: block; width: 110px; }

  /* queue lives inside the sheet on mobile */
  .player-bar .queue-section {
    display: none;
    padding: 6px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .player-bar.is-expanded .queue-section:not([hidden]) { display: block; }

  /* popovers anchor above the secondary row */
  .player-bar.is-expanded .popover { bottom: auto; top: 40%; }

  .np-cover { width: 42px; height: 42px; font-size: 1.3rem; }

  /* Mid-tier phone savings: fixed bg repaint + long blurred lists are the
     two biggest GPU costs — kill both on small screens. */
  body { background-attachment: scroll; }
  .track-row {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--glass-bg-strong);
  }
}

@media (max-width: 480px) {
  .app { padding: 20px 12px; }   /* bottom padding owned by site.css (.has-player) */

  .filter-row { gap: 8px; }
  .chip { padding: 8px 14px; font-size: 0.85rem; }

  .btn-icon { min-width: 36px; height: 36px; font-size: 0.95rem; }
  .btn-icon .ic { width: 18px; height: 18px; }
  .btn-play { width: 50px; height: 50px; font-size: 1.3rem; }
  .btn-play .ic { width: 22px; height: 22px; }
  .btn-play-mini { width: 38px; height: 38px; }

  /* volume slider hidden on phones (hardware buttons) — visible in the
     expanded sheet via the rule below */
  .vol-group .volume-bar { display: none; }

  .track-emoji { width: 42px; height: 42px; font-size: 1.25rem; }
  .track-row { padding: 10px 12px; gap: 10px; }
}

/* iOS: hardware volume can't be set programmatically — hide the slider */
body.no-volume-control .vol-group .volume-bar { display: none; }

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

  .bg-float { display: none; }
}
