/* Цвета берутся из темы Telegram (светлая/тёмная), в обычном браузере — из запасных значений. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #111114);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #3478f6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --danger: var(--tg-theme-destructive-text-color, #ff3b30);
  --sep: var(--tg-theme-section-separator-color, rgba(128, 128, 140, .18));
  --soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --soft-strong: color-mix(in srgb, var(--accent) 22%, transparent);
  --fill: color-mix(in srgb, var(--text) 7%, transparent);
  --glass: color-mix(in srgb, var(--surface) 86%, transparent);
  --like: #ff2d55;
  --ok: #34c759;
  --radius: 16px;
  --nav-h: 62px;
  --player-h: 64px;
  --vh: var(--tg-viewport-stable-height, 100vh);
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
  color-scheme: light dark;
}

/* Старые WebView (Android до Chrome 111) не знают color-mix — даём простые полупрозрачные цвета. */
@supports not (color: color-mix(in srgb, red, blue)) {
  :root {
    --soft: rgba(52, 120, 246, .12);
    --soft-strong: rgba(52, 120, 246, .22);
    --fill: rgba(128, 128, 140, .12);
    --glass: var(--surface);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #0e0f12;
    --surface: #1a1b20;
    --text: #f2f3f5;
    --hint: #8d909a;
  }
}

/* Тема из настроек приложения (по умолчанию — как в Telegram). */
:root[data-mode="light"] {
  --bg: #f2f2f7; --surface: #ffffff; --text: #111114; --hint: #8e8e93; --sep: rgba(60, 60, 67, .16); color-scheme: light;
}
:root[data-mode="dark"] {
  --bg: #0f1013; --surface: #1c1d22; --text: #f2f3f5; --hint: #8d909a; --sep: rgba(255, 255, 255, .09); color-scheme: dark;
}
:root[data-mode="amoled"] {
  --bg: #000000; --surface: #121214; --text: #ffffff; --hint: #8a8a90; --sep: rgba(255, 255, 255, .08); color-scheme: dark;
}

/* Цветной фон: мягкая подсветка в цвет палитры. */
:root.tint body { background: transparent; }
:root.tint body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 55% at 50% -8%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(80% 45% at 100% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}

.no-motion *, .no-motion *::before, .no-motion *::after { animation: none !important; transition: none !important; }

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

/* ---------- страницы ---------- */
.page {
  position: relative; display: flex; flex-direction: column; min-height: var(--vh);
  padding: 12px 16px calc(var(--nav-h) + var(--safe-bottom) + 16px);
}
.page > .content { flex: 1; position: relative; }
.page.enter { animation: page-in .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes page-in { from { opacity: 0; transform: translateX(14px); } }
body.has-player .page { padding-bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-bottom) + 24px); }
body.no-tabs .page { padding-bottom: calc(var(--safe-bottom) + 16px); }

.credit { margin-top: 28px; padding: 4px 0 2px; text-align: center; font-size: 12px; color: var(--hint); letter-spacing: .01em; }
.credit a { color: var(--link); font-weight: 600; text-decoration: none; }
.credit .beat { display: inline-block; animation: beat 1.8s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 20% { transform: scale(1.25); } 40% { transform: scale(.95); } }

/* ---------- иконки ---------- */
.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }
.i.sm { width: 18px; height: 18px; }

/* ---------- заголовки ---------- */
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.link-btn { color: var(--link); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; font-size: 15px; }
.link-btn.center { display: flex; margin: 16px auto 0; }

.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 2px 14px; }
.hello { color: var(--hint); font-size: 14px; font-weight: 500; margin-bottom: 2px; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  color: #fff; font-weight: 700; font-size: 16px; object-fit: cover;
  background: linear-gradient(135deg, var(--a1, #7f7fd5), var(--a2, #86a8e7));
}
.avatar.lg { width: 56px; height: 56px; font-size: 21px; }
.avatar-btn { border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--soft-strong); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; margin: 0 0 16px;
  border-radius: 99px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
}
.chip .i { color: var(--hint); }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--fill); color: var(--hint); }
.badge.plus { background: linear-gradient(90deg, #ff6a3d, #ff3cac); color: #fff; }

/* ---------- «Мне нравится» ---------- */
.likes-tile {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 16px; width: 100%; text-align: left;
  border-radius: 20px; color: #fff; cursor: pointer;
  background: radial-gradient(120% 140% at 0% 0%, #ff7a8a 0%, #ff2e63 45%, #b3136b 100%);
  box-shadow: 0 10px 26px rgba(255, 46, 99, .28);
}
.likes-tile::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.likes-tile .heart { width: 56px; height: 56px; border-radius: 16px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; }
.likes-tile .heart .i { width: 30px; height: 30px; }
.likes-tile .meta { flex: 1; min-width: 0; }
.likes-tile .t { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.likes-tile .s { opacity: .88; font-size: 14px; margin-top: 2px; }
.tile-play {
  position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: #fff; color: #ff2e63; box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
.tile-play .i { width: 20px; height: 20px; margin-left: 2px; }
.tile-play:active, .likes-tile:active { transform: scale(.97); }
.likes-tile, .tile, .btn, .tile-play, .icon-btn { transition: transform .12s ease, filter .12s ease, background .12s ease; }

/* ---------- плейлисты сеткой ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { text-align: left; min-width: 0; display: block; }
.tile:active { transform: scale(.97); }
.tile-cover {
  position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}
.tile-cover .cover { width: 100%; height: 100%; border-radius: 0; }
.tile-cover .cover .i { width: 40%; height: 40%; opacity: .9; }
.tile-cover.new { display: grid; place-items: center; color: var(--accent); background: var(--soft); box-shadow: none; border: 2px dashed var(--soft-strong); }
.tile-cover.new .i { width: 34px; height: 34px; }
.tile-pin { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(6px); }
.tile-title { font-weight: 600; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { color: var(--hint); font-size: 13px; margin-top: 1px; }

/* ---------- карточки и списки ---------- */
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--sep); }

.row { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; min-height: 62px; width: 100%; text-align: left; }
.row:active { background: var(--soft); }
.row .meta { flex: 1; min-width: 0; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row.unavailable { opacity: .45; }
.row.playing .title { color: var(--accent); font-weight: 600; }

.cover {
  width: 46px; height: 46px; border-radius: 10px; flex: none; object-fit: cover;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, #fff), color-mix(in srgb, var(--accent) 75%, #000));
  display: grid; place-items: center; color: #fff;
}
.cover.round { border-radius: 50%; }
.cover.lg { width: 56px; height: 56px; border-radius: 12px; }

/* обложка в строке трека + «эквалайзер», пока трек играет */
.cov { position: relative; flex: none; }
.eq { position: absolute; inset: 0; border-radius: 10px; background: rgba(0, 0, 0, .45); display: none; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 13px; }
.row.playing .eq { display: flex; }
.eq i { width: 3px; height: 16px; border-radius: 2px; background: #fff; transform-origin: bottom; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
body.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--hint); flex: none; }
.icon-btn:active { background: var(--soft); transform: scale(.92); }
.icon-btn.liked { color: var(--like); }
.icon-btn.liked .i { animation: pop .3s ease; }
.icon-btn.on { color: var(--accent); }
@keyframes pop { 50% { transform: scale(1.3); } }

/* ---------- шапка списка (плейлист, альбом, артист) ---------- */
.hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 8px 20px; }
.hero-bg {
  position: absolute; top: -12px; left: -16px; right: -16px; height: 360px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.hero-bg div {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(42px) saturate(1.5); opacity: .55; transform: scale(1.1);
}
.hero > :not(.hero-bg) { position: relative; }
.hero .cover { width: 184px; height: 184px; border-radius: 20px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); }
.hero .cover .i { width: 68px; height: 68px; opacity: .9; }
.hero .cover.round { border-radius: 50%; }
.hero h1 { font-size: 24px; font-weight: 800; margin: 16px 0 4px; letter-spacing: -.02em; }
.hero .sub { color: var(--hint); font-size: 14px; }
.actions { display: flex; gap: 10px; margin-top: 18px; justify-content: center; width: 100%; }

.btn {
  height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent-grad, var(--accent)); color: var(--accent-text);
}
.btn:active { filter: brightness(.92); transform: scale(.97); }
.btn.secondary { background: var(--surface); color: var(--link); }
.btn.round { width: 46px; padding: 0; }
.btn.block { width: 100%; }
.btn.big { height: 52px; font-size: 16px; border-radius: 16px; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- поиск ---------- */
.search-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 16px 10px; margin: -12px -16px 0; padding-top: 12px; }
.search-field { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 12px; height: 44px; color: var(--hint); }
.search-field input { flex: 1; border: 0; outline: 0; background: none; height: 100%; color: var(--text); font-size: 16px; min-width: 0; }
.search-field input::-webkit-search-cancel-button { display: none; }
.segments { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.segments::-webkit-scrollbar { display: none; }
.segments button { padding: 7px 14px; border-radius: 99px; background: var(--surface); font-size: 14px; font-weight: 500; white-space: nowrap; }
.segments button.on { background: var(--accent-grad, var(--accent)); color: var(--accent-text); }
.corrected { color: var(--hint); font-size: 13px; margin: 0 4px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--surface); font-size: 14px; max-width: 100%; }
.chips button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips .i { color: var(--hint); }

/* ---------- загрузка ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 160px; padding: 20px; border-radius: 20px; border: 2px dashed var(--soft-strong);
  background: var(--soft); color: var(--accent); cursor: pointer;
}
.dropzone .bubble { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-grad, var(--accent)); color: var(--accent-text); box-shadow: 0 8px 20px var(--soft-strong); }
.dropzone .bubble .i { width: 28px; height: 28px; }
.dropzone b { font-size: 17px; }
.dropzone span { color: var(--hint); font-size: 13px; }
.dropzone.drag { background: var(--soft-strong); }

.target { display: flex; align-items: center; gap: 12px; padding: 12px; width: 100%; text-align: left; }
.target .meta { flex: 1; min-width: 0; }
.target .label { color: var(--hint); font-size: 13px; }
.target .value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px; }
.toggle-row .meta { flex: 1; }
.toggle-row .sub { color: var(--hint); font-size: 13px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--fill); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: .2s; }
.switch input:checked + span { background: var(--accent-grad, var(--accent)); }
.switch input:checked + span::after { transform: translateX(20px); }

.file { padding: 10px 6px 10px 12px; cursor: pointer; }
.file:active:not(.locked) { background: var(--soft); }
.file-head { display: flex; align-items: center; gap: 12px; }
.file-head .meta { flex: 1; min-width: 0; }
.file-head .title { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.file-head .title .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.file-head .sub { color: var(--hint); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-cover .cover { width: 52px; height: 52px; border-radius: 12px; }
.edited { flex: none; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--soft); color: var(--accent); }
.file .progress, .file .status { margin-left: 64px; margin-right: 6px; }

/* редактор данных трека */
.ed-file { display: flex; align-items: center; gap: 6px; color: var(--hint); font-size: 13px; margin: -6px 4px 14px; word-break: break-all; }
.ed-top { display: flex; align-items: center; gap: 16px; margin: 0 4px 16px; }
.ed-cover .cover { width: 112px; height: 112px; border-radius: 18px; box-shadow: 0 10px 26px rgba(0, 0, 0, .18); }
.ed-cover .cover .i { width: 42px; height: 42px; }
.ed-cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.ed-cover-actions .btn { height: 40px; padding: 0 14px; font-size: 14px; }
.ed-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ed-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ed-field.title, .ed-field.artist { grid-column: 1 / -1; }
.ed-field span { color: var(--hint); font-size: 13px; font-weight: 500; margin-left: 4px; }
#sheet .ed-field input.text { margin: 0; }
.progress { height: 5px; border-radius: 5px; background: var(--fill); overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; width: 0; background: var(--accent-grad, var(--accent)); border-radius: 5px; transition: width .2s; }
.file.done .progress div { background: var(--ok); }
.status { font-size: 13px; margin-top: 6px; color: var(--hint); }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.upload-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px); margin-top: 14px; z-index: 4; }
body.has-player .upload-bar { bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-bottom) + 14px); }
.upload-bar .btn { box-shadow: 0 8px 22px var(--soft-strong); }
.hint { color: var(--hint); font-size: 13px; margin: 10px 4px; }

/* ---------- вход в Яндекс ---------- */
.login { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 6px 0; }
.login-logo {
  width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; color: #fff; margin: 10px 0 20px;
  background: linear-gradient(135deg, #ffcc00 0%, #ff6a3d 50%, #ff2d78 100%); box-shadow: 0 16px 36px rgba(255, 90, 80, .35);
}
.login-logo .i { width: 44px; height: 44px; }
.login-logo.sm { width: 64px; height: 64px; border-radius: 20px; margin: 0 0 14px; }
.login-logo.sm .i { width: 32px; height: 32px; }
.login h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 10px; }
.login .lead { color: var(--hint); margin: 0 0 22px; max-width: 340px; line-height: 1.45; }
.login .btn.block { max-width: 380px; }
.login-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.perks { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; width: 100%; max-width: 380px; text-align: left; }
.perks li { display: flex; align-items: center; gap: 12px; background: var(--surface); padding: 12px 14px; border-radius: 14px; }
.perks .i { color: var(--accent); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 4px 0 0; width: 100%; max-width: 400px; text-align: left; display: grid; gap: 10px; }
.steps li { counter-increment: step; background: var(--surface); border-radius: 16px; padding: 14px 14px 14px 52px; position: relative; }
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 13px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--soft); color: var(--accent);
}
.steps b { display: block; margin: 2px 0 10px; }
.steps .hint { margin: 8px 0 0; }
.code { display: flex; gap: 5px; width: 100%; }
.code span {
  flex: 1; min-width: 0; max-width: 40px; height: 46px; border-radius: 10px; display: grid; place-items: center; background: var(--bg);
  font: 700 21px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0;
}
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--hint); margin-top: 18px; font-size: 14px; }
.waiting .left { font-variant-numeric: tabular-nums; }

/* ---------- состояния ---------- */
.empty { text-align: center; color: var(--hint); padding: 40px 20px; }
.empty .i { width: 44px; height: 44px; margin-bottom: 10px; opacity: .6; }
.spinner { width: 26px; height: 26px; margin: 28px auto; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.inline { width: 18px; height: 18px; margin: 0; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: var(--vh); display: grid; place-items: center; }

.sk { background: var(--fill); background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent); background-size: 200% 100%; background-repeat: no-repeat; animation: shimmer 1.3s ease-in-out infinite; }
.sk-line { height: 12px; border-radius: 6px; width: 70%; margin: 6px 0; }
.sk-line.short { width: 40%; }
.row .sk.cover { background-color: var(--fill); }
.tile .sk-line { margin-top: 10px; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ---------- мини-плеер ---------- */
#player {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 6px); z-index: 20;
  height: var(--player-h); border-radius: 18px; background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18), inset 0 0 0 1px var(--sep); overflow: hidden;
  display: flex; align-items: center; gap: 10px; padding: 0 6px 0 8px; animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
#player .cover { width: 48px; height: 48px; }
#player .meta { flex: 1; min-width: 0; }
#player .title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player .sub { color: var(--hint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player .icon-btn { color: var(--text); }
#player .bar { position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px; background: var(--fill); overflow: hidden; }
#player .bar div { height: 100%; width: 0; background: var(--accent-grad, var(--accent)); }

/* ---------- навигация ---------- */
nav#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--sep); padding-bottom: var(--safe-bottom);
}
nav#tabs button { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--hint); font-size: 11px; font-weight: 600; }
nav#tabs button .pill { width: 56px; height: 30px; border-radius: 99px; display: grid; place-items: center; transition: background .2s; }
nav#tabs button.on { color: var(--accent); }
nav#tabs button.on .pill { background: var(--soft); }

/* ---------- нижние листы ---------- */
#backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
#backdrop.open { opacity: 1; pointer-events: auto; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 12px calc(var(--safe-bottom) + 16px);
  transform: translateY(105%); visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
}
/* Тень только у открытого листа: у закрытого она выглядывала бы снизу экрана. */
#sheet.open {
  transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -1px 0 var(--sep), 0 -12px 40px rgba(0, 0, 0, .28);
}
#sheet .grip { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 2px auto 12px; }
#sheet .sheet-title { font-weight: 700; font-size: 18px; margin: 4px 4px 12px; }
#sheet .sheet-note { color: var(--hint); font-size: 13px; margin: 12px 6px 0; line-height: 1.4; }
#sheet .row { min-height: 54px; }
#sheet .row .i { color: var(--accent); }
#sheet .row.danger, #sheet .row.danger .i { color: var(--danger); }
#sheet .sheet-track { display: flex; gap: 12px; align-items: center; padding: 4px 4px 14px; }
#sheet .sheet-track .meta { min-width: 0; }
#sheet .sheet-track .title { font-weight: 700; font-size: 16px; }
#sheet .sheet-track .sub { color: var(--hint); font-size: 14px; margin-top: 2px; }
#sheet input.text { width: 100%; height: 48px; border-radius: 14px; border: 0; padding: 0 14px; background: var(--surface); outline: none; font-size: 16px; margin-bottom: 12px; }
#sheet input.text:focus { box-shadow: 0 0 0 2px var(--accent); }
.account-card { display: flex; align-items: center; gap: 14px; padding: 4px 4px 16px; }
.account-card .meta { flex: 1; min-width: 0; }
.account-card .title { font-weight: 700; font-size: 18px; }
.account-card .sub { color: var(--hint); font-size: 14px; margin-top: 2px; }

/* ---------- полноэкранный плеер ---------- */
#sheet.player { background: #121214; color: #fff; min-height: 90vh; max-height: 96vh; overflow: hidden; }
#sheet.player .grip { background: rgba(255, 255, 255, .35); position: relative; z-index: 1; }
.now-bg { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(50px) saturate(1.6) brightness(.5); transform: scale(1.2); transition: background-image .3s; }
.now { position: relative; text-align: center; padding: 8px 10px 4px; }
.now .cover { width: min(76vw, 320px); height: min(76vw, 320px); border-radius: 20px; margin: 10px auto 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); transition: transform .3s ease; }
body.paused .now .cover { transform: scale(.92); }
.now .cover .i { width: 84px; height: 84px; }
.now-head { display: flex; align-items: center; gap: 8px; text-align: left; }
.now-head .meta { flex: 1; min-width: 0; }
.now h2 { margin: 0; font-size: 21px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .sub { color: rgba(255, 255, 255, .7); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .icon-btn { color: rgba(255, 255, 255, .85); }
.now .icon-btn.on { color: #fff; background: rgba(255, 255, 255, .16); }
.now .icon-btn.liked { color: var(--like); }
.seek { width: 100%; margin: 20px 0 4px; accent-color: #fff; }
.times { display: flex; justify-content: space-between; color: rgba(255, 255, 255, .6); font-size: 12px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px 18px; }
.controls .play { width: 72px; height: 72px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.controls .play:active { transform: scale(.94); }
.controls .play .i { width: 32px; height: 32px; }
.controls .icon-btn { width: 50px; height: 50px; color: #fff; }
.controls .icon-btn .i { width: 28px; height: 28px; }
.controls .icon-btn.mode .i { width: 22px; height: 22px; }
.controls .icon-btn.mode { color: rgba(255, 255, 255, .55); }
.controls .icon-btn.mode.on { color: #fff; background: rgba(255, 255, 255, .16); }
.now-actions { display: flex; justify-content: center; gap: 14px; }
.now-actions .icon-btn { background: rgba(255, 255, 255, .1); width: 48px; height: 48px; }

/* ---------- всплывающие сообщения ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .22s;
  background: rgba(28, 28, 32, .92); color: #fff; backdrop-filter: blur(10px);
  padding: 11px 16px; border-radius: 14px; font-size: 14px; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
body.has-player #toast { bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-bottom) + 22px); }
body.no-tabs #toast { bottom: calc(var(--safe-bottom) + 24px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.gate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--hint); gap: 10px; padding: 40px 20px; }
.gate .i { width: 52px; height: 52px; color: var(--accent); }
.gate b { color: var(--text); font-size: 19px; }
.gate .btn { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- настройки ---------- */
.gear-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface); color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}
.gear-btn .i { width: 22px; height: 22px; transition: transform .4s ease; }
.gear-btn:active .i { transform: rotate(90deg); }
.set-group { margin-top: 22px; }
.set-group h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); margin: 0 6px 8px; }
.set-group .account-card { padding: 14px 14px 12px; }
.set-group .account-card + .list { border-top: 1px solid var(--sep); }
.set-row { min-height: 54px; cursor: pointer; }
.set-row .title { font-weight: 500; }
.set-row.danger, .set-row.danger .set-icon { color: var(--danger); }
.set-icon { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--soft); color: var(--accent); }
.set-card { padding: 4px 12px 14px; }
.set-label { display: flex; align-items: center; gap: 8px; color: var(--hint); font-size: 13px; font-weight: 600; margin: 12px 2px 8px; }
.set-note { color: var(--hint); font-size: 13px; line-height: 1.4; margin: 8px 6px 0; }

.seg-full { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--fill); }
.seg-full button { flex: 1; min-width: 0; padding: 8px 4px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 14px; }
.seg-full button span { font-size: 11px; color: var(--hint); }
.seg-full button.on { background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); color: var(--accent); }
.seg-full button.on span { color: var(--accent); opacity: .8; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 6px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.swatch .dot {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .15s ease, box-shadow .15s ease;
}
.swatch .dot .i { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.swatch.on .dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); transform: scale(1.04); }
.swatch:active .dot { transform: scale(.92); }
.swatch .name { font-size: 11px; color: var(--hint); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch.on .name { color: var(--text); font-weight: 600; }

.token-card { padding: 14px; }
.token {
  display: block; padding: 12px; border-radius: 12px; background: var(--bg); word-break: break-all;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: all;
}
.token.masked { letter-spacing: .15em; color: var(--hint); user-select: none; }
.token-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn.sm { height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; flex: 1; }

/* ---------- админ-панель ---------- */
.head-btns { display: flex; gap: 10px; }
.adm-shield { color: var(--accent); box-shadow: none; background: var(--soft); }
.adm-tabs { margin: 0 0 4px; }
.adm-body { margin-top: 12px; }
.adm-body > .search-field { margin-top: 2px; }
.adm-banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; margin-bottom: 10px;
  background: var(--soft); color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.3;
}
.adm-banner .i { color: var(--accent); flex: none; }
.adm-banner.warn { background: color-mix(in srgb, #ff9500 16%, transparent); }
.adm-banner.warn .i { color: #ff9500; }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 12px 14px 13px; min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--hint); font-size: 12.5px; font-weight: 600; }
.stat-label .i { flex: none; color: var(--accent); }
.stat.warn .stat-label .i { color: #ff9500; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--hint); font-size: 12px; margin-top: 2px; line-height: 1.3; }

.chart-title { color: var(--hint); font-size: 13px; font-weight: 600; margin: 14px 2px 6px; }
.chart { position: relative; }
.bars { display: block; width: 100%; height: auto; overflow: visible; }
.bars .bar { fill: color-mix(in srgb, var(--accent) 45%, transparent); transition: fill .15s; }
.bars .bar.on { fill: var(--accent); }
.bars .axis { stroke: var(--sep); stroke-width: 1; }
.bars .tick { fill: var(--hint); font-size: 10px; text-anchor: middle; }
.bar-tip { text-align: center; font-size: 14px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }

.rank { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-size: 13px; font-weight: 700; color: var(--hint); }
.num { font-weight: 700; font-variant-numeric: tabular-nums; }
.muted { color: var(--hint); font-weight: 400; }
.badge.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.kvs { padding-top: 6px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--sep); }
.kv span { color: var(--hint); flex: none; }
.kv b { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv.bad b { color: var(--danger); }
.set-group > .btn.block { margin-top: 10px; }

textarea.text, .page input.text {
  width: 100%; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--fill); color: var(--text);
  outline: none; font: inherit; font-size: 16px; resize: vertical;
}
#sheet textarea.text { background: var(--surface); margin-bottom: 12px; }
textarea.text:focus, .page input.text:focus { box-shadow: 0 0 0 2px var(--accent); }
.set-card > textarea.text { margin-top: 12px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; }
.field-row + .field-row { border-top: 1px solid var(--sep); }
.page input.num-input { width: 110px; height: 42px; padding: 0 12px; text-align: right; font-variant-numeric: tabular-nums; }
.set-card > .btn.block { margin-top: 12px; }

.log-row { min-height: 0; padding: 10px 12px; }
.log-row .title { white-space: normal; font-size: 14px; }
.log-row .sub { white-space: normal; overflow-wrap: anywhere; }
.log-row.bad .title { color: var(--danger); }
details.log { margin-top: 8px; padding: 10px 12px; }
details.log summary { display: flex; flex-direction: column; gap: 3px; cursor: pointer; list-style: none; font-size: 14px; }
details.log summary::-webkit-details-marker { display: none; }
details.log summary b { font-size: 12px; color: var(--hint); }
details.log summary span { overflow-wrap: anywhere; }
details.log.error summary b, details.log.critical summary b { color: var(--danger); }
details.log.warning summary b { color: #ff9500; }
details.log pre {
  margin: 10px 0 0; padding: 10px; border-radius: 10px; background: var(--fill); font-size: 11.5px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto;
}
.adm-body > .seg-full { margin-bottom: 12px; }
.adm-body .set-row .sub { white-space: normal; }
.adm-body .search-field + .segments { margin-bottom: 4px; }
#sheet .row .sub { white-space: normal; }
.adm-banner code { font-size: 12px; background: var(--fill); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
.banner-detail { margin-top: 6px; font-size: 12px; font-weight: 400; color: var(--hint); overflow-wrap: anywhere; }

/* ---------- статистика прослушиваний ---------- */
.stats-tile { margin-top: 12px; background: var(--surface); border-radius: var(--radius); min-height: 60px; }
.stats-body > .seg-full { margin-bottom: 4px; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 12px; }
.period-title { font-weight: 700; font-size: 17px; text-align: center; flex: 1; }
.period-nav .icon-btn[disabled] { opacity: .3; }
.flip .i { transform: scaleX(-1); }
.stats-intro { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px 16px; }
.stats-intro > b { font-size: 18px; line-height: 1.3; }
.stats-intro-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--soft); color: var(--accent); }
.stats-intro-icon .i { width: 28px; height: 28px; }
.stats-intro .btn { margin-top: 6px; }
.adm-banner.streak { margin-top: 10px; }
.adm-banner .fire { font-size: 18px; }
.rank-row { min-height: 58px; }
.share { height: 6px; border-radius: 6px; background: var(--fill); overflow: hidden; margin-top: 6px; }
.share div { height: 100%; border-radius: 6px; background: var(--accent-grad, var(--accent)); }
.share-row { padding: 10px 2px 4px; }
.share-row + .share-row { border-top: 1px solid var(--sep); }
.share-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.share-head b { font-variant-numeric: tabular-nums; }
.new-artists .chip { background: var(--surface); }
.stats-intro .perks { margin: 2px 0 0; gap: 0; }
.stats-intro .perks li { padding: 6px 0; }
