/* Плеер. Выдернут из движка Hromly без остального его облика: там эти правила
   жили в общей тёмной теме, а у нас страница светлая, и подтягивать весь чужой
   каркас ради плеера — значит тащить на сайт чужой дизайн целиком.

   Токены объявлены локально на самом плеере: сцена у видео тёмная в любом случае,
   и наружу эта темнота не протекает. */
#atlas-player, .stage, .player-slot, media-player {
  --accent: #DE4324;
  --text: #F3F1EC;
  --soft: #C7C9CF;
  --muted: #9AA0AA;
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .22);
  --surface: #0E141E;
  --surface-2: #17202E;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 28px 54px -24px rgba(0, 0, 0, .6);
}

/* Слот, в который контроллер вкладывает сквозной плеер. */
.player-slot { position: absolute; inset: 0; }

.player-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.player-stage { position: relative; background: #05070b; }
.tv-player { display: block; width: 100%; aspect-ratio: 16/9; background: #05070b; --media-primary-color: #fff; --media-secondary-color: rgba(8,11,18,.92); --media-control-hover-background: rgba(255,255,255,.12); --media-range-bar-color: var(--accent); --media-font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.tv-player video { width: 100%; height: 100%; object-fit: contain; }
.tv-player media-control-bar { padding: 10px 12px; background: linear-gradient(transparent, rgba(3,5,9,.94)); }
.player-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; pointer-events: auto; background: radial-gradient(circle at center, rgba(36,58,95,.48), rgba(5,7,11,.92) 62%); }
.player-empty[hidden] { display: none; }
.player-start-button { --shift-x: 0; --shift-y: 0; --scale: 1; display: grid; place-items: center; width: clamp(68px, 9vw, 96px); height: clamp(68px, 9vw, 96px); padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; transform: translate(var(--shift-x), var(--shift-y)) scale(var(--scale)); transition: transform .18s cubic-bezier(.23,1,.32,1), opacity .18s ease; }
.player-start-button img { display: block; width: 100%; height: 100%; object-fit: contain; }
.player-start-button:not(:disabled):hover, .player-start-button:not(:disabled):focus-visible { --scale: 1.06; }
.player-start-button:not(:disabled):active { --scale: .97; }
.player-start-button:disabled { cursor: default; }
.player-empty b { margin-top: 20px; font-size: clamp(16px, 2vw, 23px); }
.player-empty small { color: var(--muted); }
.player-caption { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px 20px; }
.player-caption h2 { margin: 7px 0 3px; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: clamp(20px, 3vw, 31px); letter-spacing: -.04em; }
.player-caption p { margin: 0; color: var(--muted); }
.detail-player { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #05070b; box-shadow: var(--shadow); }
.catalog-heading, .player-caption, .tv-footer { align-items: flex-start; flex-direction: column; }
.tv-player media-volume-range, .tv-player media-time-display { display: none; }
.detail-player-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; color: var(--muted); }
.detail-player { position: relative; }
media-player.tv-player { --video-brand: var(--accent); --media-brand: var(--accent); --media-focus-ring-color: var(--accent); display: block; width: 100%; border-radius: var(--radius-xl); overflow: hidden; background: #05070b; }
media-player.tv-player[data-fullscreen] { border-radius: 0; }
.vds-poster { object-fit: cover; }
.player-notice { position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 9px; width: min(420px, 86%); padding: 22px 24px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: rgba(8,11,18,.93); backdrop-filter: blur(14px); text-align: center; }
.player-notice[hidden] { display: none; }
.player-notice b { font-size: 16px; }
.player-notice span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.player-notice-retry { margin-top: 4px; border: 1px solid var(--line-strong); border-radius: 11px; padding: 9px 18px; background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; }
.player-notice-retry:hover { border-color: var(--accent); }
.player-similar { position: absolute; z-index: 6; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 20px 76px; background: linear-gradient(to top, rgba(5,7,11,.94) 42%, rgba(5,7,11,.55) 78%, rgba(5,7,11,.25)); pointer-events: none; }
.player-similar[hidden] { display: none; }
.player-similar-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .01em; color: var(--soft); }
.player-similar-grid { pointer-events: auto; display: grid; grid-auto-flow: column; grid-auto-columns: 150px; justify-content: start; gap: 12px; overflow-x: auto; scrollbar-width: thin; }
.player-similar-grid .channel-card-link { gap: 7px; }
.player-similar-grid .channel-name { font-size: 12.5px; }
.player-similar-grid .channel-meta, .player-similar-grid .fav-button { display: none; }
.player-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
/* Геометрия БЕЗ перехода: плеер держится за сцену на каждой прокрутке, и
   переход превращал слежение в погоню — кнопка уезжала из-под курсора. */
.hplayer { position: fixed; z-index: 90; display: grid; background: #05070b; border: 1px solid var(--line); overflow: hidden; transition: border-radius .28s ease, box-shadow .28s ease; }
/* Перелёт в угол и обратно — смена режима, а не слежение: включаем переход
   только на время этой смены. */
.hplayer.is-moving { transition: left .28s cubic-bezier(.23,1,.32,1), top .28s cubic-bezier(.23,1,.32,1), width .28s cubic-bezier(.23,1,.32,1), height .28s cubic-bezier(.23,1,.32,1), border-radius .28s ease, box-shadow .28s ease; }
.hplayer[hidden] { display: none; }
.hplayer media-player { width: 100%; height: 100%; --video-brand: var(--accent); --media-brand: var(--accent); --media-focus-ring-color: var(--accent); }
/* В сцене плеер — обычный блок, а не фиксированный слой поверх страницы:
   так он не может отстать от прокрутки и увезти кнопку из-под курсора. */
.hplayer.is-inline { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--radius-xl); box-shadow: none; }
.hplayer.is-docked { left: auto; right: 22px; top: auto; bottom: 22px; width: 340px; height: 191px; border-radius: 16px; box-shadow: 0 26px 70px rgba(0,0,0,.6); }
.hplayer.is-docked media-video-layout { display: none; }
.hplayer-start { position: absolute; z-index: 5; left: 50%; top: 50%; --shift-x: -50%; --shift-y: -50%; filter: drop-shadow(0 8px 26px rgba(0,0,0,.58)); }
.hplayer-start[hidden] { display: none; }
.hplayer-bar { position: absolute; z-index: 7; inset: auto 0 0 0; display: none; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 4px; padding: 7px 8px; background: linear-gradient(to top, rgba(5,7,11,.96), rgba(5,7,11,.6) 70%, transparent); }
.hplayer.is-docked .hplayer-bar { display: grid; }
.hplayer-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--soft); cursor: pointer; transition: color .16s ease, background .16s ease; }
.hplayer-btn svg { width: 17px; height: 17px; }
.hplayer-btn:hover:not(:disabled) { background: rgba(255,255,255,.1); color: #fff; }
.hplayer-btn:disabled { opacity: .3; cursor: default; }
.hplayer-title { min-width: 0; color: var(--text); font-size: 12.5px; font-weight: 650; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hplayer-title:hover { color: var(--accent); }
.player-slot { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-xl); background: #05070b; border: 1px solid var(--line); }
.hplayer.is-docked { right: 10px; left: 10px; width: auto; bottom: 78px; height: 0; padding-top: 56.25%; }
.hplayer.is-docked .hplayer-bar { padding: 6px; }
.hplayer.is-inline .hplayer-bar { display: contents; }
.hplayer.is-inline .hplayer-title, .hplayer.is-inline .hplayer-close { display: none; }
.hplayer.is-inline #hplayer-prev { left: 12px; }
.hplayer.is-inline #hplayer-next { right: 12px; }
.hplayer.is-inline #hplayer-prev svg, .hplayer.is-inline #hplayer-next svg { width: 22px; height: 22px; }
.hplayer.is-inline #hplayer-prev:focus-visible, .hplayer.is-inline #hplayer-next:focus-visible { opacity: 1; }
.hplayer.is-inline #hplayer-prev:hover, .hplayer.is-inline #hplayer-next:hover { background: rgba(5,7,11,.85); }
.hplayer.is-inline #hplayer-prev:disabled, .hplayer.is-inline #hplayer-next:disabled { display: none; }
.hplayer.is-inline #hplayer-prev, .hplayer.is-inline #hplayer-next { width: 38px; height: 54px; opacity: 1; background: rgba(5,7,11,.5); }


/* --- ПЕРЕОПРЕДЕЛЕНИЯ ПОД ATLAS --- */
/* Кнопка Play — светлый круг на тёмной сцене: единственный крупный элемент
   управления до нажатия, всё остальное на странице светлое. */
.player-start-button {
  position: absolute; inset: 0; margin: auto;
  width: 84px; height: 84px; border: 0; border-radius: 999px;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .95);
  color: #14161A;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .8);
  transition: transform .34s cubic-bezier(.16, 1, .3, 1), background .2s ease;
}
.player-start-button:hover { transform: scale(1.06); background: #fff; }
.player-start-button svg { margin-left: 4px; }
.player-start-button[hidden] { display: none; }

/* Сквозной плеер накрывает сцену ровно по её месту (координаты ставит player.js). */
#atlas-player.hplayer { z-index: 30; border-radius: 20px; overflow: hidden; }
#atlas-player.hplayer.is-inline { box-shadow: none; }
