/* =========================================================
   MoVix — Bootstrap 5 Custom Styles
   ========================================================= */

/* =========================================================
   TOKENS + BOOTSTRAP OVERRIDES
   ========================================================= */
:root {
    /* Bootstrap overrides */
    --bs-body-bg: #0b0b0b;
    --bs-body-color: #ffffff;
    --bs-primary: #e50914;
    --bs-dark: #141414;
    --bs-secondary: #b3b3b3;
    --bs-border-color: rgba(255,255,255,.06);

    /* Custom tokens */
    --accent: #e50914;
    --panel: #141414;
    --muted: #b3b3b3;
    --radius: 0.875rem;
    --radius-lg: 1rem;
    --b1: 0.0625rem;
    --gap: clamp(0.8rem, 1.2vw, 1.4rem);
    --fade: 0vw;

    /* типография */
    --lh-body: 1.6;

    /* описание (detail) */
    --desc-maxch: 68;
    --desc-fs-min: .94rem;
    --desc-fs-vw:  .20vw;
    --desc-fs-max: 1.06rem;
    --desc-lh: 1.65;
    --desc-mb: .95em;

    /* Hero */
    --hero-h: clamp(20rem, 50vw, 28rem);
    --hero-gap: clamp(2rem, 10vw, 12.5rem);
    --hero-overlay-h: clamp(32%, 40vh, 42%);
    --hero-content-bottom: clamp(0.25rem, 4vh, 5vh);

    /* Cards */
    --card-min: 9ch;
    --card-min-vw: 9vw;

    /* Recommendations */
    --reco-gap: 1.1vw;
    --reco-min: 16ch;
    --reco-min-vw: 8vw;
    --reco-radius: 1rem;

    /* Player */
    --shell-w: min(87.5rem, 70vw);
    --shell-h: min(55vh, calc(75vh - 6vh));
}

/* 4K */
@media (min-width:2560px) {
    :root {
        --desc-maxch: 76;
        --desc-fs-min: 1.02rem;
        --desc-fs-max: 1.18rem;
        --hero-h: clamp(24rem, 42vw, 48rem);
        --card-min: 10ch;
        --card-min-vw: 9vw;
        --shell-w: min(105rem, 58vw);
    }
}

/* Планшеты (iPad, Android tablets) */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --gap: 2vw;
        --hero-h: clamp(18rem, 38vw, 26rem);
        --card-min: 12ch;
        --card-min-vw: 12vw;
        --reco-gap: 2vw;
    }
}

/* Средние десктопы */
@media (min-width: 1024px) and (max-width: 1440px) {
    :root {
        --hero-h: clamp(22rem, 44vw, 26rem);
        --card-min-vw: 12vw;
    }
}

/* Mobile */
@media (max-width:800px) {
    :root {
        --gap: 3.2vw;
        --desc-maxch: 60;
        --hero-h: clamp(16rem, 52vw, 24rem);
        --hero-gap: 6vw;
        --card-min: 20ch;
        --card-min-vw: 44vw;
        --reco-gap: 3.5vw;
        --reco-min: 15ch;
        --reco-min-vw: 13vw;
        --shell-w: 92vw;
    }
}

/* Landscape mobile (важно для просмотра видео) */
@media (orientation: landscape) and (max-height: 600px) {
    :root {
        --hero-h: clamp(14rem, 45vh, 20rem);
    }
    .btn {
        width: 100%;
        text-align: center;
    }
}

/* =========================================================
   BASE STYLES
   ========================================================= */
body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px));
}

a { color: #858688; text-decoration: none; }
a:hover { color: inherit; }

/* =========================================================
   NAVBAR
   ========================================================= */
.navbar {
    position: sticky !important;
    top: 0;
    z-index: 1600;
    padding: 0.5rem 1.5rem;
    /* Fallback для браузеров без backdrop-filter */
    background: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.80), rgba(0,0,0,.1)) !important;
    border-bottom: var(--b1) solid rgba(255,255,255,.06);
    display: flex !important;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

/* Улучшенный backdrop-filter с поддержкой */
@supports (backdrop-filter: blur(0.375rem)) {
    .navbar {
        background: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.65), rgba(0,0,0,0)) !important;
        backdrop-filter: blur(0.375rem);
    }
}

/* Безопасные области для iOS (notch) */
@supports (padding: env(safe-area-inset-top)) {
    .navbar {
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }
}

.navbar .container-fluid {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    width: 100%;
    padding: 0;
}

.logo {
    font-weight: 900;
    color: #fff;
    font-size: clamp(1.05rem, 1.2vw, 1.375rem);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.logo b { color: var(--accent); }
.logo:hover { color: #fff; }

.mvx-nav {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.mvx-brand {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    padding: 8px 14px;
    border-radius: 999px;
    color: #e8e8e8;
    font-weight: 700;
    text-decoration: none;
    transition: all .2s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}
.mvx-brand:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(229,9,20,.08);
    color: #e8e8e8;
}
.mvx-brand.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 24px rgba(229,9,20,.25);
}

/* Клавиатурная навигация (accessibility) */
.mvx-brand:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.mvx-search {
    margin-left: auto;
    display: flex;
    gap: 8px;
    max-width: min(40vw, 250px);
    width: 100%;
    flex-shrink: 1;
}
.mvx-search__input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
    background: #0f0f0f;
    border: 1px solid #252525;
    color: #fff;
}
.mvx-search__input:focus {
    border-color: #3a3a3a;
    box-shadow: 0 0 0 3px rgba(229,9,20,.15);
    outline: none;
}

/* Увеличенные touch-таргеты для мобильных и TV */
@media (pointer: coarse), (hover: none) {
    .mvx-brand {
        padding: 12px 18px;
        min-width: 44px;
        /*min-height: 44px;*/
    }
}

@media (max-width: 900px) {
    .mvx-brand {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .mvx-nav {
        gap: 0.15rem;
    }
}

/* =========================================================
   CONTAINER
   ========================================================= */
.container {
    max-width: min(92vw, 120rem);
    margin: 0 auto;
    padding-left: clamp(1rem, 2vw, 3.5rem);
    padding-right: clamp(1rem, 2vw, 3.5rem);
}

/* =========================================================
   GRID
   ========================================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(var(--card-min), var(--card-min-vw)), 1fr));
    gap: var(--gap);
    align-items: stretch; /* ИСПРАВЛЕНО: одинаковая высота */
}

/* =========================================================
   CARD
   ========================================================= */
.card {
    position: relative;
    display: flex; /* ИСПРАВЛЕНО: flex для одинаковой высоты */
    flex-direction: column;
    border-radius: var(--radius);
    background: #111;
    box-shadow: 0 0.625rem 1.375rem rgba(0,0,0,.25);
    border: var(--b1) solid rgba(255,255,255,.06);
    overflow: hidden;
    transition: all .28s ease;
    height: 100%; /* ИСПРАВЛЕНО: занимает всю высоту grid cell */
}
.card:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 1.125rem 2.375rem rgba(0,0,0,.35);
    border-color: rgba(255,255,255,.12);
}

/* Клавиатурная навигация */
.card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    transform: translateY(-0.25rem);
}

.card .poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    flex-shrink: 0; /* ИСПРАВЛЕНО: постер не сжимается */
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.7) 100%);
    pointer-events: none;
    opacity: .7;
    transition: opacity .25s ease;
}
.card:hover::after { opacity: .9; }

.badge {
    position: absolute;
    right: .5rem;
    top: .5rem;
    background: #2b2b2b;
    border: var(--b1) solid #3b3b3b;
    color: #fff;
    font-size: .8em;
    padding: .25em .5em;
    border-radius: 999rem;
}

/* ИСПРАВЛЕНО: убран дубликат, оставлена только одна версия */
.card .meta {
    padding: .7rem .85rem;
    background: #151515;
    border-top: var(--b1) solid #1d1d1d;
    margin-top: auto; /* ИСПРАВЛЕНО: meta всегда внизу */
}
.meta .title {
    font-weight: 700;
    text-align: center;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: clamp(.95rem, .9rem + .25vw, 1.05rem);
    min-height: 2.4em; /* ИСПРАВЛЕНО: минимальная высота для 2 строк */
}

.card .peek {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: .9rem;
    display: grid;
    gap: .5rem;
    color: #fff;
    background: linear-gradient(180deg, rgba(20,20,20,.2), rgba(20,20,20,.85));
    border-top: var(--b1) solid rgba(255,255,255,.08);
    transform: translateY(1rem);
    opacity: 0;
    visibility: hidden;
    transition: all .25s ease;
}

/* Fallback для backdrop-filter */
@supports (backdrop-filter: blur(0.625rem)) {
    .card .peek {
        backdrop-filter: blur(0.625rem);
    }
}

.card:hover .peek,
.card.peek-open .peek {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.peek .peek-title {
    font-weight: 800;
    font-size: 1rem;
}
.peek .desc {
    font-size: .92rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.peek .chip {
    font-size: .75rem;
    padding: .25rem .6rem;
    border-radius: 999rem;
    background: rgba(255,255,255,.12);
    border: var(--b1) solid rgba(255,255,255,.16);
}

/* =========================================================
   HERO CAROUSEL
   ========================================================= */
.hero-wrap {
    margin: clamp(.5rem, 1vw, 1rem) auto clamp(1rem, 2vw, 1.6rem);
    /* Добавлен webkit префикс для старых Safari */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade), #000 calc(100% - var(--fade)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fade), #000 calc(100% - var(--fade)), transparent 100%);
}

.hero {
    display: flex;
    gap: var(--hero-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: .35rem 0 .6rem;
    scrollbar-width: none;
}

.hero::-webkit-scrollbar {
    display: none;
}

.hero .slide {
    position: relative;
    flex: 0 0 100%;
    height: var(--hero-h);
    border-radius: 1.25rem;
    overflow: hidden;
    scroll-snap-align: center;
    background: #0f0f0f;
    box-shadow: 0 0.875rem 2.5rem rgba(0,0,0,.35);
}

.slide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide .overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--hero-overlay-h);
    background: linear-gradient(0deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.56) 40%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 1;
}

.slide .content {
    position: absolute;
    left: clamp(1rem, 2.2vw, 1.75rem);
    right: clamp(1rem, 2.2vw, 1.75rem);
    bottom: var(--hero-content-bottom);
    z-index: 2;
}

.slide .title {
    color: #fff;
    font-weight: 900;
    font-size: clamp(1.375rem, 4.2vw, 2.25rem);
    line-height: 1.06;
    text-shadow: 0 0.125rem 0.2rem rgba(0,0,0,.70);
    margin-bottom: 0.5rem;
}

.slide .meta {
    color: #e9e9e9;
    opacity: .95;
    font-size: .98rem;
    margin-bottom: 0.4rem;
}

.slide .desc {
    color: #e9e9e9;
    opacity: .96;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* === F A D E  M O D E  (без элементов управления) === */
.hero.is-fade {
    position: relative;
    overflow: hidden;          /* прячем соседние слайды */
    scroll-snap-type: none;    /* отключаем снап */
    gap: 0;                    /* зазоры не нужны в fade */
    padding: 0;                /* можно убрать внутренние отступы */
}

/* каждая .slide становится на всё поле и по умолчанию скрыта */
.hero.is-fade .slide {
    position: absolute;
    inset: 0;
    flex: none;                /* не участвует во флексе */
    width: 100%;
    height: var(--hero-h);
    border-radius: 1.25rem;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--hero-fade-duration, .8s) ease;
    will-change: opacity;
}

/* активная — видима и кликабельна */
.hero.is-fade .slide.active {
    opacity: 1;
    pointer-events: auto;
}

/* сохраняем твои внутренние элементы */
.hero.is-fade .slide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* заглушка на случай минимального контента — высота от переменной */
.hero.is-fade {
    min-height: var(--hero-h);
}

/* Анимация «по-словам» для заголовков/метаданных (если используешь revealWords в JS) */
.reveal-fade {
    opacity: 0;
    display: inline-block;
    transform: translateY(.25em);
    transition: opacity .35s ease, transform .35s ease;
}
.reveal-fade.on {
    opacity: 1;
    transform: translateY(0);
}

/* Чуть мягче для пользователей с reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hero.is-fade .slide { transition: none; }
    .reveal-fade { transition: none; transform: none; }
}
/* reveal без «подпрыгивания», чтобы оставаться inline */
.reveal-fade { opacity: 0; display: inline; transition: opacity .35s ease; }
.reveal-fade.on { opacity: 1; }

/* описание: позволяем нормальные переносы + подстраховка от длинных кусков */
.slide .desc {
    overflow-wrap: anywhere;      /* на всякий случай, если прилетят длинные токены */
    word-break: normal;
    hyphens: auto;
}
/* alias: поддержка class="hero hero-fade" */
.hero.hero-fade { position:relative; display:block!important; overflow:hidden!important;
    scroll-snap-type:none!important; padding:0!important; gap:0!important; min-height:var(--hero-h); }
.hero.hero-fade .slide { position:absolute; inset:0; flex:none; width:100%; height:var(--hero-h);
    border-radius:1.25rem; overflow:hidden; opacity:0; pointer-events:none;
    transition:opacity var(--hero-fade-duration,.8s) ease; will-change:opacity; }
.hero.hero-fade .slide.active { opacity:1; pointer-events:auto; }


/* Скрываем слайдер на малых экранах, КРОМЕ планшетов */
@media (max-width: 50em) and (orientation: portrait) and (max-width: 767px),
(max-height: 35em) and (orientation: landscape) and (max-width: 767px),
(max-width: 24em),
(max-height: 24em) {
    .hero-wrap,
    .hero {
        display: none !important;
    }
}

/* ИСПРАВЛЕНО: Hero виден на планшетах */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero-wrap,
    .hero {
        display: none !important;
    }
}

/* Landscape mobile - увеличиваем высоту hero */
@media (orientation: landscape) and (max-height: 600px) {
    .hero .slide {
        height: 85vh;
    }
}

/* =========================================================
   DETAIL PAGE
   ========================================================= */
.detail {
    margin: clamp(1rem, 2.2vw, 1.8rem) auto;
    display: grid;
    grid-template-columns: 22.5rem 1fr;
    gap: clamp(1rem, 2vw, 1.8rem);
    align-items: start;
}

/* Адаптация для планшетов */
@media (min-width: 768px) and (max-width: 1024px) {
    .detail {
        grid-template-columns: 18rem 1fr;
        gap: 1.5rem;
    }
}

/* Адаптация для средних десктопов */
@media (min-width: 1024px) and (max-width: 1440px) {
    .detail {
        grid-template-columns: 20rem 1fr;
    }
}

@media (max-width:767px) {
    .detail {
        grid-template-columns: 1fr;
    }
}

.detail .poster {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 0.75rem 1.75rem rgba(0,0,0,.4);
    aspect-ratio: 2/3;
    object-fit: cover;
}

.detail h2 {
    font-size: clamp(1.6rem, 3.2vw, 3.45rem);
    line-height: 1.06;
    margin: 0 0 .5rem;
}

.detail .row {
    margin: 0.85rem 0rem;
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}


.hr {
    height: var(--b1);
    background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.18), rgba(255,255,255,.05));
    margin: .9rem 0;
}

.detail .description {
    max-width: calc(var(--desc-maxch) * 1ch);
    font-size: clamp(var(--desc-fs-min), calc(.9rem + var(--desc-fs-vw)), var(--desc-fs-max));
    line-height: var(--desc-lh);
}

/* Ratings */
.ratings {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: center;
}
.rate-badge {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
}
.rate-badge a {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.val {
    font-weight: 700;
    font-size: 1.05rem;
}
.val--green { color: #31d158; }
.val--yellow { color: #f5c518; }
.val--red { color: #ff4d4f; }
.is-null { color: #9aa0a6; }

.kp-logo {
    width: 1.375rem;
    height: 1.375rem;
}
.imdb-badge {
    padding: .12rem .38rem;
    border-radius: .2rem;
    font-weight: 800;
    font-size: .85rem;
    background: #f5c518;
    color: #000;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff !important;
    border: none;
    border-radius: .75rem;
    padding: .8rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .2s ease;
}
.btn:hover {
    filter: brightness(1.1);
}

/* Клавиатурная навигация */
.btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Увеличенные кнопки для touch и TV */
@media (pointer: coarse), (hover: none) {
    .btn {
        padding: 1rem 1.4rem;
        min-width: 48px;
        /*min-height: 48px;*/
    }
}

.chip {
    display: inline-block;
    margin: .18rem .35rem .18rem 0;
}
.chip--link {
    color: #e6e6e6;
}

/* Увеличенные chip для touch */
@media (pointer: coarse), (hover: none) {
    .chip,
    .chip--link {
        padding: 0.5rem 0.9rem;
        margin: 0.3rem 0.4rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* =========================================================
   PLAYER (без overlay, появляется сверху)
   ========================================================= */
.player-stage {
    position: relative;
    background: #000;
    border-radius: 0 0 1rem 1rem;
    overflow: hidden;
    display: none;
    opacity: 0;
    transition: opacity .3s ease, margin .3s ease;
    margin-top: 0;
    border: 0;
}

.player-stage.open {
    display: block;
    opacity: 1;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(229,9,20,.3);
    box-shadow: 0 8px 32px rgba(229,9,20,.2);
}

.player-stage__header {
    background: linear-gradient(180deg, rgba(20,20,20,.95), rgba(15,15,15,.90));
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.player-stage__title {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-stage__title::before {
    content: "▶";
    color: var(--accent);
    font-size: 0.85rem;
}

#playerClose {
    background: rgba(255,255,255,.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .5rem;
    padding: .4rem .85rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

#playerClose:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
}

#playerClose:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

#playerClose::before {
    /*content: "✕";*/
    font-size: 1rem;
    line-height: 1;
}

/* Увеличенная кнопка для touch */
@media (pointer: coarse), (hover: none) {
    #playerClose {
        padding: 0.8rem 1.2rem;
        min-width: 48px;
        /*min-height: 48px;*/
    }
}

/* ИСПРАВЛЕНО: объединён дублирующийся класс */
.responsive-iframe-wrap {
/*    position: relative;*/
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.responsive-iframe-wrap iframe,
.responsive-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Плавная прокрутка к плееру */
html {
    scroll-behavior: smooth;
}

@media (max-width:767px) {
    .player-stage.open {
        max-height: 90vh;
        border-radius: 0;
        margin-top: 0.5rem;
    }

    .player-stage__header {
        padding: 0.6rem 0.75rem;
    }

    .player-stage__title {
        font-size: 0.85rem;
    }

    #playerClose {
        padding: .25rem .3rem;
        font-size: 0.8rem;
    }
}

/* Landscape mobile - максимум места для видео */
@media (orientation: landscape) and (max-height: 600px) {
    .player-stage.open {
        margin-top: 0;
        max-height: 95vh;
    }
}

/* =========================================================
   DOC-ПЛЕЕР во всю ширину окна (full-bleed)
   ========================================================= */
.player-dock {
    height: 0;
    overflow: clip;
    transition: height .45s ease;
    background: #000;
    position: relative;
    z-index: 3;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.player-dock.open {
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.player-inner {
    position: sticky;
    top: var(--header-h, 0px);
    width: 100%;
    height: 100%;
}

.player-close {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 10010;
    padding: .6rem .9rem;
    border-radius: 999px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-weight: 600;
    letter-spacing: .03em;
    border: 1px solid rgba(255,255,255,.15);
    cursor: pointer;
    touch-action: manipulation;
    transition: background .2s ease;
}

/* Fallback для backdrop-filter */
@supports (backdrop-filter: blur(8px)) {
    .player-close {
        backdrop-filter: blur(8px);
        background: rgba(0,0,0,.35);
    }
}

.player-close:hover {
    background: rgba(30,30,30,.85);
}

.player-close:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Увеличенная кнопка для TV и больших экранов */
@media (min-width: 1200px), (pointer: coarse) {
    .player-close {
        right: 4rem;
        padding: .8rem 1.1rem;
        font-size: 1.05rem;
    }
}

.player-handle {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: calc(env(safe-area-inset-top) + 6px);
    width: 72px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.35);
    z-index: 10005;
}

/* ИСПРАВЛЕНО: скрываем handle на desktop (не нужен) */
@media (pointer: fine) and (hover: hover) {
    .player-handle {
        display: none !important;
    }
}

/* Прячем кнопку и "ручку", когда док скрыт */
.player-dock[aria-hidden="true"] .player-close,
.player-dock[aria-hidden="true"] .player-handle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* =========================================================
   RECOMMENDATIONS
   ========================================================= */
.reco-wrap {
    margin: clamp(1rem,2vw,2rem) auto;
    padding: 0 clamp(1rem, 2vw, 3.5rem) 2.2vw;
}

.reco-title {
    margin: 0 0 1vw;
    font-size: clamp(1.05rem, 1.2rem + .25vw, 1.6rem);
}

.reco-grid {
    display: grid;
    gap: var(--reco-gap);
    grid-template-columns: repeat(auto-fill, minmax(max(var(--reco-min), var(--reco-min-vw)), 1fr));
    align-items: stretch; /* ИСПРАВЛЕНО: одинаковая высота */
}

.reco-card {
    display: flex; /* ИСПРАВЛЕНО: flex для одинаковой высоты */
    flex-direction: column;
    background: #121212;
    border-radius: var(--reco-radius);
    overflow: hidden;
    border: var(--b1) solid rgba(255,255,255,.06);
    color: #ddd;
    transition: all .18s ease;
    height: 100%; /* ИСПРАВЛЕНО: занимает всю высоту grid cell */
}
.reco-card:hover {
    transform: translateY(-.3vw);
    box-shadow: 0 1.2vw 3vw rgba(0,0,0,.35);
    border-color: rgba(255,255,255,.12);
    color: #ddd;
}

.reco-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    transform: translateY(-.3vw);
}

.reco-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    flex-shrink: 0; /* ИСПРАВЛЕНО: постер не сжимается */
}

.reco-meta {
    padding: .6rem;
    margin-top: auto; /* ИСПРАВЛЕНО: meta всегда внизу */
}

.reco-name {
    font-weight: 500;
    font-size: clamp(.8rem, .8rem + .42vw, .95rem);
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.44em; /* ИСПРАВЛЕНО: минимальная высота для 2 строк */
}

/* =========================================================
   FOOTER
   ========================================================= */
.sticky-footer {
    position: fixed;
    z-index: 1600;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.5rem 0.5rem;
    /* Fallback для браузеров без backdrop-filter */
    background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.80), rgba(0,0,0,.95));
    /*border-bottom: 1px solid rgba(255,255,255,.06);*/
}

@supports (backdrop-filter: blur(6px)) {
    .sticky-footer {
        backdrop-filter: blur(6px);
        background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.65), rgba(0,0,0,.9));
    }
}

.sticky-footer__inner {
    height: 15px;
    text-align: center;
    color: #dfe3ea;
    font-size: clamp(.7rem, 1.4vw, .9rem);
    padding: 0px 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sticky-footer .brand {
    color: #fff;
}
.sticky-footer .brand b {
    color: #ff4757;
}

/* Скрываем footer в landscape для больше места под видео */
@media (orientation: landscape) and (max-height: 600px) {
    .sticky-footer {
        display: none;
    }
}

/* =========================================================
   UTILS
   ========================================================= */
.hide { display: none !important; }

.section {
    margin: 1.5rem 0 .9rem;
    display: flex;
    justify-content: space-between;
}
.section h2 {
    margin: 0;
    font-size: clamp(1.05rem, 1.2rem + .25vw, 1.6rem);
    font-weight: 800;
}

.thin { font-weight:300; }

/* =========================================================
   MOBILE SPECIFIC
   ========================================================= */
@media (max-width: 800px) {
    /* ИСПРАВЛЕНО: возвращаем поиск на mobile */
    .mvx-search {
        display: none !important;
        max-width: 100%;
        margin-left: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Компактная навигация */
    .mvx-brand span:not(.icon) {
        font-size: 0.8rem;
    }
    .detail .description {
        max-width: 100%;   /* убрать ограничение */
        -webkit-line-clamp: unset; /* не обрезать строки */
        display: block;
    }
    .navbar .container-fluid {
        justify-content: center; /* центрируем всё содержимое */
        flex-wrap: wrap; /* перенос при нехватке места */
    }
    .btn {
        width: 100%;
        padding: 1rem 1.4rem;
        min-width: 48px;
        min-height: 48px;
    }

}
@media (max-width:767px) {
    .detail {
        gap: 1rem; /* уменьшить отступы */
    }
}
@media (max-width:767px) {
    .detail {
        grid-template-columns: 1fr;
    }
    .btn {
        width: 100%;
        padding: 1rem 1.4rem;
        min-width: 48px;
        min-height: 48px;
    }
}


/* =========================================================
   SMART TV OPTIMIZATION
   ========================================================= */
@media (min-width: 1920px) and (pointer: coarse) {
    :root {
        --gap: 1.5vw;
        --card-min: 14ch;
        --card-min-vw: 11vw;
    }

    /* Увеличенные кнопки для пульта */
    .mvx-brand {
        padding: 14px 24px;
        font-size: 1.1rem;
        min-width: 60px;
        min-height: 60px;
    }

    .btn {
        padding: 1.2rem 1.8rem;
        font-size: 1.1rem;
        min-width: 60px;
        min-height: 60px;
    }

    /* Отключаем hover эффекты на TV */
    .card:hover {
        transform: none;
    }

    .reco-card:hover {
        transform: none;
    }

    /* Показываем peek всегда, т.к. на TV нет hover */
    .card .peek {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Убираем scroll-snap для TV (плохо работает с пультом) */
    .hero {
        scroll-snap-type: none;
    }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --bs-border-color: rgba(255,255,255,.25);
    }

    .card {
        border-width: 2px;
    }

    .mvx-brand.is-active {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }
}

/* Dark Mode Sync (для систем с темной темой) */
@media (prefers-color-scheme: light) {
    :root {
        --bs-body-bg: #0b0b0b;
        --bs-body-color: #ffffff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   PERFORMANCE OPTIMIZATION
   ========================================================= */

/* Отключаем backdrop-filter на слабых устройствах */
@media (prefers-reduced-motion: no-preference) {
    @media (max-device-pixel-ratio: 1.5) {
        .navbar,
        .sticky-footer,
        .player-close,
        .card .peek {
            backdrop-filter: none !important;
        }
    }
}

/* Оптимизация для GPU */
.card,
.reco-card,
.mvx-brand,
.btn {
    will-change: transform;
}

.card:hover,
.reco-card:hover,
.mvx-brand:hover {
    will-change: auto;
}

/* =========================================================
   PRINT STYLES
   ========================================================= */
@media print {
    .navbar,
    .sticky-footer,
    .player-stage,
    .player-dock,
    .mvx-search {
        display: none !important;
    }

    .card .peek {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
}
/* запятая перед каждым следующим чипом */
.detail .row a.chips + a.chips::before,
.detail .row a.chip  + a.chip::before {
    color: var(--bs-body-color);
    content: ", ";
    opacity: .85;
}

/* на всякий — сделаем чипы inline, чтобы запятые шли в строку */
.detail .row a.chips,
.detail .row a.chip {
    color: var(--bs-body-color);
    display: inline;
    margin: 0 .0rem 0 0;
}
/* =========================================================
   END OF STYLESHEET
   ========================================================= */