/* ============================================================
   SONAR — Telegram Mini App
   ============================================================ */
:root {
  --bg: #07060d;
  --bg-2: #0e0b1a;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --surface-3: rgba(255, 255, 255, .12);
  --stroke: rgba(255, 255, 255, .08);
  --text: #f5f3ff;
  --muted: #a29dbd;
  --dim: #6d6889;
  --violet: #9b6bff;
  --violet-2: #7c8cff;
  --mint: #3cf0b4;
  --pink: #ff5fa2;
  --grad: linear-gradient(135deg, var(--violet) 0%, var(--violet-2) 50%, var(--mint) 100%);
  --grad-soft: linear-gradient(135deg, color-mix(in srgb, var(--violet) 35%, transparent), color-mix(in srgb, var(--mint) 25%, transparent));
  --grad-line: linear-gradient(90deg, var(--violet), var(--mint));
  --grad-fav: linear-gradient(135deg, color-mix(in srgb, var(--violet) 70%, #000), var(--violet) 45%, #ff5fa2);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --tabs-h: 64px;
  --mini-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  min-height: 100vh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 24px; height: 24px; flex: none; }
img { display: block; }
[hidden] { display: none !important; }

img.fade { opacity: 0; transition: opacity .45s var(--ease); }
img.fade.ok { opacity: 1; }

/* ---------- background aurora ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(80px); opacity: .32; will-change: transform;
}
.aurora i:nth-child(1) { background: var(--violet); top: -35vmax; left: -25vmax; animation: drift1 22s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: var(--mint); bottom: -40vmax; right: -30vmax; opacity: .22; animation: drift2 26s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: var(--violet-2); top: 30vh; left: 40vw; width: 40vmax; height: 40vmax; opacity: .12; animation: drift1 30s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(12vw, 10vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-14vw, -8vh) scale(1.1); } }

/* ---------- splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 22px;
  background: var(--bg); transition: opacity .6s var(--ease), visibility .6s;
}
#splash.out { opacity: 0; visibility: hidden; }
.splash-logo { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.splash-logo img { width: 120px; height: 120px; animation: pop .8s var(--spring) both; filter: drop-shadow(0 0 24px color-mix(in srgb, var(--violet) 60%, transparent)); }
.splash-logo .ring {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--mint); opacity: 0;
  animation: ping 2s var(--ease) infinite;
}
.splash-logo .r2 { animation-delay: .5s; border-color: var(--violet-2); }
.splash-logo .r3 { animation-delay: 1s; border-color: var(--violet); }
.splash-name {
  font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .3em; padding-left: .3em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise .8s .2s var(--ease) both;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* ---------- layout ---------- */
.view {
  min-height: 100vh;
  padding: 14px 16px calc(var(--tabs-h) + var(--safe-b) + 28px);
}
body.has-mini .view { padding-bottom: calc(var(--tabs-h) + var(--mini-h) + var(--safe-b) + 36px); }
.view > * { animation: viewIn .5s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .12s; }
.view > *:nth-child(5) { animation-delay: .16s; }
.view > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(16px); } }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 28px 2px 12px; font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -.01em;
}
.section-title a { font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 2px 6px; }
.topbar .logo { width: 38px; height: 38px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--violet) 50%, transparent)); }
.topbar .hello { flex: 1; min-width: 0; line-height: 1.15; }
.topbar .hello small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.topbar .hello b { font-size: 18px; font-weight: 800; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--grad); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px color-mix(in srgb, var(--violet) 50%, transparent); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- "Моя волна" hero ---------- */
.wave-hero {
  position: relative; margin-top: 14px; min-height: 230px; padding: 22px; border-radius: 28px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  background: radial-gradient(120% 140% at 0% 0%, #241a4d 0%, #120e26 55%, #0b1b1a 100%);
  border: 1px solid var(--stroke);
  isolation: isolate;
  transition: transform .3s var(--ease);
}
.wave-hero:active { transform: scale(.985); }
.orb { position: absolute; right: -40px; top: 50%; width: 260px; height: 260px; transform: translateY(-50%); z-index: -1; }
.orb i {
  position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: screen; filter: blur(18px);
  animation: spin 9s linear infinite;
}
.orb i:nth-child(1) { background: conic-gradient(from 0deg, var(--violet), transparent 40%, var(--mint) 70%, transparent); }
.orb i:nth-child(2) { inset: 30px; background: conic-gradient(from 120deg, var(--violet-2), transparent 50%, var(--accent-3, #ff5fa2) 80%, transparent); animation-duration: 6s; animation-direction: reverse; opacity: .75; }
.orb i:nth-child(3) { inset: 70px; background: radial-gradient(circle, #fff 0%, #c9b8ff 30%, transparent 70%); filter: blur(10px); animation: breathe 3.5s ease-in-out infinite; }
.wave-hero.playing .orb i:nth-child(1) { animation-duration: 3s; }
.wave-hero.playing .orb i:nth-child(2) { animation-duration: 2.2s; }
.wave-hero.playing .orb i:nth-child(3) { animation-duration: 1.1s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.18); opacity: .8; } }

.wave-lines { position: absolute; left: 0; bottom: 0; width: 100%; height: 90px; z-index: -1; opacity: .5; }
.wave-lines path { fill: none; stroke-width: 2; stroke: url(#g-brand); stroke-dasharray: 6 8; animation: dash 8s linear infinite; }
.wave-lines path:nth-child(2) { opacity: .5; animation-duration: 12s; }
@keyframes dash { to { stroke-dashoffset: -280; } }

.wave-info { max-width: 64%; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: color-mix(in srgb, var(--mint) 12%, transparent); color: var(--mint); border: 1px solid color-mix(in srgb, var(--mint) 25%, transparent);
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.wave-info h1 { margin: 14px 0 6px; font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.wave-info p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; font-weight: 600; }
.wave-play {
  margin-top: 18px; height: 46px; padding: 0 20px 0 14px; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14.5px;
  background: #fff; color: #120e26; box-shadow: 0 10px 30px color-mix(in srgb, var(--violet) 45%, transparent);
  transition: transform .25s var(--spring);
}
.wave-play:active { transform: scale(.94); }
.wave-play svg { width: 22px; height: 22px; }

/* ---------- moods ---------- */
.moods { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 84px); grid-auto-columns: 168px; gap: 10px; }
.mood {
  position: relative; border-radius: 18px; padding: 12px 14px; overflow: hidden; display: flex; align-items: flex-end;
  font-weight: 800; font-size: 14.5px; line-height: 1.15; background: var(--mood, var(--grad)); isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); transition: transform .25s var(--spring);
}
.mood:active { transform: scale(.95); }
.mood .art {
  position: absolute; right: -8px; top: -4px; width: 78px; height: 78px; z-index: -1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .35)); animation: float 4s ease-in-out infinite; animation-delay: calc(var(--d, 0s) * -1);
}
.mood::before { content: ""; position: absolute; width: 90px; height: 90px; right: -20px; top: -20px; border-radius: 50%; background: rgba(255, 255, 255, .18); filter: blur(14px); z-index: -2; }
.mood::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .28)); z-index: -1; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.mood-cover img { width: 62%; height: 62%; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .4)); animation: float 5s ease-in-out infinite; }

/* ---------- horizontal scrollers ---------- */
.hscroll {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px 6px; scroll-padding: 16px;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

.card { width: 138px; cursor: pointer; }
.card .cover {
  position: relative; width: 138px; height: 138px; border-radius: 16px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35); transition: transform .3s var(--ease);
}
.card:active .cover { transform: scale(.95); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .cover .play-fab {
  position: absolute; right: 8px; bottom: 8px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(10, 8, 20, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .15); transition: transform .25s var(--spring);
}
.card .cover .play-fab svg { width: 18px; height: 18px; }
.card.current .cover { box-shadow: 0 0 0 2px var(--mint), 0 10px 30px color-mix(in srgb, var(--mint) 30%, transparent); }
.card b { display: block; margin-top: 9px; font-size: 13.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- track rows ---------- */
.tracks { display: flex; flex-direction: column; gap: 2px; }
.track {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 7px 6px; margin: 0 -6px; border-radius: 14px;
  cursor: pointer; transition: background .2s;
}
.track:active { background: var(--surface); }
.track .rank { width: 22px; text-align: center; font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--dim); flex: none; }
.track .rank.top { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.track .thumb { position: relative; width: 50px; height: 50px; border-radius: 11px; overflow: hidden; background: var(--surface-2); flex: none; }
.track .thumb img { width: 100%; height: 100%; object-fit: cover; }
.track .meta { flex: 1; min-width: 0; }
.track .meta b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .meta span { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .dur { font-size: 12.5px; color: var(--dim); font-weight: 700; font-variant-numeric: tabular-nums; }
.track .liked { color: var(--pink); width: 16px; height: 16px; }
.track .more { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); flex: none; }
.track .more:active { background: var(--surface-2); }
.track .more svg { width: 20px; height: 20px; }
.track.current .meta b { color: var(--mint); }
.track .eq {
  position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 14px;
  background: rgba(7, 6, 13, .55);
}
.track.current .eq { display: flex; }
.eq i { width: 4px; border-radius: 2px; background: var(--mint); height: 30%; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
body:not(.is-playing) .eq i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 70%; } }

/* drag reorder */
.track .grip { width: 34px; height: 40px; display: none; place-items: center; color: var(--dim); touch-action: none; flex: none; }
.tracks.sorting .track .grip { display: grid; }
.tracks.sorting .track .more { display: none; }
.track.dragging { z-index: 5; background: var(--bg-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px var(--stroke); transition: none; }

/* ---------- skeleton ---------- */
.sk { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-3) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.sk-row .a { width: 50px; height: 50px; }
.sk-row .b { flex: 1; display: grid; gap: 7px; }
.sk-row .b i { display: block; height: 12px; }
.sk-row .b i:last-child { width: 55%; }

/* ---------- search ---------- */
.search-head { position: sticky; top: 0; z-index: 5; margin: -14px -16px 0; padding: 14px 16px 12px; background: linear-gradient(var(--bg) 70%, transparent); }
.search-head h1 { margin: 6px 2px 14px; font-family: var(--display); font-size: 26px; font-weight: 800; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--stroke); transition: border-color .25s, box-shadow .25s;
}
.search-box:focus-within { border-color: color-mix(in srgb, var(--violet) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 15%, transparent); }
.search-box svg { color: var(--muted); width: 22px; height: 22px; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 600; }
.search-box input::placeholder { color: var(--dim); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .clear { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); }
.search-box .clear svg { width: 14px; height: 14px; color: var(--text); }

.sonar-empty { display: grid; justify-items: center; text-align: center; padding: 40px 10px 10px; }
.radar { position: relative; width: 150px; height: 150px; margin-bottom: 18px; }
.radar::before, .radar::after, .radar i {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--violet) 35%, transparent);
}
.radar::after { inset: 25px; border-color: color-mix(in srgb, var(--violet-2) 35%, transparent); }
.radar i:nth-child(1) { inset: 50px; border-color: color-mix(in srgb, var(--mint) 45%, transparent); }
.radar i:nth-child(2) {
  border: 0; background: conic-gradient(from 0deg, color-mix(in srgb, var(--mint) 45%, transparent), transparent 25%);
  animation: spin 2.4s linear infinite;
}
.radar i:nth-child(3) { inset: 66px; border: 0; background: var(--grad); box-shadow: 0 0 24px var(--violet); }
.radar.scanning i:nth-child(2) { animation-duration: .9s; }
.sonar-empty h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.sonar-empty p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; font-weight: 600; max-width: 300px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  padding: 9px 14px; border-radius: 99px; font-size: 13.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--stroke); transition: transform .2s var(--spring), background .2s;
}
.chip:active { transform: scale(.94); background: var(--surface-2); }

/* ---------- library ---------- */
.page-title { margin: 8px 2px 16px; font-family: var(--display); font-size: 26px; font-weight: 800; }
.fav-card {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 22px; overflow: hidden;
  background: var(--grad-fav); cursor: pointer; isolation: isolate;
  box-shadow: 0 16px 40px color-mix(in srgb, var(--violet) 30%, transparent); transition: transform .3s var(--ease);
}
.fav-card:active { transform: scale(.98); }
.fav-card::before { content: ""; position: absolute; width: 220px; height: 220px; right: -60px; top: -90px; border-radius: 50%; background: rgba(255, 255, 255, .14); z-index: -1; }
.fav-card .ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: rgba(255, 255, 255, .18); backdrop-filter: blur(6px); }
.fav-card .ic svg { width: 28px; height: 28px; }
.fav-card b { display: block; font-size: 19px; font-weight: 800; }
.fav-card span { font-size: 13.5px; font-weight: 700; opacity: .85; }
.fav-card > svg { margin-left: auto; opacity: .8; }

.pl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pl { cursor: pointer; min-width: 0; }
.pl .cover { aspect-ratio: 1; border-radius: 18px; overflow: hidden; transition: transform .3s var(--ease); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.pl:active .cover { transform: scale(.96); }
.pl b { display: block; margin-top: 9px; font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pl.new .cover {
  display: grid; place-items: center; background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--violet) 45%, transparent); box-shadow: none;
}
.pl.new .cover .plus { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); box-shadow: 0 8px 24px color-mix(in srgb, var(--violet) 40%, transparent); color: #fff; }
.pl.new .cover .plus svg { width: 28px; height: 28px; }

.mosaic { width: 100%; height: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic.one { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.solid-cover { width: 100%; height: 100%; display: grid; place-items: center; font-size: 48px; background: var(--pl-grad, var(--grad)); }

/* ---------- collection page (playlist / favorites / mood) ---------- */
.coll-head { position: relative; display: grid; justify-items: center; text-align: center; padding: 6px 0 4px; }
.coll-head::before {
  content: ""; position: absolute; left: -16px; right: -16px; top: -14px; height: 320px; z-index: -1;
  background: var(--coll-glow, radial-gradient(60% 70% at 50% 20%, color-mix(in srgb, var(--violet) 35%, transparent), transparent 70%));
}
.coll-cover { width: 200px; height: 200px; border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
.coll-cover .solid-cover { font-size: 76px; }
.coll-head h1 { margin: 18px 0 4px; font-family: var(--display); font-size: 24px; font-weight: 800; line-height: 1.15; }
.coll-head p { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.coll-actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0 14px; }
.round-btn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); transition: transform .2s var(--spring), background .2s; }
.round-btn:active { transform: scale(.9); }
.round-btn.on { background: color-mix(in srgb, var(--mint) 18%, transparent); color: var(--mint); }
.round-btn svg { width: 22px; height: 22px; }
.big-play {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--violet) 50%, transparent); transition: transform .25s var(--spring);
}
.big-play:active { transform: scale(.9); }
.big-play svg { width: 30px; height: 30px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-weight: 600; font-size: 14.5px; line-height: 1.5; }
.empty .big { font-size: 48px; margin-bottom: 10px; }

/* ---------- mini player ---------- */
.mini {
  position: fixed; z-index: 30; left: 10px; right: 10px; bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); height: var(--mini-h);
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px; border-radius: 18px; overflow: hidden;
  background: rgba(26, 21, 46, .78); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: miniIn .5s var(--spring) both; cursor: pointer;
}
@keyframes miniIn { from { transform: translateY(120%); opacity: 0; } }
.mini-progress { position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--grad); }
.mini-cover { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; background: var(--surface-2); }
body.is-playing .mini-cover { animation: none; }
.mini-meta { flex: 1; min-width: 0; line-height: 1.25; }
.mini-meta b { display: block; font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-meta span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; transition: transform .2s var(--spring), color .2s; }
.icon-btn:active { transform: scale(.85); }
.icon-btn.liked, .like-btn.liked { color: var(--pink); }
.icon-btn.liked svg { animation: heartPop .45s var(--spring); }
@keyframes heartPop { 40% { transform: scale(1.35); } }
.mini .play-btn { background: #fff; color: #120e26; width: 40px; height: 40px; }
.mini .play-btn svg { width: 20px; height: 20px; }
.mini.loading .play-btn svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: rgba(9, 7, 17, .82); backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.tabs a { position: relative; flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--dim); font-size: 11px; font-weight: 800; transition: color .25s; }
.tabs a svg { width: 24px; height: 24px; transition: transform .35s var(--spring); }
.tabs a.active { color: var(--text); }
.tabs a.active svg { transform: translateY(-2px) scale(1.1); color: var(--mint); }
.tabs-glow {
  position: absolute; top: -1px; height: 2px; width: calc(100% / 4 - 32px); left: 16px; border-radius: 2px;
  background: var(--grad); box-shadow: 0 0 14px var(--violet); transition: transform .45s var(--spring);
}

/* ---------- full player ---------- */
.player {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; padding: 12px 22px calc(var(--safe-b) + 22px);
  background: var(--bg); transform: translateY(100%); transition: transform .5s var(--ease); overflow: hidden; isolation: isolate;
  touch-action: pan-x;
}
.player.open { transform: none; }
.player-bg { position: absolute; inset: -60px; z-index: -1; background-size: cover; background-position: center; filter: blur(60px) saturate(1.6) brightness(.55); transform: scale(1.2); transition: background-image .6s; }
.player-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 6, 13, .2), rgba(7, 6, 13, .85) 75%); }
.player-head { display: flex; align-items: center; gap: 8px; }
.player-source { flex: 1; text-align: center; line-height: 1.2; min-width: 0; }
.player-source small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.player-source b { display: block; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-cover-wrap { position: relative; flex: 1; display: grid; place-items: center; min-height: 0; padding: 18px 0; }
.player-cover {
  width: min(84vw, 46vh, 400px); aspect-ratio: 1; border-radius: 26px; object-fit: cover; background: var(--surface-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); transform: scale(.86); transition: transform .7s var(--spring), opacity .3s;
}
body.is-playing .player-cover { transform: scale(1); }
.player-cover.swap { opacity: 0; transform: scale(.8) !important; }
.player-glow { position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--grad); filter: blur(70px); opacity: .0; z-index: -1; transition: opacity .7s; }
body.is-playing .player-glow { opacity: .35; animation: breathe 4s ease-in-out infinite; }
.player-meta { display: flex; align-items: center; gap: 12px; }
.player-titles { flex: 1; min-width: 0; }
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
.player-title { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 800; white-space: nowrap; display: inline-block; }
.player-title.scroll { animation: marquee 12s linear infinite; padding-right: 40px; }
@keyframes marquee { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--shift, -50%)); } }
.player-artist { margin: 4px 0 0; color: var(--muted); font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.like-btn svg { width: 28px; height: 28px; }
.player-progress { margin-top: 22px; }
.seek {
  --p: 0%; --b: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; touch-action: none;
}
.seek::-webkit-slider-runnable-track {
  height: 5px; border-radius: 5px;
  background: var(--grad-line) 0 / var(--p) 100% no-repeat, linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, .22)) 0 / var(--b) 100% no-repeat, rgba(255, 255, 255, .1);
}
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 30%, transparent), 0 2px 8px rgba(0, 0, 0, .4); transition: transform .2s; }
.seek:active::-webkit-slider-thumb { transform: scale(1.3); }
.seek::-moz-range-track { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .12); }
.seek::-moz-range-progress { height: 5px; border-radius: 5px; background: var(--grad); }
.seek::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #fff; }
.times { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.player-controls { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 22px; }
.icon-btn.big svg { width: 34px; height: 34px; }
.icon-btn.mode { color: var(--muted); position: relative; }
.icon-btn.mode.on { color: var(--mint); }
.icon-btn.mode.on::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--mint); }
.play-main {
  position: relative; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #120e26;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--violet) 55%, transparent); transition: transform .25s var(--spring);
}
.play-main:active { transform: scale(.9); }
.play-main svg { width: 34px; height: 34px; }
.play-main .spinner { position: absolute; inset: -5px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--mint); border-right-color: var(--violet); opacity: 0; transition: opacity .2s; animation: spin .8s linear infinite; }
.player.loading .play-main .spinner { opacity: 1; }
.player-bottom { display: flex; justify-content: space-between; gap: 8px; }
.pill-btn {
  flex: 1; height: 42px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .08); transition: transform .2s var(--spring), background .2s;
}
.pill-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .14); }
.pill-btn svg { width: 18px; height: 18px; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 82vh; display: flex; flex-direction: column;
  padding: 8px 16px calc(var(--safe-b) + 16px); border-radius: 26px 26px 0 0;
  background: #14102a; border-top: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
  transform: translateY(105%); transition: transform .45s var(--ease);
}
.sheet.open { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .2); margin: 2px auto 12px; flex: none; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; }
.sheet-body > * { animation: viewIn .35s var(--ease) both; }
.sheet-track { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--stroke); }
.sheet-track img { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.sheet-track b { display: block; font-size: 15.5px; font-weight: 800; }
.sheet-track span { font-size: 13px; color: var(--muted); font-weight: 600; }
.sheet h3 { margin: 4px 4px 14px; font-family: var(--display); font-size: 18px; font-weight: 700; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 8px; border-radius: 14px; font-size: 15.5px; font-weight: 700; text-align: left; transition: background .2s; }
.menu-item:active { background: var(--surface-2); }
.menu-item svg { width: 22px; height: 22px; color: var(--muted); }
.menu-item.danger, .menu-item.danger svg { color: #ff6b81; }
.menu-item .pl-mini { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex: none; }
.menu-item .pl-mini .solid-cover { font-size: 20px; }
.menu-item small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.menu-item .tick { margin-left: auto; color: var(--mint); }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin: 0 4px 8px; font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.text-input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--stroke); outline: 0;
  background: var(--surface-2); font-size: 16px; font-weight: 700; transition: border-color .2s, box-shadow .2s;
}
.text-input:focus { border-color: color-mix(in srgb, var(--violet) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 15%, transparent); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 12px; font-size: 22px; background: var(--surface); transition: transform .2s var(--spring), background .2s; }
.emoji-grid button.sel { background: var(--grad-soft); box-shadow: inset 0 0 0 2px var(--violet); transform: scale(1.05); }
.color-row { display: flex; gap: 10px; }
.color-row button { width: 38px; height: 38px; border-radius: 50%; background: var(--c); transition: transform .2s var(--spring); }
.color-row button.sel { box-shadow: 0 0 0 3px #14102a, 0 0 0 5px #fff; transform: scale(1.08); }
.primary-btn {
  width: 100%; height: 54px; border-radius: 16px; font-size: 16px; font-weight: 800; color: #fff; background: var(--grad);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--violet) 40%, transparent); transition: transform .2s var(--spring), opacity .2s;
}
.primary-btn:active { transform: scale(.97); }
.primary-btn:disabled { opacity: .5; }
.ghost-btn { width: 100%; height: 48px; margin-top: 8px; border-radius: 14px; font-weight: 800; color: #ff6b81; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; top: 12px; left: 16px; right: 16px; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 800;
  background: rgba(30, 24, 56, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  animation: toastIn .45s var(--spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { transform: translateY(-30px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
