/* GoKino (тест) — оформление как у сайта inKino: тёмный фон, красный акцент, постеры 2:3 */
:root {
  --bg: #141414;
  --surface: #1c1c1e;
  --card: #232326;
  --raised: #2c2c30;
  --line: rgba(255, 255, 255, .08);
  --text: #f2f2f2;
  --muted: rgba(242, 242, 242, .6);
  --red: #e50914;
  --red-hover: #ff2030;
  --radius: 8px;
  --gutter: clamp(16px, 5vw, 64px);
  --header: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: clip; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
* { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── Шапка ── */
.header { position: sticky; top: 0; z-index: 50; height: var(--header); display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter); background: rgba(20, 20, 20, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: -.4px; flex: none; }
.logo img { width: 46px; height: 46px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: var(--text); background: var(--raised); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; margin: 0; }
.search-box input { width: clamp(140px, 22vw, 280px); height: 40px; padding: 0 14px 0 38px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); outline: none; }
.search-box input:focus { border-color: rgba(255, 255, 255, .35); }
.search-box svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; fill: var(--muted); }
.mobile-nav { display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px var(--gutter); border-bottom: 1px solid var(--line); }
.mobile-nav a { padding: 6px 12px; border-radius: 8px; background: var(--card); color: var(--muted); white-space: nowrap; font-size: 14px; }
.mobile-nav a.active { background: var(--text); color: #111; }
@media (max-width: 820px) {
  .header { gap: 12px; }
  .header .nav { display: none; }
  .mobile-nav { display: flex; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .logo span { display: none; }
}

/* ── Страница ── */
.page { padding: 24px var(--gutter) 64px; }
.page-title { font-size: 28px; font-weight: 800; margin: 0 0 20px; letter-spacing: -.3px; }
.section { margin: 0 0 36px; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 700; border-left: 4px solid var(--red); padding-left: 10px; }
.section-head a, .section-head .muted { margin-left: auto; color: var(--muted); font-size: 14px; }
.section-head a:hover { color: var(--text); }
.empty { padding: 64px 16px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin: 12px 0 6px; font-size: 20px; }
.empty .btn { margin-top: 14px; }

/* Ряд карточек с прокруткой вбок — от края до края окна: карточки выезжают из-за края и растворяются в нём */
.scroller { position: relative; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(130px, 15vw, 190px); gap: 20px; overflow-x: auto;
  scroll-snap-type: x proximity;
  /* запас сверху и снизу под рамку наведения (3px + подъём 3px) */
  padding: 10px var(--gutter) 12px; margin: -10px calc(-1 * var(--gutter)) -2px;
  scroll-padding-inline: var(--gutter); scrollbar-width: none;
  --fade-l: 0px; --fade-r: 0px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%); }
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
/* Растворение — только с той стороны, где ещё есть что листать */
.scroller.more-l .row { --fade-l: var(--gutter); }
.scroller.more-r .row { --fade-r: var(--gutter); }
.row-arrow { position: absolute; top: 0; bottom: 56px; z-index: 3; width: var(--gutter); min-width: 36px; border: 0; padding: 0;
  background: none; font-size: 40px; line-height: 1; color: #fff; opacity: 0; transition: opacity .15s; cursor: pointer;
  text-shadow: 0 0 10px rgba(0, 0, 0, .8); }
.row-arrow.left { left: calc(-1 * var(--gutter)); }
.row-arrow.right { right: calc(-1 * var(--gutter)); }
.scroller.more-l:hover .row-arrow.left, .scroller.more-r:hover .row-arrow.right, .row-arrow:focus-visible { opacity: 1; }
.scroller:not(.more-l) .row-arrow.left, .scroller:not(.more-r) .row-arrow.right { pointer-events: none; }
@media (hover: none) { .row-arrow { display: none; } }
/* Серии — шире, превью 16:9 */
.row.eps { grid-auto-columns: clamp(220px, 22vw, 300px); gap: 16px; }
/* у серий подпись ниже превью короче — стрелки по высоте превью */
.scroller:has(.eps) .row-arrow { bottom: 46px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 22px; }
@media (min-width: 1320px) { .grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* ── Карточка ── */
.card { display: block; min-width: 0; }
.poster { position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: var(--card);
  transition: transform .18s ease, box-shadow .18s ease; }
.card:hover .poster, .card:focus-visible .poster { transform: translateY(-3px); box-shadow: 0 0 0 3px #fff; }
.card:focus-visible { outline: none; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; padding: 3px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; line-height: 1.2; }
.badge.rating { top: 6px; right: 6px; }
.badge.type { bottom: 6px; right: 6px; font-weight: 500; font-size: 11px; }
.card-title { margin: 8px 2px 0; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { margin: 2px 2px 0; font-size: 12px; line-height: 17px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Кнопки, поля ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 8px; border: 0; background: var(--card); font-weight: 600; white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-hover); }
.btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ── Страница фильма ── */
.movie { position: relative; isolation: isolate; }
.movie-backdrop { position: absolute; inset: 0 0 auto; height: 520px; overflow: hidden; z-index: -1; }
.movie-backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(36px) brightness(.4); transform: scale(1.2); }
.movie-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, var(--bg)); }
.movie-top { display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); gap: 32px; align-items: start; margin-bottom: 40px; }
.movie-top .poster { box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.movie h1 { margin: 0 0 4px; font-size: clamp(24px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -.4px; }
.movie .orig { color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 12px; min-height: 22px; min-width: 0; }
.orig-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mpaa { flex: none; color: #fff; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 4px; line-height: 18px; }
.age { flex: none; font-size: 14px; font-weight: 500; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 0; color: var(--muted); margin-bottom: 14px; line-height: 22px; }
.meta-line > span + span::before { content: "•"; margin: 0 9px; opacity: .6; }
.meta-line .q { color: #4caf50; font-weight: 700; }
.meta-line.genres::first-letter { text-transform: uppercase; }
.ratings { display: flex; gap: 14px; margin-bottom: 18px; }
.rating { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.rating b { font-size: 12px; padding: 2px 6px; border-radius: 4px; color: #111; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
/* «Смотреть», под ней — время */
.play-col { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.play-col .btn { width: 100%; }
.play-time { color: var(--muted); font-size: 13px; }
@media (max-width: 600px) { .play-col { flex: 1 1 100%; } }
.desc { max-width: 820px; line-height: 1.6; margin: 0 0 4px; }
.people { margin-top: 14px; color: var(--muted); font-size: 14px; max-width: 820px; }
.people b { color: var(--text); font-weight: 500; }

/* ── Плеер: отдельная страница во весь экран, как в приложении ── */
.watch { position: fixed; inset: 0; background: #000; }
.watch iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watch-top { position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px 40px; background: linear-gradient(rgba(0, 0, 0, .8), transparent); transition: opacity .25s; pointer-events: none; }
.watch-top > * { pointer-events: auto; }
.watch.idle .watch-top { opacity: 0; }
.watch.idle .watch-top > * { pointer-events: none; }
/* Полоса сверху: навели — снова показать «Назад» (над фреймом события мыши до страницы не доходят) */
.watch-hot { position: absolute; left: 0; right: 0; top: 0; height: 72px; z-index: 1; }
.watch:not(.idle) .watch-hot { display: none; }
.icon-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 0;
  background: rgba(30, 30, 30, .85); color: #fff; }
.icon-btn:hover { background: rgba(60, 60, 60, .9); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.watch-title { flex: 1; min-width: 0; padding-top: 2px; }
.watch-title b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 19px; line-height: 1.25; }
.watch-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; }
.watch-msg b { display: block; color: var(--text); font-size: 18px; margin-bottom: 8px; }
@media (max-width: 600px) { .watch-top { padding: 10px 10px 30px; gap: 8px; } .watch-title b { font-size: 16px; } }

/* Сезоны (чипы) и серии (плитки) — как в inKino */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--card); color: var(--muted); font-weight: 500; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: #111; }
.season[hidden] { display: none; }
/* Серия: превью-кадр 16:9, под ним «Серия N» и длительность */
.episode { display: block; min-width: 0; }
.ep-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--card);
  transition: transform .18s ease, box-shadow .18s ease; }
.ep-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ep-thumb svg { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 9px; border-radius: 50%;
  fill: #fff; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .15s; }
.episode:hover .ep-thumb, .episode:focus-visible .ep-thumb { transform: translateY(-3px); box-shadow: 0 0 0 3px #fff; }
.episode:hover .ep-thumb svg, .episode:focus-visible .ep-thumb svg { opacity: 1; }
.episode:focus-visible { outline: none; }
.ep-name { display: block; margin: 8px 2px 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.ep-time { display: block; margin: 0 2px; font-size: 12px; color: var(--muted); }
#episodes { scroll-margin-top: calc(var(--header) + 16px); }
@media (max-width: 600px) { .row.eps { gap: 12px; grid-auto-columns: calc((100vw - 2 * var(--gutter) - 12px) / 1.6); } }

.footer { padding: 20px var(--gutter) 32px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

/* ── Телефон (как в приложении) ── */
@media (max-width: 600px) {
  .row { gap: 12px; grid-auto-columns: calc((100vw - 2 * var(--gutter) - 24px) / 2.3); }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
  .movie-top { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .movie-top .poster { max-width: 320px; }
  .actions .btn { flex: 1 1 100%; }
  .page-title { font-size: 24px; }
}
