/* Тема «В озвучке» — в духе онлайн-кинотеатра: почти чёрный фон, большие обложки, ряды с прокруткой вбок,
   крупные номера в «Топ-10», серии списком. Акцент — янтарно-жёлтый, как индикатор звука
   (у «Серийки» — розовый, у «Мелодрамки» — розовое золото на светлом).
   Работает вместе с config.layout: title 'story', home 'showcase', episodes 'list'. */
:root {
  --bg: #0a0d14;
  --panel: #161b26;
  --line: #252c3b;
  --text: #f3f5f9;
  --text-soft: #c3c9d6;
  --muted: #8a93a6;
  --accent: #ffc531;
  --accent-text: #1a1405;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font);
  --radius: 6px;
  --radius-sm: 6px;
  --max: 1440px;
  --poster-ratio: 2 / 3;
  --grid-min: 150px;
  --gutter: clamp(14px, 4vw, 56px);
  --empty-poster: linear-gradient(160deg, #2b3550, #11151f 70%);
  --empty-poster-text: #ffe39a;
  --header-bg: rgba(10, 13, 20, .94);
  color-scheme: dark;
}

/* ---------- шапка ---------- */
.top { border-bottom: 0; padding: 12px var(--gutter); transition: background .25s; }
.logo { font-weight: 800; letter-spacing: -.4px; color: var(--text); font-size: 20px; }
.search input { background: rgba(255, 255, 255, .08); border-color: transparent; border-radius: 4px; }
.search input:focus { border-color: var(--text-soft); background: rgba(0, 0, 0, .6); }
/* на витрине шапка прозрачная поверх баннера и темнеет при прокрутке */
.is-showcase .top { position: fixed; left: 0; right: 0; background: linear-gradient(rgba(0, 0, 0, .75), transparent); backdrop-filter: none; }
.is-showcase.scrolled .top { background: var(--header-bg); }

h1 { font-weight: 800; letter-spacing: -.5px; }
h2 { font-weight: 700; font-size: 19px; }
main { max-width: var(--max); padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- категории ---------- */
.chip { background: transparent; border-color: #3a4357; color: var(--text-soft); border-radius: 4px; }
a.chip:hover { border-color: var(--text); color: var(--text); }
.chip.chip-active, .chip.chip-active:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ---------- карточки ---------- */
.card { position: relative; }
.poster { border-radius: var(--radius); }
.card:hover .poster { transform: scale(1.04); box-shadow: 0 10px 30px rgba(0, 0, 0, .7), 0 0 0 2px var(--accent); }
.card[data-boost]::before { content: "RU"; position: absolute; z-index: 1; top: 6px; left: 6px; padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 800; letter-spacing: .5px; background: var(--accent); color: var(--accent-text); }
.card-top::before { display: none; }
.card-name { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.card-meta { color: var(--muted); }

/* ---------- кнопки ---------- */
.feed-cta { background: var(--accent); color: var(--accent-text); border-radius: 6px; box-shadow: none; }
.feed-cta-icon { background: var(--accent-text); color: var(--accent); }
.slide-btn, .choice-continue { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.slide-like.on span, .like-btn.on span { color: var(--accent); }
.like-btn.on { border-color: var(--accent); }
.pager a, .btn { border-radius: 4px; }
.pager a:hover, .btn:hover { border-color: var(--text); }

/* ================= главная-витрина ================= */
.is-showcase main { padding-top: 0; }
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px;
  min-height: min(82vh, 760px); margin: 0 calc(-1 * var(--gutter)) 8px; padding: 110px var(--gutter) 48px; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -60px; z-index: -2; background: var(--hero-bg, none) center 30% / cover;
  filter: blur(28px) saturate(1.2) brightness(.7); transform: scale(1.1); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--bg) 8%, rgba(10, 13, 20, .55) 55%, rgba(10, 13, 20, .15)), linear-gradient(transparent 55%, var(--bg)); }
.hero-info { max-width: 620px; }
.hero-badge { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 700; font-size: 17px; }
.top-badge { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 4px; background: var(--accent); color: var(--accent-text);
  font-size: 10px; font-weight: 900; line-height: 1; text-align: center; padding: 3px; }
.hero-title { font-size: clamp(30px, 5vw, 60px); line-height: 1.02; font-weight: 900; letter-spacing: -1px; margin: 0 0 12px; }
.hero-meta { color: var(--text-soft); font-size: 15px; margin-bottom: 12px; }
.hero-desc { color: var(--text-soft); font-size: 17px; line-height: 1.45; margin: 0 0 22px; max-width: 560px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-play, .hero-more { display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px; border-radius: 6px; font-size: 18px; font-weight: 700; }
.hero-play { background: var(--accent); color: var(--accent-text); }
.hero-play:hover { filter: brightness(1.08); }
.hero-more { background: rgba(120, 130, 150, .45); color: #fff; backdrop-filter: blur(6px); }
.hero-more:hover { background: rgba(120, 130, 150, .3); }
.hero-art { display: block; order: 2; width: clamp(200px, 22vw, 300px); }
.hero-poster { border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, .7); }
.hero-art:hover .hero-poster { transform: none; }

.showcase-head { max-width: 760px; }
.showcase-head h1 { font-size: 22px; margin: 8px 0 8px; }
/* категории на витрине — одной строкой с прокруткой */
.is-showcase .genres { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-top: 18px; }
.is-showcase .genres::-webkit-scrollbar { display: none; }
.is-showcase .genres .chip { flex: none; padding: 6px 12px; font-size: 13px; }

/* ряды */
.shelf { margin: 30px 0 0; }
.shelf-title { margin: 0 0 10px; font-size: 20px; }
.shelf-title a { display: inline-flex; align-items: baseline; gap: 10px; }
.shelf-title span { font-size: 14px; font-weight: 600; color: var(--accent); opacity: 0; transform: translateX(-6px); transition: .2s; }
.shelf-title a:hover span, .shelf-title a:focus-visible span { opacity: 1; transform: none; }
.shelf .row { grid-auto-columns: calc((100% - 6 * 10px) / 7); gap: 10px; scrollbar-width: none; padding: 6px 0 10px; scroll-snap-type: x proximity; }
.shelf .row::-webkit-scrollbar { display: none; }
.shelf .card-meta { display: none; }
.row-wrap { position: relative; }
.row-arrow { position: absolute; top: 6px; bottom: 10px; width: 44px; border: 0; z-index: 3; cursor: pointer; font-size: 40px; line-height: 1;
  color: #fff; opacity: 0; transition: opacity .2s; }
.row-prev { left: calc(-1 * var(--gutter)); width: var(--gutter); background: linear-gradient(90deg, rgba(10, 13, 20, .9), transparent); }
.row-next { right: calc(-1 * var(--gutter)); width: var(--gutter); background: linear-gradient(270deg, rgba(10, 13, 20, .9), transparent); }
.row-wrap:hover .row-arrow { opacity: 1; }
.row-arrow[hidden] { display: none; }

/* «Топ-10»: крупный номер слева от обложки */
.row-top { grid-auto-columns: calc((100% - 4 * 10px) / 5) !important; }
.card-top { display: flex; align-items: flex-end; }
.rank { flex: none; width: 44%; margin-right: -9%; font-size: clamp(90px, 11vw, 170px); font-weight: 900; line-height: .78; letter-spacing: -8px;
  text-align: right; color: var(--bg); -webkit-text-stroke: 3px #7d879e; paint-order: stroke; user-select: none; }
.card-top .poster { width: 60%; position: relative; }
.card-top:hover .rank { -webkit-text-stroke-color: var(--accent); }

#all { margin-top: 40px; font-size: 20px; }

/* ================= страница сериала (вид «история») ================= */
.story { max-width: 1100px; display: flex; flex-direction: column; }
/* сюжет — сразу под шапкой, серии — ниже (порядок в HTML не меняется) */
.story > .crumbs, .story-hero { order: 0; }
.story-lead { order: 1; }
.story-about { order: 2; margin-bottom: 8px; }
.story-about h2 { display: none; }
.story-eps { order: 3; }
.story-hero { border-radius: 0 !important; }
.story-play { border-radius: 6px; font-weight: 700; background: var(--accent); color: var(--accent-text); max-width: 320px; }
.story-like { border-radius: 6px; background: rgba(120, 130, 150, .3); border-color: transparent; }
.story-tabs button { border-radius: 4px; background: var(--panel); }
.story-tabs button.on { background: var(--text); border-color: var(--text); color: var(--bg); }

/* серии списком */
.eps-list { display: flex !important; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.eps-list .ep { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; text-align: left;
  padding: 14px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 15px; }
.eps-list .ep:hover { background: var(--panel); }
.eps-list .ep[hidden] { display: none; }
.ep-num { font-size: 22px; font-weight: 800; color: var(--muted); text-align: center; }
.ep-name { font-weight: 600; }
.ep-dur { color: var(--muted); font-size: 13px; }
.eps-list .ep.ep-current { background: var(--panel); color: var(--text); box-shadow: inset 3px 0 var(--accent); font-weight: 400; }
.eps-list .ep.ep-current .ep-num { color: var(--accent); }
.eps-list .ep-watched::after, .eps-list .ep.ep-current.ep-watched::after { position: static; font-size: 14px; color: var(--accent); }
.eps-list .ep-watched .ep-name { color: var(--muted); }

@media (min-width: 761px) {
  /* шапка сериала: обложка слева, текст справа */
  .story-hero { display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-areas: "poster h1" "poster meta" "poster chips" "poster actions" "poster progress";
    column-gap: 36px; align-content: end; text-align: left; padding: 48px 40px 36px; margin: 0 0 16px; }
  .story-hero > .poster { grid-area: poster; width: 100%; margin: 0; align-self: end; }
  .story-hero h1 { grid-area: h1; font-size: 40px; line-height: 1.05; font-weight: 900; }
  .story-hero .meta { grid-area: meta; }
  .story-hero .chips { grid-area: chips; justify-content: flex-start; }
  .story-actions { grid-area: actions; justify-content: flex-start; }
  .story-progress { grid-area: progress; margin-left: 0; }
  .story-hero::after { background: linear-gradient(90deg, rgba(10, 13, 20, .2), rgba(10, 13, 20, .6)), linear-gradient(transparent 40%, var(--bg)); }
}

@media (max-width: 1100px) {
  .shelf .row { grid-auto-columns: calc((100% - 4 * 10px) / 5); }
  .row-top { grid-auto-columns: calc((100% - 3 * 10px) / 4) !important; }
}
@media (max-width: 760px) {
  .logo { font-size: 18px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 18px; min-height: 0; padding: 76px var(--gutter) 24px; }
  .hero::after { background: linear-gradient(rgba(10, 13, 20, .3), rgba(10, 13, 20, .2) 40%, var(--bg)); }
  .hero-art { order: -1; width: min(62vw, 260px); }
  .hero-badge { justify-content: center; font-size: 14px; margin-bottom: 8px; }
  .top-badge { width: 30px; height: 30px; font-size: 8px; }
  .hero-title { font-size: 28px; margin-bottom: 8px; }
  .hero-meta { font-size: 13px; }
  .hero-desc { display: none; }
  .hero-actions { justify-content: center; flex-wrap: nowrap; }
  .hero-play, .hero-more { flex: 1; justify-content: center; padding: 11px 12px; font-size: 16px; }
  .shelf { margin-top: 22px; }
  .shelf-title { font-size: 17px; }
  .shelf-title span { opacity: 1; transform: none; font-size: 13px; }
  .shelf .row { grid-auto-columns: 31%; gap: 8px; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
  .row-top { grid-auto-columns: 46% !important; }
  .rank { font-size: 96px; letter-spacing: -5px; -webkit-text-stroke-width: 2px; }
  .card::before { top: 4px; left: 4px; font-size: 9px; }
  .eps-list .ep { grid-template-columns: 40px minmax(0, 1fr) auto auto; padding: 13px 8px; }
  .ep-num { font-size: 18px; }
  .story-hero .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; margin: 10px -12px 0; padding: 0 12px; }
  .story-hero .chips::-webkit-scrollbar { display: none; }
  .story-hero .chips .chip { flex: none; }
}
