/* Общие стили: один файл для сайта (index.html) и SEO-страниц (шаблоны API) */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #000;
  --surface: #111;
  --surface-2: #0d0d0d;
  --hover: #151515;
  --ph: #1c1c1c;
  --line: #1f1f1f;
  --line-2: #2a2a2a;
  --text: #ededed;
  --strong: #fff;
  --soft: #d4d4d4;
  --muted: #8a8a8a;
  --accent: #a3db45;
  --accent-hi: #b6ea5c;
  --accent-bg: #1a2610;
  --accent-fg: #c4f06a;
  --on-accent: #0b1200;
  --tg: #6ab3f3;
  --open-bg: #0b0f06;
  --open-line: #3a5216;
  --r: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: Onest, system-ui, sans-serif;
  color-scheme: dark;
}

html { background: var(--bg) }
body { margin: 0; min-height: 100%; font: 15px/1.45 var(--font); color: var(--text) }
button, input { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
[hidden] { display: none !important }

/* страница, шапка, логотип */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 24px }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px }
/* кнопка «назад» и логотип слева: сам логотип всегда ведёт на главную */
.top .left { display: flex; align-items: center; gap: 12px; min-width: 0 }
.logo { display: inline-flex; align-items: center; font-size: 17px; font-weight: 800; color: var(--text); text-decoration: none; transition: color .2s }
.logo::before { content: ''; flex: none; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--accent) }
.logo b { color: var(--accent); font-weight: inherit; transition: color .2s }
.logo:hover { color: var(--accent) }
.logo:hover b { color: var(--accent-hi) }

.link { padding: 12px 0; color: var(--tg); font-size: 13px; font-weight: 600; text-decoration: none }

/* текст */
.label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.meta { color: var(--accent); font-size: 13px; font-weight: 600 }
.muted { color: var(--muted); font-size: 13px }
.block { display: flex; flex-direction: column; gap: 8px }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line-2); background: none; color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s }
.btn:hover { border-color: #5a5a5a }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 800 }
.btn.primary:hover { background: var(--accent-hi) }
.btn.sm { min-height: 40px; padding: 0 16px; border-radius: var(--r) }
.btn:disabled { opacity: .5; cursor: default }
.icon-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); cursor: pointer; transition: border-color .2s, color .2s }
.icon-btn:hover { border-color: var(--accent); color: var(--accent) }

/* «пилюли»: озвучки, жанры, активные фильтры */
.pills { display: flex; flex-wrap: wrap; gap: 8px }
.pill { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: none; color: var(--soft); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: border-color .2s, background .2s, color .2s }
.pill:hover { border-color: var(--accent) }
.pill.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-fg) }
.pill.more { border-style: dashed; color: var(--accent) }

/* плашка последней серии и «живая» точка */
.fresh { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-fg); font-size: 12px; font-weight: 600 }
.fresh::before, .dot { content: ''; flex: none; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: breathe 1.6s ease-in-out infinite }

/* кадры: лента со стрелками */
.strip { position: relative }
.shots { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 0 }
.shots::-webkit-scrollbar { display: none }
.shots > * { flex: none; width: 168px; aspect-ratio: 16 / 9; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--ph); cursor: zoom-in; scroll-snap-align: start; transition: border-color .2s, transform .25s var(--ease) }
.shots > *:hover { border-color: var(--accent); transform: translateY(-2px) }
.shots img { display: block; width: 100%; height: 100%; object-fit: cover }
.arr { position: absolute; top: 50%; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; margin-top: -20px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(10, 10, 10, .85); backdrop-filter: blur(4px); color: var(--text); cursor: pointer; transition: border-color .2s, color .2s }
.arr:hover { border-color: var(--accent); color: var(--accent) }
.arr.l { left: 6px }
.arr.r { right: 6px }
.arr[hidden] { display: none }

/* серии */
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 248px; overflow-y: auto }
.eps > * { display: grid; place-items: center; height: 44px; padding: 0; border-radius: 10px; border: 1px solid #242424; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: border-color .2s, background .2s, color .2s }
.eps > *:hover { border-color: var(--accent) }
.eps > .on { border-color: var(--accent); background: var(--accent); color: var(--on-accent) }

/* мини-карточка с постером: «Новые серии» в боковой панели и «Похожее» */
.tile { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid transparent; border-radius: var(--r); background: none; color: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s }
.tile:hover { background: var(--hover) }
.tile img, .tile .ph { flex: none; width: 40px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--ph) }
.tile .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.tile b { color: var(--strong); font-size: 14px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.tile small { color: var(--muted); font-size: 12px }
.tile .meta { font-size: 12px }
.similar { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none }
.similar .tile { border-color: var(--line) }
.similar .tile:hover { border-color: var(--accent) }

/* просмотр картинки на весь экран */
.lb { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .9); backdrop-filter: blur(6px); cursor: zoom-out }
.lb[hidden] { display: none }
.lb img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 14px; box-shadow: 0 24px 64px rgba(0, 0, 0, .7) }
.lb .arr { position: fixed }

/* загрузка */
.spin { flex: none; display: inline-block; box-sizing: border-box; width: var(--s, 16px); height: var(--s, 16px); border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite }

/* фон из плавающих предметов (backdrop.js) */
.items { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none }
.item { position: absolute; aspect-ratio: 1; translate: -50% -50%; opacity: var(--o); animation: drift ease-in-out infinite alternate; will-change: transform }
.item svg { display: block; width: 100%; height: 100%; animation: turn linear infinite }
@keyframes drift { to { transform: translate(var(--dx), var(--dy)) } }
@keyframes turn { to { transform: rotate(var(--r)) } }

@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes breathe { 0%, 100% { opacity: .35 } 50% { opacity: .75 } }
@keyframes spin { to { transform: rotate(360deg) } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important }
}
