/* film.rmmargus.com — tokens */
:root {
  --bg: #121821;
  --surface: #1a2230;
  --surface-2: #222c3d;
  --line: #2b3648;
  --text: #e8ecf1;
  --muted: #8a96a8;
  --accent: #f2b441;
  --accent-ink: #1b1406;
  --danger: #ff6b6b;
  --hole: #2b3648;
  --radius: 10px;
  --brand: "Unbounded", "Golos Text", system-ui, sans-serif;
  --display: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* header */
.top {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 0 10px;
}
.logo {
  font-family: var(--brand); font-weight: 700; font-size: 20px; letter-spacing: .04em;
  display: flex; align-items: baseline; gap: 8px; white-space: nowrap;
}
.logo small { font: 500 12px var(--body); color: var(--muted); letter-spacing: .02em; }
.top .spacer { flex: 1; }
.top-link { color: var(--muted); font-size: 14px; }
.top-link:hover { color: var(--text); }

/* header search with drop-down results */
.hsearch { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.hsearch input {
  width: 100%; height: 42px; padding: 0 38px 0 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 15px var(--body);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.hsearch input::placeholder { color: var(--muted); }
.hsearch input::-webkit-search-cancel-button { -webkit-appearance: none; }
.hsearch input:focus { outline: none; border-color: var(--accent); background: #1d2635; box-shadow: 0 0 0 3px rgba(242,180,65,.16); }
.hs-icon { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.hsearch.open .hs-icon, .hsearch input:focus ~ .hs-icon { color: var(--accent); }
.hs-clear {
  position: absolute; right: 6px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
}
.hs-clear:hover { background: var(--surface-2); color: var(--text); }
.hs-drop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  max-height: min(560px, calc(100vh - 90px)); overflow-y: auto; padding: 8px;
  border-radius: 14px; background: #182030; border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,.55); animation: pop .15s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; overscroll-behavior: contain;
}
.hs-head { padding: 6px 8px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hs-item {
  display: flex; gap: 12px; align-items: center; padding: 6px; border-radius: 10px;
  transition: background .12s ease;
}
.hs-item + .hs-item { margin-top: 2px; }
.hs-item:hover, .hs-item.active { background: rgba(255,255,255,.07); }
.hs-poster { flex: none; width: 46px; height: 68px; border-radius: 7px; background: var(--surface-2) center / cover no-repeat; }
.hs-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.hs-name { font-weight: 600; font-size: 15px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0; font-size: 13px; color: var(--muted); }
.hs-meta .star { color: var(--accent); margin-right: 3px; }
.hs-dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: 0 8px; opacity: .7; }
.hs-origin { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.hs-body .perf { height: 4px; gap: 2px; margin-top: 4px; max-width: 180px; }
.hs-state { display: flex; align-items: center; gap: 10px; padding: 18px 10px; color: var(--muted); font-size: 14px; }
.hs-state.error { color: var(--danger); }
.hs-all {
  display: block; margin-top: 8px; padding: 11px; border-radius: 10px; text-align: center;
  background: var(--surface-2); font-weight: 600; font-size: 14px;
}
.hs-all:hover, .hs-all.active { background: #2b3649; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@media (max-width: 719px) {
  .top { gap: 12px; }
  .logo small { display: none; }
  .hsearch { max-width: none; }
  .hsearch input { height: 40px; font-size: 16px; }
  /* full-width sheet under the header on phones */
  .hs-drop { position: fixed; top: 62px; left: 8px; right: 8px; max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); }
  .hs-poster { width: 42px; height: 62px; }
  .hs-origin { display: none; }
}

/* search hero */
.search {
  position: relative; margin: 6px 0 22px;
}
.search input {
  width: 100%; padding: 16px 52px 16px 18px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  font: 500 18px var(--body);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,180,65,.18); }
.search .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1;
}
.search .clear:hover { background: var(--surface-2); color: var(--text); }

/* sections */
.row { margin: 0 0 30px; }
.row-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.row-head h2 {
  margin: 0; font: 700 18px var(--display);
}
.row-head .count { font: 500 12px var(--mono); color: var(--muted); }
.row-head .spacer { flex: 1; }

/* home: catalogue filters */
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.link-btn:hover { color: var(--accent); }
.muted { color: var(--muted); font-weight: 500; }
.catalog { margin-top: 8px; }
.cat-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cat-bar > * { min-width: 0; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg button {
  height: 34px; padding: 0 18px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px; transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.cat-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.fdd { position: relative; }
.fdd-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px 0 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; white-space: nowrap; transition: border-color .15s ease, background .15s ease;
}
.fdd-btn:hover { border-color: #3a4760; background: var(--surface-2); }
.fdd-btn[aria-expanded="true"] { border-color: var(--accent); }
.fdd-btn.active { border-color: rgba(242,180,65,.55); background: rgba(242,180,65,.08); }
.fdd-label { color: var(--muted); }
.fdd-val { font-weight: 600; }
.fdd-btn svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s ease; }
.fdd-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.flag.sm { width: 20px; height: 14px; border-radius: 2px; }
.flag.blank { display: inline-block; width: 20px; height: 14px; box-shadow: none; }
.fdd-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; min-width: 230px; max-height: 360px; overflow-y: auto;
  padding: 6px; border-radius: 14px; background: #182030; border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,.55); animation: pop .15s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; overscroll-behavior: contain;
}
.fdd-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; font-size: 14px;
}
.fdd-opt > span:not(.flag) { flex: 1; }
.fdd-opt .flag { flex: none; }
.fdd-opt:hover { background: rgba(255,255,255,.07); }
.fdd-opt.on { color: var(--accent); font-weight: 600; }
.fdd-check { width: 18px; height: 18px; flex: none; }
.fdd-list.as-sheet .fdd-opt { min-height: 50px; font-size: 16px; }
.fdd-list.as-sheet::before { content: attr(aria-label); display: block; padding: 8px 10px 10px; font-weight: 700; font-size: 17px; }

/* categories: a sticky list on the left (desktop), a chip row on phones */
.cat-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.cat-main { min-width: 0; }
.cat-side {
  position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 32px); overflow-y: auto; padding: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; overscroll-behavior: contain;
}
.cat-side::before { content: "Категории"; padding: 6px 10px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip-f {
  flex: none; display: flex; align-items: center; height: 38px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: #c9d1dc; font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.chip-f:hover { background: rgba(255,255,255,.06); color: var(--text); }
.chip-f[aria-selected="true"] { background: rgba(242,180,65,.14); color: var(--accent); font-weight: 600; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cat-head h2 { margin: 0; font: 700 20px var(--display); }
.row-head .spacer { flex: 1; }
@media (max-width: 719px) {
  .cat-bar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; margin-bottom: 12px; }
  .seg { display: flex; }
  .seg button { flex: 1; }
  .cat-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .cat-filters::-webkit-scrollbar { display: none; }
  .fdd-btn { height: 38px; font-size: 13px; padding: 0 10px 0 12px; }
  .cat-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cat-side {
    position: static; flex-direction: row; gap: 8px; max-height: none; overflow-x: auto; overflow-y: hidden;
    margin: 0 calc(-1 * var(--gutter)) 14px; padding: 0 var(--gutter); border: 0; border-radius: 0; background: none;
    scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .cat-side::-webkit-scrollbar { display: none; }
  .cat-side::before { display: none; }
  .chip-f { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
  .chip-f[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
  .cat-side { order: -1; }
  .cat-head h2 { font-size: 17px; }
}

/* poster grid */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; } }
.card { display: block; position: relative; }
.card .poster {
  aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2) center / cover no-repeat;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover .poster { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,.35); }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  font: 700 13px var(--body); line-height: 1;
  background: rgba(18,24,33,.85); color: var(--text); padding: 5px 7px; border-radius: 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.card .badge.rate.good { background: #3bb33b; color: #fff; }
.card .badge.rate.mid { background: #6f7784; color: #fff; }
.card .badge.rate.bad { background: #e0453a; color: #fff; }
.card .name { margin: 8px 0 0; font-weight: 500; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font: 500 12px var(--mono); color: var(--muted); margin-top: 3px; display: flex; gap: 8px; }
.card .meta .star { color: var(--accent); }
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .card .name { font-size: 13px; margin-top: 6px; }
  .card .meta { font-size: 11px; gap: 6px; }
  .card .badge { top: 6px; left: 6px; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
  .card:hover .poster { transform: none; box-shadow: none; }
  .cont { width: 232px; }
  .row { margin-bottom: 24px; }
  .row-head h2 { font-size: 17px; }
  .search input { font-size: 16px; padding: 14px 46px 14px 16px; }
}

.more { display: flex; justify-content: center; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 15px;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: #3a4760; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #f7c35c; border-color: #f7c35c; }
.btn-ghost { background: transparent; }
.btn .mono { font: 500 13px var(--mono); opacity: .8; }

/* continue watching: horizontal strip with perforation progress */
.strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.cont {
  flex: 0 0 auto; width: 250px;
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.cont:hover { border-color: #3a4760; }
.cont .poster { width: 64px; aspect-ratio: 2 / 3; border-radius: 8px; background: var(--surface-2) center / cover no-repeat; }
.cont .name { font-weight: 500; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cont .pos { font: 500 12px var(--mono); color: var(--muted); margin-top: 4px; }
.cont .pos b { color: var(--accent); font-weight: 500; }
/* text column stretches to the poster height; the progress bar sits at its bottom */
.cont > div:last-child { display: flex; flex-direction: column; min-width: 0; padding: 2px 0; }
.cont .perf { margin-top: auto; padding-top: 8px; box-sizing: content-box; }

/* perforation progress: 20 sprocket holes, filled ones are lit */
.perf { display: flex; gap: 3px; height: 6px; }
.perf i { flex: 1; border-radius: 2px; background: var(--hole); }
.perf i.on { background: var(--accent); }
.perf.done i { background: var(--muted); }

/* states */
.empty, .error { color: var(--muted); padding: 24px 0; text-align: center; }
.error { color: var(--danger); }
.skeleton .poster { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* title page: poster | head, more ; player below. Phones move the player up under the head. */
.title-layout {
  display: grid; grid-template-columns: var(--poster-w, 200px) minmax(0, 1fr);
  grid-template-areas: "poster head" "poster more" "player player";
  column-gap: 32px; row-gap: 14px; align-items: start; margin-top: 12px;
}
.hero-poster {
  grid-area: poster; align-self: stretch; min-height: 240px; border-radius: 14px;
  background: var(--surface-2) center / cover no-repeat; box-shadow: 0 14px 34px rgba(0,0,0,.4), 0 0 0 1px var(--line);
}
.hero-head, .hero-more { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-head { grid-area: head; }
.hero-more { grid-area: more; }
.hero-head > *, .hero-more > * { margin: 0; }
.title-layout .player-block { grid-area: player; margin: 18px 0 32px; }
h1.title { font: 700 clamp(24px, 3.6vw, 38px) / 1.12 var(--display); letter-spacing: -.01em; }
.hero-head .origin { color: var(--muted); font-size: 15px; margin-top: -8px; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; color: #b7c0cd; font-size: 14px; }
.meta-line .mi { display: inline-flex; align-items: center; }
.meta-line .mi + .mi::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: 0 10px; }
.flags { display: inline-flex; gap: 6px; }
.flag { display: block; width: 22px; height: 16px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.country-name { font-size: 13px; }
.meta-line .age, .meta-line .q {
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text);
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.rating, .genre {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; border: 1px solid var(--line); background: var(--surface);
}
.rating .star { color: var(--accent); font-size: 13px; }
.rating b { font-size: 15px; font-weight: 700; }
.rating small { color: var(--muted); font-size: 12px; }
.genre { color: #c9d1dc; }
.desc { margin: 0; color: #c9d1dc; font-size: 15px; line-height: 1.6; }
.desc-more { display: none; }
.credits { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 14px; line-height: 1.45; }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; color: var(--text); }

@media (max-width: 719px) {
  .title-layout {
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-areas: "poster head" "player player" "more more";
    column-gap: 14px; row-gap: 0; margin-top: 4px;
  }
  .hero-poster { align-self: start; min-height: 0; aspect-ratio: 2 / 3; border-radius: 10px; }
  .hero-head { gap: 8px; align-self: center; }
  h1.title { font-size: 21px; line-height: 1.2; }
  .hero-head .origin { font-size: 13px; margin-top: -4px; }
  .meta-line { font-size: 13px; gap: 6px 10px; }
  .meta-line .mi + .mi::before { display: none; }
  .flag { width: 20px; height: 14px; }
  .rating { height: 26px; padding: 0 9px; gap: 4px; }
  .rating b { font-size: 13px; }
  .rating small { font-size: 11px; }
  .title-layout .player-block { margin: 16px 0 18px; }
  .hero-more { gap: 12px; padding-bottom: 28px; }
  .genre { height: 28px; padding: 0 11px; font-size: 12px; }
  .desc { font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .desc.open { display: block; -webkit-line-clamp: unset; }
  .desc-more {
    display: inline-block; margin-top: 4px; padding: 4px 0; border: 0; background: none;
    color: var(--accent); font-size: 14px; font-weight: 600;
  }
  .desc-more[hidden] { display: none; }
  .credits { grid-template-columns: 1fr; gap: 2px; font-size: 13px; }
  .credits dd { margin-bottom: 8px; }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.eps { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.ep {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; padding: 8px 4px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font: 500 15px var(--mono);
}
.ep:hover { border-color: #3a4760; }
.ep.watched { color: var(--muted); }
.ep.watched::after { content: "✓"; position: absolute; top: 4px; right: 6px; font-size: 11px; color: var(--muted); }
.ep.current { border-color: var(--accent); color: var(--accent); }
.ep .perf { width: 70%; height: 4px; gap: 2px; }

/* title page: custom player */
.player-block { margin: 0 0 28px; }

.player {
  --ui-bg: rgba(14, 18, 26, .86);
  --ui-line: rgba(255, 255, 255, .1);
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 80svh;
  background: #000; border-radius: 16px; overflow: hidden; isolation: isolate;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 1px var(--line);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
@media (max-width: 719px) {
  .player { width: auto; margin: 0 calc(-1 * var(--gutter)); border-radius: 0; box-shadow: none; }
}
.player.is-fs { max-height: none; border-radius: 0; box-shadow: none; aspect-ratio: auto; height: 100%; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; }
.player.started:not(.ui-on):not(.paused) { cursor: none; }

.p-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
.player.enhanced .p-canvas { display: block; }
.player.enhanced video { opacity: 0; }
.player.in-pip .p-canvas { display: none; }
.p-hit { position: absolute; inset: 0; z-index: 1; transition: background .25s ease; }
.player { touch-action: manipulation; }

/* big centre controls (touch screens) */
.p-center {
  position: absolute; inset: 0; z-index: 2; display: none; align-items: center; justify-content: center; gap: 40px;
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.player.touch .p-center { display: flex; }
.player.touch.started.ui-on:not(.has-overlay) .p-center { opacity: 1; }
.player.touch.started.ui-on:not(.has-overlay) .p-center > * { pointer-events: auto; }
.player.touch.started.ui-on:not(.has-overlay) .p-hit { background: rgba(0,0,0,.35); }
.c-btn {
  width: 52px; height: 52px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.35); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.c-btn svg { width: 26px; height: 26px; }
.c-btn:disabled { opacity: .3; }
.c-btn.c-main { width: 68px; height: 68px; background: rgba(0,0,0,.45); }
.c-btn.c-main svg { width: 34px; height: 34px; }
.c-btn:active:not(:disabled) { transform: scale(.92); }
.player.touch #bPrev, .player.touch #bPlay, .player.touch #bNext, .player.touch .p-vol { display: none; }
.player.touch .p-time { margin-left: 6px; }
.player.touch .p-seek { height: 26px; }
.player.touch .p-thumb { transform: scale(1); }
.player.touch .p-seek:hover .p-rail { height: 4px; }
.player.touch .p-seek.dragging .p-rail { height: 6px; }
.player.touch .p-seek:not(.dragging) .p-tip { opacity: 0; }

/* bottom sheet for the menu and the season/episode lists (touch, moved into <body>) */
.sheet-bg { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.6); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.as-sheet {
  --ui-bg: #151b26; --ui-line: rgba(255,255,255,.1);
  position: fixed !important; z-index: 1001; left: 8px; right: 8px; top: auto !important;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: auto !important; max-width: 560px; margin: 0 auto; max-height: 72vh; overflow-y: auto;
  padding: 8px; border-radius: 18px; background: #151b26; border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 -10px 40px rgba(0,0,0,.5); color: #fff; animation: sheet .22s ease;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
.as-sheet .m-row, .as-sheet .m-opt, .as-sheet .m-head, .as-sheet .dd-opt { min-height: 50px; font-size: 16px; }
.dd-list.as-sheet::before {
  content: attr(aria-label); display: block; padding: 8px 10px 10px; font-weight: 700; font-size: 17px;
}

.p-toast {
  position: absolute; left: 50%; top: 16px; z-index: 8; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 8px 14px; border-radius: 10px; background: var(--ui-bg); border: 1px solid var(--ui-line);
  font-size: 13px; text-align: center; animation: pop .2s ease;
}

/* top & bottom bars fade in over gradient scrims */
.p-top, .p-bottom {
  position: absolute; left: 0; right: 0; z-index: 2;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.player.started.ui-on .p-top, .player.started.ui-on .p-bottom { opacity: 1; pointer-events: auto; transform: none; }
.player.has-overlay .p-top, .player.has-overlay .p-bottom { opacity: 0 !important; pointer-events: none !important; }
.p-top {
  top: 0; display: flex; align-items: center; gap: 12px; padding: 14px 16px 36px;
  background: linear-gradient(to bottom, rgba(0,0,0,.72), rgba(0,0,0,0));
  transform: translateY(-6px);
}
.p-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; }
.p-title b { font: 600 15px var(--display); overflow: hidden; text-overflow: ellipsis; }
.p-ep { font: 600 13px var(--body); color: var(--accent); flex: none; }
.p-eptitle { font-size: 13px; color: rgba(255,255,255,.7); overflow: hidden; text-overflow: ellipsis; }
.player:not(.is-fs) .p-title b { display: none; }
.p-bottom {
  bottom: 0; padding: 40px 12px 8px;
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,.35) 60%, rgba(0,0,0,0));
  transform: translateY(6px);
}

/* seek bar */
.p-seek { position: relative; height: 18px; margin: 0 6px; cursor: pointer; touch-action: none; display: flex; align-items: center; }
.p-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,.22); overflow: hidden; transition: height .15s ease; }
.p-seek:hover .p-rail, .p-seek.dragging .p-rail { height: 6px; }
.p-buf { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.32); }
.p-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); box-shadow: 0 0 12px rgba(242,180,65,.6); }
.p-thumb {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(242,180,65,.25);
  transform: scale(0); transition: transform .15s ease;
}
.p-seek:hover .p-thumb, .p-seek.dragging .p-thumb { transform: scale(1); }
.p-tip {
  position: absolute; bottom: 22px; left: 0; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 7px; background: var(--ui-bg); border: 1px solid var(--ui-line);
  font: 500 12px var(--mono); white-space: nowrap; opacity: 0; transition: opacity .12s ease; pointer-events: none;
}
.p-seek:hover .p-tip, .p-seek.dragging .p-tip { opacity: 1; }

/* control row */
.p-bar { display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.p-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: #fff;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}
.p-btn svg { width: 24px; height: 24px; }
.p-btn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.p-btn:active:not(:disabled) { transform: scale(.92); }
.p-btn:disabled { opacity: .35; cursor: default; }
.p-btn.p-main svg { width: 28px; height: 28px; }
#bSettings svg { transition: transform .3s ease; }
#bPip[aria-pressed="true"] { color: var(--accent); }
.player.in-pip::after {
  content: "Видео в отдельном окне"; position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  color: var(--muted); font-size: 15px; pointer-events: none;
}
#bSettings[aria-expanded="true"] svg { transform: rotate(60deg); }
.p-spacer { flex: 1; }
.p-time { font: 500 13px var(--mono); color: rgba(255,255,255,.75); margin-left: 8px; white-space: nowrap; }
.p-time b { color: #fff; font-weight: 500; }

.p-vol { display: flex; align-items: center; }
.p-vol input {
  -webkit-appearance: none; appearance: none; width: 0; opacity: 0; height: 4px; margin: 0;
  border-radius: 4px; cursor: pointer; transition: width .2s ease, opacity .2s ease, margin .2s ease;
  background: linear-gradient(to right, #fff var(--v, 100%), rgba(255,255,255,.25) var(--v, 100%));
}
.p-vol:hover input, .p-vol:focus-within input { width: 84px; opacity: 1; margin: 0 8px 0 2px; }
.p-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
.p-vol input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }

@media (max-width: 560px) {
  .p-vol input, .p-vol:hover input { display: none; }
  .p-btn { width: 38px; height: 38px; }
  .p-btn svg { width: 22px; height: 22px; }
  .p-time { font-size: 12px; margin-left: 4px; }
}

/* settings menu */
.p-menu {
  position: absolute; right: 12px; bottom: 70px; z-index: 5;
  width: 360px; max-width: calc(100% - 24px); max-height: calc(100% - 90px); overflow-y: auto;
  padding: 6px; border-radius: 14px; background: var(--ui-bg); border: 1px solid var(--ui-line);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  animation: pop .16s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.m-row, .m-opt, .m-head {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent; color: #fff; text-align: left; font-size: 14px;
}
.m-row:hover, .m-opt:hover, .m-head:hover { background: rgba(255,255,255,.09); }
.m-row .m-name { font-weight: 500; }
.m-row .m-name { flex: none; }
.m-row .m-val { flex: 1; min-width: 0; color: rgba(255,255,255,.6); font-size: 13px; line-height: 1.3; text-align: right; overflow-wrap: anywhere; }
.m-row svg { width: 16px; height: 16px; color: rgba(255,255,255,.45); flex: none; }
.m-head { font-weight: 600; border-bottom: 1px solid var(--ui-line); border-radius: 9px 9px 0 0; margin-bottom: 4px; }
.m-head svg { width: 18px; height: 18px; }
.m-opt .m-check { width: 18px; height: 18px; flex: none; color: var(--accent); }
.m-opt .m-check svg { width: 18px; height: 18px; display: block; }
.m-opt.on { color: var(--accent); font-weight: 600; }

/* season & episode dropdowns (top right) */
.player.serial .p-top { padding-right: 250px; }
.p-pick {
  position: absolute; top: 12px; right: 12px; z-index: 6; display: flex; gap: 8px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.player:not(.started) .p-pick, .player.ui-on .p-pick, .player.pick-open .p-pick { opacity: 1; pointer-events: auto; }
.dd { position: relative; }
.dd-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 14px;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.16); color: #fff;
  background: rgba(14,18,26,.55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s ease, border-color .15s ease;
}
.dd-btn:hover { background: rgba(14,18,26,.8); border-color: rgba(255,255,255,.28); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); }
.dd-btn svg { width: 18px; height: 18px; opacity: .7; transition: transform .2s ease; }
.dd-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.dd-list {
  position: absolute; top: calc(100% + 6px); right: 0; width: 230px; max-width: calc(100vw - 24px);
  overflow-y: auto; padding: 6px; border-radius: 14px;
  background: var(--ui-bg); border: 1px solid var(--ui-line);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: pop .16s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent;
}
.dd-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent; color: #fff; text-align: left; font-size: 14px;
}
.dd-opt:hover { background: rgba(255,255,255,.09); }
.dd-opt .m-check { width: 18px; height: 18px; flex: none; color: var(--accent); }
.dd-opt .m-check svg { width: 18px; height: 18px; display: block; }
.dd-opt .dd-name { flex: 1; }
.dd-opt .dd-meta { font: 500 12px var(--mono); color: rgba(255,255,255,.5); }
.dd-opt.watched .dd-name { color: rgba(255,255,255,.55); }
.dd-opt.on { color: var(--accent); font-weight: 600; }
.dd-opt.on .dd-name { color: var(--accent); }
.player.is-fs .p-top { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.player.is-fs .p-bottom { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.player.is-fs .p-pick { right: max(12px, env(safe-area-inset-right)); }
@media (max-width: 560px) {
  .player.serial .p-top { display: none; }
  .p-pick { top: 10px; right: 10px; gap: 6px; }
  .p-bottom { padding: 32px 8px 4px; }
  .next-toast { left: 8px; right: 8px; bottom: 70px; justify-content: space-between; }
  .big-play { width: 72px; height: 72px; }
  .big-play svg { width: 32px; height: 32px; }
  .overlay .play-label { font-size: 14px; margin-top: 12px; }
  .player.serial .overlay.idle { padding-top: 58px; }
  .c-btn { width: 46px; height: 46px; }
  .c-btn.c-main { width: 62px; height: 62px; }
  .p-center { gap: 32px; }
  .dd-btn { height: 32px; font-size: 13px; padding: 0 8px 0 11px; }
}

/* overlay (idle / errors), loader, seek flashes */
.overlay {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); color: var(--text); text-align: center; padding: 20px; overflow: hidden;
}
.overlay .backdrop { display: none; }
.overlay.idle { background: #000; }
.overlay.idle .backdrop {
  display: block; position: absolute; inset: -40px;
  background: var(--surface-2) center / cover no-repeat; filter: blur(26px) brightness(.5) saturate(1.2); transform: scale(1.05);
}
.overlay.idle::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 30%, rgba(0,0,0,.55) 100%);
}
.overlay .msg { position: relative; z-index: 1; max-width: 40ch; display: flex; flex-direction: column; align-items: center; }
.overlay .msg p { margin: 8px 0; }
.big-play {
  width: 88px; height: 88px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 10px rgba(242,180,65,.16), 0 14px 36px rgba(242,180,65,.35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.big-play svg { width: 38px; height: 38px; margin-left: 4px; }
.big-play:hover { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(242,180,65,.2), 0 18px 44px rgba(242,180,65,.45); }
.overlay .play-label { margin: 16px 0 0; font-weight: 600; font-size: 16px; }
.overlay .play-label .mono { font: 600 15px var(--body); color: var(--accent); margin-left: 6px; }
.btn-glass {
  background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-glass:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.28); }
.btn-glass svg { width: 18px; height: 18px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }

.p-loader { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.p-flash {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 92px; height: 92px; justify-content: center; border-radius: 50%;
  background: rgba(0,0,0,.45); font: 500 12px var(--mono); opacity: 0; pointer-events: none;
}
.p-flash svg { width: 30px; height: 30px; }
.p-flash.back { left: 12%; }
.p-flash.fwd { right: 12%; }
.p-flash.show { animation: flash .6s ease; }
@keyframes flash { 0% { opacity: 0; transform: translateY(-50%) scale(.85); } 25% { opacity: 1; transform: translateY(-50%) scale(1); } 100% { opacity: 0; } }

.next-toast {
  position: absolute; right: 14px; bottom: 84px; z-index: 5;
  display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 14px; font-size: 14px;
  border-radius: 12px; background: var(--ui-bg); border: 1px solid var(--ui-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: pop .2s ease;
}
.next-toast b { font-weight: 600; color: var(--accent); }


footer { color: var(--muted); font-size: 12px; padding: 24px 0 32px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
