/* ads — settings for everyone on the site pages (static/js/site-extras.js): feature flags, the announcement
   bar, the maintenance screen, messages from FILM, and the banner slots with «Реклама». */

/* ---- feature flags: site-extras.js puts html.no-<flag> for every feature switched off ---- */
html.no-remote .rm-pill, html.no-remote .rm-tv, html.no-remote .md-ctl,
html.no-handoff .rm-send, html.no-handoff .rm-hmenu, html.no-handoff .rm-here, html.no-handoff .rm-offer, html.no-handoff .md-here,
html.no-stats .am-item[data-go="stats"], html.no-stats .st-sec,
html.no-new-episodes #newRow, html.no-new-episodes .pm-new,
html.no-pick #pickBtn,
html.no-telegram-notify .nt-sec,
html.no-registration .auth-switch a[data-mode="register"], html.no-registration .pf-out [data-act="register"],
html.no-google-login #gWrap,
html.no-tv-code-login .auth-tv, html.no-tv-code-login .tv-sec { display: none !important; }

/* ---- announcement bar: glass under the header; info is violet, warn amber ---- */
.ann {
  --ann-c: #c9a6ff; --ann-bg: rgba(192,107,255,.13); --ann-line: rgba(201,166,255,.3);
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px; padding: 8px 8px 8px 10px;
  border-radius: 20px; border: 1px solid var(--ann-line);
  background: linear-gradient(180deg, var(--ann-bg), rgba(255,255,255,.03));
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--glass-hi); color: var(--text);
  animation: ann-in .32s cubic-bezier(.2,.8,.2,1);
  transition: opacity .24s ease, transform .24s ease;
}
.ann-warn { --ann-c: #ffc24b; --ann-bg: rgba(255,170,60,.14); --ann-line: rgba(255,200,110,.34); }
.ann.gone { opacity: 0; transform: translateY(-6px); }
.ann-ic {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px;
  background: rgba(255,255,255,.08); color: var(--ann-c); box-shadow: var(--glass-hi);
}
.ann-ic svg { width: 19px; height: 19px; }
.ann-text { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.ann-link {
  flex: none; display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 8px 0 14px;
  border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: var(--ann-c); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.ann-link:hover { background: rgba(255,255,255,.13); }
.ann-link svg { width: 16px; height: 16px; }
.ann-x {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0;
  border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.ann-x:hover { background: rgba(255,255,255,.08); color: var(--text); }
.ann-x svg { width: 18px; height: 18px; }
@keyframes ann-in { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 719px) {
  .ann { flex-wrap: wrap; margin-bottom: 16px; gap: 8px 10px; }
  .ann-text { flex-basis: calc(100% - 100px); font-size: 13.5px; }
  .ann-link { order: 3; margin-left: 44px; }
}

/* ---- maintenance: the whole screen, one glass card ---- */
html.mnt-on, html.mnt-on body { overflow: hidden; }
html.mnt-on .tabbar, html.mnt-on .rm-pill { display: none !important; }
.mnt {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(192,107,255,.22), rgba(11,9,19,.92) 60%), rgba(11,9,19,.9);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.mnt-card {
  width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 30px 24px 24px; border-radius: 28px; border: 1px solid var(--glass-line);
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04)); box-shadow: var(--glass-hi);
}
.mnt-ic {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 20px;
  background: var(--accent-grad); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.mnt-ic svg { width: 30px; height: 30px; }
.mnt-card h2 { margin: 4px 0 0; font: 700 22px / 1.2 var(--display); }
.mnt-card p { margin: 0; color: #d4cee3; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.mnt-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; }
.mnt-btn svg { width: 18px; height: 18px; }

/* ---- messages from FILM: a stack of glass cards at the top ---- */
.fmsg-stack {
  position: fixed; z-index: 1200; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  width: min(380px, calc(100% - 32px)); display: grid;
}
.fmsg {
  --i: 0;
  grid-area: 1 / 1; align-self: start; display: flex; flex-direction: column; gap: 12px;
  padding: 16px; border-radius: 24px; border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(48,40,74,.78), rgba(24,19,40,.86));
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow: var(--glass-hi), 0 18px 44px rgba(0,0,0,.4);
  transform: translateY(calc(var(--i) * 9px)) scale(calc(1 - var(--i) * .04));
  transform-origin: 50% 0; z-index: calc(10 - var(--i));
  transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .24s ease;
  animation: fmsg-in .34s cubic-bezier(.2,.8,.2,1);
}
.fmsg.back { opacity: .7; pointer-events: none; }
.fmsg.back > * { visibility: hidden; }
.fmsg.gone { opacity: 0; transform: translateY(-10px) scale(.97); }
.fmsg-head { display: flex; align-items: center; gap: 12px; }
.fmsg-ic {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px;
  background: var(--accent-grad); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.fmsg-ic svg { width: 20px; height: 20px; }
.fmsg-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.fmsg-who b { font-size: 15px; }
.fmsg-who small { color: var(--muted); font-size: 12.5px; }
.fmsg-text { margin: 0; font-size: 14.5px; line-height: 1.5; color: #e6e1f2; white-space: pre-line; overflow-wrap: anywhere; max-height: 40vh; overflow: auto; }
.fmsg-ok { align-self: flex-end; height: 40px; padding: 0 22px; }
@keyframes fmsg-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@media (max-width: 719px) {
  .fmsg-stack { left: 12px; right: 12px; width: auto; top: calc(10px + env(safe-area-inset-top)); }
  .fmsg-ok { align-self: stretch; }
}

/* ---- banner slots: rounded like the cards, a liquid-glass frame, a small «Реклама» ---- */
.ad-slot { display: none; }
.ad-slot.pr-on {
  --ar: 6 / 1;
  position: relative; display: block; margin: 0 0 30px; padding: 5px; border-radius: 22px;
  border: 1px solid var(--glass-line); background: var(--glass); box-shadow: var(--glass-hi);
  animation: ad-in .4s ease;
}
.ad-link { display: block; aspect-ratio: var(--ar); max-height: 260px; width: 100%; border-radius: 17px; overflow: hidden; background: var(--surface); }
.ad-link picture, .ad-link img { display: block; width: 100%; height: 100%; }
.ad-link img { object-fit: cover; transition: transform .4s ease; }
.ad-link:hover img { transform: scale(1.012); }
.ad-ya { min-height: 0; border-radius: 17px; overflow: hidden; }
.ad-label {
  position: absolute; top: 12px; left: 12px; z-index: 1; padding: 2px 8px; border-radius: 999px; pointer-events: none;
  background: rgba(14,10,26,.55); border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px) saturate(150%); -webkit-backdrop-filter: blur(8px) saturate(150%);
  color: rgba(255,255,255,.82); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; line-height: 1.5;
}
@keyframes ad-in { from { opacity: 0; } }

/* the catalogue: a full row of the grid (later cards fill the gap before it) */
.grid.cg-dense { grid-auto-flow: row dense; }
.ad-catalog-inline.pr-on { grid-column: 1 / -1; margin: 4px 0; }
.ad-title-below-player.pr-on { grid-column: 1 / -1; min-width: 0; margin: 0 0 30px; }
@media (max-width: 719px) {
  .ad-slot.pr-on { --ar: 16 / 5; margin-bottom: 24px; padding: 4px; border-radius: 20px; }
  .ad-link, .ad-ya { border-radius: 16px; }
  .ad-label { top: 10px; left: 10px; }
  .ad-title-below-player.pr-on { margin: 0 0 22px; }
}

/* phones: the slim bar above the tab bar (site-extras.js sets `bottom`); hidden on wide screens */
.ad-mobile-sticky.pr-on {
  --ar: 32 / 5;
  position: fixed; left: 50%; z-index: 890; width: min(400px, calc(100% - 24px)); margin: 0;
  bottom: calc(92px + env(safe-area-inset-bottom)); padding: 3px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(48,56,72,.42), rgba(20,25,34,.55));
  backdrop-filter: blur(3px) saturate(165%); -webkit-backdrop-filter: blur(3px) saturate(165%);
  border-color: rgba(255,255,255,.13); box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
  transform: translateX(-50%);
  transition: bottom .34s cubic-bezier(.2,.8,.2,1), opacity .24s ease, transform .24s ease;
}
.ad-mobile-sticky .ad-link { max-height: 64px; border-radius: 15px; }
.ad-mobile-sticky .ad-ya { max-height: 100px; border-radius: 15px; }
.ad-mobile-sticky .ad-label { top: 50%; left: 9px; transform: translateY(-50%); font-size: 9.5px; padding: 1px 6px; }
.ad-mobile-sticky.off, .ad-mobile-sticky.gone { opacity: 0; pointer-events: none; transform: translate(-50%, 12px); }
.ad-x {
  position: absolute; top: -9px; right: -6px; z-index: 2; display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); background: rgba(22,17,38,.82); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.ad-x svg { width: 14px; height: 14px; }
.ad-x::after { content: ""; position: absolute; inset: -9px; }   /* a finger-sized target */
@media (min-width: 720px) { .ad-mobile-sticky { display: none !important; } }
html.page-open .ad-mobile-sticky, html.modal-open .ad-mobile-sticky, html.fake-fs-on .ad-mobile-sticky { display: none !important; }
/* the remote pill and its offer card sit over the bar, never under it */
html.pr-sticky-on .rm-pill, html.pr-sticky-on .rm-offer.low { margin-bottom: var(--ad-sticky-h, 0px); }
@media (max-width: 719px) {
  html.pr-sticky-on body.has-tabbar { padding-bottom: calc(84px + var(--ad-sticky-h, 0px) + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .ann, .fmsg, .ad-slot.pr-on { animation: none; }
}

/* maintenance: an admin can still sign in (auth.js dialog over the screen; the steps the server
   keeps closed meanwhile are left out) */
.mnt-in {
  margin-top: -4px; padding: 6px 10px; border: 0; background: none; color: var(--muted); cursor: pointer;
  font: 500 13.5px var(--body); text-decoration: underline; text-underline-offset: 3px;
}
.mnt-in:hover { color: var(--text); }
html.mnt-on .auth-modal { z-index: 3100; }
html.mnt-on .auth-modal .auth-switch, html.mnt-on .auth-modal .auth-tv, html.mnt-on .auth-modal .auth-forgot { display: none !important; }

/* «Что посмотреть?» switched off: «Фильтры» takes the whole row on phones */
html.no-pick .cat-bar .btn-filters { grid-column: 1 / -1; }

/* «Смотреть как зритель» bar (site-extras.js) */
.viewer-bar {
  position: fixed; z-index: 1400; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px;
  border-radius: 999px; border: 1px solid rgba(255,194,75,.45); background: rgba(40,28,10,.82); color: #ffd98a;
  backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
  font-size: 13px; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}
.viewer-bar button {
  flex: none; min-height: 32px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: #ffc24b; color: #2a1c05; font-weight: 700; font-size: 13px;
}
@media (max-width: 719px) { .viewer-bar { bottom: calc(104px + env(safe-area-inset-bottom)); font-size: 12px; } }
