:root {
  --bg: #14100d;
  --bg-2: #1d1713;
  --text: #f6ede4;
  --muted: #a8998b;
  --line: rgba(255, 255, 255, .07);
  --accent: #f2a98a;
  --accent-2: #e2825f;
  --serif: "Cormorant", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 72px; /* высота нижнего меню без учёта safe-area; мини-плеер стоит над ним */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
svg { display: block; }

/* мягкое свечение на фоне */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70% 38% at 85% -4%, rgba(242, 169, 138, .20), transparent 70%),
    radial-gradient(60% 40% at -10% 30%, rgba(142, 88, 70, .18), transparent 70%);
}

#app {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  padding: 28px 20px calc(150px + var(--safe-b));
}

.head h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: 40px; line-height: 1; letter-spacing: .01em;
}
.head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* категории */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 22px -20px 8px; padding: 2px 20px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  transition: background .25s, color .25s, border-color .25s;
}
.chip.on { background: #f7e7dc; color: #2a1d16; border-color: transparent; }

/* список */
.list { list-style: none; margin: 0; padding: 0; }
.list li { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.row {
  cursor: pointer; width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 10px 0; text-align: left;
  border-bottom: 1px solid var(--line);
}
.list li:last-child .row { border-bottom: 0; }
.cover {
  width: 64px; height: 64px; flex: none; border-radius: 16px; object-fit: cover;
  background: var(--bg-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .3s var(--ease);
}
.row:active .cover { transform: scale(.95); }
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.t {
  font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.s { font-size: 12.5px; color: var(--muted); }
.row.active .t { color: var(--accent); }

.eq { display: none; gap: 2.5px; align-items: flex-end; height: 14px; margin-right: 2px; }
.row.active .eq { display: flex; }
.eq i { width: 3px; height: 40%; border-radius: 2px; background: var(--accent); }
.row.playing .eq i { animation: eq 1s ease-in-out infinite; }
.row.playing .eq i:nth-child(2) { animation-delay: -.35s; }
.row.playing .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.state { text-align: center; color: var(--muted); margin: 60px 0; font-size: 14px; }

/* мини-плеер */
.mini {
  position: fixed; z-index: 5; left: 50%;
  width: calc(100% - 24px); max-width: 536px;
  bottom: calc(var(--tabbar-h) + 12px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 9px;
  border-radius: 22px; overflow: hidden; cursor: pointer;
  background: rgba(36, 28, 23, .82);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, 160%); transition: transform .5s var(--ease);
}
.mini.show { transform: translate(-50%, 0); }
.mini-progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(255, 255, 255, .08); }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.mini-cover { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex: none; }
.mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-title { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 12px; color: var(--muted); }
.mini-btn {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #2a1d16; background: linear-gradient(145deg, var(--accent), var(--accent-2));
}
.mini-btn svg { width: 20px; height: 20px; }

/* полноэкранный плеер */
.player {
  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  background: var(--bg);
  transform: translateY(100%); visibility: hidden;
  transition: transform .55s var(--ease), visibility 0s .55s;
}
.player.open { transform: none; visibility: visible; transition: transform .55s var(--ease); }
.player-bg {
  position: absolute; inset: -20%; opacity: .9; filter: blur(30px) saturate(1.2);
  transition: background 1s;
}
.player::after { /* затемнение к низу */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(20, 16, 13, .25), var(--bg) 78%);
}
.icon-btn {
  position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top, 0px)); left: 16px;
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.icon-btn svg { width: 22px; height: 22px; }

.player-body {
  position: relative; z-index: 1; height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  padding: 64px 28px calc(28px + var(--safe-b));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
}
.player-body::-webkit-scrollbar { display: none; }
.player-body > * { flex-shrink: 0; }
.art {
  width: min(76vw, 38vh, 340px); aspect-ratio: 1; border-radius: 32px; flex: none;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 90px rgba(242, 169, 138, .20);
  transition: transform .8s var(--ease);
  transform: scale(.9);
}
.art img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.player.open .art { transform: scale(1); }
.player.playing .art { animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.meta { text-align: center; margin: 34px 0 22px; }
.meta h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.05; }
.meta p { margin: 8px 0 0; color: var(--muted); font-size: 14px; letter-spacing: .02em; }

.seek { width: 100%; }
.times { display: flex; justify-content: space-between; margin-top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; --p: 0%; touch-action: none; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--p), rgba(255, 255, 255, .14) var(--p));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  transition: transform .2s;
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }

.controls { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 14px; }
.ctl { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; color: var(--text); transition: transform .15s, opacity .2s; }
.ctl:active { transform: scale(.88); }
.ctl svg { width: 28px; height: 28px; }
.ctl:disabled { opacity: .3; }
.ctl.play {
  width: 78px; height: 78px; color: #2a1d16;
  background: linear-gradient(145deg, #f8c4a8, var(--accent-2));
  box-shadow: 0 12px 34px rgba(226, 130, 95, .42);
}
.ctl.play svg { width: 34px; height: 34px; }

.toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(160px + var(--safe-b));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 14px; font-size: 13px;
  background: rgba(50, 38, 31, .95); border: 1px solid var(--line);
  transition: .35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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