/* ════════════════════════════════════════
   ANIROXA — main.css  v3
════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg:          #0a0a0f;
  --bg2:         #111118;
  --bg3:         #1a1a24;
  --surface:     #16161f;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.13);
  --text:        #e8e8f0;
  --text2:       #8888a8;
  --text3:       #45455a;
  --accent:      #e63e6d;
  --accent2:     #ff6b9d;
  --gold:        #f5c842;
  --radius:      14px;
  --radius-lg:   22px;
  --shadow:      0 8px 40px rgba(0,0,0,0.6);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.45);
  --ease:        cubic-bezier(0.4,0,0.2,1);
  --font-d: 'Syne', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --header-h: 90px;   /* высота шапки — используется для padding main */
}

[data-theme="light"] {
  --bg:        #f2f2f7;
  --bg2:       #e8e8f0;
  --bg3:       #dcdce8;
  --surface:   #ffffff;
  --border:    rgba(0,0,0,0.07);
  --border2:   rgba(0,0,0,0.14);
  --text:      #18181f;
  --text2:     #5c5c78;
  --text3:     #9999b5;
  --shadow:    0 8px 40px rgba(0,0,0,0.10);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Theme transition — равномерная на всё ── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  transition: background-color 0.3s ease,
              border-color 0.3s ease,
              color 0.3s ease,
              box-shadow 0.3s ease,
              opacity 0.3s ease;
}
/* Отдельно обнуляем у того, чему нужна своя анимация */
.card { transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease) !important; }
.card-poster img { transition: transform 0.45s ease !important; }
.header { transition: transform 0.35s var(--ease), background-color 0.3s ease, border-color 0.3s ease !important; }
.modal-panel { transition: transform 0.38s cubic-bezier(0.32,0.72,0,1), opacity 0.32s ease !important; }
.modal-backdrop { transition: opacity 0.32s ease !important; }
.sort-btn { transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease !important; }
.btn-watch { transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease !important; }

html { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════
   HEADER  — трёхколоночный, центрированный
══════════════════════════════════════ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10,10,15,0.88);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .header { background: rgba(242,242,247,0.90); }
.header--hidden { transform: translateY(-100%); }

/* Три колонки: лого | центр | правые кнопки */
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 6px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (min-width: 640px) {
  .header-inner { padding: 10px 24px 8px; gap: 16px; }
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
@media (min-width: 640px) { .logo-img { height: 52px; } }

.logo-img--dark  { display: block; }
.logo-img--light { display: none; }
[data-theme="light"] .logo-img--dark  { display: none; }
[data-theme="light"] .logo-img--light { display: block; }

.logo-fallback {
  display: none;
  align-items: baseline;
  gap: 2px;
}
.logo-text {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.logo-beta {
  font-size: 10px; font-weight: 700;
  color: var(--accent); vertical-align: super;
}

/* ── Название бренда рядом с лого (только десктоп) ── */
.logo-name {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}
@media (min-width: 640px) { .logo-name { font-size: 24px; } }
.logo-name sup { font-size: 9px; font-weight: 700; color: var(--accent); vertical-align: super; }

/* ── Центральный блок ── */
.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Разделитель между группами кнопок в хедере */
.hdr-sep {
  width: 1px;
  height: 20px;
  background: var(--border2);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Строка поиска + фильтр */
.search-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.search-row .search-wrap {
  width: 100%;
  max-width: 480px;
}

/* Поиск */
.search-wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 14px;
  height: 38px;
  gap: 8px;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(230,62,109,0.12);
}
.search-icon { width: 15px; height: 15px; color: var(--text3); flex-shrink: 0; }
.search-input {
  background: none; border: none; outline: none;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  width: 100%;
}
.search-input::placeholder { color: var(--text3); }
.search-clear {
  width: 18px; height: 18px; color: var(--text3);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.search-clear:hover { color: var(--text); }
.search-clear svg { width: 14px; height: 14px; }
.search-clear[hidden] { display: none; }

/* Sort bar — внутри header-center, только десктоп */
.sort-bar {
  display: none; /* скрыта на мобиле — есть внизу */
}
@media (min-width: 640px) {
  .sort-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: visible;
    width: 100%;
    padding-bottom: 2px;
  }
}

.sort-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-b);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sort-btn svg { width: 11px; height: 11px; }
.sort-btn:hover { color: var(--text); border-color: var(--border2); }
.sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Популярное split-button ── */
.sort-pop-wrap {
  position: relative;
  flex-shrink: 0;
}
.sort-pop-chevron {
  opacity: 0.6;
  margin-left: 1px;
  transition: transform 0.18s;
}
.sort-pop-wrap.open .sort-pop-chevron { transform: rotate(180deg); }
.sort-pop-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 130px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 4px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 200;
}
.sort-pop-wrap.open .sort-pop-drop { display: flex; }
.sort-pop-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-b);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.sort-pop-item:hover { background: var(--bg3); color: var(--text); }
.sort-pop-item.active { color: var(--accent); }

/* ── Мобильная нижняя панель сортировки ── */
.mob-sort-bar {
  display: none;
}
@media (max-width: 639px) {
  .mob-sort-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 90;
    background: rgba(10,10,15,0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border2);
    padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
    gap: 4px;
    justify-content: space-around;
  }
}
[data-theme="light"] .mob-sort-bar { background: rgba(242,242,247,0.94); }

.mob-sort-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1; padding: 5px 4px;
  font-family: var(--font-b); font-size: 10px; font-weight: 500;
  color: var(--text3);
  background: none; border: none; cursor: pointer; border-radius: 10px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.mob-sort-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.mob-sort-btn.active { color: var(--accent); }
.mob-sort-btn:active { background: var(--bg3); }

/* ── Группа мобильных кнопок (попап) ── */
.mob-sort-group {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.mob-sort-group-btn {
  width: 100%;
}
.mob-group-icon { display: flex; align-items: center; justify-content: center; }
.mob-group-icon svg { width: 18px; height: 18px; }

.mob-sort-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 150px;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 300;
}
[data-theme="light"] .mob-sort-popup {
  background: #f2f2f7;
  border-color: rgba(0,0,0,.1);
  box-shadow: 0 -8px 32px rgba(0,0,0,.18);
}
.mob-sort-popup.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mob-sort-popup-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 9px;
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.mob-sort-popup-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.mob-sort-popup-item:hover { background: var(--bg3); color: var(--text); }
.mob-sort-popup-item.active { color: var(--accent); }

/* ── Правые кнопки ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--border2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
/* Telegram — особый цвет при ховере */
.tg-btn:hover { border-color: #2CA5E0; color: #2CA5E0; }
/* Docs кнопка */
.docs-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Profile button (desktop) */
.profile-btn-desk { overflow: hidden; padding: 0; }
.profile-btn-desk svg { width: 16px; height: 16px; }
.profile-btn-desk img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.profile-btn-desk:hover { border-color: var(--accent); color: var(--accent); }
.profile-btn-desk.has-avatar { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.profile-btn-desk .desk-initials { font-family: var(--font-d); font-size: 12px; font-weight: 700; color: #fff; line-height: 1; }

/* ══════════════════════════════════════
   MAIN / GRID
══════════════════════════════════════ */
.main {
  padding-top: 100px; /* без sort-bar в хедере меньше */
  padding-bottom: 80px; /* место для нижней панели */
  padding-left: 12px;
  padding-right: 12px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (min-width: 640px) {
  .main { padding-top: 145px; padding-bottom: 80px; padding-left: 20px; padding-right: 20px; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (min-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 16px; } }
@media (min-width: 1200px){ .grid { grid-template-columns: repeat(6, 1fr); gap: 18px; } }

/* ── Онгоинг: заголовки дней внутри грида ── */
.day-header {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  padding: 12px 2px 10px;
  border-bottom: 1px solid var(--border);
}
.day-header:first-child { padding-top: 0; }

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: cardIn 0.35s ease both;
  will-change: transform;
}
.card:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 10px 32px rgba(0,0,0,0.55), 0 0 0 1px var(--accent);
  border-color: var(--accent);
}
.card:active { transform: scale(0.97); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card poster ── */
.card-poster {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg3);
}
.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: blur(0.3px);
  transform: translateZ(0); /* GPU-слой, убирает ступенчатость */
}

.card:hover .card-poster img { transform: scale(1.06) translateZ(0); }

.card-score {
  position: absolute;
  bottom: 7px; left: 7px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  color: var(--gold);
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 7px;
  display: flex; align-items: center; gap: 3px;
  line-height: 1;
}
.card-score::before { content: '★'; font-size: 9px; }

.card-meta { padding: 8px 9px 9px; }
.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 640px) { .card-title { font-size: 13px; } }

/* ── Skeleton ── */
.card-skeleton .card-poster { background: var(--bg3); }
.card-skeleton .card-poster::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--bg2) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line {
  height: 10px; border-radius: 5px; margin-bottom: 6px;
  background: linear-gradient(90deg, var(--bg3) 0%, var(--bg2) 50%, var(--bg3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line.short { width: 55%; }
.card-skeleton .card-meta { padding: 9px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Loader ── */
.loader {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; padding: 44px 0;
}
.loader[aria-hidden="true"] { display: none; }
.loader-ring {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.loader-ring:nth-child(2) { animation-delay: 0.18s; background: var(--accent2); }
.loader-ring:nth-child(3) { animation-delay: 0.36s; }
@keyframes pulse {
  0%,80%,100% { transform: scale(0.55); opacity: 0.35; }
  40%          { transform: scale(1.1);  opacity: 1; }
}

/* ── Error / No more ── */
.error-banner {
  display: flex; align-items: center; gap: 12px;
  background: rgba(230,62,109,0.07);
  border: 1px solid rgba(230,62,109,0.2);
  border-radius: var(--radius);
  padding: 14px 18px; margin: 20px 0;
  color: var(--accent2); font-size: 14px;
}
.error-emoji { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.error-banner[hidden] { display: none; }
#retryBtn {
  margin-left: auto; padding: 6px 14px;
  background: var(--accent); color: #fff;
  border-radius: 8px; font-size: 13px; font-weight: 500;
}
#retryBtn:hover { background: var(--accent2); }
.no-more { text-align: center; color: var(--text3); font-size: 13px; padding: 30px 0; letter-spacing: 0.2em; }
.no-more[hidden] { display: none; }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end;
  pointer-events: none;
}
@media (min-width: 640px) { .modal { align-items: center; justify-content: center; } }
.modal.open { pointer-events: all; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
}
.modal.open .modal-backdrop { opacity: 1; }

/* Панель */
.modal-panel {
  position: relative;
  background: var(--bg2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 93dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--border2);
  transform: translateY(100%);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.modal.open .modal-panel { transform: translateY(0); }

@media (min-width: 640px) {
  .modal-panel {
    border-radius: var(--radius-lg);
    max-width: 880px;
    width: 92vw;
    max-height: 88dvh;
    border: 1px solid var(--border2);
    transform: translateY(24px) scale(0.96);
    opacity: 0;
  }
  .modal.open .modal-panel { transform: translateY(0) scale(1); opacity: 1; }
}

/* Drag handle — только мобиле */
.modal-handle {
  width: 38px; height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 12px auto 4px;
}
@media (min-width: 640px) { .modal-handle { display: none; } }

/* Крестик — ТОЛЬКО десктоп */
.modal-close {
  display: none; /* скрыт по умолчанию */
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  align-items: center; justify-content: center;
  z-index: 2;
}
.modal-close:hover { color: var(--text); border-color: var(--border2); }
.modal-close svg { width: 15px; height: 15px; }
@media (min-width: 640px) {
  .modal-close { display: flex; } /* показываем только на ПК */
}

/* Body */
.modal-body {
  display: flex;
  flex-direction: column;
  padding: 12px 16px 24px;
  gap: 16px;
}
@media (min-width: 480px) {
  .modal-body { flex-direction: row; align-items: flex-start; padding: 24px 28px; gap: 24px; }
}

/* Постер в модалке */
.modal-poster-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  width: 100%; aspect-ratio: 21/9; /* горизонтальный на мобиле */
  background: var(--bg3);
}
@media (min-width: 480px) {
  .modal-poster-wrap { width: 170px; aspect-ratio: 2/3; }
}
@media (min-width: 640px)  { .modal-poster-wrap { width: 220px; } }
@media (min-width: 900px)  { .modal-poster-wrap { width: 270px; } }

.modal-poster {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center center;
}
.modal-poster-blur {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(22px) brightness(0.35);
  z-index: -1; transform: scale(1.3);
}

/* Info */
.modal-info { flex: 1; min-width: 0; padding-top: 2px; }
.modal-skeleton { display: flex; flex-direction: column; gap: 10px; }
.modal-skeleton.hidden { display: none; }
.sk {
  background: linear-gradient(90deg, var(--bg3) 0%, var(--surface) 50%, var(--bg3) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s infinite;
}
.sk-title { height: 22px; width: 78%; }
.sk-meta  { height: 13px; width: 48%; }
.sk-desc  { height: 12px; width: 100%; }
.sk-desc.short { width: 62%; }

.modal-genres {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px;
}
.genre-tag {
  font-size: 11px; font-weight: 500;
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text2);
}

.modal-title {
  font-family: var(--font-d);
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 7px;
}
.modal-meta {
  font-size: 13px; color: var(--text2); margin-bottom: 10px;
}
.modal-meta span + span::before { content: ' · '; opacity: 0.45; }
.modal-score-row { margin-bottom: 12px; }
.modal-score {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-d);
  font-size: 22px; font-weight: 700; color: var(--gold);
}
.modal-score::before { content: '★'; font-size: 17px; }

/* Описание — скролл */
.modal-desc-wrap { position: relative; margin-bottom: 20px; }
.modal-desc {
  font-size: 14px; line-height: 1.72; color: var(--text2);
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: none;
  padding-right: 2px;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.modal-desc::-webkit-scrollbar { display: none; }
.modal-desc.expanded {
  max-height: none;
  mask-image: none;
  -webkit-mask-image: none;
}
@media (min-width: 640px) { .modal-desc { max-height: 150px; } }
.desc-expand-btn {
  color: var(--accent); font-size: 12px; font-weight: 500;
  padding: 4px 0; display: block; margin-top: 5px;
}
.desc-expand-btn:hover { color: var(--accent2); }

/* Actions */
.modal-actions { display: flex; align-items: center; gap: 12px; }
.btn-watch {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-family: var(--font-b); font-size: 15px; font-weight: 600;
  padding: 11px 26px; border-radius: 100px;
  box-shadow: 0 4px 20px rgba(230,62,109,0.32);
}
.btn-watch:hover:not(:disabled) {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(230,62,109,0.5);
}
.btn-watch:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-watch svg { width: 17px; height: 17px; }
.btn-stub-note { font-size: 12px; color: var(--text3); }

/* ── Scroll to top ── */
#scrollTop {
  position: fixed;
  bottom: 22px; right: 18px;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  z-index: 50;
}
#scrollTop.visible { opacity: 1; pointer-events: all; transform: translateY(0); }
#scrollTop:hover { color: var(--text); border-color: var(--accent); }
#scrollTop svg { width: 19px; height: 19px; }
/* На мобиле поднимаем над нижней панелью сортировки (~62px) */
@media (max-width: 639px) {
  #scrollTop { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); right: 14px; }
}

/* ══════════════════════════════════════
   FILTER BUTTON
══════════════════════════════════════ */
#filterBtn { position: relative; }
.filter-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid var(--bg2);
  opacity: 0; transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#filterBtn.active .filter-dot,
#filterBtnMob.active .filter-dot { opacity: 1; transform: scale(1); }
#filterBtn.active,
#filterBtnMob.active { border-color: rgba(230,62,109,0.5); color: var(--accent); }

/* ══════════════════════════════════════
   FILTER DRAWER
══════════════════════════════════════ */
.fd-backdrop {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease;
}
.fd-backdrop.open { opacity: 1; pointer-events: all; }

.fd-drawer {
  position: fixed; z-index: 300;
  background: var(--bg2);
  display: flex; flex-direction: column;
  overflow: hidden;
  /* Десктоп — справа */
  top: 0; right: 0; bottom: 0;
  width: clamp(320px, 38vw, 460px);
  border-left: 1px solid var(--border2);
  transform: translateX(105%);
  transition: transform 0.34s cubic-bezier(0.32,0.72,0,1);
}
.fd-drawer.open { transform: translateX(0); }

@media (max-width: 639px) {
  .fd-drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 90dvh;
    border-left: none; border-top: 1px solid var(--border2);
    border-radius: 20px 20px 0 0;
    transform: translateY(105%);
  }
  .fd-drawer.open { transform: translateY(0); }
}

.fd-handle-bar {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border2); margin: 10px auto 0; flex-shrink: 0;
}
@media (min-width: 640px) { .fd-handle-bar { display: none; } }

.fd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fd-head-title {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-d); font-size: 17px; font-weight: 700; color: var(--text);
}
.fd-head-title svg { color: var(--accent); flex-shrink: 0; }
.fd-head-right { display: flex; align-items: center; gap: 8px; }

.fd-reset {
  font-family: var(--font-b); font-size: 12px; font-weight: 500;
  color: var(--text3); background: none; border: none; cursor: pointer;
  padding: 5px 10px; border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}
.fd-reset:hover { color: var(--accent); background: rgba(230,62,109,0.08); }

.fd-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color 0.15s;
}
.fd-close:hover { color: var(--text); border-color: var(--border2); }
.fd-close svg { width: 13px; height: 13px; }
@media (max-width: 639px) { .fd-close { display: none; } }

.fd-body {
  flex: 1; overflow-y: auto; padding: 4px 20px 16px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}

.fd-section { margin-top: 22px; }

.fd-label {
  font-family: var(--font-d); font-size: 10px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text3);
  margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;
}
.fd-hint {
  font-family: var(--font-b); font-size: 9px; font-weight: 400;
  letter-spacing: 0; text-transform: none; color: var(--text3); opacity: 0.7;
}
.fd-year-val {
  font-family: var(--font-b); font-size: 12px; font-weight: 600;
  color: var(--accent); letter-spacing: 0; text-transform: none;
}

/* Чипы */
.fd-chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.fd-chips::-webkit-scrollbar { display: none; }
.fd-chips--wrap { flex-wrap: wrap; overflow-x: visible; }

.fd-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-b); font-size: 12px; font-weight: 500;
  color: var(--text2); background: var(--bg3); border: 1px solid var(--border);
  border-radius: 100px; padding: 6px 14px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: border-color 0.14s, color 0.14s, background-color 0.14s, transform 0.1s;
}
.fd-chip:hover { color: var(--text); border-color: var(--border2); }
.fd-chip:active { transform: scale(0.94); }
.fd-chip.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(230,62,109,0.3);
}

/* Range slider */
.fd-range-wrap { position: relative; height: 32px; margin-bottom: 6px; }
.fd-range-track {
  position: absolute; top: 50%; left: 0; right: 0;
  height: 4px; background: var(--bg3); border-radius: 2px; transform: translateY(-50%);
}
.fd-range-fill {
  position: absolute; height: 100%;
  background: var(--accent); border-radius: 2px;
}
.fd-range-input {
  position: absolute; top: 50%; width: 100%; transform: translateY(-50%);
  -webkit-appearance: none; appearance: none;
  background: transparent; pointer-events: none;
  height: 32px; outline: none;
}
.fd-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg2);
  box-shadow: 0 2px 8px rgba(230,62,109,0.4);
  cursor: pointer; pointer-events: all;
  transition: transform 0.15s;
}
.fd-range-input::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg2);
  box-shadow: 0 2px 8px rgba(230,62,109,0.4);
  cursor: pointer; pointer-events: all;
}
.fd-range-input::-webkit-slider-thumb:hover { transform: scale(1.18); }
.fd-range-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text3); font-family: var(--font-b);
}

/* Активные теги */
.fd-active {
  padding: 0 20px 14px; display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 0; flex-shrink: 0;
}
.fd-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-b); font-size: 11px; font-weight: 500;
  background: rgba(230,62,109,0.1); border: 1px solid rgba(230,62,109,0.25);
  color: var(--accent2); border-radius: 100px; padding: 4px 8px 4px 11px;
}
.fd-tag-x {
  width: 15px; height: 15px; border-radius: 50%;
  background: rgba(230,62,109,0.15); display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; border: none; color: var(--accent); flex-shrink: 0;
}
.fd-tag-x svg { width: 8px; height: 8px; }

/* ══════════════════════════════════════
   DESKTOP/MOBILE VISIBILITY
══════════════════════════════════════ */
.desk-only { display: inline-flex; }
.mob-only  { display: none; }
@media (max-width: 639px) {
  .desk-only { display: none !important; }
  .mob-only  { display: inline-flex; }
}

/* ══════════════════════════════════════
   MOB MENU (⋯ дропдаун)
══════════════════════════════════════ */
.mob-menu-wrap {
  position: relative;
}

.mob-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  /* скрыт по умолчанию */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
}
.mob-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.mob-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.14s ease;
}
.mob-menu-item:hover,
.mob-menu-item:active {
  background: var(--bg3);
}
.mob-menu-item > svg { flex-shrink: 0; color: var(--text2); width: 18px; height: 18px; }

/* ── Profile item in mob-menu ── */
.mob-menu-item--profile {
  gap: 10px;
}
.mob-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.mob-avatar-sm svg { width: 15px; height: 15px; stroke: rgba(255,255,255,0.9); color: rgba(255,255,255,0.9); }
.mob-avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.mob-avatar-sm .mob-avatar-initials {
  font-family: var(--font-d);
  font-size: 11px; font-weight: 700; color: #fff; line-height: 1;
  user-select: none;
}
.mob-menu-chevron { margin-left: auto; flex-shrink: 0; color: var(--text3) !important; width: 14px !important; height: 14px !important; }
.mob-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ══════════════════════════════════════
   SUBSCRIPTION GATE
══════════════════════════════════════ */
.sub-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.32s ease;
}
.sub-gate.open { display: flex; opacity: 1; }

.sub-gate-card {
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.sub-gate-logo {
  height: 52px;
  width: auto;
  margin-bottom: 4px;
}
.sub-gate-logo--dark  { display: block; }
.sub-gate-logo--light { display: none; }
[data-theme="light"] .sub-gate-logo--dark  { display: none; }
[data-theme="light"] .sub-gate-logo--light { display: block; }

.sub-gate-title {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.sub-gate-desc {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 320px;
}

.sub-gate-channels {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0;
}

.sub-gate-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
}
.sub-gate-channel:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.sub-gate-channel svg { flex-shrink: 0; color: #2CA5E0; }
.sub-gate-channel span { flex: 1; text-align: left; }
.sub-gate-arrow { color: var(--text3) !important; }

.sub-gate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: var(--font-b);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.18s, opacity 0.18s, transform 0.15s;
}
.sub-gate-btn:hover  { background: var(--accent2); transform: translateY(-1px); }
.sub-gate-btn:active { transform: scale(0.98); }
.sub-gate-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.sub-gate-error {
  font-size: 13px;
  color: var(--accent);
  min-height: 18px;
}

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