.product-detail__image--video {
    position: relative;
    overflow: hidden;
    aspect-ratio: 436 / 582;
    background: #000;
    border-radius: 8px;
}

.product-detail__image--video .product-video-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.product-detail__image--video .product-video-poster img,
.product-detail__image--video .product-video-poster video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.product-detail__image--video .product-video-player {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    background: #000;
    z-index: 1;
}

.product-detail__image--video.is-playing .product-video-poster {
    display: none;
}

.product-detail__image--video.is-playing .product-video-player {
    display: block;
}

.product-video-inline-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: none;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.product-detail__image--video.is-playing .product-video-inline-controls {
    display: flex;
}

.product-video-inline-toggle,
.product-video-inline-mute {
    position: static;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: rgba(31, 31, 31, 0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.product-video-inline-mute svg,
.product-video-inline-toggle svg {
    display: block;
    width: 14px;
    height: 14px;
}

.product-video-inline-toggle::before {
    content: none;
}

.product-video-inline-toggle svg path {
    fill: currentColor;
}

.product-video-play {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.product-video-play--corner {
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(31, 31, 31, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-video-play--corner::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

.product-video-play--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(91, 91, 91, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-video-play--center::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

.product-video-mobile__label .product-video-play--corner {
    position: static;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.product-video-fancybox-trigger {
    position: absolute;
    left: -9999px;
    width: 80px;
    height: 107px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.product-video-fancybox-trigger img {
    width: 80px;
    height: 107px;
    object-fit: cover;
    display: block;
}

.f-thumbs__slide.is-product-video-thumb,
.fancybox__thumbs .f-carousel__slide.is-product-video-thumb {
    position: relative;
}

.f-thumbs__slide.is-product-video-thumb::after,
.fancybox__thumbs .f-carousel__slide.is-product-video-thumb::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(31, 31, 31, 0.72);
    box-sizing: border-box;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M4 2.5v7l6-3.5-6-3.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 55% 50%;
    background-size: 10px 10px;
}

/* Fancybox: видео должно занимать весь контейнер (без letterbox) */
.fancybox__slide[data-type='html5video'] video,
.fancybox__slide[data-type="html5video"] video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.fancybox__content video[controls] {
    controls: none;
}

/* Fancybox: скрыть нативные media-controls (Chrome/Safari) */
.fancybox__slide[data-type='html5video'] video::-webkit-media-controls,
.fancybox__slide[data-type="html5video"] video::-webkit-media-controls,
.fancybox__slide[data-type='html5video'] video::-webkit-media-controls-enclosure,
.fancybox__slide[data-type="html5video"] video::-webkit-media-controls-enclosure,
.fancybox__slide[data-type='html5video'] video::-webkit-media-controls-panel,
.fancybox__slide[data-type="html5video"] video::-webkit-media-controls-panel {
    display: none !important;
    opacity: 0 !important;
}

.product-video-mobile {
    display: none;
}

.product-video-mobile__frame {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
}

.product-video-mobile__player {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    aspect-ratio: 436 / 582;
    object-fit: contain;
    background: #111;
}

.product-video-mobile__trigger {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    width: 100%;
    min-height: 48px;
    border: none;
    padding: 12px;
    background: transparent;
    cursor: pointer;
}

.product-video-mobile__label {
    position: static;
    left: auto;
    bottom: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    font-size: 12px;
    color: #5B5B5B;
    z-index: 2;
}

.product-video-mobile__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    background: linear-gradient(135deg, #f7f7f7 0%, #e9e9e9 100%);
    color: #5B5B5B;
    font-size: 13px;
}

.product-video-overlay {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 10050;
    display: none;
    padding: 0;
    background: transparent;
    align-items: flex-start;
    justify-content: flex-start;
    visibility: hidden;
    pointer-events: none;
}

.product-video-overlay.is-open {
    display: block;
    visibility: visible;
    pointer-events: auto;
}

.product-video-overlay.is-open.is-expanded {
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: visible;
    pointer-events: auto;
}

.product-video-overlay__frame {
    position: relative;
    width: min(32vw, 554px);
    aspect-ratio: 9 / 14;
    border-radius: 6px;
    border: 2px solid #1f1f1f;
    /* visible — чтобы крестик мог сидеть на углу рамки как у Vitacci */
    overflow: visible;
    cursor: pointer;
}

.product-video-overlay__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
    display: block;
    pointer-events: none;
    overflow: hidden;
}

.product-video-overlay__mini-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(91, 91, 91, 0.55);
    pointer-events: none;
    display: none;
}

.product-video-overlay__mini-play::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-42%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 11px;
    border-color: transparent transparent transparent #fff;
}

.product-video-overlay.is-open:not(.is-expanded) .product-video-overlay__mini-play {
    display: block;
}

.product-video-overlay__preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 4px;
    overflow: hidden;
}

.product-video-overlay__preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-video-overlay__preview-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(31, 31, 31, 0.72);
    color: #fff;
    cursor: pointer;
}

.product-video-overlay__preview-play::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-42%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent #fff;
}

.product-video-overlay.is-open.is-expanded .product-video-overlay__frame {
    width: auto;
    max-width: min(100%, 420px);
    max-height: calc(100vh - 32px);
    aspect-ratio: auto;
    border-radius: 8px;
    border-width: 0;
    cursor: default;
    overflow: hidden;
}

.product-video-overlay.is-open.is-expanded .product-video-overlay__video {
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    max-width: 100%;
    border-radius: 8px;
}

.product-video-overlay__mute {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 6;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(31, 31, 31, 0.72);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Крестик как у Vitacci: тёмный круг, белый X, центр на углу рамки */
.product-video-overlay__close {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 7;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(31, 31, 31, 0.78);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0;
    line-height: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.product-video-overlay__close svg {
    display: block;
    width: 12px;
    height: 12px;
}

/* Mute только в большом фрейме */
.product-video-overlay.is-open.is-expanded .product-video-overlay__mute {
    display: flex;
}

.product-video-overlay.is-open.is-expanded .product-video-overlay__close {
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    background: rgba(31, 31, 31, 0.72);
    box-shadow: none;
}

.product-video-overlay.is-open.is-expanded .product-video-overlay__close svg {
    width: 14px;
    height: 14px;
}

/* Play на области слайдера (не floating FAB) */
.product-video-slider-play {
    position: absolute;
    right: 12px;
    bottom: 36px;
    z-index: 6;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(91, 91, 91, 0.55);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.product-video-slider-play::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.fancybox__content {
    position: relative;
}

.product-video-fancybox-mute {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: rgba(31, 31, 31, 0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.product-video-fancybox-mute svg {
    display: block;
    width: 14px;
    height: 14px;
}

@media (max-width: 998px) {
    .product-detail__image--video {
        display: block !important;
    }

    /* Общий play на обёртке слайдера; на самом видео-слайде дубли не нужны */
    .product-detail__image--video .product-video-play--center,
    .product-detail__image--video .product-video-play--corner {
        display: none;
    }

    .product-video-slider-play {
        display: flex;
    }

    .product-video-overlay.is-open:not(.is-expanded) {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        left: 10px;
    }

    .product-video-mobile {
        display: none !important;
    }

    .product-detail__images-wrapper {
        order: 1;
        position: relative;
    }

    .product-detail__info {
        order: 3;
    }
}

@media (min-width: 999px) {
    .product-video-mobile,
    .product-video-overlay,
    .product-video-slider-play {
        display: none !important;
    }
}
