:root {
  --bg: #0a0a0a;
  --bg-card: #161616;
  --bg-card-hover: #1f1f1f;
  --red: #e0222b;
  --red-glow: #ff3b44;
  --white: #f5f5f5;
  --muted: #8a8a8a;
  --border: #2a2a2a;

  /* Нижний безопасный отступ: Telegram не отдаёт env(safe-area-inset-bottom)
     в своём WebView, но с Bot API 8.0 даёт собственные переменные. Берём максимум. */
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  /* Верхний отступ в полноэкранном режиме: статус-бар телефона + зона, где
     Telegram рисует свои плавающие кнопки «закрыть/меню». Вне полного экрана
     обе переменные нулевые — отступа нет. */
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  /* Высота зоны нижних вкладок: капсула 58px (48 + 2×4 отступа + 2×1 рамка)
     + 10px до края экрана */
  --tabbar-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

/* Мягкое затемнение под системной полосой жестов: без него значки
   телефона внизу сливались бы с прокрученным под них списком. Без
   границы — плавно сходит на нет. Вне полного экрана высота нулевая. */
#app::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--safe-bottom) * 1.6);
  background: linear-gradient(to top, rgba(10,10,10,0.8), rgba(10,10,10,0));
  pointer-events: none;
  z-index: 4;
}

#app {
  /* Ровно по окну WebView. Раньше высота бралась из
     --tg-viewport-stable-height: в полноэкранном режиме она не совпадает с
     реальным окном и меняется при свайпах/разворачивании — привязанная к
     низу #app капсула вкладок «ходила» и уезжала под край экрана, отрываясь
     от плеера (тот прибит к экрану). Теперь низ приложения = низ экрана. */
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 500px 300px at 15% -5%, rgba(224,34,43,0.16), transparent 60%),
    radial-gradient(ellipse 400px 260px at 100% 10%, rgba(224,34,43,0.08), transparent 60%),
    var(--bg);
}

/* --- Иконка (наушники + мик) --- */
.hs-band { stroke: var(--white); stroke-width: 9; }
.hs-pad { fill: var(--red); }
.hs-mic-arc { stroke: var(--red-glow); stroke-width: 3.4; }

/* --- Векторные иконки (общий класс, цвет наследуется от родителя) --- */
.ic {
  display: block;
  width: 20px;
  height: 20px;
  color: inherit;
  flex-shrink: 0;
  pointer-events: none; /* клик всегда ловит кнопка, а не svg */
}
.ic-14 { width: 14px; height: 14px; }
.ic-16 { width: 16px; height: 16px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-22 { width: 22px; height: 22px; }
.ic-26 { width: 26px; height: 26px; }
.ic-28 { width: 28px; height: 28px; }
.ic-accent { color: var(--red-glow); filter: drop-shadow(0 0 6px rgba(255,59,68,0.5)); }

/* Кнопки с иконкой — центрируем содержимое */
/* color/font — наследуем явно: Safari на iOS иначе красит текст кнопок в
   системный синий (так на iPhone выглядели «Коран» и «Нашиды» на главной). */
button {
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: inherit;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* --- Topbar --- */
/* Шапка без полосы и без фона, и она не занимает место в раскладке: висит
   поверх экрана. Список прокручивается ПОД плашками до самого верха экрана,
   а не обрывается по нижнему краю шапки. Название и язык — отдельные
   «плавающие» плашки; между ними касания проходят сквозь шапку к списку. */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding: calc(10px + var(--safe-top)) 12px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
/* Мягкое затемнение только под статус-баром телефона (часы, батарея):
   без него значки терялись бы на прокрученном под них списке. Без
   границы — плавно сходит на нет. Вне полного экрана высота нулевая. */
.topbar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(var(--tg-safe-area-inset-top, 0px) * 1.6);
  background: linear-gradient(to bottom, rgba(10,10,10,0.8), rgba(10,10,10,0));
  pointer-events: none;
  z-index: -1;
}

/* Маячок в конце списка нашидов: и подпись «Загрузка…», и точка,
   по которой понимаем, что пора тянуть следующую сотню */
.list-sentinel {
  padding: 18px 12px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* --- Экран выбора языка при первом входе --- */
.lang-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: calc(24px + var(--safe-top)) 24px 24px;
  background:
    radial-gradient(ellipse 520px 320px at 50% 12%, rgba(224,34,43,0.20), transparent 62%),
    var(--bg);
}
.lang-gate.hidden { display: none; }

.lang-gate-logo {
  width: 74px;
  height: 74px;
  filter: drop-shadow(0 0 16px rgba(255,59,68,0.55));
}
.lang-gate-title {
  text-align: center;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 600;
  color: var(--white);
}
.lang-gate-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}
.lang-gate-btn {
  width: 100%;
  justify-content: center;
  gap: 10px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
}
.lang-gate-btn:active {
  background: var(--bg-card-hover);
  border-color: var(--red);
}

/* Бейдж с кодом языка — замена эмодзи-флагу, выглядит одинаково везде */
.lang-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(224, 34, 43, 0.16);
  color: var(--red-glow);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

/* --- Переключатель языка --- */
.lang-switch { position: relative; flex-shrink: 0; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 999px;
  background: rgba(255,255,255,0.025);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.lang-btn:active { background: rgba(255,255,255,0.10); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(22,22,22,0.98);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lang-menu.hidden { display: none; }

.lang-option {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--white);
  font-size: 14px;
}
.lang-option:active { background: rgba(255,255,255,0.08); }
.lang-option.active {
  color: var(--red-glow);
  background: rgba(224,34,43,0.12);
  font-weight: 600;
}
/* Плашка с названием — такая же, как кнопка языка, но отдельная */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 38px;
  padding: 0 16px 0 10px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 999px;
  background: rgba(255,255,255,0.025);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.logo-icon {
  width: 26px; height: 26px;
  filter: drop-shadow(0 0 6px rgba(255,59,68,0.65));
}
.logo-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
  text-shadow: 0 0 12px rgba(224, 34, 43, 0.5);
}

/* --- Screens --- */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  /* Сверху — место под плавающую шапку (10 + 38 + 6 = 54px + зазор 12px):
     в начальном положении список стоит под плашками, а при прокрутке
     уезжает под них до края экрана. */
  /* Снизу — место под плавающие вкладки, чтобы последняя строка списка
     докручивалась выше них, а не оставалась под плашками. */
  padding: calc(66px + var(--safe-top)) 12px calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  animation: screenIn 0.22s ease;
}
.screen.active { display: block; }
.screen.has-player { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 72px); }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 12px;
}
.screen-title { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 16px;
}
.admin-export-btn {
  margin-left: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

/* --- Search --- */
.search-bar { margin-bottom: 10px; }
.search-bar input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--white);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-bar input:focus { border-color: var(--red); }
.search-bar input::placeholder { color: var(--muted); }

/* --- Lists --- */
.list { display: flex; flex-direction: column; gap: 8px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.list-item:active { background: var(--bg-card-hover); transform: scale(0.99); }

.list-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #2a0a0c, #120404);
  border: 1px solid var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--red-glow);
  flex-shrink: 0;
  overflow: hidden;
}

/* Обложка трека вместо иконки (нашиды) — тот же приём маски, что у mini-art в плеере */
.list-item-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 68%, rgba(0,0,0,0.5) 88%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 68%, rgba(0,0,0,0.5) 88%, transparent 100%);
}

.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Строка, которую сейчас перетаскивают в «Избранном» */
.list-item.dragging {
  position: relative;
  z-index: 20;
  transform-origin: center;
  box-shadow: 0 10px 26px rgba(0,0,0,0.55), 0 0 0 1px var(--red);
  opacity: 0.96;
  transition: none;             /* следуем за пальцем без задержки */
}
.list-item.dragging .list-item-title { color: var(--red-glow); }
/* соседи расступаются плавно, взятая строка — без задержки, за пальцем */
.list.reordering .list-item { transition: transform 0.16s ease; }
.list.reordering .list-item.dragging { transition: none; }
/* пока тащим — страница не должна прокручиваться под пальцем */
.list.reordering { touch-action: none; }

/* Кнопка «убрать запись» — только у админа. Приглушённая, чтобы не спорить
   со звёздочкой и скачиванием, но краснеет при нажатии. */
.list-item-hide {
  background: none;
  border: none;
  color: var(--muted);
  flex-shrink: 0;
  padding: 4px;
  opacity: 0.55;
  transition: color 0.15s, opacity 0.15s;
}
.list-item-hide:active { color: var(--red-glow); opacity: 1; }
#np-hide { display: none; }

/* Пометка популярного нашида (сколько раз включали) */
.hot {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--red-glow);
  font-weight: 600;
}

.list-item-fav, .list-item-download {
  background: none;
  border: none;
  color: var(--muted);
  flex-shrink: 0;
  padding: 4px;
  transition: color 0.15s;
}
.list-item-download { overflow: visible; }
.list-item-download:disabled { opacity: 0.5; }
.list-item-fav.active { color: var(--red-glow); filter: drop-shadow(0 0 6px var(--red-glow)); }

.dl-bounce {
  color: var(--red-glow) !important;
  filter: drop-shadow(0 0 6px var(--red-glow));
  animation: dlArrowLoop 0.45s ease-in-out 2;
}
@keyframes dlArrowLoop {
  0%   { transform: translateY(-5px); opacity: 0.4; }
  60%  { transform: translateY(4px); opacity: 1; }
  100% { transform: translateY(-5px); opacity: 0.4; }
}

/* Подготовка нашида к скачиванию (брендинг через бота может занять до ~90с):
   обычная прыгающая стрелка (как и при обычном dl-bounce), но в цикле,
   плюс кольцо прогресса вокруг кнопки — раз точного % нет, крутится бесконечно. */
.list-item-download.loading,
.np-side-btn.loading {
  position: relative;
}
.list-item-download.loading svg,
.np-side-btn.loading svg {
  color: var(--red-glow);
  filter: drop-shadow(0 0 6px var(--red-glow));
  animation: dlArrowLoop 0.7s ease-in-out infinite;
}
.list-item-download.loading::before,
.np-side-btn.loading::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(255,59,68,0.18);
  border-top-color: var(--red-glow);
  border-right-color: var(--red-glow);
  animation: dlRingSpin 0.85s linear infinite;
  pointer-events: none;
}
@keyframes dlRingSpin { to { transform: rotate(360deg); } }

.list-item.playing {
  border-color: var(--red);
  background: linear-gradient(90deg, rgba(224,34,43,0.10), var(--bg-card) 60%);
  box-shadow: 0 0 0 1px var(--red), 0 0 16px rgba(224, 34, 43, 0.2);
}
.list-item.playing .list-item-icon {
  border-color: var(--red-glow);
  box-shadow: 0 0 10px rgba(255,59,68,0.5);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* --- Мини-эквалайзер (мини-плеер): высоту столбиков двигает JS в реальном
   времени по спектру звука (см. updateMiniEq в app.js), тут только базовый
   вид столбика и лёгкое сглаживание шага между кадрами анализатора. */
.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  flex-shrink: 0;
}
.eq-bars span {
  width: 4px;
  background: var(--red-glow);
  border-radius: 2px;
  height: 14%;
  box-shadow: 0 0 4px var(--red-glow);
  transition: height 0.08s ease-out, opacity 0.2s;
}
.eq-bars:not(.playing) span { opacity: 0.35; }

/* --- Мини-плеер (нижний бар) --- */
.player-bar {
  position: fixed;
  left: 8px; right: 8px;
  /* «Примагничен» к капсуле вкладок: --tabbar-h уже включает её 10px до
     края экрана, сверх — только 2px. Появляется, выезжая из-за капсулы. */
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 2px);
  animation: playerSnap 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  /* стеклянная полупрозрачная плашка (чуть прозрачнее — просвечивает фон) */
  background: linear-gradient(135deg, rgba(48,26,28,0.07), rgba(16,13,13,0.045));
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  z-index: 10;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.07);
  cursor: pointer;
  transition: transform 0.15s;
}
/* если backdrop-filter не поддерживается — не оставляем «дырявый» фон */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .player-bar { background: linear-gradient(135deg, #1a1414, #0f0d0d); }
}
.player-bar:active { transform: scale(0.99); }
.player-bar.hidden { display: none; }
@keyframes playerSnap {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Полоска перемотки в мини-плеере: врезана в нижний край плашки, на всю
   ширину. Заливку рисуем градиентом прямо на дорожке (см. updateProgress
   в app.js). Бегунок — видимый кружок, иначе на мыши (Telegram Desktop)
   по плашке ничего не подсказывает, что тут можно тянуть и перематывать,
   курсор-рука у неё и так на весь мини-плеер (он целиком кликабелен —
   открывает полный плеер). Отступы: чуть отступаем от самого края и от
   боковых скруглённых углов (радиус 18px), чтобы бегунок при наведении
   не срезало overflow:hidden у .player-bar. */
.player-bar-progress {
  position: absolute;
  bottom: 3px; right: 20px;
  /* Не заходит под кнопки перемотки/паузы слева — начинается там же, где
     начинается название трека. Отступ = padding-left плашки (11) + три
     кнопки-транспорта с их gap'ами (20+10+38+10+20+10 = 108) ≈ 119px. */
  left: 119px;
  padding: 0;
  z-index: 2;                 /* над кликом по плашке, иначе откроется плеер */
}
.player-bar-progress input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  /* Сам элемент выше видимой линии — это площадь для пальца (по 3px линию
     попасть невозможно). Видимую линию рисует фон: background-size задаёт
     ей высоту, а сам градиент-заливку до текущей позиции ставит JS. */
  height: 12px;
  border-radius: 0;
  outline: none;
  cursor: pointer;
  /* Именно background-image, а не цвет: цвет фона залил бы всю высоту
     элемента (background-size на него не действует), и вместо тонкой
     линии вышла бы серая полоса на всю высоту. */
  background-color: transparent;
  background-image: linear-gradient(to right, rgba(255,255,255,0.20), rgba(255,255,255,0.20));
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-position: left center;
  transition: background-size 0.15s;
}
/* На ховере/тапе линия чуть толще — уже само по себе подсказка,
   что элемент интерактивный, до всякого бегунка. */
.player-bar-progress input[type="range"]:hover,
.player-bar-progress input[type="range"]:active {
  background-size: 100% 4px;
}
.player-bar-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 6px rgba(224,34,43,0.7);
  cursor: pointer;
  transition: transform 0.15s;
}
.player-bar-progress input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 6px rgba(224,34,43,0.7);
  cursor: pointer;
  transition: transform 0.15s;
}
/* Растёт под курсором/пальцем — видно, что именно тут можно тянуть. */
.player-bar-progress input[type="range"]:hover::-webkit-slider-thumb,
.player-bar-progress input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.35);
}
.player-bar-progress input[type="range"]:hover::-moz-range-thumb,
.player-bar-progress input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.35);
}

.player-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px 11px;     /* повыше — плашку видно лучше */
}

.player-info { flex: 1; min-width: 0; }
.player-surah { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-reciter { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mini-playpause {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--red-glow), var(--red));
  border: none;
  color: var(--white);
  box-shadow: 0 0 14px rgba(224,34,43,0.55);
  flex-shrink: 0;
  padding: 0;
}
/* Перемотка назад/вперёд рядом с play — размером поменьше, без заливки */
.mini-side-btn {
  background: none;
  border: none;
  color: var(--white);
  padding: 2px;
  flex-shrink: 0;
  opacity: 0.85;
}
.mini-side-btn:active { opacity: 0.5; }

/* Крестик закрытия плеера — приглушённее прочих кнопок (не основное
   действие) и с собственным кругом-хитбоксом побольше самой иконки,
   чтобы по нему было удобно попасть пальцем. */
.mini-close-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.55;
}
.mini-close-btn:hover { opacity: 0.85; background: rgba(255,255,255,0.08); }
.mini-close-btn:active { opacity: 1; background: rgba(255,255,255,0.14); }

/* --- Полноэкранный "Сейчас играет" --- */
.now-playing {
  position: fixed;
  inset: 0;
  /* полупрозрачное «стекло» поверх приложения */
  background:
    radial-gradient(ellipse 700px 500px at 50% 0%, rgba(224,34,43,0.20), transparent 55%),
    rgba(10,8,8,0.72);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  backdrop-filter: blur(28px) saturate(140%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.now-playing.open { transform: translateY(0); }
.now-playing.hidden { display: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .now-playing { background: radial-gradient(ellipse 700px 500px at 50% 0%, rgba(224,34,43,0.18), transparent 55%), #0a0808; }
}

.np-glow {
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(224,34,43,0.35), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 4px;
  position: relative;
  z-index: 1;
}
.np-collapse-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  /* стеклянная, в тон плееру — вместо глухого серого квадратного фона */
  background: linear-gradient(160deg, rgba(80,26,30,0.55), rgba(30,14,16,0.45));
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
  color: var(--white);
  line-height: 1;
  padding: 0;
  transition: transform 0.15s, background 0.15s;
}
.np-collapse-btn:active {
  transform: scale(0.92);
  background: linear-gradient(160deg, rgba(110,32,38,0.6), rgba(40,18,20,0.5));
}
.np-header-title {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: 600;
}

.np-art-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  min-height: 0;
}
.np-art {
  width: min(62vw, 260px);
  height: min(62vw, 260px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #241010, #0c0505 70%);
  border: 1px solid rgba(224,34,43,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 50px rgba(224,34,43,0.25), inset 0 0 30px rgba(0,0,0,0.6);
}
/* Круговой эквалайзер внутри обложки */
.np-viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}
/* Обложка канала по центру круга. Не вращается — стоит статично.
   Края растворяются в фоне маской, чтобы не было резкого обреза. */
.np-art-img {
  position: relative;
  z-index: 1;
  width: 62%;
  height: 62%;
  border-radius: 50%;
  object-fit: cover;
  animation: none;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 55%, rgba(0,0,0,0.75) 76%, rgba(0,0,0,0.25) 91%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 55%, rgba(0,0,0,0.75) 76%, rgba(0,0,0,0.25) 91%, transparent 100%);
}
.np-art-ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid var(--red-glow);
  opacity: 0.55;
  animation: ringPulse 2.4s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.06); opacity: 0.15; }
}

/* Загрузка нашида из Telegram (первый заход, ещё не в кэше на диске) */
.np-art.loading .np-art-ring {
  animation: none;
  border-style: dashed;
  border-color: var(--red-glow);
  opacity: 0.9;
  animation: ringSpin 0.9s linear infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.np-art.loading .np-art-img { opacity: 0.45; }
.mini-playpause.loading { animation: mppPulse 0.9s ease-in-out infinite; }
@keyframes mppPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.np-meta { text-align: center; padding: 18px 0 8px; position: relative; z-index: 1; }
.np-surah { font-size: 19px; font-weight: 700; text-shadow: 0 0 16px rgba(224,34,43,0.35); }
.np-reciter { font-size: 13px; color: var(--muted); margin-top: 4px; }

.np-progress { padding: 10px 2px 4px; position: relative; z-index: 1; }
.np-progress input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}
.np-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}
.np-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.np-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 14px 0 2px;
  position: relative;
  z-index: 1;
}
.np-controls-side {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 4px 0 6px;
  position: relative;
  z-index: 1;
}
.np-side-btn {
  background: none; border: none;
  color: var(--muted);
  padding: 6px;
  transition: color 0.15s;
}
.np-side-btn:disabled { opacity: 0.5; }
/* Скачивание — только у админов; у остальных кнопки просто нет
   (класс is-admin ставится на body после проверки сессии) */
#np-download { display: none; }
body.is-admin #np-download { display: inline-flex; }
.np-side-btn.active { color: var(--red-glow); filter: drop-shadow(0 0 8px var(--red-glow)); }

/* --- Громкость (полноэкранный плеер) --- */
.np-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 2px;
  position: relative;
  z-index: 1;
}
.np-volume-icon {
  background: none; border: none;
  color: var(--muted);
  padding: 4px;
  flex-shrink: 0;
}
.np-volume-icon.active { color: var(--red-glow); }
.np-volume input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.14);
  outline: none;
  cursor: pointer;
}
.np-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
  cursor: pointer;
}
.np-volume input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
  cursor: pointer;
}
.np-main-btn {
  background: none; border: none;
  color: var(--white);
  padding: 6px;
}
.np-main-btn:active { opacity: 0.6; }
.np-play-btn {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--red-glow), var(--red));
  border: none;
  color: var(--white);
  padding: 0;
  box-shadow: 0 0 26px rgba(224,34,43,0.55);
}

/* --- Всплывающее уведомление (например, «Трек отправлен вам в чат») --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 78px);
  transform: translate(-50%, 12px);
  max-width: 86%;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30,16,18,0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  color: var(--white);
  font-size: 13px;
  text-align: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- Главный экран: выбор раздела --- */
/* Экран становится колонкой только когда активен — сама .screen.active
   у остальных экранов всё ещё display:block, эта пара правил их не трогает */
#screen-home.active {
  display: flex;
  flex-direction: column;
}
.home-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  justify-content: center;
  padding: 8px 4px 60px;
}

/* Кнопка входа в админку — видна только самому админу (body.is-admin,
   ставится в JS после проверки сессии на бэкенде; сама кнопка — просто
   удобный вход в уже защищённый экран, не источник защиты). */
.admin-home-btn {
  display: none;
  margin: 0 4px 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
body.is-admin .admin-home-btn { display: block; }
.admin-home-btn:active { background: var(--bg-card-hover); }
.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--bg-card), #100c0c);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.home-card:active { transform: scale(0.98); }
.home-card:hover, .home-card:focus-visible {
  border-color: rgba(224,34,43,0.55);
  box-shadow: 0 0 24px rgba(224,34,43,0.18);
}
.home-card-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}
.home-card-title {
  color: var(--white);
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(224,34,43,0.4);
}
.home-card-sub { font-size: 12px; color: var(--muted); }

/* Логотип шапки — тоже кнопка возврата на главный экран */
.logo { cursor: pointer; }

/* --- Tabbar --- */
/* Нижние вкладки — ОДНА капсула с тремя значками внутри. Висит поверх
   экрана, список прокручивается под ней до нижнего края. Фон и размытие
   плотнее, чем у плашек шапки: иначе текст списка просвечивает сквозь
   капсулу и подписи под значками не прочитать. */
.tabbar {
  /* Прибита к низу экрана — так же, как мини-плеер над ней, поэтому они
     больше не разъезжаются */
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 5;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  background: rgba(18,13,14,0.55);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.tab-btn {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:active { background: rgba(255,255,255,0.07); }
.tab-btn .tab-icon { color: inherit; }
/* Активная вкладка — подсвеченная «таблетка» внутри капсулы */
.tab-btn.active {
  color: var(--red-glow);
  background: rgba(224,34,43,0.14);
}
.tab-btn.active .tab-icon { filter: drop-shadow(0 0 7px rgba(255,59,68,0.6)); }
.tabbar.hidden { display: none; }

/* --- Экран админки --- */
.admin-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.admin-stat-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.admin-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--red-glow);
}
.admin-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.admin-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 18px 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.admin-breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
}
.admin-breakdown-row span:last-child { color: var(--muted); }
.admin-user-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.admin-user-name { font-size: 13px; font-weight: 600; }
.admin-user-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
