/* TG Music Player — Spotify Dark UI.
   Палитра: фон #121212, панели #181818 / #282828, текст #FFFFFF / #B3B3B3,
   акцент #1ED760. Шрифт Manrope (Medium 500 / Bold 700, кириллица + латиница)
   лежит локально: web/fonts/*.woff2, без внешних CDN.
   html[data-perf="lite"] отключает анимации и тени для слабых устройств. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/manrope-cyrillic-500-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/manrope-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/manrope-cyrillic-700-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/manrope-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --bg: #121212;
  --panel: #181818;
  --panel-2: #282828;
  --panel-3: #333333;
  --text: #ffffff;
  --muted: #b3b3b3;
  --muted-2: #7a7a7a;
  --green: #1ed760;
  --green-hover: #1fdf64;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 8px;
  --radius-sm: 4px;
  --player-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "Manrope", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Arial, sans-serif;
  --viz-a: #1ed760;
  --viz-b: #8efab5;
  color-scheme: dark;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior-y: contain;
}

button { font-family: inherit; }

/* --------------------------------------------------------------- background */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 42% at 16% -10%, rgba(30, 215, 96, 0.16), rgba(18, 18, 18, 0) 72%),
    radial-gradient(70% 34% at 92% -8%, rgba(30, 215, 96, 0.09), rgba(18, 18, 18, 0) 70%),
    linear-gradient(180deg, #1c1c1c 0%, #161616 180px, var(--bg) 460px);
}

/* --------------------------------------------------------------- app shell */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 10px) calc(12px + var(--safe-r)) calc(22px + var(--safe-b)) calc(12px + var(--safe-l));
}

body.has-player .app {
  padding-bottom: calc(var(--player-h) + var(--safe-b) + 28px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 12px;
}

.brand { flex: 1 1 auto; min-width: 0; }

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.brand h1 {
  margin: 0;
  font-size: 1.72rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .sub {
  margin: 5px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* зелёная CTA-пилюля в стиле Spotify */
.shuffle-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #000;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.12s ease, background 0.15s ease;
}

.shuffle-cta svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shuffle-cta:active { transform: scale(0.96); background: var(--green-hover); }
.shuffle-cta:disabled { opacity: 0.4; }

/* ------------------------------------------------------------------- search */
.searchbar {
  position: sticky;
  top: calc(var(--safe-t) + 6px);
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 6px 0 13px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.searchbar:hover { background: var(--panel-2); }

.searchbar:focus-within {
  background: var(--panel-2);
  box-shadow: 0 0 0 2px #fff;
}

.searchbar .search-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.searchbar input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 2px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  -webkit-user-select: text;
  user-select: text;
}

.searchbar input::placeholder { color: var(--muted-2); }
.searchbar input::-webkit-search-cancel-button { display: none; }

.searchbar .clear {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}

.searchbar .clear:active { color: var(--text); }
.clear[hidden] { display: none; }

/* ------------------------------------------------------------------- chips */
.chips {
  display: flex;
  gap: 8px;
  padding: 12px 2px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }
.chips[hidden] { display: none; }

/* компактный переключатель «Все / Избранное» в шапке списка */
.scope {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  margin: 10px 2px 0;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel);
}

.scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.scope-btn:active { transform: scale(0.97); }
.scope-btn[aria-selected="true"] { background: #fff; color: #000; }

.scope-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.66rem;
  line-height: 16px;
  text-align: center;
}

.scope-btn[aria-selected="true"] .scope-count { background: rgba(0, 0, 0, 0.12); }

@media (hover: hover) {
  .scope-btn:hover { color: var(--text); }
  .scope-btn[aria-selected="true"]:hover { color: #000; background: #f0f0f0; }
}

.chip {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.chip:active { transform: scale(0.96); }
.chip[aria-selected="true"] { background: #fff; color: #000; }
.chip[aria-selected="true"]:active { background: #f0f0f0; }

@media (hover: hover) {
  .chip:hover { background: var(--panel-3); }
  .chip[aria-selected="true"]:hover { background: #f0f0f0; }
}

.filter-note {
  margin: 8px 4px 2px;
  font-size: 0.74rem;
  color: var(--muted);
}

.filter-note[hidden] { display: none; }

/* --------------------------------------------------------------------- list */
.list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0 4px;
}

.sentinel { height: 1px; }

/* плотная строка в стиле Spotify: номер / обложка / название + исполнитель / время */
.row {
  display: grid;
  grid-template-columns: 22px 42px minmax(0, 1fr) 28px auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 8px 5px 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 56px;
  contain-intrinsic-size: auto 56px;
  transition: background 0.14s ease;
}

.row:hover,
.row:focus-visible,
.row:active { background: var(--panel-2); outline: 0; }

.row-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.row .num { display: block; }
.row .bars { display: none; align-items: flex-end; gap: 2px; height: 14px; }

.row.active { background: rgba(30, 215, 96, 0.08); }
.row.active:hover { background: rgba(30, 215, 96, 0.14); }
.row.active .num { display: none; }
.row.active .bars { display: flex; }
.row.active .title { color: var(--green); }

.row .bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--green);
  transform-origin: bottom center;
  animation: eq 1s ease-in-out infinite;
}

.row .bars i:nth-child(1) { height: 100%; animation-delay: 0s; }
.row .bars i:nth-child(2) { height: 70%; animation-delay: 0.24s; }
.row .bars i:nth-child(3) { height: 88%; animation-delay: 0.12s; }
.row .bars i:nth-child(4) { height: 54%; animation-delay: 0.36s; }

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

body.paused .row .bars i { animation-play-state: paused; }
body:not(.playing) .row .bars i { animation-play-state: paused; }

/* --------------------------------------------------- генеративные обложки */
.cover {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  /* фон задаётся из app.js: уникальный градиент по хешу названия/исполнителя */
  background: linear-gradient(140deg, #343434, #191919);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 95% at 20% 6%, rgba(255, 255, 255, 0.28), transparent 60%);
  opacity: 0.5;
}

.cover .eq {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 19px;
}

.cover .eq i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.94);
}

.cover-lg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  box-shadow: none;
}

.cover-lg .eq { height: 30%; gap: 5px; }
.cover-lg .eq i { width: 5px; border-radius: 2px; }
/* в stage статичную иконку заменяет процедурная анимация #stageFx */
.stage-art .cover-lg .eq { display: none; }

.row .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.row .title {
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .artist {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .dur {
  padding-right: 2px;
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* сердце: компактное в строке списка, крупнее в stage */
.like {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.like svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 0.15s ease;
}

.like[aria-pressed="true"] { color: var(--green); }
.like[aria-pressed="true"] svg { fill: currentColor; }
.like:active { transform: scale(0.88); }
.like:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

@media (hover: hover) {
  .like:hover { color: var(--green); background: rgba(30, 215, 96, 0.12); }
}

.row-like { justify-self: center; }

/* ------------------------------------------------- empty / scan / sentinel */
.empty { padding: 56px 16px 40px; text-align: center; }
.empty[hidden] { display: none; }

.empty-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
}

.empty-art svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-sub { margin: 0; font-size: 0.84rem; color: var(--muted); }

.scan-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.scan-note[hidden] { display: none; }

.scan-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* -------------------------------------------------------------- mini player */
.player {
  position: fixed;
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  bottom: calc(8px + var(--safe-b));
  z-index: 24;
  max-width: 760px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.62);
  animation: rise 0.22s ease;
}

.player[hidden] { display: none; }

@keyframes rise {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mini {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  /* нижний отступ больше высоты seek-mini: полоса прогресса не перекрывает кнопки */
  padding: 8px 8px 16px 10px;
}

.mini-cover {
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
}

.mini-cover .cover { width: 44px; height: 44px; transition: transform 0.14s ease; }
.mini-cover:active .cover { transform: scale(0.95); }

.mini-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.mini-title {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-sub {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.mini-artist {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-time {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.mini-time::before { content: "·"; margin-right: 6px; opacity: 0.7; }

.mini-controls { display: flex; align-items: center; gap: 2px; }

.mini-like { color: var(--muted); }
.mini-like svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 0.15s ease;
}
.mini-like[aria-pressed="true"] { color: var(--green); }
.mini-like[aria-pressed="true"] svg { fill: currentColor; }

/* --------------------------------------------------------------- controls */
.ctrl {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  transition: transform 0.12s ease, color 0.15s ease, background 0.15s ease;
}

.ctrl svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }

.ctrl svg.ico-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl:active { transform: scale(0.9); }

.ctrl-sm { width: 34px; height: 34px; }
.ctrl-sm svg { width: 20px; height: 20px; }

/* кнопка play/pause: фирменный зелёный круг с чёрной иконкой */
.ctrl-play {
  width: 42px;
  height: 42px;
  background: var(--green);
  color: #000;
  box-shadow: 0 4px 14px rgba(30, 215, 96, 0.28);
}

.ctrl-play svg { width: 18px; height: 18px; }
.ctrl-play:active { transform: scale(0.93); background: var(--green-hover); }
.ctrl-play .i-pause { width: 17px; height: 17px; }

/* состояние кнопки play/pause задаётся классом, а не атрибутом hidden:
   hidden не отражается на SVG-элементах, поэтому управляем через CSS */
.ctrl-play .i-pause { display: none; }
.ctrl-play.is-playing .i-play { display: none; }
.ctrl-play.is-playing .i-pause { display: block; }
.ctrl-play.is-loading .i-play,
.ctrl-play.is-loading .i-pause { display: none; }

.ctrl-lg { width: 62px; height: 62px; }
.ctrl-lg svg { width: 24px; height: 24px; }
.ctrl-lg .i-pause { width: 22px; height: 22px; }

@media (hover: hover) {
  .ctrl:hover { color: #fff; }
  .ctrl-play:hover { background: var(--green-hover); transform: scale(1.05); }
}

.toggle { position: relative; color: var(--muted); }
.toggle[aria-pressed="true"] { color: var(--green); }

.toggle[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  transform: translateX(-50%);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.22);
  border-top-color: #000;
  animation: spin 0.8s linear infinite;
}

.spinner[hidden] { display: none; }

/* ------------------------------------------------------------------ seeks */
.seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  --fill: 0%;
}

.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--green) 0 var(--fill, 0%),
    rgba(255, 255, 255, 0.3) var(--fill, 0%) 100%
  );
}

.seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--green); }

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.seek:active::-webkit-slider-thumb,
.seek:focus-visible::-webkit-slider-thumb { opacity: 1; }

.seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.seek:disabled { opacity: 0.4; }

/* тонкая полоса прогресса внизу мини-плеера */
.seek-mini {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 12px;
}

.seek-mini::-webkit-slider-runnable-track { height: 3px; border-radius: 0 0 2px 2px; }
.seek-mini::-webkit-slider-thumb { width: 9px; height: 9px; margin-top: -3px; }
.seek-mini::-moz-range-track { height: 3px; border-radius: 0 0 2px 2px; }
.seek-mini::-moz-range-progress { height: 3px; }
.seek-mini::-moz-range-thumb { width: 9px; height: 9px; }

.seek-row { display: flex; align-items: center; gap: 10px; }

.time {
  flex: 0 0 auto;
  min-width: 36px;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* -------------------------------------------------------------------- fabs */
.fabs {
  position: fixed;
  right: max(14px, calc(50% - 380px + 14px));
  bottom: calc(var(--player-h) + var(--safe-b) + 26px);
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fabs[hidden] { display: none; }

.fab {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(40, 40, 40, 0.94);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease;
  animation: fade 0.18s ease;
}

.fab svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fab:active { transform: scale(0.92); }
.fab-accent { background: var(--green); color: #000; }
.fab[hidden] { display: none; }

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + var(--safe-b) + 26px);
  z-index: 70;
  pointer-events: none;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #2e2e2e;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
  animation: fade 0.16s ease;
}

.toast[hidden] { display: none; }

/* ------------------------------------------------------------------- stage */
.stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage[hidden] { display: none; }

.stage-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: fade 0.2s ease;
}

.stage-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  width: 100%;
  max-width: 560px;
  height: 100%;
  max-height: var(--tg-viewport-stable-height, 100dvh);
  padding: calc(var(--safe-t) + 8px) calc(22px + var(--safe-r)) calc(var(--safe-b) + 14px) calc(22px + var(--safe-l));
  overflow: hidden;
  /* оттенок берётся из обложки текущего трека (--tint-h задаёт app.js) */
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(30, 215, 96, 0.14), rgba(18, 18, 18, 0) 60%),
    linear-gradient(180deg, hsl(var(--tint-h, 150), 24%, 22%) 0%, #141414 58%, var(--bg) 100%);
  animation: sheet-up 0.26s cubic-bezier(0.22, 0.8, 0.3, 1);
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.stage-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 8px;
}

.stage-kicker {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}

.stage-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  transition: background 0.15s ease, transform 0.12s ease;
}

.stage-icon:active { transform: scale(0.92); background: rgba(0, 0, 0, 0.45); }

.stage-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* слот занимает всё свободное место между шапкой и метаданными; обложка —
   квадрат по меньшей стороне слота, по центру. container queries дают
   обложке «во всю ширину» на телефонах и «по высоте» на низких окнах. */
.stage-art-slot {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding-bottom: 16px;
  container-type: size;
}

.stage-art {
  position: relative;
  width: min(100cqw, 100cqh);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.stage-fx {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

.stage-art .viz {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 46px;
  pointer-events: none;
  opacity: 0.92;
  mix-blend-mode: screen;
  transition: opacity 0.2s ease;
  border-radius: 8px;
}

.viz.idle { opacity: 0; }

.stage-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  text-align: left;
}

.stage-meta-text { flex: 1 1 auto; min-width: 0; }

.stage-meta-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-action {
  width: 40px;
  height: 40px;
  color: var(--muted);
}

.stage-action svg { width: 19px; height: 19px; }
.stage-action[aria-pressed="true"] { color: var(--green); }
.stage-action[aria-pressed="true"] svg { fill: currentColor; }
.stage-action[disabled] { opacity: 0.5; }
.stage-action.is-busy svg { opacity: 0.35; }

@media (hover: hover) {
  .stage-action:hover { background: rgba(0, 0, 0, 0.45); color: #fff; }
  .stage-action[aria-pressed="true"]:hover { color: var(--green); }
}

.stage-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.028em;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.stage-artist {
  margin: 5px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-card .seek-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 2px 12px;
  margin-top: 14px;
  padding-top: 0;
}

.stage-card .seek-row .seek {
  grid-column: 1 / -1;
  grid-row: 1;
  height: 30px;
}

.stage-card .seek-row .time { min-width: 0; }
.stage-card .seek-row .time:first-of-type { grid-column: 1; grid-row: 2; text-align: left; }
.stage-card .seek-row .time:last-of-type { grid-column: 2; grid-row: 2; text-align: right; }

.stage-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 0;
}

.stage-controls .ctrl { width: 48px; height: 48px; color: var(--muted); }
.stage-controls .ctrl:not(.toggle) { color: #fff; }
.stage-controls .ctrl-play { width: 62px; height: 62px; color: #000; }

body.stage-open { overflow: hidden; }

/* ---------------------------------------------------------------- overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.overlay[hidden] { display: none; }

.overlay-card { max-width: 320px; text-align: center; }

.overlay-card p {
  margin: 18px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.loader {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--green);
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.retry {
  height: 40px;
  margin-top: 20px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 0.86rem;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.15s ease;
}

.retry:active { transform: scale(0.96); background: #f0f0f0; }
.retry[hidden] { display: none; }

/* -------------------------------------------------------------- эквалайзер */
/* круглая кнопка-иконка в шапке: открывает шторку эквалайзера */
.icon-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn[aria-pressed="true"] {
  background: rgba(30, 215, 96, 0.16);
  color: var(--green);
}

/* шторка снизу */
.eq {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.eq[hidden] { display: none; }

.eq-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  animation: fade 0.2s ease;
}

.eq-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px calc(18px + var(--safe-r)) calc(var(--safe-b) + 16px) calc(18px + var(--safe-l));
  border-radius: 16px 16px 0 0;
  background: var(--panel);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.6);
  animation: sheet-up 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.eq-grab {
  width: 36px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.24);
}

.eq-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eq-heading { flex: 1 1 auto; min-width: 0; }

.eq-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.eq-sub {
  margin: 3px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* переключатель Вкл/Выкл */
.eq-power {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.eq-power.on { background: var(--green); color: #000; }

.eq-power-track {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.15s ease;
}

.eq-power.on .eq-power-track { background: rgba(0, 0, 0, 0.32); }

.eq-power-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}

.eq-power.on .eq-power-knob { transform: translateX(14px); }

.eq-close { width: 32px; height: 32px; background: var(--panel-2); }
.eq-close svg { width: 18px; height: 18px; }

/* 5 вертикальных полос */
.eq-bands {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  margin: 16px 0 6px;
}

.eq-band {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.eq-value {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.15s ease;
}

.eq-slot {
  position: relative;
  width: 100%;
  height: 148px;
  border-radius: 10px;
  outline: none;
  touch-action: none;
  cursor: ns-resize;
  -webkit-tap-highlight-color: transparent;
}

/* линия 0 дБ */
.eq-slot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.eq-slot:focus-visible { box-shadow: 0 0 0 2px rgba(30, 215, 96, 0.6); }

.eq-track {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 4px;
  border-radius: 2px;
  background: #4d4d4d;
  transform: translateX(-50%);
  overflow: hidden;
}

.eq-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--eq-ratio, 50) * 1%);
  border-radius: 2px;
  background: var(--green);
}

.eq-knob {
  position: absolute;
  left: 50%;
  bottom: calc((var(--eq-ratio, 50) / 100) * (100% - 16px));
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.eq-freq {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

/* выключен — ползунки приглушены, значения сохраняются */
.eq.is-off .eq-track { background: #3a3a3a; }
.eq.is-off .eq-fill { background: var(--muted-2); }
.eq.is-off .eq-knob { background: #d6d6d6; }
.eq.is-off .eq-value { color: var(--muted-2); }

/* пресеты */
.eq-presets {
  display: flex;
  gap: 8px;
  padding: 4px 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.eq-presets::-webkit-scrollbar { display: none; }

.eq-chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.eq-chip:active { transform: scale(0.96); }
.eq-chip.active { background: #fff; color: #000; }

.eq-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.eq-hint {
  min-width: 0;
  font-size: 0.66rem;
  line-height: 1.3;
  color: var(--muted-2);
}

.eq-reset {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.12s ease;
}

.eq-reset:active { transform: scale(0.96); background: var(--panel-3); }

body.eq-open { overflow: hidden; }

/* --------------------------------------------------------- предложить трек */
/* компактная пилюля в шапке: иконка загрузки + короткая подпись */
.suggest-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(30, 215, 96, 0.14);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.suggest-cta svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggest-cta:active {
  transform: scale(0.96);
  background: rgba(30, 215, 96, 0.24);
}

@media (hover: hover) {
  .suggest-cta:hover { background: rgba(30, 215, 96, 0.22); }
}

/* шторка снизу, как у эквалайзера */
.suggest {
  position: fixed;
  inset: 0;
  z-index: 57;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.suggest[hidden] { display: none; }

.suggest-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  animation: fade 0.2s ease;
}

.suggest-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px calc(18px + var(--safe-r)) calc(var(--safe-b) + 16px) calc(18px + var(--safe-l));
  border-radius: 16px 16px 0 0;
  background: var(--panel);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.6);
  animation: sheet-up 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.suggest-grab {
  width: 36px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.24);
}

.suggest-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.suggest-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.suggest-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.suggest-sub {
  margin: 3px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.suggest-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: var(--panel-2);
}

.suggest-close svg { width: 18px; height: 18px; }
.suggest-close:disabled { opacity: 0.5; }

.suggest-hint {
  margin: 10px 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

.suggest-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

/* выбор файла: пунктирная зона, подсвечивается после выбора */
.suggest-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.suggest-file svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--green);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggest-file-label {
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggest-file.has-file {
  border-style: solid;
  border-color: rgba(30, 215, 96, 0.55);
}

.suggest-file:focus-within { box-shadow: 0 0 0 2px rgba(30, 215, 96, 0.55); }

.suggest-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.suggest-status {
  margin: 2px 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.suggest-status:empty { min-height: 0; }
.suggest-status.is-error { color: #ff6b6b; }
.suggest-status.is-success { color: var(--green); }

.suggest-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.suggest-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.suggest-action:active { transform: scale(0.97); }
.suggest-action.ghost { background: var(--panel-2); color: var(--text); }
.suggest-action.ghost:active { background: var(--panel-3); }
.suggest-action.primary { min-width: 124px; background: var(--green); color: #000; }
.suggest-action.primary:active { background: var(--green-hover); }
.suggest-action:disabled { opacity: 0.5; transform: none; }

.suggest-action .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

body.suggest-open { overflow: hidden; }

/* --------------------------------------------------------------- login */
.login {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 22px) calc(18px + var(--safe-r)) calc(var(--safe-b) + 22px) calc(18px + var(--safe-l));
  overflow-y: auto;
  background:
    radial-gradient(90% 42% at 16% -10%, rgba(30, 215, 96, 0.16), rgba(18, 18, 18, 0) 72%),
    radial-gradient(70% 34% at 92% -8%, rgba(30, 215, 96, 0.09), rgba(18, 18, 18, 0) 70%),
    linear-gradient(180deg, #1c1c1c 0%, #161616 180px, var(--bg) 460px);
}

.login[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 380px;
  margin: auto;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.login-eyebrow {
  margin: 14px 0 6px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.login-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-sub {
  margin: 8px 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.login-form { margin-top: 18px; text-align: left; }

.login-label {
  display: block;
  margin: 0 0 7px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.login-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input::placeholder { color: var(--muted-2); letter-spacing: 0.12em; }

.login-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(30, 215, 96, 0.18);
}

.login-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #ff8a8a;
}

.login-actions { display: flex; gap: 10px; margin-top: 10px; }

.login-btn {
  flex: 1 1 0;
  height: 46px;
  border: 0;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.login-btn.ghost { background: var(--panel-2); color: var(--text); }
.login-btn.primary { background: var(--green); color: #000; }
.login-btn:active { transform: scale(0.97); }
.login-btn:disabled { opacity: 0.55; transform: none; }

.login-hint {
  margin: 18px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}

.login-hint a,
.login-open-bot { color: var(--green); font-weight: 700; text-decoration: none; }

.login-hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.92em;
}

.login-open-bot {
  display: inline-flex;
  align-items: center;
  height: 38px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid rgba(30, 215, 96, 0.4);
  border-radius: 999px;
}

body.login-open { overflow: hidden; }

/* ------------------------------------------------- «Слушать в фоне» */
.icon-btn[hidden] { display: none; }

.bg-link {
  position: fixed;
  inset: 0;
  z-index: 56;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bg-link[hidden] { display: none; }

.bg-link-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  animation: fade 0.2s ease;
}

.bg-link-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px calc(18px + var(--safe-r)) calc(var(--safe-b) + 16px) calc(18px + var(--safe-l));
  border-radius: 16px 16px 0 0;
  background: var(--panel);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.6);
  animation: sheet-up 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.bg-link-grab {
  width: 36px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.24);
}

.bg-link-head { display: flex; align-items: flex-start; gap: 10px; }
.bg-link-heading { flex: 1 1 auto; min-width: 0; }

.bg-link-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bg-link-sub {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.bg-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
}

.bg-code {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 14px 10px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.bg-code-copy {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #000;
  font-size: 0.8rem;
  font-weight: 800;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.bg-code-copy:active { transform: scale(0.96); }
.bg-code-copy:disabled { opacity: 0.5; }

.bg-url-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 8px;
}

.bg-url {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--green);
  font-size: 0.86rem;
  line-height: 1.4;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

.bg-copy-link {
  width: 100%;
  height: 44px;
}

.bg-warning {
  margin: 0 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 214, 107, 0.35);
  border-radius: 12px;
  background: rgba(255, 214, 107, 0.08);
  color: #ffd66b;
  font-size: 0.76rem;
  line-height: 1.45;
}

.bg-timer {
  margin: 0 0 4px;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.bg-timer.is-expired { color: #ff8a8a; }
.bg-status.is-success { color: var(--green); }

.bg-open {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #000;
  font-size: 0.88rem;
  font-weight: 800;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.bg-open:active { transform: scale(0.97); }
.bg-open:disabled { opacity: 0.5; transform: none; }

.bg-open svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bg-status {
  min-height: 1.1em;
  margin: 8px 0 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #ff8a8a;
  text-align: center;
}

.bg-help {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
}

.bg-help p { margin: 0 0 8px; }
.bg-help p:last-child { margin-bottom: 0; }
.bg-help strong { color: var(--text); font-weight: 700; }

body.bg-link-open { overflow: hidden; }

/* iOS вне Telegram: эквалайзер по умолчанию не создаёт Web Audio граф */
.eq-ios-note {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 214, 107, 0.35);
  border-radius: 12px;
  background: rgba(255, 214, 107, 0.08);
}

.eq-ios-note[hidden] { display: none; }

.eq-ios-note p {
  margin: 0 0 8px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #ffd66b;
}

.eq-ios-enable {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #ffd66b;
  color: #000;
  font-size: 0.76rem;
  font-weight: 800;
  transition: transform 0.12s ease;
}

.eq-ios-enable:active { transform: scale(0.97); }
.eq.is-ios-guarded .eq-bands { opacity: 0.45; }

/* ------------------------------------------------------------ adaptation */
@media (min-width: 700px) {
  .stage { align-items: center; padding: 20px; }
  .stage-card {
    height: min(88vh, 720px);
    max-width: 460px;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
  .eq { align-items: center; padding: 20px; }
  .eq-card {
    max-height: min(88vh, 640px);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
  .suggest { align-items: center; padding: 20px; }
  .suggest-card {
    max-height: min(88vh, 640px);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
  .bg-link { align-items: center; padding: 20px; }
  .bg-link-card {
    max-height: min(88vh, 640px);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

@media (max-width: 439px) {
  .suggest-cta { width: 34px; padding: 0; justify-content: center; }
  .suggest-cta span { display: none; }
}

@media (max-height: 720px) {
  .stage-art-slot { padding-bottom: 12px; }
  .stage-title { font-size: 1.15rem; }
  .stage-card .seek-row { padding-top: 10px; }
  .stage-controls { margin-top: 10px; }
  .stage-controls .ctrl-play { width: 56px; height: 56px; }
  .eq-slot { height: 118px; }
  .eq-bands { margin: 12px 0 4px; }
}

@media (max-height: 560px) {
  .stage-card { overflow-y: auto; overscroll-behavior: contain; }
  .stage-title {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  .stage-art-slot { min-height: 96px; padding-bottom: 8px; }
  .stage-card .seek-row { margin-top: 8px; }
  .stage-controls { margin-top: 8px; }
}

/* WebView без container queries: центрированная формула по доступной высоте */
@supports not (container-type: size) {
  .stage-art-slot {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .stage-art {
    width: min(100%, max(120px, calc(100vh - var(--safe-t) - var(--safe-b) - 300px)));
    width: min(100%, max(120px, calc(100dvh - var(--safe-t) - var(--safe-b) - 300px)));
    margin-inline: auto;
  }
}

/* без aspect-ratio: квадрат через padding-bottom */
@supports not (aspect-ratio: 1 / 1) {
  .stage-art {
    height: 0;
    padding-bottom: 100%;
  }
}

@media (min-width: 700px) {
  @supports not (container-type: size) {
    .stage-art {
      width: min(100%, max(120px, calc(88vh - 300px)));
      width: min(100%, max(120px, calc(88dvh - 300px)));
    }
  }
}

@media (max-width: 359px) {
  .row { grid-template-columns: 20px 40px minmax(0, 1fr) 26px auto; gap: 8px; }
  .row .cover { width: 40px; height: 40px; }
  .row-like { width: 26px; height: 26px; }
  .row-like svg { width: 17px; height: 17px; }
  .mini-like { display: none; }
  .mini-controls .ctrl-sm { width: 30px; height: 30px; }
  .ctrl-play { width: 40px; height: 40px; }
  .brand h1 { font-size: 1.5rem; }
  .topbar { gap: 8px; }
  .shuffle-cta { width: 34px; padding: 0; justify-content: center; }
  .shuffle-cta span { display: none; }
  .eq-hint { display: none; }
  .eq-head { gap: 8px; }
  .eq-card {
    padding-left: calc(14px + var(--safe-l));
    padding-right: calc(14px + var(--safe-r));
  }
  .bg-code { font-size: 1.35rem; letter-spacing: 0.1em; }
  .bg-code-copy { padding: 0 12px; }
  .login-input { font-size: 1.15rem; letter-spacing: 0.1em; }
}

/* ------------------------------------------------ низкая нагрузка / a11y */
@media (prefers-reduced-motion: reduce) {
  .player,
  .stage-card,
  .stage-backdrop,
  .eq-card,
  .eq-backdrop,
  .suggest-card,
  .suggest-backdrop,
  .bg-link-card,
  .bg-link-backdrop,
  .fab,
  .toast { animation: none; }
  .row .bars i,
  .scan-note::before { animation: none; }
  .row,
  .like,
  .like svg,
  .mini-like svg,
  .scope-btn,
  .chip,
  .ctrl,
  .eq-power,
  .eq-power-knob,
  .eq-chip,
  .icon-btn,
  .suggest-cta,
  .suggest-action,
  .suggest-file,
  .shuffle-cta { transition: none; }
}

html[data-perf="lite"] .player,
html[data-perf="lite"] .stage-card,
html[data-perf="lite"] .eq-card,
html[data-perf="lite"] .suggest-card,
html[data-perf="lite"] .fab,
html[data-perf="lite"] .toast { box-shadow: none; }

html[data-perf="lite"] .row .bars i { animation: none; }
html[data-perf="lite"] .like,
html[data-perf="lite"] .like svg,
html[data-perf="lite"] .mini-like svg,
html[data-perf="lite"] .scope-btn { transition: none; }
html[data-perf="lite"] .player,
html[data-perf="lite"] .stage-card,
html[data-perf="lite"] .stage-backdrop,
html[data-perf="lite"] .eq-card,
html[data-perf="lite"] .eq-backdrop,
html[data-perf="lite"] .suggest-card,
html[data-perf="lite"] .suggest-backdrop,
html[data-perf="lite"] .bg-link-card,
html[data-perf="lite"] .bg-link-backdrop { animation: none; }
html[data-perf="lite"] .stage-art,
html[data-perf="lite"] .searchbar { box-shadow: none; }

/* скрытая вкладка: браузер всё равно не рисует, но класс не должен быть мёртвым */
html.anim-paused .row .bars i,
html.anim-paused .scan-note::before,
html.anim-paused .loader,
html.anim-paused .spinner { animation-play-state: paused; }

