/* player-features — see contract */

/* ---- clock and end time, top right: «23:58 · конец в 01:42» ---- */
.p-when { flex: none; display: inline-flex; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-when .p-ends { margin-left: 0; font-size: 13px; color: rgba(255,255,255,.68); }
.p-when .p-ends::before { content: "·"; margin: 0 7px; color: rgba(255,255,255,.4); }
@media (max-width: 560px) { .p-when .p-ends { font-size: 12px; } .p-when .p-ends::before { margin: 0 5px; } }
@media (max-width: 380px) { .player:not(.is-fs) .p-when .p-ends:not([hidden]) { display: inline; } }
/* the copy in the control row: only where the top bar is hidden (phones, serial players) */
.p-ends-b { display: none; }
@media (max-width: 560px) { .player.serial .p-ends.p-ends-b:not([hidden]) { display: inline; } }
/* narrow phones: the end time stays, the total duration in the timer makes room for it */
@media (max-width: 380px) {
  .player.serial .p-ends.p-ends-b { margin-left: 6px; font-size: 11px; }
  .player.serial .p-time .p-dur { display: none; }
}

/* ---- frame: «Заполнить» / «Растянуть» (title.js sets the --fit-* box for the filter canvases) ---- */
.player.fit-cover video#video { object-fit: cover; }
.player.fit-fill video#video { object-fit: fill; }
.player.fit-cover .p-canvas, .player.fit-fill .p-canvas {
  inset: auto; left: var(--fit-x, 0); top: var(--fit-y, 0); width: var(--fit-w, 100%); height: var(--fit-h, 100%);
}
.player.fit-cover .p-canvas { clip-path: inset(var(--fit-cy, 0) var(--fit-cx, 0)); }
.player.fit-fill .p-canvas { transform: scale(var(--fit-sx, 1), var(--fit-sy, 1)); }

/* ---- seek rail: intro and end credits ---- */
.p-seg { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.p-seg.intro { background: rgba(110, 205, 255, .55); }
.p-seg.credits { background: rgba(192, 107, 255, .6); }

/* ---- «Пропустить заставку» ---- */
.p-skip {
  position: absolute; right: 16px; bottom: 84px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 20px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.22); color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
  font: 600 14.5px var(--body); white-space: nowrap;
  animation: pop .25s ease; transition: bottom .25s ease, background .15s ease, transform .15s ease;
}
.p-skip svg { width: 18px; height: 18px; flex: none; }
.p-skip:hover { background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.14)); }
.p-skip:active { transform: scale(.96); }
.player:not(.ui-on) .p-skip { bottom: 24px; }
.player.has-overlay .p-skip, .player.rate-open .p-skip, .player.in-pip .p-skip, .player.sheet-open .p-skip { display: none; }
.player.is-fs .p-skip { right: max(16px, env(safe-area-inset-right)); }
.player.is-fs:not(.ui-on) .p-skip { bottom: max(24px, env(safe-area-inset-bottom)); }
.player.pp-docked .p-skip { right: calc(var(--ppw) + 16px); }
@media (max-width: 560px) {
  .p-skip { right: 10px; bottom: 64px; height: 38px; padding: 0 10px 0 15px; font-size: 13.5px; }
  .player:not(.ui-on) .p-skip { bottom: 14px; }
}

/* ---- next episode: countdown ring ---- */
.next-btn .next-ic { position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; }
.next-btn svg.next-ring {
  display: none; position: absolute; inset: 0; width: 34px; height: 34px; color: var(--accent); transform: rotate(-90deg);
}
.next-btn:hover svg.next-ring { color: var(--accent-ink); }
.next-ring circle { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 3; }
.next-ring .nr-run { stroke: currentColor; stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: 0; }
.next-in { display: none; font: 700 14px var(--body); font-variant-numeric: tabular-nums; line-height: 1; }
.next-toast.counting .next-ic > svg:not(.next-ring) { display: none; }
.next-toast.counting .next-ring, .next-toast.counting .next-in { display: block; }
.next-toast.counting .nr-run { animation: next-ring 10s linear forwards; }
/* while counting, × reads «Отмена» */
.next-x .nx-t { display: none; }
.next-toast.counting .next-x { width: auto; padding: 0 15px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.next-toast.counting .next-x .nx-i { display: none; }
.next-toast.counting .next-x .nx-t { display: inline; }
@keyframes next-ring { to { stroke-dashoffset: 106.8; } }
@media (max-width: 560px) {
  .next-btn .next-ic, .next-btn svg.next-ring { width: 30px; height: 30px; }
  .next-in { font-size: 13px; }
}

/* ---- idle overlay: «Продолжить · 12:34» + «С начала» ---- */
.play-meta { display: flex; flex-direction: column; align-items: center; }
.overlay .p-restart {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; margin-top: 14px; padding: 0 18px 0 14px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26);
  font: 600 14px var(--body); white-space: nowrap; transition: background .15s ease, transform .15s ease;
}
.p-restart svg { width: 17px; height: 17px; flex: none; }
.p-restart:hover { background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.1)); }
.p-restart:active { transform: scale(.96); }
@media (max-width: 560px) {
  .play-meta.with-restart { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin-top: 30px; }
  .play-meta.with-restart .play-label { margin: 0; }
  .play-meta.with-restart .pl-ep { display: none; }
  .overlay .play-meta .p-restart { margin: 0; height: 32px; padding: 0 13px 0 10px; font-size: 13px; }
  .p-restart svg { width: 15px; height: 15px; }
}

/* ---- settings menu: greyed-out rows, in-place switches, options with a hint ---- */
.m-row.m-dis { cursor: default; }
.m-row.m-dis:hover { background: transparent; }
.m-dis .m-name { color: rgba(255,255,255,.45); }
.m-row.m-dis .m-val { color: rgba(255,255,255,.35); }
.m-switch {
  position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px;
  background: rgba(255,255,255,.16); box-shadow: inset 0 1px 2px rgba(0,0,0,.3); transition: background .2s ease;
}
.m-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .2s ease;
}
.m-flip.on .m-switch { background: var(--accent-grad); }
.m-flip.on .m-switch::after { transform: translateX(16px); }
.m-hinted { align-items: flex-start; }
.m-hinted .m-check { margin-top: 2px; }
.m-opt.on .m-tl small { color: rgba(255,143,177,.75); }

/* serials: the clock in the top bar stops short of the season / episode buttons (title.js
   measures them into --pickw), in the page and in fullscreen alike */
.player.serial .p-top { padding-right: calc(var(--pickw, 230px) + 28px); }
.player.serial.is-fs .p-top { padding-right: calc(var(--pickw, 230px) + 28px + env(safe-area-inset-right)); }

/* ---- sleep timer: the moon chip with the time left (top bar; the control-row copy where the top bar is hidden) ---- */
.p-sleep {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px 0 8px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
  font: 600 12.5px var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; transition: background .15s ease;
}
.p-sleep svg { width: 15px; height: 15px; flex: none; color: #ffc2d6; }
.p-sleep:hover { background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.1)); }
.p-sleep-b { display: none; margin-left: 8px; }
@media (max-width: 560px) {
  .player.serial .p-sleep.p-sleep-b:not([hidden]) { display: inline-flex; }
  .p-sleep { height: 26px; padding: 0 9px 0 7px; font-size: 12px; }
}
/* 320–380 px: the control row is full (five buttons, the time, «конец в …»): while a timer is set
   the chip takes the end time's place, and «после серии» shrinks to the moon alone (title.js sets
   .sleep-set / .sleep-end on the player) */
@media (max-width: 380px) {
  .player.serial.sleep-set .p-ends.p-ends-b:not([hidden]) { display: none; }
  .player.sleep-end .p-sleep.p-sleep-b { gap: 0; padding: 0 7px; }
  .player.sleep-end .p-sleep.p-sleep-b span { display: none; }
}

/* ---- sleep timer: the calm card when it fires (black after a while on computers) ---- */
.sleep-card {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(14,10,30,.78), rgba(4,3,10,.94));
  animation: fade .6s ease; transition: background 2s ease; cursor: default;
}
.sleep-card .sc-in { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; transition: opacity 2s ease; }
.sc-moon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; color: #ffd6e4;
  border: 1px solid rgba(255,255,255,.16); background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}
.sc-moon svg { width: 30px; height: 30px; }
.sleep-card b { font: 600 18px var(--display); color: rgba(255,255,255,.92); }
.sc-go {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px 0 17px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.22); color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
  font: 600 15px var(--body); transition: background .15s ease, transform .15s ease;
}
.sc-go svg { width: 18px; height: 18px; flex: none; }
.sc-go:hover { background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.14)); }
.sc-go:active { transform: scale(.96); }
.sleep-card.dark { background: #000; cursor: none; }
.sleep-card.dark .sc-in { opacity: 0; }
.player.sleep-on .p-top, .player.sleep-on .p-bottom, .player.sleep-on .p-center, .player.sleep-on .p-pick,
.player.sleep-on .p-skip, .player.sleep-on .next-toast { opacity: 0 !important; pointer-events: none !important; }
@media (max-width: 560px) {
  .sc-moon { width: 52px; height: 52px; }
  .sc-moon svg { width: 25px; height: 25px; }
  .sleep-card b { font-size: 16px; }
  .sc-go { height: 40px; font-size: 14px; }
}

/* phones: the tab bar steps aside while the player is under it (title.js) */
@media (max-width: 719px) {
  html.tb-over-player .tabbar { transform: translate(-50%, calc(100% + 30px)); opacity: 0; pointer-events: none; }
}

/* admin «Элементы плеера» (config.player.hidden_controls): title.js puts hc-<key> on the player.
   Hidden elements leave the flex rows (no gaps); play / pause, seek, fullscreen and the gear stay
   (the gear goes only when its menu is left empty, title.js). «Смотреть вместе» stays while in a
   room: it is the way out of it. */
.player.hc-party:not(.in-party) #bParty, .player.hc-handoff #bHandoff, .player.hc-pip #bPip,
.player.hc-volume .p-vol,
.player.hc-episodes #bPrev, .player.hc-episodes #bNext, .player.hc-episodes #cPrev, .player.hc-episodes #cNext,
.player.hc-clock .p-when, .player.hc-clock .p-ends.p-ends-b,
.player.hc-sleep_chip .p-sleep,
.player.hc-skip_intro .p-skip,
.player.hc-autonext_toast .next-toast { display: none !important; }

/* the next-episode countdown when the card above is hidden: a compact, non-blocking pill at the
   bottom right (title.js #nextPill; Escape cancels, Enter / OK plays now) */
.next-pill {
  position: absolute; right: 16px; bottom: 84px; z-index: 5; display: flex; align-items: center;
  height: 36px; padding: 0 4px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(14,18,26,.72); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35); font: 600 13px var(--body); white-space: nowrap;
  animation: pop .25s ease; transition: bottom .25s ease;
}
.next-pill[hidden] { display: none; }
.next-pill button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: inherit;
  font: inherit; cursor: pointer; transition: background .15s ease;
}
.next-pill button:hover, .next-pill button:focus-visible { background: rgba(255,255,255,.14); }
.next-pill b { font-variant-numeric: tabular-nums; color: var(--accent); }
.np-dot { opacity: .5; }
.np-x { color: rgba(255,255,255,.75) !important; }
.player:not(.ui-on) .next-pill { bottom: 24px; }
.player.is-fs .next-pill { right: max(16px, env(safe-area-inset-right)); }
.player.is-fs:not(.ui-on) .next-pill { bottom: max(24px, env(safe-area-inset-bottom)); }
.player.pp-docked .next-pill { right: calc(var(--ppw) + 16px); }
.player.has-overlay .next-pill, .player.in-pip .next-pill, .player.pa-running > .next-pill { display: none; }
.player.sleep-on .next-pill { opacity: 0 !important; pointer-events: none !important; }
@media (max-width: 560px) {
  .next-pill { right: 10px; bottom: 64px; height: 32px; font-size: 12.5px; }
  .next-pill button { height: 26px; padding: 0 8px; }
  .player:not(.ui-on) .next-pill { bottom: 14px; }
}
