/* =============================================
   TV-play PWA — Главный стилевой файл
   Тёмная тема в стиле Netflix/Kino.pub
   ============================================= */

/* --- CSS Переменные --- */
:root {
  --bg: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-header: rgba(10,10,10,0.95);
  --bg-overlay: rgba(0,0,0,0.85);
  --accent: #e50914;
  --accent-hover: #f40612;
  --accent-dim: rgba(229,9,20,0.15);
  --text: #ffffff;
  --text-muted: #999999;
  --text-dim: #666666;
  --border: #2a2a2a;
  --card-radius: 10px;
  --header-height: 60px;
  --nav-height: 60px;
  --transition: 0.2s ease;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
}

/* --- Сброс и базовые стили --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

ul {
  list-style: none;
}

/* --- Загрузчик страницы --- */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

.page-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-logo {
  font-size: 64px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* --- App контейнер --- */
#app {
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

/* --- Хедер --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 0 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo span {
  font-size: 1.4rem;
}

.header-search {
  flex: 1;
  max-width: 400px;
  margin-left: auto;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  gap: 8px;
  transition: border-color var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.search-input-wrap input {
  padding: 8px 0;
  width: 100%;
  font-size: 0.9rem;
  background: none;
  color: var(--text);
}

.search-input-wrap input::placeholder {
  color: var(--text-dim);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: transform var(--transition);
}

.header-avatar:hover { transform: scale(1.05); }

.avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 0;
  min-width: 160px;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: fadeDown 0.15s ease;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.avatar-menu-item:hover { background: rgba(255,255,255,0.05); }
.avatar-menu-item.danger { color: var(--accent); }

.avatar-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* --- Нижняя навигация --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color var(--transition);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item:active {
  opacity: 0.7;
}

/* --- Основной контент --- */
.main-content {
  min-height: calc(100vh - var(--header-height) - var(--nav-height));
}

/* --- Страница логина --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(229,9,20,0.08) 0%, transparent 60%),
    var(--bg);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  background: rgba(229,9,20,0.05);
}

.form-input::placeholder { color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.btn-secondary:hover { background: rgba(255,255,255,0.15); }

.btn-icon {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
}

.btn-icon:hover { background: rgba(255,255,255,0.14); }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-error {
  background: rgba(229,9,20,0.1);
  border: 1px solid rgba(229,9,20,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #ff6b6b;
  margin-bottom: 16px;
  display: none;
}

.login-error.visible { display: block; }

/* --- Баннер (Hero) --- */
.hero-banner {
  position: relative;
  height: 300px;
  background: linear-gradient(135deg, #1a0a0a 0%, #0d0d1a 100%);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  opacity: 0.35;
  transition: opacity 0.5s ease;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    rgba(10,10,10,0.6) 50%,
    rgba(10,10,10,0.2) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 24px 16px;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  max-width: 80%;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hero-rating {
  color: #f5c518;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.hero-btn-play {
  background: var(--accent);
  color: #fff;
}

.hero-btn-play:hover { background: var(--accent-hover); }

.hero-btn-info {
  background: rgba(255,255,255,0.15);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.hero-btn-info:hover { background: rgba(255,255,255,0.22); }

/* --- Ряды фильмов (горизонтальный скролл) --- */
.films-row {
  padding: 24px 0 8px;
}

.row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}

.row-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.row-link {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity var(--transition);
}

.row-link:hover { opacity: 0.8; }

.row-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

.row-scroll::-webkit-scrollbar { display: none; }

/* --- Карточка фильма --- */
.film-card {
  flex-shrink: 0;
  width: 130px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.film-card:hover {
  transform: scale(1.04);
}

.film-card:active {
  transform: scale(0.97);
}

.card-poster {
  width: 130px;
  height: 192px;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--bg-card);
  position: relative;
  box-shadow: var(--shadow-card);
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.card-poster img.loading { opacity: 0; }
.card-poster img.loaded { opacity: 1; }

/* Заглушка постера */
.card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.placeholder-icon {
  font-size: 2rem;
  opacity: 0.7;
}

.placeholder-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  opacity: 0.9;
  word-break: break-word;
}

.placeholder-year {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Бейдж рейтинга */
.card-rating {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #f5c518;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Бейдж категории */
.card-cat-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.card-cat-badge.serial { background: #1565c0; }
.card-cat-badge.anime { background: #6a1b9a; }
.card-cat-badge.show { background: #2e7d32; }

.card-info {
  padding: 6px 2px 4px;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-year {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Сетка карточек (каталог) */
.films-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
}

.films-grid .film-card {
  width: 100%;
}

.films-grid .card-poster {
  width: 100%;
  aspect-ratio: 2/3;
  height: auto;
}

/* --- Каталог --- */
.catalog-page {
  padding-bottom: 20px;
}

.catalog-filters {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}

.catalog-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-bar {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-select:focus { border-color: var(--accent); }

.filter-select option { background: #1a1a1a; }

.results-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Пагинация --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
}

.pagination-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 8px;
}

/* --- Поиск --- */
.search-page {
  padding: 16px;
}

.search-hero {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-hero .search-big-icon {
  font-size: 4rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.search-hero p {
  font-size: 1rem;
}

.search-results-header {
  padding: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.search-results-header strong {
  color: var(--text);
}

/* --- Страница фильма --- */
.film-page {
  padding-bottom: 40px;
}

.film-hero {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, #1a0a0a 0%, #0d0d1a 100%);
  overflow: hidden;
}

.film-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  opacity: 0.3;
}

.film-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    rgba(10,10,10,0.5) 60%,
    rgba(10,10,10,0.15) 100%
  );
}

.film-hero-content {
  position: relative;
  z-index: 1;
  padding: 20px 16px;
  width: 100%;
}

.film-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--transition);
}

.film-back-btn:hover { background: rgba(0,0,0,0.8); }

.film-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.film-original {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-style: italic;
}

.film-ratings {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.rating-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

.rating-kp {
  background: rgba(255, 102, 0, 0.15);
  border: 1px solid rgba(255, 102, 0, 0.3);
  color: #ff9800;
}

.rating-imdb {
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.3);
  color: #f5c518;
}

.film-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
}

.film-actions {
  display: flex;
  gap: 10px;
}

.play-btn {
  flex: 1;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  box-shadow: 0 4px 15px rgba(229,9,20,0.3);
}

.play-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }
.play-btn:active { transform: translateY(0); }
.play-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.film-body {
  padding: 20px 16px;
}

.film-description {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.film-section {
  margin-bottom: 22px;
}

.film-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.film-section-value {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.genres-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.genre-tag {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Серии (сериалы) */
.seasons-block {
  padding: 0 16px 20px;
}

.seasons-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.seasons-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.season-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.season-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Плеер --- */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-modal.hidden { display: none; }

.player-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  cursor: pointer;
}

.player-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  margin: 20px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.player-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.player-close-btn:hover { background: var(--accent); }

.player-iframe-wrap {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
}

.player-iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --- Toast уведомления --- */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.error {
  border-color: rgba(229,9,20,0.4);
  background: rgba(229,9,20,0.1);
}

.toast.success {
  border-color: rgba(76,175,80,0.4);
  background: rgba(76,175,80,0.1);
}

.toast.fade-out { animation: toastOut 0.25s ease forwards; }

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

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

/* --- Состояния загрузки и пустоты --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, #222 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--card-radius);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  flex-shrink: 0;
  width: 130px;
}

.skeleton-poster {
  width: 130px;
  height: 192px;
  border-radius: var(--card-radius);
}

.skeleton-line {
  height: 10px;
  border-radius: 5px;
  margin-top: 6px;
}

.skeleton-line.w80 { width: 80%; }
.skeleton-line.w50 { width: 50%; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Профиль --- */
.profile-page {
  padding: 20px 16px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.profile-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item:hover { background: rgba(255,255,255,0.04); }

.profile-menu-item.danger { color: var(--accent); }

.menu-item-icon { font-size: 1.2rem; }
.menu-item-label { font-size: 0.9rem; font-weight: 500; }
.menu-item-arrow { margin-left: auto; color: var(--text-dim); font-size: 0.8rem; }

/* --- Скелетон для страницы фильма --- */
.film-hero-skeleton {
  height: 280px;
  background: var(--bg-card);
}

/* --- Разделитель --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

/* --- Адаптив --- */
@media (min-width: 480px) {
  .film-card { width: 150px; }
  .card-poster { width: 150px; height: 222px; }
  .skeleton-card { width: 150px; }
  .skeleton-poster { width: 150px; height: 222px; }
}

@media (min-width: 768px) {
  :root {
    --header-height: 68px;
    --nav-height: 0px;
  }

  #app { padding-bottom: 0; }

  .bottom-nav { display: none; }

  .header-inner {
    padding: 0 32px;
  }

  .header-search {
    max-width: 500px;
  }

  .hero-banner {
    height: 420px;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .film-card { width: 160px; }
  .card-poster { width: 160px; height: 237px; }

  .films-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    padding: 20px 32px;
  }

  .row-scroll { padding: 4px 32px 12px; }
  .row-header { padding: 0 32px; }

  .film-hero { min-height: 400px; }
  .film-hero-content { padding: 30px 32px; }
  .film-back-btn { left: 32px; top: 24px; }
  .film-title { font-size: 2rem; }

  .catalog-filters,
  .filter-bar,
  .film-body,
  .seasons-block,
  .search-page,
  .profile-page {
    padding-left: 32px;
    padding-right: 32px;
  }

  .toast-container { bottom: 24px; }
}

@media (min-width: 1024px) {
  .film-card { width: 180px; }
  .card-poster { width: 180px; height: 267px; }
  .films-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (min-width: 1280px) {
  .hero-banner { height: 500px; }
  .hero-title { font-size: 2.6rem; max-width: 60%; }
}

/* --- Утилиты --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-auto { margin-top: auto; }
