/* ============ Asharas — premium Apple glass, 3D motion ============ */
:root {
  --bg: #06080d;
  --text: rgba(255, 255, 255, 0.95);
  --text-dim: rgba(255, 255, 255, 0.55);
  --accent: #0a84ff;
  --accent-2: #5ce6c3;
  --accent-soft: rgba(10, 132, 255, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: 1px solid rgba(255, 255, 255, 0.2);
  --glass-blur: blur(25px);
  --glass-hover: rgba(255, 255, 255, 0.16);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --player-h: 104px;
  --font: "Manrope", -apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Sora", "Manrope", -apple-system, sans-serif;
  --font-serif: "Instrument Serif", "New York", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

:root.dim {
  --bg: #020308;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.1);
}
:root.dim .bg-orb { opacity: 0.22; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
  font-family: var(--font);
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s;
}

::selection { background: rgba(10, 132, 255, 0.4); }

button { font: inherit; color: inherit; }

/* ---- Ambient aurora background ---- */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  opacity: 0.5;
  z-index: -1;
  animation: drift 26s ease-in-out infinite alternate;
  transition: opacity 0.6s;
}
.orb-1 { width: 50vw; height: 50vw; top: -15vw; left: -12vw; background: #123a7a; }
.orb-2 { width: 42vw; height: 42vw; bottom: -13vw; right: -10vw; background: #0c5f5a; animation-delay: -9s; }
.orb-3 { width: 30vw; height: 30vw; top: 36%; left: 56%; background: #14356b; animation-delay: -17s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1) rotate(0deg); filter: blur(120px) hue-rotate(0deg); }
  to   { transform: translate(6vw, -4vw) scale(1.18) rotate(20deg); filter: blur(120px) hue-rotate(35deg); }
}

/* ---- Apple frosted glass utility ---- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.6);
  border: var(--glass-border);
  box-shadow: var(--shadow);
}

/* ================= Welcome screen ================= */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(12, 40, 90, 0.55), transparent 60%), var(--bg);
  transition: opacity 0.55s ease, transform 0.55s var(--ease-spring);
}
#welcome.leave { opacity: 0; transform: scale(1.04); pointer-events: none; }

.welcome-inner { text-align: center; max-width: 640px; }

.logo-tile {
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  background: linear-gradient(160deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05));
  animation: tile-float 5s ease-in-out infinite;
}
.logo-tile span {
  background: linear-gradient(120deg, #9fd0ff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes tile-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

.brand-xl {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 4.4rem) !important;
  letter-spacing: -0.06em;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin: 38px 0 30px;
}
.mode-card {
  cursor: pointer;
  border-radius: 24px;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.35s var(--ease-spring), background 0.3s, box-shadow 0.35s;
  animation: intro 0.9s var(--ease-spring) 0.35s backwards;
}
.mode-card:last-child { animation-delay: 0.5s; }
.mode-card:hover {
  background: var(--glass-hover);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
}
.mode-emoji { font-size: 2.2rem; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5)); }
.mode-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.mode-desc { color: var(--text-dim); font-size: 0.88rem; line-height: 1.45; font-weight: 300; }

.key-hints { color: var(--text-dim); font-size: 0.82rem; font-family: var(--font-mono); }
.key-hints kbd {
  font-family: inherit;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 2px 7px;
  margin: 0 2px;
  font-size: 0.78rem;
}

/* ================= Shell layout ================= */
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 26px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 22px calc(var(--player-h) + 64px);
}

.sidebar {
  position: sticky;
  top: 26px;
  align-self: start;
  border-radius: 24px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: intro 0.9s var(--ease-spring) 0.05s backwards;
}
.side-brand { padding: 0 8px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.62rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  background: linear-gradient(110deg,
    #ffffff 20%,
    color-mix(in srgb, var(--accent) 65%, #ffffff) 40%,
    var(--accent-2) 50%,
    color-mix(in srgb, var(--accent) 65%, #ffffff) 60%,
    #ffffff 80%);
  background-size: 240% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: -240% center; } }

/* Premium brand: soft glow behind the wordmark + letter reveal on the
   welcome screen. */
.brand-xl {
  position: relative;
  filter: drop-shadow(0 6px 34px color-mix(in srgb, var(--accent) 45%, transparent));
  animation: shimmer 6s linear infinite, brand-rise 1s var(--ease-spring) both;
}
@keyframes brand-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.96); letter-spacing: 0.05em; }
  to   { opacity: 1; transform: translateY(0) scale(1); letter-spacing: -0.035em; }
}

.tagline {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 1.05rem;
  font-weight: 400;
}
.tagline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25em;
  letter-spacing: 0;
  background: linear-gradient(100deg, #8fc4ff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.25s, color 0.25s, transform 0.25s var(--ease-spring), border-color 0.25s;
}
.nav-btn svg { width: 19px; height: 19px; }
.nav-btn:hover { color: var(--text); background: var(--glass-bg); transform: translateX(3px); }
.nav-btn.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.22), rgba(92, 230, 195, 0.1));
  border-color: rgba(10, 132, 255, 0.35);
}

/* ================= Main column ================= */
.app { min-width: 0; }

@keyframes intro {
  from { opacity: 0; transform: translateY(22px); filter: blur(10px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}
.search-box { animation: intro 0.9s var(--ease-spring) 0.15s backwards; }
.toolbar    { animation: intro 0.9s var(--ease-spring) 0.25s backwards; }
#view-home  { animation: intro 0.9s var(--ease-spring) 0.35s backwards; }

/* ---- Search (redesigned prominent navbar) ---- */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
              0 0 0 0 rgba(10, 132, 255, 0);
  transition: border-color 0.4s, box-shadow 0.4s, background 0.4s, transform 0.35s var(--ease-spring);
  animation: search-glow 4s ease-in-out infinite;
}
@keyframes search-glow {
  0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(10, 132, 255, 0); }
  50%      { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(10, 132, 255, 0.12); }
}
.search-box:focus-within {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.35),
              0 0 0 3px rgba(10, 132, 255, 0.18),
              0 0 50px rgba(10, 132, 255, 0.2);
  transform: translateY(-2px) scale(1.01);
  animation: none;
}
.search-icon {
  width: 22px; height: 22px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.3s, filter 0.3s;
}
.search-box:focus-within .search-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(10, 132, 255, 0.5));
}
#search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}
#search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}
.search-btn {
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: #fff;
  padding: 11px 28px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0a84ff, #0fcfaa);
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.3s var(--ease-spring), filter 0.2s, box-shadow 0.3s;
}
.search-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 28px rgba(10, 132, 255, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.search-btn:active { transform: scale(0.94); }

/* ---- Toolbar (listen together + language) ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 26px;
}
.spacer { flex: 1; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(120deg, rgba(10, 132, 255, 0.35), rgba(92, 230, 195, 0.22));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform 0.25s var(--ease-spring), filter 0.2s, box-shadow 0.25s;
}
.pill-btn svg { width: 17px; height: 17px; }
.pill-btn:hover { transform: translateY(-2px); filter: brightness(1.15); box-shadow: 0 12px 24px rgba(0,0,0,0.4); }
.pill-btn:active { transform: scale(0.95); }
.pill-btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-dim);
  font-weight: 500;
}
.pill-btn.ghost:hover { color: var(--text); }

.lang-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
}
.lang-label { color: var(--text-dim); font-size: 0.8rem; }
#lang-select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#lang-select option { background: #10131c; color: #fff; }

/* ---- Section heads ---- */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 16px;
}
.head-bar {
  width: 4px; height: 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(10, 132, 255, 0.6);
}
.row-head { display: flex; align-items: center; justify-content: space-between; margin-top: 34px; }
.row-head .section-head { margin-bottom: 16px; }
.link-btn {
  border: none;
  background: none;
  color: var(--accent-2);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: filter 0.2s, transform 0.2s;
}
.link-btn:hover { filter: brightness(1.2); transform: translateX(2px); }

/* ---- Mood grid ---- */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 13px;
  margin-bottom: 30px;
  perspective: 1000px;
}
.mood-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 20px 10px 16px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--text);
  background: linear-gradient(160deg,
    hsla(var(--tint), 70%, 55%, 0.16),
    hsla(var(--tint), 70%, 40%, 0.05));
  border: 1px solid hsla(var(--tint), 75%, 65%, 0.3);
  backdrop-filter: var(--glass-blur) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.6);
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0));
  transition: transform 0.18s ease-out, box-shadow 0.3s, border-color 0.3s;
  animation: card-in 0.6s var(--ease-spring) backwards;
}
.mood-grid .mood-card:nth-child(n) { animation-delay: calc(0.05s * var(--i, 0)); }
.mood-card:hover {
  --lift: -5px;
  border-color: hsla(var(--tint), 80%, 70%, 0.6);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5),
              0 0 26px hsla(var(--tint), 80%, 60%, 0.25);
}
.mood-card:active { --lift: -1px; }
.mood-emoji {
  font-size: 1.7rem;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.55));
  transform: translateZ(26px);
  transition: transform 0.3s var(--ease-spring);
}
.mood-card:hover .mood-emoji { transform: translateZ(40px) scale(1.12); }

/* ---- Fun fact card ---- */
.fact-card {
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 8px;
}
#fact-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.12rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ---- Trending row ---- */
.trend-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 152px;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 16px;
  scroll-snap-type: x mandatory;
  perspective: 1000px;
}
.trend-row::-webkit-scrollbar { height: 6px; }
.trend-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.trend-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px;
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0));
  transition: transform 0.18s ease-out, background 0.3s, box-shadow 0.3s;
  animation: card-in 0.6s var(--ease-spring) backwards;
}
.trend-card:hover {
  --lift: -5px;
  background: var(--glass-hover);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.5);
}
.trend-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 13px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transform: translateZ(18px);
}
.trend-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-by {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- List view ---- */
.list-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.list-head .section-head { margin-bottom: 0; }

.empty-note { color: var(--text-dim); padding: 22px 4px; }
.empty-note.error { color: #ff6961; }

.results {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  perspective: 1200px;
}

.track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.6);
  border: var(--glass-border);
  cursor: pointer;
  overflow: hidden;
  transform-style: preserve-3d;
  transform: perspective(900px)
             rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
             translateY(var(--lift, 0));
  transition: background 0.3s, border-color 0.3s,
              transform 0.18s ease-out, box-shadow 0.3s;
  animation: card-in 0.6s var(--ease-spring) backwards;
}
@keyframes card-in {
  from { opacity: 0; transform: perspective(900px) rotateX(14deg) translateY(34px); filter: blur(6px); }
  to   { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0); filter: blur(0); }
}
.track:hover {
  --lift: -4px;
  background: var(--glass-hover);
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.5);
}
.track.active {
  border-color: rgba(10, 132, 255, 0.6);
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.2), rgba(92, 230, 195, 0.08));
}

/* Light sheen sweeping across a card on hover */
.track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%,
              rgba(255, 255, 255, 0.14) 50%, transparent 65%);
  transform: translateX(-130%);
  transition: transform 0.7s ease;
  pointer-events: none;
}
.track:hover::after { transform: translateX(130%); }

/* Album art pops toward the viewer in 3D */
.track-cover {
  width: 64px; height: 64px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  transform: translateZ(0);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.track:hover .track-cover {
  transform: translateZ(30px) scale(1.05);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.55);
}

.track-info { flex: 1; min-width: 0; }
.track-name {
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-by {
  color: var(--text-dim);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-duration {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

/* Row action buttons */
.row-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.2s var(--ease-spring), border-color 0.2s;
}
.row-btn svg { width: 17px; height: 17px; }
.row-btn:hover { color: var(--text); background: var(--glass-hover); transform: translateY(-2px); }
.row-btn.lit { color: #ff7a9c; border-color: rgba(255, 122, 156, 0.4); }
.row-btn.lit svg { fill: currentColor; }
.row-btn.danger:hover { color: #ff6961; border-color: rgba(255, 105, 97, 0.4); }

/* Equalizer badge on the active track */
.track-eq { display: none; align-items: flex-end; gap: 2.5px; height: 18px; margin-right: 2px; }
.track.active .track-eq { display: inline-flex; }
.track-eq span {
  width: 3.5px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  animation: equalize 1s ease-in-out infinite;
}
.track-eq span:nth-child(1) { height: 55%; }
.track-eq span:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.track-eq span:nth-child(3) { height: 70%; animation-delay: 0.3s; }
.track.active.paused .track-eq span { animation-play-state: paused; }

@keyframes equalize {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}

/* ---- Playlists view ---- */
.pl-create {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  margin-bottom: 18px;
}
.pl-create input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  padding: 6px 10px;
}
.playlists { display: flex; flex-direction: column; gap: 12px; }
.pl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  animation: card-in 0.5s var(--ease-spring) backwards;
}
.pl-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.pl-name { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }
.pl-count { color: var(--text-dim); font-size: 0.82rem; }

/* ================= Player bar ================= */
.player {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 150%) perspective(900px) rotateX(18deg);
  width: min(1150px, calc(100% - 24px));
  min-height: var(--player-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.7fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  border-radius: 26px;
  z-index: 50;
  transition: transform 0.7s var(--ease-spring);
}
.player.visible { transform: translate(-50%, 0) perspective(900px) rotateX(0); }

.player-track { display: flex; align-items: center; gap: 16px; min-width: 0; }

/* Prominent artwork — tilts in 3D under the cursor */
.cover-wrap {
  position: relative;
  width: 74px; height: 74px;
  flex-shrink: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55);
  transform: perspective(600px)
             rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
             scale(var(--s, 1));
  transition: transform 0.2s ease-out, box-shadow 0.4s;
}
#player-cover {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.cover-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%,
              rgba(255, 255, 255, 0.08) 34%, transparent 55%);
  pointer-events: none;
}
.player.playing .cover-wrap {
  --s: 1.05;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.6), 0 0 34px rgba(10, 132, 255, 0.3);
}

.track-meta { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.track-title { font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { color: var(--text-dim); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-center { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.controls { display: flex; align-items: center; justify-content: center; gap: 16px; }

/* Small utility controls (shuffle, repeat, fav, download, dim) */
.mini-btn {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-dim);
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.25s, background 0.25s, transform 0.25s var(--ease-spring);
}
.mini-btn svg { width: 19px; height: 19px; }
.mini-btn:hover { color: var(--text); background: var(--glass-bg); transform: translateY(-3px); }
.mini-btn:active { transform: scale(0.9); }
.mini-btn.lit { color: var(--accent-2); }
.mini-btn.lit svg { filter: drop-shadow(0 0 8px rgba(92, 230, 195, 0.7)); }
#btn-fav.lit { color: #ff7a9c; }
#btn-fav.lit svg { fill: currentColor; filter: drop-shadow(0 0 8px rgba(255, 122, 156, 0.6)); }

.repeat-one {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  font-family: var(--font-mono);
  opacity: 0;
  transition: opacity 0.2s;
}
#btn-repeat.one .repeat-one { opacity: 1; }

/* ---- 3D floating glass control buttons ---- */
.ctrl-btn {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  cursor: pointer;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.35),
              inset 0 -6px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s var(--ease-spring),
              box-shadow 0.3s, background 0.3s;
}
.ctrl-btn:hover {
  background: var(--glass-hover);
  transform: translateY(-5px);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55),
              inset 0 1px 0 rgba(255, 255, 255, 0.4),
              inset 0 -6px 12px rgba(0, 0, 0, 0.18);
}
.ctrl-btn:active { transform: translateY(-2px) scale(0.92); }

/* Icons gently bob above the glass, each on its own rhythm */
.btn-float {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  animation: floaty 3.6s ease-in-out infinite;
}
#btn-prev .btn-float { animation-delay: -0.9s; }
#btn-next .btn-float { animation-delay: -2.1s; }

@keyframes floaty {
  0%, 100% { transform: translateY(1.5px); }
  50%      { transform: translateY(-2.5px); }
}

.ctrl-btn svg {
  width: 20px; height: 20px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.play-btn {
  width: 58px; height: 58px;
  background: linear-gradient(160deg, rgba(60, 165, 255, 0.95), rgba(15, 150, 120, 0.95));
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: 0 14px 30px rgba(10, 132, 255, 0.4),
              inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
              inset 0 -8px 14px rgba(0, 60, 70, 0.35);
}
.play-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-5px);
  box-shadow: 0 22px 40px rgba(10, 132, 255, 0.5),
              inset 0 1.5px 0 rgba(255, 255, 255, 0.55),
              inset 0 -8px 14px rgba(0, 60, 70, 0.3);
}
.play-btn .btn-float { position: relative; }
.play-btn svg {
  width: 24px; height: 24px;
  position: absolute;
  top: 50%; left: 50%;
  margin: -12px 0 0 -12px;
  transition: opacity 0.25s, transform 0.25s;
}
.play-btn .icon-pause { opacity: 0; transform: scale(0.5) rotate(-90deg); }
.player.playing .play-btn .icon-pause { opacity: 1; transform: scale(1) rotate(0deg); }
.player.playing .play-btn .icon-play { opacity: 0; transform: scale(0.5) rotate(90deg); }

/* Pulse ring while playing */
.player.playing .play-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(120, 230, 200, 0.55);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  from { transform: scale(1); opacity: 0.9; }
  to   { transform: scale(1.55); opacity: 0; }
}

/* ---- Seek + volume sliders ---- */
.seek-row { display: flex; align-items: center; gap: 10px; }
.time {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  min-width: 38px;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), rgba(255, 255, 255, 0.18) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 8px rgba(10, 132, 255, 0.6);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 8px rgba(10, 132, 255, 0.6);
}

.player-right { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.vol-icon { width: 20px; height: 20px; color: var(--text-dim); flex-shrink: 0; margin-left: 4px; }
.volume { max-width: 92px; }

/* ================= Dialog & toast ================= */
dialog.glass {
  margin: auto;
  border-radius: 22px;
  padding: 26px;
  min-width: min(380px, 90vw);
  color: var(--text);
  background: rgba(20, 24, 34, 0.85);
}
dialog.glass::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
dialog h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.pl-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pl-option {
  text-align: left;
  padding: 11px 14px;
  border-radius: 13px;
  border: var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.pl-option:hover { background: var(--glass-hover); transform: translateX(3px); }
dialog .pl-create { margin-bottom: 12px; border: var(--glass-border); }
dialog .pill-btn.ghost { width: 100%; justify-content: center; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 40px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  background: rgba(20, 26, 38, 0.9);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity 0.35s, transform 0.35s var(--ease-spring);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 28px; height: 28px;
  margin: 24px auto;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Language row sections ---- */
.trend-row .trend-card:empty { display: none; }
.trend-row .empty-note {
  grid-column: 1 / -1;
  padding: 16px 0;
}

/* ---- Listen Together participants ---- */
.lt-participants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 260px;
  overflow-y: auto;
}
.lt-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
}
.lt-participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  flex-shrink: 0;
}
.lt-participant-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
}
.lt-transfer-btn {
  font-size: 0.78rem;
  padding: 5px 12px !important;
}
.lt-kick-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50% !important;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
}
.lt-kick-btn:hover {
  color: #ff6961;
}

/* ================= Listen Together ================= */
/* Session bar — replaces the Listen Together button when a session is active */
.lt-session-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  animation: intro 0.4s var(--ease-spring);
}
.lt-session-bar[hidden] { display: none; }
.lt-bar-icon { font-size: 1.1rem; }
.lt-bar-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.lt-bar-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  background: rgba(92, 230, 195, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(92, 230, 195, 0.3);
}
.lt-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.82rem;
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease-spring), border-color 0.2s;
}
.lt-bar-btn svg { width: 14px; height: 14px; }
.lt-bar-btn:hover {
  background: var(--glass-hover);
  color: var(--text);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}
.lt-bar-btn:active { transform: scale(0.95); }
.lt-bar-leave:hover {
  color: #ff6961;
  border-color: rgba(255, 105, 97, 0.4);
}

/* Listen Together dialogs */
.lt-dialog {
  max-width: 420px;
  width: 90vw;
  text-align: center;
}
.lt-dialog h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 6px;
}
.lt-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 22px;
  line-height: 1.45;
}
.lt-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.lt-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 16px;
  border: var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  text-align: left;
  transition: background 0.25s, transform 0.25s var(--ease-spring), border-color 0.25s;
}
.lt-option:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
  border-color: rgba(10, 132, 255, 0.4);
}
.lt-option:active { transform: scale(0.98); }
.lt-option-icon { font-size: 1.8rem; flex-shrink: 0; }
.lt-option-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  display: block;
}
.lt-option-desc {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

/* Host dialog: code display */
.lt-code-display {
  margin: 16px 0 8px;
}
.lt-code {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: all;
}
.lt-host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 14px;
}
.lt-host-actions .pill-btn {
  font-size: 0.85rem;
  padding: 9px 16px;
}
.lt-leave-btn {
  background: rgba(255, 105, 97, 0.15) !important;
  border-color: rgba(255, 105, 97, 0.35) !important;
  color: #ff6961 !important;
}
.lt-leave-btn:hover {
  background: rgba(255, 105, 97, 0.28) !important;
  filter: brightness(1.1);
}

/* Join dialog: code input */
.lt-join-input-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
#lt-code-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 12px;
  border: var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
#lt-code-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: none;
}
#lt-code-input:focus {
  border-color: rgba(10, 132, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}
.lt-join-input-wrap .pill-btn {
  flex-shrink: 0;
}

/* Transfer host: empty participants */
.lt-empty-participants {
  color: var(--text-dim);
  font-size: 0.88rem;
  padding: 18px 0;
  font-style: italic;
}

/* Dialog close button shared style */
.lt-dialog-close {
  width: 100%;
  justify-content: center;
}

/* ================= Queue view ================= */
.queue-section {
  margin-bottom: 24px;
}
.queue-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-left: 4px;
}
.queue-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.6);
  border: var(--glass-border);
  margin-bottom: 8px;
  transition: background 0.25s, transform 0.25s var(--ease-spring);
  animation: card-in 0.5s var(--ease-spring) backwards;
}
.queue-track:hover {
  background: var(--glass-hover);
  transform: translateX(3px);
}
.queue-track.active {
  border-color: rgba(10, 132, 255, 0.5);
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.18), rgba(92, 230, 195, 0.06));
}
.queue-track-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.queue-track-cover {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.queue-track-info {
  flex: 1;
  min-width: 0;
}
.queue-track-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-track-by {
  color: var(--text-dim);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-remove {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.queue-remove:hover {
  color: #ff6961;
  background: rgba(255, 105, 97, 0.15);
  transform: scale(1.1);
}
#btn-queue.lit {
  color: var(--accent-2);
}

/* ================= Creator section (premium) ================= */
.creator-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px 28px;
  border-radius: 24px;
  margin: 46px 0 20px;
  overflow: hidden;
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%),
    radial-gradient(120% 160% at 100% 100%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 55%),
    var(--glass-bg);
  backdrop-filter: var(--glass-blur) saturate(1.6);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.6);
  border: 1px solid transparent;
  animation: card-in 0.7s var(--ease-spring) backwards;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s;
}
/* Animated gradient ring around the card */
.creator-section::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2), transparent 55%, var(--accent));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: creator-border 8s linear infinite;
  pointer-events: none;
}
@keyframes creator-border { to { background-position: 300% center; } }
.creator-section:hover { transform: translateY(-4px); box-shadow: 0 30px 60px rgba(0,0,0,0.5); }

.creator-avatar {
  position: relative;
  width: 66px; height: 66px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent),
              inset 0 2px 4px rgba(255,255,255,0.4);
}
.creator-avatar span {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.75rem; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* Pulsing halo */
.creator-avatar::after {
  content: ""; position: absolute; inset: -5px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-2) 60%, transparent);
  animation: pulse 2.4s ease-out infinite;
}

.creator-info { flex: 1; min-width: 0; }
.creator-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-2);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
  margin-bottom: 8px;
}
.creator-name {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.32rem; letter-spacing: -0.02em;
  margin-bottom: 7px;
  background: linear-gradient(110deg, #ffffff 25%, var(--accent-2) 55%,
    color-mix(in srgb, var(--accent) 60%, #fff) 80%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
}
.creator-bio {
  color: var(--text-dim);
  font-size: 0.92rem; line-height: 1.6; font-weight: 400;
  max-width: 60ch;
}
.creator-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.creator-chip {
  font-size: 0.78rem; font-weight: 500;
  padding: 5px 13px; border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}
.creator-chip:hover { transform: translateY(-2px); background: var(--glass-hover); }

@media (max-width: 600px) {
  .creator-section { flex-direction: column; text-align: center; padding: 24px 18px; }
  .creator-chips { justify-content: center; }
  .creator-bio { margin: 0 auto; }
}

/* ================= Reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  .btn-float, .bg-orb, .track-eq span, .brand-name, .logo-tile { animation: none; }
  .sidebar, .search-box, .toolbar, #view-home, .track, .trend-card,
  .mode-card, .pl-row { animation: none; }
  .track, .cover-wrap, .mood-card, .trend-card { transform: none !important; }
}

/* ================= Premium mobile ================= */
@media (max-width: 900px) {
  .shell {
    display: block;
    padding: 20px 16px 260px;
  }
  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
    overflow-x: auto;
  }
  .side-brand { flex-shrink: 0; }
  .side-brand .brand-name { font-size: 1.35rem; }
  .tagline { display: none; }
  .side-nav { flex-direction: row; gap: 6px; }
  .nav-btn { padding: 9px 13px; border-radius: 999px; white-space: nowrap; }
  .nav-btn:hover { transform: none; }

  /* Distinct mobile typography: bigger, airier, serif-accented */
  .brand-xl { font-size: clamp(2.6rem, 12vw, 3.4rem) !important; }
  .mode-title { font-size: 1.08rem; }
  .track-name { font-size: 1rem; letter-spacing: -0.02em; }
  .track-by { font-size: 0.83rem; font-weight: 300; letter-spacing: 0; }
  #fact-text { font-size: 1.05rem; }
  .section-head { font-size: 0.9rem; letter-spacing: 0.12em; }

  .search-box { padding: 6px 6px 6px 16px; }
  .search-btn { padding: 11px 18px; font-size: 0.92rem; }
  .toolbar { flex-wrap: wrap; }

  .mood-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .mood-card { padding: 15px 6px 12px; font-size: 0.8rem; border-radius: 15px; }
  .mood-emoji { font-size: 1.45rem; }

  .trend-row { grid-auto-columns: 132px; }

  .track { padding: 11px 12px; gap: 11px; border-radius: 18px; }
  .track-cover { width: 56px; height: 56px; border-radius: 13px; }
  .track-duration { display: none; }
  .row-btn { width: 34px; height: 34px; }

  /* Docked glass sheet player with larger touch targets */
  .player {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px) * 0.4);
    border-radius: 30px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(30px) saturate(1.8);
    -webkit-backdrop-filter: blur(30px) saturate(1.8);
  }
  .player-right { justify-content: center; }
  .vol-icon, .volume { display: none; }

  .cover-wrap { width: 60px; height: 60px; border-radius: 15px; }
  .track-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.02em; }
  .track-artist { font-size: 0.85rem; font-weight: 300; }

  .controls { gap: 14px; }
  .ctrl-btn { width: 48px; height: 48px; }
  .ctrl-btn svg { width: 21px; height: 21px; }
  .play-btn { width: 62px; height: 62px; }
  .play-btn svg { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
}

@media (max-width: 420px) {
  .mood-grid { grid-template-columns: repeat(2, 1fr); }
  .mood-card { flex-direction: row; justify-content: center; gap: 8px; padding: 13px 8px; }
  .mood-emoji { font-size: 1.25rem; }
  .controls { gap: 10px; }
  .mini-btn { width: 34px; height: 34px; }
}

/* ================= Layered upgrade: themes, search matrix, cards ========= */
[hidden] { display: none !important; }

/* Sidebar & player read themed hues (fallback = original glass look) */
.sidebar { background: var(--sidebar-bg, var(--glass-bg)); }
.player  { background: var(--player-bg, var(--glass-bg)); }
[data-theme] .orb-1 { background: var(--orb-1); }
[data-theme] .orb-2 { background: var(--orb-2); }
[data-theme] .orb-3 { background: var(--orb-3); }

/* ---- 6 premium themes (distinct sidebar / panel / player hues) ---- */
:root[data-theme="royal-sapphire"] {
  --bg: #060a16; --accent: #3b6fff; --accent-2: #57d6ff; --accent-soft: rgba(59,111,255,0.85);
  --glass-bg: rgba(120,150,255,0.09);
  --sidebar-bg: linear-gradient(180deg, rgba(37,58,120,0.6), rgba(14,22,52,0.45));
  --player-bg: linear-gradient(90deg, rgba(18,30,72,0.88), rgba(30,20,70,0.82));
  --orb-1: #1b3a8a; --orb-2: #263a9e; --orb-3: #123063;
}
:root[data-theme="dark-horizon"] {
  --bg: #0a0a0f; --accent: #7c5cff; --accent-2: #b98cff; --accent-soft: rgba(124,92,255,0.85);
  --glass-bg: rgba(150,130,255,0.08);
  --sidebar-bg: linear-gradient(180deg, rgba(30,26,52,0.62), rgba(14,12,22,0.5));
  --player-bg: linear-gradient(90deg, rgba(20,18,30,0.9), rgba(40,26,66,0.82));
  --orb-1: #2a2350; --orb-2: #3a2a66; --orb-3: #151226;
}
:root[data-theme="velvet-moss"] {
  --bg: #070d0a; --accent: #4caf6a; --accent-2: #c9d67a; --accent-soft: rgba(76,175,106,0.85);
  --glass-bg: rgba(150,220,160,0.08);
  --sidebar-bg: linear-gradient(180deg, rgba(34,52,38,0.62), rgba(16,26,20,0.5));
  --player-bg: linear-gradient(90deg, rgba(18,30,22,0.9), rgba(34,44,20,0.82));
  --orb-1: #1e3a28; --orb-2: #3a4420; --orb-3: #16281c;
}
:root[data-theme="crimson-eclipse"] {
  --bg: #0d0608; --accent: #e0475f; --accent-2: #ff9d7a; --accent-soft: rgba(224,71,95,0.85);
  --glass-bg: rgba(255,140,150,0.08);
  --sidebar-bg: linear-gradient(180deg, rgba(58,24,32,0.62), rgba(22,10,14,0.5));
  --player-bg: linear-gradient(90deg, rgba(28,12,16,0.92), rgba(46,14,22,0.82));
  --orb-1: #4a1620; --orb-2: #2a0e14; --orb-3: #3a1218;
}
:root[data-theme="neon-wave"] {
  --bg: #070516; --accent: #c04bff; --accent-2: #22d3ee; --accent-soft: rgba(192,75,255,0.85);
  --glass-bg: rgba(190,120,255,0.1);
  --sidebar-bg: linear-gradient(180deg, rgba(40,20,80,0.64), rgba(12,14,40,0.5));
  --player-bg: linear-gradient(90deg, rgba(16,14,44,0.9), rgba(46,16,80,0.82));
  --orb-1: #3a1878; --orb-2: #142060; --orb-3: #6a1e9e;
}
:root[data-theme="classic-slate"] {
  --bg: #0c0e12; --accent: #8aa0c0; --accent-2: #cfd8e8; --accent-soft: rgba(138,160,192,0.85);
  --glass-bg: rgba(200,210,230,0.07);
  --sidebar-bg: linear-gradient(180deg, rgba(52,58,68,0.58), rgba(22,26,32,0.5));
  --player-bg: linear-gradient(90deg, rgba(6,7,10,0.96), rgba(14,16,22,0.92));
  --orb-1: #2a3038; --orb-2: #20252e; --orb-3: #333a45;
}
:root[data-theme="spotify"] {
  --bg: #000000; --accent: #1ed760; --accent-2: #1db954; --accent-soft: rgba(30,215,96,0.85);
  --glass-bg: rgba(255,255,255,0.055);
  --glass-hover: rgba(255,255,255,0.12);
  --sidebar-bg: linear-gradient(180deg, #0a0a0a, #000000);
  --player-bg: linear-gradient(90deg, #181818, #101010);
  --orb-1: #0b3b1f; --orb-2: #07341c; --orb-3: #0a2a16;
}

/* ---- Search matrix ---- */
.search-wrap { position: relative; }
.search-filters { display: flex; gap: 8px; margin-top: 12px; }
.filter-pill {
  border: 1px solid rgba(255,255,255,0.18); background: var(--glass-bg); color: var(--text-dim);
  padding: 7px 15px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.86rem; font-weight: 500;
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s var(--ease-spring);
}
.filter-pill:hover { color: var(--text); transform: translateY(-2px); }
.filter-pill.active { color: #fff; border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 40%, transparent), color-mix(in srgb, var(--accent-2) 22%, transparent)); }

.reco-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  border-radius: 18px; padding: 8px; max-height: 340px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  animation: reco-in 0.25s var(--ease-spring);
}
@keyframes reco-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.reco-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: none; background: transparent;
  border-radius: 12px; cursor: pointer; text-align: left; font: inherit; color: var(--text);
  transition: background 0.18s, transform 0.18s; }
.reco-item:hover { background: var(--glass-hover); transform: translateX(3px); }
.reco-item img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.reco-text { display: flex; flex-direction: column; min-width: 0; }
.reco-title { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reco-by { color: var(--text-dim); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Theme selector mirrors the language selector */
#theme-select { background: transparent; border: none; outline: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
#theme-select option { background: #12141c; color: #fff; }

/* ---- Card "add to queue" overlay ---- */
.trend-cover-box { position: relative; }
.card-queue {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 10px;
  opacity: 0; transform: translateY(-6px); background: rgba(10,14,24,0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.18);
}
.trend-card:hover .card-queue { opacity: 1; transform: translateY(0); }

/* Spotify-style floating play button */
.card-play {
  position: absolute; bottom: 8px; right: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: none; cursor: pointer; color: #06131a;
  background: linear-gradient(145deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 70%, var(--accent)));
  box-shadow: 0 8px 20px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.25) inset;
  opacity: 0; transform: translateY(10px) scale(0.85);
  transition: opacity 0.28s var(--ease-spring), transform 0.28s var(--ease-spring), filter 0.2s;
}
.card-play svg { width: 20px; height: 20px; margin-left: 2px; }
.trend-card:hover .card-play { opacity: 1; transform: translateY(0) scale(1); }
.card-play:hover { filter: brightness(1.1); transform: translateY(-2px) scale(1.06); }
.card-play:active { transform: scale(0.94); }

/* ================= 3D particle-field background ================= */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  display: block;
}

/* ================= Synced lyrics panel ================= */
#lyrics-panel {
  position: fixed;
  right: 16px;
  top: 80px;
  bottom: calc(var(--player-h) + 40px + env(safe-area-inset-bottom, 0px));
  width: min(350px, calc(100vw - 32px));
  z-index: 45;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 10px;
  animation: reco-in 0.35s var(--ease-spring);
}
.lyrics-head { display: flex; align-items: center; justify-content: space-between; }
.lyrics-head .section-head { margin-bottom: 0; }
.lyrics-meta {
  color: var(--text-dim); font-size: 0.84rem; margin: 8px 2px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lyrics-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px;
  padding: 10px 6px 45%;
  mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 30px), transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 30px), transparent);
}
.lyrics-body::-webkit-scrollbar { width: 5px; }
.lyrics-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.lyric-line {
  color: var(--text-dim);
  font-size: 1.04rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transform-origin: left center;
  transition: color 0.3s, transform 0.3s var(--ease-spring), text-shadow 0.3s, opacity 0.3s;
  opacity: 0.75;
}
.lyric-line:hover { color: var(--text); opacity: 1; }
.lyric-line.static { cursor: default; }
.lyric-line.active {
  color: #fff;
  opacity: 1;
  font-weight: 700;
  transform: scale(1.05) translateX(5px);
  text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 75%, transparent),
               0 0 44px color-mix(in srgb, var(--accent-2) 35%, transparent);
}

/* On wide screens, dock the panel beside the content instead of over it */
@media (min-width: 1560px) {
  body.lyrics-visible .shell { transform: translateX(-180px); transition: transform 0.5s var(--ease-spring); }
}
@media (max-width: 900px) {
  #lyrics-panel {
    left: 10px; right: 10px; width: auto;
    top: auto; height: 44vh;
    bottom: calc(226px + env(safe-area-inset-bottom, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  #lyrics-panel { animation: none; }
}
