/* ЖОПФЛЕКС — тёмно-синяя база, красный акцент. Без VHS-эффектов.
   Целевой экран: ТВ 1280×720 (10-foot UI), с адаптацией до мобильного. */

:root {
  /* Фон: тёмно-синий, ближе к ночному */
  --bg:        #070b16;
  --bg-2:      #0b1120;
  --bg-3:      #101a2e;
  --surface:   #131e33;
  --surface-2: #1a2740;
  --line:      rgba(120, 150, 200, 0.14);
  --line-2:    rgba(120, 150, 200, 0.26);

  /* Акцент: красный ЖОПФЛЕКСА */
  --red:       #e50914;
  --red-hi:    #ff1f2b;
  --red-dim:   #b00710;

  --text:      #eef2fa;
  --text-2:    #a8b6cf;
  --text-3:    #6b7c99;

  --radius:    10px;
  --radius-lg: 16px;

  --ease: cubic-bezier(.22, .61, .36, 1);

  --pad: clamp(20px, 3.2vw, 56px);
  --header-h: clamp(64px, 7vh, 88px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  /* Мягкое свечение сверху, без шума и скан-линий */
  background:
    radial-gradient(1200px 620px at 50% -14%, rgba(229, 9, 20, 0.10), transparent 62%),
    radial-gradient(900px 520px at 88% 4%, rgba(40, 90, 190, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 42%, #05080f 100%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---------- Заставка (Netflix-style): зум-аут логотипа + звук ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity .6s var(--ease), visibility .6s;
}
.boot.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.boot-logo {
  width: clamp(320px, 62vw, 900px);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  /* Зум-аут: от крупного к нормальному, с лёгким свечением в конце */
  animation: bootZoom 1.9s cubic-bezier(.19, 1, .22, 1) forwards;
  filter: drop-shadow(0 0 0 rgba(229, 9, 20, 0));
}
@keyframes bootZoom {
  0%   { transform: scale(1.9); opacity: 0; filter: drop-shadow(0 0 0 rgba(229,9,20,0)); }
  18%  { opacity: 1; }
  78%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 34px rgba(229, 9, 20, .55)); }
}

/* ---------- Шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, rgba(7, 11, 22, .96), rgba(7, 11, 22, .72) 70%, transparent);
  backdrop-filter: blur(10px);
}
.topbar-inner {
  width: 100%;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 48px);
}

.brand { flex: none; }
.brand-word {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: clamp(19px, 1.9vw, 27px);
  letter-spacing: .09em;
  color: var(--red);
  text-shadow: 0 0 22px rgba(229, 9, 20, .45);
  transition: color .2s var(--ease), text-shadow .2s var(--ease);
}
.brand:focus-visible .brand-word,
.brand:hover .brand-word { color: var(--red-hi); text-shadow: 0 0 30px rgba(255, 31, 43, .7); }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 14px);
  margin-right: auto;
}
.nav a {
  position: relative;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-2);
  transition: color .18s var(--ease), background .18s var(--ease);
  outline: none;
}
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--text); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
}

/* Фокус для ТВ и клавиатуры — крупный, заметный с дивана */
.nav a:focus-visible,
.search-btn:focus-visible,
.brand:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 2px var(--red), 0 0 0 6px rgba(229, 9, 20, .22);
  color: #fff;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.search-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  transition: color .18s, background .18s;
}
.search-btn svg { width: 20px; height: 20px; }
.search-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* ---------- Поиск ---------- */
.search-panel {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  padding: calc(var(--header-h) + 8px) var(--pad) 24px;
  background: rgba(5, 8, 15, .97);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  animation: dropIn .22s var(--ease);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.search-inner { display: flex; align-items: center; gap: 14px; max-width: 900px; margin: 0 auto; }
#search-input {
  flex: 1;
  padding: 16px 20px;
  font-size: clamp(16px, 1.5vw, 20px);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
#search-input::placeholder { color: var(--text-3); }
#search-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229, 9, 20, .2); }
.search-close {
  width: 46px; height: 46px;
  font-size: 26px; line-height: 1;
  color: var(--text-2);
  border-radius: 50%;
  transition: color .18s, background .18s;
}
.search-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.search-results {
  max-width: 900px;
  margin: 18px auto 0;
  max-height: 62vh;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border-radius: var(--radius);
  transition: background .16s;
  outline: none;
}
.search-row:hover, .search-row:focus-visible { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.search-row img { width: 40px; height: 60px; object-fit: cover; border-radius: 5px; flex: none; background: var(--bg-3); }
.search-row-t { display: grid; gap: 2px; min-width: 0; }
.search-row-t b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-row-t span { font-size: 12.5px; color: var(--text-3); }
.search-empty { padding: 26px 4px; color: var(--text-3); font-size: 15px; }

/* ---------- Общее ---------- */
.view { padding: 0 0 80px; outline: none; }
.wrap { padding: 0 var(--pad); }

.section { margin-top: clamp(30px, 4.4vh, 56px); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--pad);
  margin-bottom: 14px;
}
.section-title {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: clamp(17px, 1.6vw, 23px);
  letter-spacing: .03em;
  color: var(--text);
}
.section-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  transition: color .18s;
}
.section-more:hover { color: var(--red-hi); }

/* ---------- Ряд постеров ---------- */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(112px, 11.4vw, 168px);
  gap: clamp(9px, 1vw, 15px);
  padding: 6px var(--pad) 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  scroll-padding-left: var(--pad);
}
.rail::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-3);
  aspect-ratio: 2 / 3;
  outline: none;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  will-change: transform;
}
.card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s var(--ease), filter .25s var(--ease);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  pointer-events: none;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px) scale(1.045);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .62), 0 0 0 2px var(--red), 0 0 26px rgba(229, 9, 20, .34);
  z-index: 2;
}
.card:hover img, .card:focus-visible img { transform: scale(1.04); }

.card-badge {
  position: absolute;
  top: 7px; left: 7px;
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: rgba(7, 11, 22, .82);
  border-radius: 5px;
  backdrop-filter: blur(4px);
}
.card-badge--series { background: rgba(229, 9, 20, .9); }

/* ---------- Герой ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(20px, 3.4vw, 52px);
  align-items: center;
  padding: clamp(22px, 3.6vh, 44px) var(--pad) clamp(26px, 4vh, 48px);
  margin-top: 4px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40px 0 -20px 0;
  background: radial-gradient(760px 340px at 22% 40%, rgba(229, 9, 20, .13), transparent 68%);
  pointer-events: none;
}
.hero-body { position: relative; min-width: 0; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--red-hi);
}
.hero-kicker::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}
.hero-title {
  margin: 0 0 10px;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 62px);
  line-height: 1.02;
  letter-spacing: .005em;
  text-wrap: balance;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: clamp(12.5px, 1.05vw, 14.5px);
  color: var(--text-2);
}
.hero-meta .dot { color: var(--text-3); }
.hero-meta .imdb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-weight: 800;
  color: #f5c518;
  background: rgba(245, 197, 24, .1);
  border: 1px solid rgba(245, 197, 24, .3);
  border-radius: 5px;
}
.hero-note {
  max-width: 56ch;
  margin: 0 0 8px;
  font-size: clamp(13.5px, 1.15vw, 16px);
  line-height: 1.55;
  color: var(--text-2);
}
.hero-slogan {
  margin: 0 0 20px;
  font-size: clamp(13px, 1.1vw, 15px);
  font-style: italic;
  color: var(--text-3);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 8px;
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 700;
  letter-spacing: .01em;
  outline: none;
  transition: background .18s var(--ease), color .18s, box-shadow .18s, transform .12s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-hi); }

.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn--ghost:hover { background: rgba(255, 255, 255, .15); }

.btn--ghost.is-on { color: var(--red-hi); box-shadow: inset 0 0 0 1px rgba(229, 9, 20, .55); }

.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--red), 0 0 22px rgba(229, 9, 20, .5);
}

.hero-poster {
  position: relative;
  width: clamp(150px, 17vw, 250px);
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(0, 0, 0, .68), 0 0 0 1px var(--line-2);
}
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Жанры ---------- */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 15vw, 220px), 1fr));
  gap: clamp(10px, 1.2vw, 16px);
  padding: 0 var(--pad);
}
.genre-tile {
  position: relative;
  display: grid;
  align-content: end;
  gap: 4px;
  min-height: clamp(84px, 11vh, 118px);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px var(--line);
  outline: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.genre-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(229, 9, 20, .22), transparent 62%);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.genre-tile:hover, .genre-tile:focus-visible {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px var(--red), 0 12px 30px rgba(0, 0, 0, .5), 0 0 22px rgba(229, 9, 20, .22);
}
.genre-tile:hover::before, .genre-tile:focus-visible::before { opacity: 1; }
.genre-tile b {
  position: relative;
  font-family: 'Oswald', sans-serif;
  font-size: clamp(15px, 1.35vw, 19px);
  font-weight: 600;
  letter-spacing: .02em;
}
.genre-tile span { position: relative; font-size: 12px; color: var(--text-3); }

/* ---------- Сетка каталога ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(112px, 11.4vw, 168px), 1fr));
  gap: clamp(10px, 1.1vw, 16px);
  padding: 0 var(--pad);
}

/* ---------- Страница тайтла ---------- */
.detail {
  display: grid;
  grid-template-columns: clamp(180px, 20vw, 300px) minmax(0, 1fr);
  gap: clamp(22px, 3.4vw, 52px);
  padding: clamp(20px, 3.4vh, 44px) var(--pad) 0;
  align-items: start;
}
.detail-poster {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(0, 0, 0, .68), 0 0 0 1px var(--line-2);
  aspect-ratio: 2 / 3;
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-title {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 3.6vw, 50px);
  line-height: 1.04;
}
.detail-orig {
  margin: 0 0 14px;
  font-size: clamp(12.5px, 1.05vw, 15px);
  color: var(--text-3);
}
.detail-block { margin-top: 22px; }
.detail-block h3 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.detail-block p { margin: 0; font-size: clamp(13.5px, 1.15vw, 16px); line-height: 1.6; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color .16s, box-shadow .16s;
  outline: none;
}
.chip:hover, .chip:focus-visible { color: #fff; box-shadow: inset 0 0 0 1px var(--red); }

/* Платформы */
.platforms { display: flex; flex-wrap: wrap; gap: 10px; }
.platform {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 700;
  color: #fff;
  outline: none;
  transition: transform .16s var(--ease), box-shadow .18s var(--ease), filter .18s;
}
.platform:hover { transform: translateY(-2px); filter: brightness(1.08); }
.platform:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--red); }
.platform--imdb   { background: #f5c518; color: #12100a; }
.platform--vk     { background: #2b7fd4; }
.platform--rutube { background: #d81f26; }
.platform--rezka  { background: #2f3b52; }
.platform small { font-weight: 600; opacity: .72; font-size: 11.5px; }

/* ---------- Пустое состояние ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(48px, 12vh, 120px) var(--pad);
  text-align: center;
}
.empty h2 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 600;
}
.empty p { margin: 0; max-width: 44ch; font-size: 14.5px; line-height: 1.6; color: var(--text-3); }

/* ---------- Подвал ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--pad);
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-brand {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .09em;
  color: var(--red-dim);
}
.footer-meta { font-size: 12.5px; color: var(--text-3); }

/* ---------- Подсказка ТВ ---------- */
.hint {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 12px;
  color: var(--text-2);
  background: rgba(11, 17, 32, .92);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
  white-space: nowrap;
}
.hint.is-visible { opacity: .92; }
.hint kbd {
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.hint-sep { color: var(--text-3); }

/* ---------- ТВ: 1280×720 и крупнее ---------- */
@media (min-width: 1100px) and (min-height: 640px) {
  .rail { grid-auto-columns: clamp(128px, 10.6vw, 176px); }
  .card:hover, .card:focus-visible { transform: translateY(-5px) scale(1.06); }
}

/* Короткий экран (720p): герой компактнее, чтобы первый ряд был виден целиком */
@media (max-height: 800px) {
  .hero { padding-top: 10px; padding-bottom: 18px; }
  .hero-title { font-size: clamp(28px, 3.4vw, 46px); }
  .hero-note { font-size: 14px; margin-bottom: 6px; }
  .hero-slogan { margin-bottom: 14px; }
  .hero-poster { width: clamp(140px, 15vw, 200px); }
  .hero-kicker { margin-bottom: 8px; }
  .section { margin-top: 22px; }
}

/* ТВ-режим: включается по ?tv=1 или при 1280×720 */
body.is-tv { --pad: 44px; }
body.is-tv .hint { opacity: 1; }
body.is-tv .nav a { padding: 11px 17px; font-size: 15.5px; }
body.is-tv .card:hover, body.is-tv .card:focus-visible { transform: translateY(-5px) scale(1.07); }

/* ---------- Мобильное ---------- */
@media (max-width: 720px) {
  .topbar-inner { gap: 12px; }
  .nav { gap: 2px; }
  .nav a { padding: 8px 9px; font-size: 12.5px; }
  .nav a.is-active::after { left: 9px; right: 9px; }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .hero-poster { width: 132px; order: -1; }
  .detail { grid-template-columns: 1fr; }
  .detail-poster { width: 148px; }
  .hint { display: none; }
  .rail { grid-auto-columns: 116px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
