/* Musicsstef — тёмный музыкальный плеер */
:root {
  --bg: #121212;
  --bg-elev: #1e1e1e;
  --card: #1e1e1e;
  --card-2: #282828;
  --card-hover: #2f2f2f;
  --text: #ffffff;
  --text-2: #b3b3b3;
  --text-3: #7a7a7a;
  --accent: #1ed760;
  --accent-press: #1aa34a;
  --on-accent: #000000;
  --line: rgba(255, 255, 255, .08);
  --danger: #f15e6c;
  --radius: 8px;
  --radius-lg: 14px;
  --ease: cubic-bezier(.22, 1, .36, 1);  /* мягкий выход без «щелчка» в конце */
  --spd: 1;          /* скорость анимаций из настроек: 1.6 медленно … 0.7 быстро */
  --cover-r: 8px;
  /* отступы под вырез и системные панели: браузер (env), Telegram (--tg-*), Android-приложение (--safe-area-*) */
  --sat: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --tabbar-h: 58px;
  --mini-h: 56px;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f4f4f4;
  --card: #f2f2f2;
  --card-2: #e8e8e8;
  --card-hover: #e0e0e0;
  --text: #121212;
  --text-2: #5c5c5c;
  --text-3: #8e8e8e;
  --accent: #14b350;
  --accent-press: #108f40;
  --line: rgba(0, 0, 0, .08);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; }
.hidden { display: none !important; }

/* ---------- иконки ---------- */
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); transition: transform .15s var(--ease), color .15s; }
.icon-btn:active { transform: scale(.88); }
.icon-btn.big svg.i { width: 30px; height: 30px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.on::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 30px; }
.icon-btn { position: relative; }

/* ---------- раскладка ---------- */
#app { min-height: 100%; }
#views { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 16px); }
body.has-mini #views { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--sab) + 24px); }
.view { min-height: 100vh; padding: calc(var(--sat) + 12px) 16px 0; animation: viewIn calc(.32s * var(--spd)) var(--ease); }
.view.back-anim { animation: viewBack calc(.32s * var(--spd)) var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes viewBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.view.tab-anim { animation: fadeIn calc(.26s * var(--spd)) var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 14px; }
h2 { font-size: 21px; font-weight: 800; letter-spacing: -.015em; margin: 26px 0 12px; }

/* ---------- шапка главной ---------- */
.home-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 32px; padding: 0 14px; border-radius: 16px; background: var(--card-2); color: var(--text); font-size: 14px; white-space: nowrap; transition: background .2s, color .2s, transform .12s; }
.chip:active { transform: scale(.95); }
.chip.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---------- плитки 2×4 ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { display: flex; align-items: center; gap: 0; height: 56px; background: var(--card-2); border-radius: 6px; overflow: hidden; text-align: left; transition: background .15s, transform .12s var(--ease); }
.tile:active { transform: scale(.97); background: var(--card-hover); }
.tile .cov { width: 56px; height: 56px; flex: none; }
.tile b { flex: 1; min-width: 0; padding: 0 10px; font-size: 13px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.playing b { color: var(--accent); }

/* ---------- обложки ---------- */
.cov { background: var(--card-2) center/cover no-repeat; position: relative; overflow: hidden; }
.cov img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.cov img.ok { opacity: 1; }
.cov .ph { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; color: var(--text-3); }
.cov .ph svg.i { width: 40%; height: 40%; }
.cov.liked { background: linear-gradient(135deg, #0d7a6f, #1ed760 60%, #c8f560); }
.cov.liked .ph { color: #fff; }
.cov.mosaic { display: grid; grid-template-columns: 1fr 1fr; }
.cov.mosaic img { opacity: 1; }

/* ---------- карусели ---------- */
.carousel { display: flex; gap: 14px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.card { flex: none; width: 140px; scroll-snap-align: start; text-align: left; transition: transform .12s var(--ease); }
.card:active { transform: scale(.96); }
.card .cov { width: 140px; height: 140px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.card .ct { margin-top: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cs { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.card.playing .ct { color: var(--accent); }

/* ---------- список треков ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 7px 0; text-align: left; width: 100%; border-radius: 6px; transition: background .15s; }
.row:active { background: var(--card); }
.row .cov { width: 48px; height: 48px; border-radius: 4px; flex: none; }
.row.round .cov { border-radius: 50%; }
.row .rm { flex: 1; min-width: 0; }
.row .rt { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .rs { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.row .rs svg.i { width: 14px; height: 14px; color: var(--accent); }
.row.playing .rt { color: var(--accent); }
.row .more { width: 36px; height: 36px; color: var(--text-2); }
.row .num { width: 22px; text-align: center; color: var(--text-2); font-size: 14px; flex: none; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; height: 12px; background: var(--accent); border-radius: 1px; transform-origin: 50% 100%; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: none; } }

/* ---------- поиск ---------- */
.searchbox { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(var(--sat) + 8px) 16px 10px; margin: calc(-1 * (var(--sat) + 12px)) -16px 6px; }
.field { display: flex; align-items: center; gap: 10px; height: 46px; background: var(--text); color: #121212; border-radius: 8px; padding: 0 12px; }
html[data-theme="light"] .field { background: var(--card-2); color: var(--text); }
.field svg.i { color: #555; }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: inherit; height: 100%; }
.field button { color: #555; }
.empty { text-align: center; color: var(--text-2); padding: 48px 20px; }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }

/* ---------- кнопки ---------- */
.btn { height: 44px; padding: 0 22px; border-radius: 22px; background: var(--accent); color: var(--on-accent); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; justify-content: center; transition: transform .12s var(--ease), background .15s; }
.btn:active { transform: scale(.96); background: var(--accent-press); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--text-3); }
.btn.small { height: 32px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .5; }

/* ---------- заголовок плейлиста ---------- */
.topbar { display: flex; align-items: center; gap: 8px; margin: -4px -8px 4px; min-height: 40px; }
.topbar .icon-btn { color: var(--text); }
.pl-head { display: flex; flex-direction: column; align-items: center; padding: 6px 0 14px; position: relative; }
.pl-head::before { content: ""; position: absolute; top: -200px; right: -16px; bottom: -20px; left: -16px; background: linear-gradient(to bottom, var(--hero, #2a4a3a), transparent); opacity: .55; z-index: -1; pointer-events: none; }
.pl-head .cov { width: 200px; height: 200px; border-radius: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.pl-title { align-self: stretch; font-size: 24px; font-weight: 800; margin: 18px 0 4px; letter-spacing: -.015em; }
.pl-sub { align-self: stretch; color: var(--text-2); font-size: 13px; }
.pl-actions { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.pl-actions .spacer { flex: 1; }
.fab { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; transition: transform .12s var(--ease); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.fab:active { transform: scale(.92); }
.fab svg.i { width: 28px; height: 28px; }

/* ---------- медиатека ---------- */
.lib-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.lib-head h1 { margin: 0; flex: 1; font-size: 24px; }
.lib-head .icon-btn { color: var(--text); }
.sortbar { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 13px; margin: 12px 0 4px; }
.sortbar button { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-size: 13px; font-weight: 600; }

/* ---------- добавление ---------- */
.add-hint { color: var(--text-2); font-size: 14px; margin: -6px 0 14px; }
.add-form { display: flex; gap: 8px; }
.add-form .field { flex: 1; }
.add-form .btn { height: 46px; border-radius: 8px; padding: 0 16px; }
.job { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border-radius: 10px; margin-bottom: 8px; animation: fadeIn .25s var(--ease); }
.job .jm { flex: 1; min-width: 0; }
.job .jt { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .js { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.job .js.err { color: var(--danger); white-space: pre-line; }
.job .bar { height: 3px; background: var(--card-2); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.job .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.job .bar.indet i { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.job .st { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); }
.job .st.err { color: var(--danger); }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--card-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result .btn { flex: none; }
.result .cov { width: 64px; height: 48px; }

/* ---------- мини-плеер ---------- */
.mini {
  position: fixed; left: 8px; right: 8px; z-index: 20;
  bottom: calc(var(--tabbar-h) + var(--sab) + 4px);
  height: var(--mini-h); display: flex; align-items: center; gap: 2px; padding: 0 4px 0 8px;
  background: var(--mini-bg, #3a3a3a); border-radius: 8px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  transition: background .6s, transform .3s var(--ease), opacity .3s;
  animation: miniIn calc(.38s * var(--spd)) var(--ease);
}
@keyframes miniIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.mini-hit { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mini-hit:active { opacity: .85; }
.mini-btn { width: 44px; height: 44px; flex: none; }
.mini-cover { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--card-2); flex: none; }
.mini-meta { flex: 1; min-width: 0; }
.mini-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.mini-artist { font-size: 12px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { color: #fff; }
.mini .icon-btn.on { color: var(--accent); }
.mini .icon-btn.on::after { display: none; }
.mini-progress { position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: rgba(255, 255, 255, .2); border-radius: 1px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; width: 0; background: #fff; }

/* ---------- нижняя навигация ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 19;
  height: calc(var(--tabbar-h) + var(--sab)); padding-bottom: var(--sab);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(to top, var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent));
}
#tabbar::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; background: linear-gradient(to top, rgba(0,0,0,.6), transparent); pointer-events: none; }
html[data-theme="light"] #tabbar::before { background: none; }
#tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text-2); transition: color .15s; }
#tabbar button.active { color: var(--text); }
#tabbar button:active .ti { transform: scale(.85); }
#tabbar .ti { display: grid; transition: transform .15s var(--ease); }
#tabbar .ti svg.i { width: 26px; height: 26px; }

/* ---------- полноэкранный плеер ---------- */
.player {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; background: var(--bg);
  transform: translateY(100%); transition: transform calc(.42s * var(--spd)) var(--ease), visibility 0s calc(.42s * var(--spd)); visibility: hidden;
  color: #fff;
}
.player.open { transform: none; visibility: visible; transition: transform calc(.42s * var(--spd)) var(--ease), visibility 0s; }
.player.dragging { transition: none; }
.player-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(to bottom, var(--pbg, #3a3a3a) 0%, #121212 85%); transition: background .8s; }
.player-inner { position: relative; height: 100%; display: flex; flex-direction: column; padding: calc(var(--sat) + 8px) 24px calc(var(--sab) + 16px); max-width: 520px; margin: 0 auto; }
.player-head { display: flex; align-items: center; justify-content: space-between; }
.player-head .icon-btn { color: #fff; }
.player-src { text-align: center; min-width: 0; flex: 1; }
.player-src small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.player-src b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-art { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 20px 0; }
.art-track { position: relative; width: 100%; max-width: min(100%, 52vh); max-width: min(100cqw, 100cqh); aspect-ratio: 1; will-change: transform; }
.art-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--cover-r); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); background: #282828; transition: transform .35s var(--ease), border-radius .3s var(--ease), box-shadow .6s; }
.player.held .art-img { transform: scale(.94); }


/* трек грузится — кольцо вокруг кнопки «играть» */
.play-btn { position: relative; }
.play-btn::after, .mini-play::before { content: ""; position: absolute; top: -6px; right: -6px; bottom: -6px; left: -6px; border-radius: 50%; border: 2.5px solid transparent;
  border-top-color: var(--accent); opacity: 0; pointer-events: none; transition: opacity .2s; }
.mini-play::before { top: 2px; right: 2px; bottom: 2px; left: 2px; }
body.buffering .play-btn::after, body.buffering .mini-play::before { opacity: 1; animation: spin .9s linear infinite; }
.mini-hit { will-change: transform; }
.player-meta { display: flex; align-items: center; gap: 12px; }
.pm-text { flex: 1; min-width: 0; }
.player-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 15px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.player-meta .icon-btn { color: rgba(255, 255, 255, .85); }
.player-meta .icon-btn.on { color: var(--accent); }
.player-meta .icon-btn.on::after { display: none; }
.seek { margin-top: 18px; }
.seek input { width: 100%; height: 20px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; --p: 0%; }
.seek input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, .25) var(--p)); }
.seek input::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; margin-top: -4.5px; border: 0; }
.seek input::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.seek input::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.seek input::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
.seek-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255, 255, 255, .65); margin-top: 4px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.controls .icon-btn { color: #fff; width: 48px; height: 48px; }
.controls .icon-btn.big svg.i { width: 36px; height: 36px; }
.controls .icon-btn[data-act="shuffle"], .controls .icon-btn[data-act="repeat"] { color: rgba(255, 255, 255, .8); }
.controls .icon-btn.on { color: var(--accent) !important; }
.play-btn { width: 68px; height: 68px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; transition: transform .12s var(--ease); }
.play-btn:active { transform: scale(.92); }
.play-btn svg.i { width: 34px; height: 34px; }
.player-foot { display: flex; justify-content: space-between; margin-top: 18px; }
.player-foot .icon-btn { color: rgba(255, 255, 255, .8); }
.badge-one { position: absolute; font-size: 8px; font-weight: 800; top: 9px; right: 10px; }

/* ---------- нижний лист ---------- */
.sheet { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; }
.sheet-backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .6); animation: fade calc(.25s * var(--spd)); }
@keyframes fade { from { opacity: 0; } }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto;
  background: var(--bg-elev); border-radius: 14px 14px 0 0; padding: 6px 16px calc(var(--sab) + 16px);
  animation: sheetIn calc(.36s * var(--spd)) var(--ease); max-width: 640px; margin: 0 auto;
}
.sheet.closing .sheet-panel { animation: sheetOut calc(.22s * var(--spd)) cubic-bezier(.5, 0, .75, 0) forwards; }
.sheet.closing .sheet-backdrop { animation: fade calc(.22s * var(--spd)) reverse forwards; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--text-3); margin: 4px auto 10px; opacity: .6; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head .cov { width: 48px; height: 48px; border-radius: 4px; }
.sheet-head .rt { font-weight: 700; }
.sheet-head .rs { color: var(--text-2); font-size: 13px; }
.sheet-title { font-weight: 800; font-size: 18px; margin: 4px 0 10px; }
.act { display: flex; align-items: center; gap: 16px; width: 100%; padding: 13px 2px; text-align: left; font-size: 16px; border-radius: 6px; }
.act:active { background: var(--card-2); }
.act svg.i { color: var(--text-2); }
.act.danger, .act.danger svg.i { color: var(--danger); }
.act.on svg.i { color: var(--accent); }
.sheet .field { margin: 6px 0 14px; }
.sheet-btns { display: flex; gap: 10px; justify-content: flex-end; }
.q-label { font-size: 13px; color: var(--text-2); font-weight: 700; margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; z-index: 80; bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--sab) + 18px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: 8px; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- экран входа ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; gap: 10px; }
.gate img { width: 88px; height: 88px; margin-bottom: 10px; }
.gate h1 { margin: 0; }
.gate p { color: var(--text-2); margin: 0; max-width: 320px; }

/* скелетоны */
.sk { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 700px) {
  .view { max-width: 900px; margin: 0 auto; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .card, .card .cov { width: 170px; }
  .card .cov { height: 170px; }
}
@media (hover: hover) {
  .tile:hover, .row:hover { background: var(--card-hover); }
  .row:hover { background: var(--card); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.buffering .play-btn::after, body.buffering .mini-play::before { animation: spin 1.6s linear infinite !important; }
}

/* ---------- v4: аккаунт, поиск по источникам, выбор, загрузка ---------- */
.avatar { position: relative; overflow: hidden; padding: 0; border: 0; cursor: pointer; }
.avatar img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 56px; height: 56px; font-size: 22px; }
.account { display: flex; align-items: center; gap: 14px; padding: 6px 0 14px; }
.acc-name { font-size: 18px; font-weight: 800; }
.acc-name small { font-weight: 500; color: var(--text-2); font-size: 14px; }
.quota { padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.qbar { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.qbar i { display: block; height: 100%; background: var(--accent); }
.hint { color: var(--text-2); font-size: 13px; }
p.hint { margin: 8px 0; }
h2.sec { display: flex; align-items: baseline; gap: 8px; }
h2.sec small { font-size: 13px; color: var(--text-2); font-weight: 600; }
.src-chips { margin: 0 -16px 8px; padding: 0 16px; }
.src-chips .chip { height: 30px; font-size: 13px; }
.web-status { min-height: 18px; margin: 2px 0 6px; }
.rs .src { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 5px; border-radius: 4px; background: var(--card-2); color: var(--text-2); text-transform: uppercase; }
.rs .tag { flex: none; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.rs .hrt { display: inline-flex; }
.rs > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.web-row .cov { border-radius: 4px; }
.web-row .icon-btn { width: 40px; height: 40px; color: var(--text); flex: none; }
.web-row .add { color: var(--accent); }
.web-row .add.done { color: var(--accent); }
.web-row .add.dis { opacity: .35; }
.web-row .spin { width: 18px; height: 18px; }
.upload-tile { display: flex; align-items: center; gap: 14px; width: 100%; margin: 14px 0 4px; padding: 14px; text-align: left; border-radius: 10px; background: var(--card); transition: background .15s, transform .12s var(--ease); }
.upload-tile:active { transform: scale(.98); background: var(--card-2); }
.upload-tile svg.i { width: 30px; height: 30px; color: var(--accent); }
.upload-tile b { display: block; }
.upload-tile small { color: var(--text-2); font-size: 12px; }
.sortbar .up { color: var(--accent); }
.cov.own { background: linear-gradient(135deg, #3a1c71, #d76d77 55%, #ffaf7b); }
.cov.own .ph { color: #fff; }
.player-badge { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,.15); color: #fff; }
.player-foot .icon-btn.hidden { display: none; }
.seek input:disabled { opacity: .5; }
.check { width: 24px; height: 24px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--text-3); display: grid; place-items: center; color: transparent; transition: background .15s, box-shadow .15s; }
.check svg.i { width: 16px; height: 16px; }
.check.on { background: var(--accent); box-shadow: none; color: var(--on-accent); }
.selbar {
  position: fixed; left: 8px; right: 8px; z-index: 25; bottom: calc(var(--tabbar-h) + var(--sab) + 4px);
  height: var(--mini-h); display: flex; align-items: center; gap: 8px; padding: 0 8px;
  background: var(--card-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: miniIn .3s var(--ease);
}
.selbar .spacer { flex: 1; }
.selbar .icon-btn { color: var(--text); }
body.selecting #mini { visibility: hidden; }

/* ---------- v5: лимиты и админ-раздел ---------- */
.limits { padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.limits .quota { border: 0; padding: 6px 0; margin: 0; }
.qrow { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.qrow span:last-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.qbar.warn i { background: #f5a524; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; }
.stat-grid > div { background: var(--card); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 11px; color: var(--text-2); line-height: 1.2; }
.mode-desc { margin: 6px 0 10px; }
.users .avatar { width: 40px; height: 40px; flex: none; }
.users .rt small { font-weight: 400; }
.rs .tag.ban { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
@media (max-width: 360px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.gate-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin: 14px 0 6px; }
.gate-btns .btn { width: 100%; text-decoration: none; }
.gate .hint { max-width: 320px; }

/* ---------- бренд: экран загрузки и шапка ---------- */
#splash { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: #000; display: grid; place-items: center; transition: opacity .35s var(--ease), visibility .35s; }
#splash img { width: min(46vw, 220px); height: auto; animation: splash-in .6s var(--ease) both; }
#splash i { position: absolute; bottom: calc(var(--sab) + 56px); width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(13, 222, 92, .25); border-top-color: #0dde5c; animation: spin .9s linear infinite; }
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splash-in { from { opacity: 0; transform: scale(.92); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #splash img, #splash i { animation: none; } }
.brandbar { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.brandbar .brand-logo { height: 30px; width: auto; }
.brandbar b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.brandbar .avatar { width: 34px; height: 34px; }
.gate .gate-logo { width: 150px; height: auto; margin-bottom: 14px; }

/* ---------- рекомендации ---------- */
.shelf-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.shelf-head h2 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-head small { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.cov.mixcov { --mc: #1ed760; background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 55%, #000), #111); }
.cov.mixcov img { filter: saturate(1.05); }
.cov.mixcov::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 2; background: linear-gradient(to top, color-mix(in srgb, var(--mc) 85%, #000) 0%, transparent 46%); pointer-events: none; }
.mix-label { position: absolute; z-index: 3; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.01em; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cov.mixcov.big .mix-label { font-size: 24px; bottom: 14px; }
.card.mix .cov { width: 150px; height: 150px; }
.card.mix { width: 150px; }
.card-add { position: absolute; z-index: 3; right: 6px; bottom: 6px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, .72); color: #fff; display: grid; place-items: center; transition: transform .12s var(--ease), background .2s; }
.card-add:active { transform: scale(.88); }
.card-add.done { background: var(--accent); color: var(--on-accent); }
.card-add svg.i { width: 20px; height: 20px; }
.onboard { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 14px 0 4px; border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(13, 222, 92, .22), rgba(13, 222, 92, .05)); border: 1px solid rgba(13, 222, 92, .25); }
.onboard img { width: 44px; height: auto; flex: none; }
.onboard div { flex: 1; min-width: 0; }
.onboard b { display: block; font-size: 15px; margin-bottom: 2px; }
.onboard span { color: var(--text-2); font-size: 13px; }
.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.ob-groups { max-height: 46vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.ob-btns { position: sticky; bottom: 0; padding-top: 12px; background: var(--bg-elev); }
.ob-add { margin-bottom: 4px; }

/* ---------- приложение: нет сети, вход через Telegram ---------- */
.netbar { position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(var(--sat) + 8px); display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: #3a1d1d; color: #ffd7d7; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: netIn .25s var(--ease); }
.netbar svg.i { width: 18px; height: 18px; color: #ff8a8a; }
@keyframes netIn { from { opacity: 0; transform: translateY(-8px); } }
.btn.tg-login { background: #2aabee; color: #fff; }
.btn.tg-login:disabled { opacity: .6; }
.login-status { min-height: 2.6em; }
.resume-btn { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--sab) + 18px); display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 24px; background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.resume-btn svg.i { width: 20px; height: 20px; }

/* диагностика (долгое нажатие на логотип) */
.brand-logo { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.diag-note { width: 100%; min-height: 64px; margin: 6px 0 10px; padding: 10px 12px; border-radius: 12px; border: 0; background: var(--bg-2, rgba(255,255,255,.06)); color: var(--text); font: inherit; resize: vertical; }
.diag-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.diag-log { max-height: 46vh; overflow: auto; margin: 0; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.35); color: var(--text-2); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
.resume-btn.big { padding: 18px 30px; font-size: 18px; border-radius: 32px; bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--sab) + 40px); }
.resume-btn.big svg.i { width: 26px; height: 26px; }
.safe-note { margin: 12px 0; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.05); }
.safe-note p { margin: 0 0 10px; }

/* Узнать песню */
.rec-ov { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); text-align: center; overflow-y: auto; }
.rec-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; }
.rec-body { width: 100%; max-width: 340px; }
.rec-body h2 { margin: 18px 0 6px; font-size: 22px; overflow-wrap: anywhere; }
.rec-body p { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.rec-pulse { position: relative; width: 112px; height: 112px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #000; }
.rec-pulse::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; background: var(--accent); opacity: .35; animation: rec-pulse 1.5s ease-out infinite; }
.rec-pulse svg.i { position: relative; width: 52px; height: 52px; }
@keyframes rec-pulse { to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rec-pulse::before { animation: none; } }
.rec-left { font-variant-numeric: tabular-nums; }
.rec-spin { margin: 0 auto; }
.rec-cover { position: relative; width: min(240px, 66vw); aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: var(--card); color: var(--text-2); }
.rec-cover img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.rec-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.rec-actions .btn { flex: 1; }
.rec-link { margin-top: 16px; padding: 10px; background: none; border: 0; color: var(--text-2); font: inherit; }
.rec-stack { flex-direction: column; align-items: stretch; }
.rec-stack .btn { flex: none; }
.rec-stack .rec-link { margin-top: 2px; }

/* караоке-текст: обложка рассыпается пикселями, фон — её основной цвет, на её месте текст */
.player-bg::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: color-mix(in srgb, var(--pbg, #3a3a3a) 78%, #000);
  opacity: 0; transition: opacity .6s var(--ease), background .8s; }
.player.lyrics-on .player-bg::after { opacity: 1; }
.art-pixels { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
.player.pixeling .art-pixels { display: block; }
.player.art-gone .art-img { visibility: hidden; }
.player-art { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lyrics { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility 0s .25s;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 80%, transparent);
  mask-image: linear-gradient(transparent, #000 16%, #000 80%, transparent); }
.lyrics::-webkit-scrollbar { display: none; }
.player.lyrics-on .lyrics { opacity: 1; visibility: visible; transition: opacity calc(.4s * var(--spd)) var(--ease) calc(.55s * var(--spd)), visibility 0s; }
.lyrics-scroll { padding: 26% 2px 48%; }
.lyr-line { margin: 0 0 .55em; font-size: calc(clamp(22px, 6.4vw, 30px) * var(--lyr-scale, 1)); font-weight: 800; line-height: 1.22; letter-spacing: -.01em;
  color: rgba(255, 255, 255, .34); transition: color .35s, opacity .35s; }
.lyr-line.past { color: rgba(255, 255, 255, .62); }
/* текущая строка заполняется белым слева направо; у строки в несколько рядов заливка идёт ряд за рядом */
.lyr-line.cur span { background: linear-gradient(90deg, var(--lyr-fill, #fff) calc(var(--p, 0%) - 4%), rgba(255, 255, 255, .34) calc(var(--p, 0%) + 4%));
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-box-decoration-break: slice; box-decoration-break: slice; }
.lyr-gap span { display: inline-flex; gap: 8px; padding: 6px 0; background: none !important; }
.lyr-gap i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .34); }
.lyr-gap.cur i { background: var(--lyr-fill, #fff); animation: lyr-dot 1.2s ease-in-out infinite; }
.lyr-gap.cur i:nth-child(2) { animation-delay: .15s; } .lyr-gap.cur i:nth-child(3) { animation-delay: .3s; }
@keyframes lyr-dot { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
.lyrics-plain { white-space: pre-line; font-size: 19px; font-weight: 700; line-height: 1.45; color: rgba(255, 255, 255, .88); }
.lyrics-note, .lyrics-src { font-size: 12px; color: rgba(255, 255, 255, .55); margin: 0 0 14px; }
.lyrics-src { margin-top: 26px; }
.lyrics-msg { font-size: 18px; font-weight: 700; color: rgba(255, 255, 255, .8); text-align: center; margin-top: 20%; }
.lyrics-skel { display: grid; gap: 16px; }
.lyrics-skel .sk { display: block; height: 26px; background: linear-gradient(90deg, rgba(255,255,255,.08) 25%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.08) 75%); background-size: 200% 100%; }
@media (prefers-reduced-motion: reduce) { .lyr-gap.cur i { animation: none; } }

/* ---------- настройки ---------- */
.icon-btn.gear { margin-left: auto; color: var(--text); }
.lib-head .icon-btn.gear { margin-left: 0; }
.settings { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--sab) + 40px); }
.set-h1 { font-size: 30px; font-weight: 800; margin: 4px 0 16px; }
.set-profile { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border-radius: var(--radius-lg); background: var(--card); color: var(--text); text-align: left; }
.set-profile .avatar { width: 52px; height: 52px; flex: none; }
.sp-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sp-name b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-name small { color: var(--text-2); font-size: 13px; }
.sp-chev { color: var(--text-3); transform: rotate(180deg); display: flex; }
.set-sec { margin-top: 26px; }
.set-sec h2 { font-size: 17px; font-weight: 800; margin: 0 0 12px; }
.set-sec h3 { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 14px 0 8px; }
.set-hint { font-size: 12.5px; color: var(--text-2); margin: 10px 0 0; line-height: 1.4; }
.set-hint.center { text-align: center; margin-top: 14px; }
.set-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.set-chip { padding: 9px 14px; border-radius: 999px; background: var(--card-2); color: var(--text); font-size: 14px; font-weight: 600;
  transition: background .25s var(--ease), color .25s, transform .15s; }
.set-chip:active { transform: scale(.96); }
.set-chip.on { background: var(--accent); color: var(--on-accent); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 12px; }
.swatch { position: relative; aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform .2s var(--ease); }
.swatch:active { transform: scale(.9); }
.swatch.on::after { content: ""; position: absolute; top: -5px; right: -5px; bottom: -5px; left: -5px; border-radius: 50%; border: 2.5px solid var(--text); }
.sw-cover { background: conic-gradient(from 30deg, #ff5f5f, #ffd23f, #3ee6b0, #4aa8ff, #c39bff, #ff5f5f); }
.sw-cover::before { content: ""; position: absolute; top: 28%; right: 28%; bottom: 28%; left: 28%; border-radius: 4px; background: #111; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.sw-custom { background: var(--c); cursor: pointer; overflow: visible; }
.sw-custom::before { content: "+"; position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff;
  border-radius: 50%; background: conic-gradient(rgba(255,0,0,.45), rgba(255,255,0,.45), rgba(0,255,0,.45), rgba(0,255,255,.45), rgba(0,0,255,.45), rgba(255,0,255,.45), rgba(255,0,0,.45)); }
.sw-custom input { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.set-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.set-tile { display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-lg); background: var(--card); color: var(--text); font-size: 13px;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .25s var(--ease), transform .15s; }
.set-tile:active { transform: scale(.97); }
.set-tile.on { box-shadow: inset 0 0 0 2px var(--accent); }
.set-tile b { font-weight: 700; }
.tile-bg { display: block; height: 54px; border-radius: 8px; }
.bgprev-cover { background: linear-gradient(#7a5b2a, #121212 90%); }
.bgprev-solid { background: #6a4f22; }
.bgprev-aura { background: radial-gradient(circle at 30% 30%, #b07a2e, transparent 55%), radial-gradient(circle at 75% 70%, #5a3c8c, transparent 55%), #101010; }
.bgprev-accent { background: linear-gradient(color-mix(in srgb, var(--accent) 60%, #000), #0b0b0b 90%); }
.bgprev-dark { background: #121212; box-shadow: inset 0 0 0 1px var(--line); }
.bgprev-black { background: #000; box-shadow: inset 0 0 0 1px var(--line); }
.tile-art { position: relative; display: block; height: 64px; perspective: 160px; }
.tile-art i { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 4px; background: var(--card-2); }
.tile-art i:nth-child(1) { background: var(--accent); }
.tile-single i:not(:first-child) { display: none; }
.tile-single i:first-child { width: 44px; height: 44px; margin: -22px; }
.tile-flow i:nth-child(1) { z-index: 3; }
.tile-flow i:nth-child(2) { transform: translateX(-26px) translateZ(-20px) rotateY(60deg); }
.tile-flow i:nth-child(3) { transform: translateX(26px) translateZ(-20px) rotateY(-60deg); }
.tile-flow i:nth-child(4) { transform: translateX(-40px) translateZ(-30px) rotateY(60deg); opacity: .6; }
.tile-flow i:nth-child(5) { transform: translateX(40px) translateZ(-30px) rotateY(-60deg); opacity: .6; }
.tile-stack i { width: 46px; height: 46px; margin: -23px; }
.tile-stack i:nth-child(1) { z-index: 3; transform: scale(.8); }
.tile-stack i:nth-child(2) { transform: translateY(-20px) translateZ(-14px) rotateX(58deg); }
.tile-stack i:nth-child(3) { transform: translateY(20px) translateZ(-14px) rotateX(-58deg); }
.tile-stack i:nth-child(4) { transform: translateY(-30px) translateZ(-24px) rotateX(58deg); opacity: .6; }
.tile-stack i:nth-child(5) { transform: translateY(30px) translateZ(-24px) rotateX(-58deg); opacity: .6; }
.set-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; cursor: pointer; }
.set-switch span { display: grid; gap: 2px; }
.set-switch b { font-size: 15px; font-weight: 600; }
.set-switch small { font-size: 12.5px; color: var(--text-2); }
.set-switch input { position: absolute; opacity: 0; pointer-events: none; }
.set-switch i { flex: none; position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--card-2); transition: background .25s var(--ease); }
.set-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .3s var(--ease); }
.set-switch input:checked + i { background: var(--accent); }
.set-switch input:checked + i::after { transform: translateX(18px); }
.set-reset { width: 100%; margin-top: 30px; }
/* превью: мини-плеер с текущими настройками; нажатие показывает анимацию смены трека */
.set-preview { position: relative; display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px; border-radius: var(--radius-lg);
  overflow: hidden; color: #fff; cursor: pointer; isolation: isolate;
  background: linear-gradient(to bottom, var(--pbg, #3a3a3a), #121212 160%); }
.set-preview.pbg-solid { background: color-mix(in srgb, var(--pbg) 80%, #000); }
.set-preview.pbg-dark { background: #181818; }
.set-preview.pbg-black { background: #000; box-shadow: inset 0 0 0 1px var(--line); }
.set-preview.pbg-accent { background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 55%, #000), #0b0b0b 160%); }
.set-preview.pbg-aura { background: #0d0d0d; }
.set-preview.pbg-aura::before { content: ""; position: absolute; top: -40%; right: -40%; bottom: -40%; left: -40%; z-index: -1; filter: blur(30px);
  background: radial-gradient(circle at 30% 35%, color-mix(in srgb, var(--pbg) 70%, #fff), transparent 45%), radial-gradient(circle at 70% 60%, color-mix(in srgb, var(--pbg) 60%, var(--accent)), transparent 50%);
  animation: aura calc(14s * var(--spd)) ease-in-out infinite alternate; }
.sp-stage { flex: none; width: 92px; height: 92px; }
.sp-art { position: relative; width: 100%; height: 100%; }
.sp-img, .sp-art .art-ghost { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-radius: var(--cover-r);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); backface-visibility: hidden; }
.cover-glow .sp-img { box-shadow: 0 8px 40px -4px color-mix(in srgb, var(--pbg) 80%, #fff); }
.sp-pixels { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: none; pointer-events: none; z-index: 3; }
.sp-meta { flex: 1; min-width: 0; display: grid; gap: 4px; }
.sp-meta b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-meta small { font-size: 12.5px; opacity: .75; }
.sp-bar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin-top: 6px; overflow: hidden; }
.sp-bar i { display: block; width: 38%; height: 100%; background: var(--accent); }
.sp-play { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; }

/* ---------- фон плеера ---------- */
.player.pbg-solid .player-bg { background: color-mix(in srgb, var(--pbg, #3a3a3a) 80%, #000); }
.player.pbg-dark .player-bg { background: #121212; }
.player.pbg-black .player-bg { background: #000; }
.player.pbg-accent .player-bg { background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 55%, #000) 0%, #0b0b0b 85%); }
.player.pbg-aura .player-bg { background: #0b0b0b; overflow: hidden; }
.player.pbg-aura .player-bg::before { content: ""; position: absolute; top: -35%; right: -35%; bottom: -35%; left: -35%; filter: blur(60px); opacity: .9; will-change: transform;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--pbg, #3a3a3a) 75%, #fff), transparent 42%),
    radial-gradient(circle at 72% 62%, color-mix(in srgb, var(--pbg, #3a3a3a) 65%, var(--accent)), transparent 46%),
    radial-gradient(circle at 40% 85%, var(--pbg, #3a3a3a), transparent 40%);
  animation: aura calc(16s * var(--spd)) ease-in-out infinite alternate; transition: background .8s; }
@keyframes aura { 0% { transform: translate3d(-6%, -4%, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(5%, 3%, 0) rotate(20deg) scale(1.08); }
  100% { transform: translate3d(-3%, 6%, 0) rotate(-12deg) scale(1.02); } }

/* ---------- обложка: форма, свечение, смена трека ---------- */
.player.cover-glow .art-img { box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 22px 90px -8px color-mix(in srgb, var(--pbg, #3a3a3a) 85%, #fff); }
.art-track .art-ghost { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 2; pointer-events: none; backface-visibility: hidden; }
.art-img { backface-visibility: hidden; }

/* ---------- карусель и стопка ---------- */
/* размер области обложки — от неё считаются размеры (container queries): телефон, планшет, альбомная, ПК */
.player-art { container-type: size; }
.flow { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; touch-action: none; overflow: hidden;
  transition: opacity calc(.3s * var(--spd)) var(--ease); user-select: none; -webkit-user-select: none; }
.flow-in { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }  /* плоский слой: глубина — внутри каждой карточки */
.flow-in > .fc, .flow-in > .sb { pointer-events: auto; }
.player.cover-flow .flow, .player.cover-stack .flow { display: block; }
.player.cover-flow .art-track, .player.cover-stack .art-track { visibility: hidden; }
.player.cover-flow .art-pixels { visibility: visible; }
.player.lyrics-on .flow { opacity: 0; pointer-events: none; }
/* карусель */
.fc { position: absolute; left: 50%; top: 50%; width: var(--fw); height: var(--fw); margin: calc(var(--fw) / -2) 0 0 calc(var(--fw) / -2);
  transform-style: preserve-3d; will-change: transform; cursor: pointer; }
.fc-face { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: var(--cover-r); overflow: hidden; background: #222; box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.fc-face img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.player.cover-flow:not(.no-reflect) .fc-face { -webkit-box-reflect: below 3px linear-gradient(transparent 62%, rgba(255,255,255,.22)); }
/* стопка: 3D-коробка — верх/низ обложка, передний торец — плашка с названием */
.player.cover-stack.pbg-cover .player-bg { background: #000; }
.sb { position: absolute; left: 50%; top: 50%; width: var(--bw); height: var(--bt); margin: calc(var(--bt) / -2) 0 0 calc(var(--bw) / -2);
  transform-style: preserve-3d; will-change: transform; cursor: pointer; }
.sb-front { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateZ(calc(var(--bd) / 2)); display: flex; align-items: center; justify-content: center;
  gap: .4em; padding: 0 14px; background: var(--sc, #2c2c2c); color: var(--st, #fff); font-size: calc(var(--bt) * .52); line-height: 1;
  white-space: nowrap; overflow: hidden; backface-visibility: hidden; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.3); }
.sb-front b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.sb-front span { opacity: .85; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.sb-face { position: absolute; left: 0; top: calc((var(--bt) - var(--bd)) / 2); width: var(--bw); height: var(--bd); overflow: hidden;
  backface-visibility: hidden; background: #1c1c1c; }
.sb-face img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sb-face::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; background: linear-gradient(rgba(0,0,0,0) 40%, rgba(0,0,0,.35)); }
.sb-top { transform: rotateX(90deg) translateZ(calc(var(--bt) / 2)); }
.sb-bottom { transform: rotateX(-90deg) translateZ(calc(var(--bt) / 2)); }
.sb-bottom::after { background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,0) 60%); }

/* ---------- без анимаций (настройки → скорость «Выкл») ---------- */
html.no-anim *, html.no-anim *::before, html.no-anim *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
html.no-anim body.buffering .play-btn::after, html.no-anim body.buffering .mini-play::before { animation: spin 1.6s linear infinite !important; }

/* ---------- плеер на широких и низких экранах ----------
   альбомная ориентация телефона, планшет, компьютер: обложка (карусель, стопка, текст) слева, управление справа */
@media (orientation: landscape) and (max-height: 620px), (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .player-inner { max-width: 1100px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 1fr); column-gap: clamp(20px, 4vw, 56px);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto minmax(0, 1fr);
    padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
  .player-head { grid-column: 1 / -1; grid-row: 1; }
  .player-art { grid-column: 1; grid-row: 2 / -1; padding: 12px 0; }
  .player-meta { grid-column: 2; grid-row: 3; }
  .seek { grid-column: 2; grid-row: 4; }
  .controls { grid-column: 2; grid-row: 5; }
  .player-foot { grid-column: 2; grid-row: 6; }
}
@media (orientation: landscape) and (max-height: 420px) {
  .player-inner { padding-top: calc(var(--sat) + 2px); padding-bottom: calc(var(--sab) + 6px); }
  .seek { margin-top: 8px; }
  .player-foot { margin-top: 8px; }
  .player-art { padding: 4px 0; }
}

/* ---------- v13: исполнители, инструменты, серии и значки, анимации карусели ---------- */
.artist-row .chev { color: var(--text-3); transform: rotate(180deg); display: flex; flex: none; }
.pl-head .cov.round { border-radius: 50%; }
.player-artist { cursor: pointer; }
.player-artist:active { opacity: .7; }
/* карусель/стопка: «Растворение» — новая раскладка проявляется без движения */
.flow-in.fade-in { animation: flowFade calc(.42s * var(--spd)) var(--ease); }
@keyframes flowFade { from { opacity: 0; } }
/* инструменты (лист из плеера) */
.fx-sec { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.fx-sec:last-of-type { border-bottom: 0; }
.fx-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 6px; }
.fx-head b { font-size: 15px; }
.fx-head span { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fx-range { width: 100%; height: 28px; margin: 0 0 8px; -webkit-appearance: none; appearance: none; background: transparent; }
.fx-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--card-2); }
.fx-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); margin-top: -9px; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.fx-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--card-2); }
.fx-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 0; }
.fx-ab { display: flex; gap: 8px; }
.fx-ab .btn { flex: 1; }
.fx-ab .btn.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.fx-switch { margin-top: 8px; padding: 6px 0; }
.fx-reset { width: 100%; margin-top: 14px; }
/* серия дней: огонёк на главной */
.streak { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px 0 6px; border-radius: 16px; background: var(--card-2); color: var(--text-2); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; transition: background .25s, color .25s, transform .12s; }
.streak:active { transform: scale(.95); }
.streak svg.i { width: 20px; height: 20px; }
.streak.on { color: #ff8a1f; background: color-mix(in srgb, #ff8a1f 18%, var(--card-2)); }
.streak-card { padding: 14px; border-radius: var(--radius-lg); background: var(--card); margin-bottom: 6px; }
.streak-card.lit { background: linear-gradient(135deg, color-mix(in srgb, #ff8a1f 28%, var(--card)), var(--card) 70%); }
.streak-big { display: flex; align-items: baseline; gap: 8px; }
.streak-big svg.i { width: 34px; height: 34px; color: #ff8a1f; align-self: center; }
.streak-card:not(.lit) .streak-big svg.i { color: var(--text-3); }
.streak-big b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.streak-big span { color: var(--text-2); font-size: 14px; }
.streak-week { display: flex; justify-content: space-between; margin: 14px 0 10px; }
.wk { display: grid; justify-items: center; gap: 4px; }
.wk i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--text-3); }
.wk i svg.i { width: 18px; height: 18px; }
.wk.on i { background: #ff8a1f; color: #fff; }
.wk.today i { box-shadow: 0 0 0 2px var(--text); }
.wk small { font-size: 11px; color: var(--text-2); }
.streak-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--text-2); }
.streak-foot b { color: var(--text); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 12px; background: var(--card); text-align: center; opacity: .55; }
.badge.earned { opacity: 1; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--card)), var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.badge .bi { font-size: 28px; line-height: 1; filter: grayscale(1); }
.badge.earned .bi { filter: none; }
.badge b { font-size: 12.5px; line-height: 1.15; }
.badge small { font-size: 10.5px; color: var(--text-2); line-height: 1.2; }
.badge .bp { display: block; width: 100%; height: 3px; border-radius: 2px; background: var(--card-2); overflow: hidden; margin-top: 4px; }
.badge .bp i { display: block; height: 100%; background: var(--accent); }
.set-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border-radius: var(--radius-lg); background: var(--card); color: var(--text); text-align: left; }
.set-ach { margin-top: 10px; }
.ach-ico { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #ffb020 22%, var(--card-2)); color: #ffb020; }
@media (max-width: 360px) { .badges { grid-template-columns: repeat(2, 1fr); } }

/* закрытый плеер не крутит фон-«ауру» и спиннеры: телефон не тратит силы, пока листаешь главную */
.player:not(.open) .player-bg::before, .player:not(.open) .lyr-gap i { animation-play-state: paused; }

/* ---------- iOS до 16.2 и старые Android WebView: нет color-mix() — простые цвета вместо смесей ---------- */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  #tabbar { background: linear-gradient(to top, var(--bg) 55%, transparent); }
  .rs .tag { background: rgba(128,128,128,.2); }
  .rs .tag.ban { background: rgba(128,128,128,.2); }
  .cov.mixcov { background: linear-gradient(160deg, var(--mc), #111); }
  .cov.mixcov::after { background: linear-gradient(to top, var(--mc) 0%, transparent 46%); }
  .player-bg::after { background: var(--pbg, #3a3a3a); box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.22); }
  .bgprev-accent { background: linear-gradient(var(--accent), #0b0b0b 90%); }
  .set-preview.pbg-solid { background: var(--pbg); box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.2); }
  .set-preview.pbg-accent { background: linear-gradient(to bottom, var(--accent), #0b0b0b 160%); }
  .set-preview.pbg-aura::before { background: radial-gradient(circle at 30% 35%, var(--pbg), transparent 45%), radial-gradient(circle at 70% 60%, var(--pbg), transparent 50%); }
  .cover-glow .sp-img { box-shadow: 0 8px 40px -4px var(--pbg); }
  .player.pbg-solid .player-bg { background: var(--pbg, #3a3a3a); box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.2); }
  .player.pbg-accent .player-bg { background: linear-gradient(to bottom, var(--accent) 0%, #0b0b0b 85%); }
  .player.pbg-aura .player-bg::before { background: radial-gradient(circle at 30% 30%, var(--pbg, #3a3a3a), transparent 42%),
    radial-gradient(circle at 72% 62%, var(--pbg, #3a3a3a), transparent 46%),
    radial-gradient(circle at 40% 85%, var(--pbg, #3a3a3a), transparent 40%); }
  .player.cover-glow .art-img { box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 22px 90px -8px var(--pbg, #3a3a3a); }
  .streak.on { background: var(--card-2); }
  .streak-card.lit { background: linear-gradient(135deg, var(--card), var(--card) 70%); }
  .badge.earned { background: linear-gradient(180deg, var(--card), var(--card)); box-shadow: inset 0 0 0 1px rgba(128,128,128,.2); }
  .ach-ico { background: var(--card-2); }
}

/* ---------- iOS 12–14: нет aspect-ratio — квадраты задаём явными размерами ---------- */
@supports not (aspect-ratio: 1) {
  .art-track { width: 100%; max-width: none; width: calc(100vw - 48px); height: calc(100vw - 48px);
    width: min(calc(100vw - 48px), 52vh, 472px); height: min(calc(100vw - 48px), 52vh, 472px); }
  .rec-cover { height: 240px; height: min(240px, 66vw); }
  .swatch { height: 0; padding-top: 100%; }
}

/* ---------- поиск по словам песни ---------- */
.search-mode { margin: 10px 0 2px; }
.search-mode .chip svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.lyr-hit { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; font-size: 12.5px; line-height: 1.35; color: var(--text); opacity: .85; }
.lyr-hit svg { width: 12px; height: 12px; flex: none; margin-top: 2px; color: var(--accent); }
.lyr-hit span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-style: italic; }
.words-hint i { color: var(--text); }
/* предложение обновить Android-приложение */
.upd { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; text-align: center; }
.upd h2 { margin: 4px 0 0; }
.upd .hint { margin: 0 0 6px; }
/* экран въезжает сбоку (viewIn) — пока едет, страница не должна прокручиваться вбок (на iPhone её можно было «утянуть») */
#views { overflow-x: clip; }
@supports not (overflow: clip) { .view { animation-name: viewInFade; } }
@keyframes viewInFade { from { opacity: 0; } }
