.ec-yt-slider-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.ec-yt-slider-wrap *,
.ec-yt-slider-wrap *::before,
.ec-yt-slider-wrap *::after {
    box-sizing: border-box;
}

.ec-yt-shorts {
    --ec-yt-card-width: 230px;
    display: flex;
    flex-wrap: nowrap;
    gap: clamp(12px, 2vw, 18px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding: 4px max(4px, env(safe-area-inset-right)) 18px max(4px, env(safe-area-inset-left));
    scrollbar-width: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-x pan-y;
    transform: translateZ(0);
}

.ec-yt-shorts::-webkit-scrollbar {
    display: none;
}

.ec-yt-shorts.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.ec-yt-short-card {
    flex: 0 0 min(var(--ec-yt-card-width), 86vw);
    width: min(var(--ec-yt-card-width), 86vw);
    min-width: 0;
    max-width: 86vw;
    margin: 0;
    scroll-snap-align: start;
}

.ec-yt-thumb-button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    text-align: inherit;
    touch-action: manipulation;
}

.ec-yt-frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: clamp(14px, 3vw, 22px);
    background: #111;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
    transform: translateZ(0);
    isolation: isolate;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.ec-yt-frame img,
.ec-yt-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ec-yt-frame img {
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

.ec-yt-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .62);
    transform: translate(-50%, -50%);
    transition: transform .18s ease, background .18s ease;
}

.ec-yt-play::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 17px;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 18px solid #fff;
}

.ec-yt-thumb-button:hover .ec-yt-play,
.ec-yt-thumb-button:focus-visible .ec-yt-play {
    transform: translate(-50%, -50%) scale(1.06);
    background: rgba(0, 0, 0, .76);
}

.ec-yt-title {
    display: none !important;
}

.ec-yt-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.ec-yt-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    background: #111;
    color: #fff;
    font-size: 25px;
    line-height: 1;
    transition: opacity .2s ease, transform .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ec-yt-nav:hover,
.ec-yt-nav:focus-visible {
    opacity: .82;
    transform: translateY(-1px);
}

.ec-yt-nav:disabled {
    opacity: .28;
    cursor: not-allowed;
    transform: none;
}

.ec-yt-error,
.ec-yt-empty {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff7ed;
}

.ec-yt-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
}

.ec-yt-modal.is-open {
    display: flex;
}

.ec-yt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .74);
}

.ec-yt-modal-panel {
    position: relative;
    width: min(420px, 92vw);
    max-height: calc(100vh - 32px);
    max-height: calc(100svh - 32px);
    max-height: calc(100dvh - 32px);
    z-index: 1;
}

.ec-yt-modal-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 18px;
    background: #000;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}

.ec-yt-modal-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ec-yt-modal-close {
    position: absolute;
    right: -10px;
    top: -12px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    -webkit-tap-highlight-color: transparent;
}

body.ec-yt-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: none;
}

@media (max-width: 900px) {
    .ec-yt-shorts {
        --ec-yt-card-width: 210px;
    }
}

@media (max-width: 600px) {
    .ec-yt-controls {
        display: none;
    }

    .ec-yt-shorts {
        --ec-yt-card-width: 74vw;
        gap: 12px;
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: 12px;
        scroll-snap-type: x proximity;
    }

    .ec-yt-short-card {
        max-width: 78vw;
    }

    .ec-yt-modal-panel {
        width: min(94vw, 420px);
    }
}

@media (max-width: 380px) {
    .ec-yt-shorts {
        --ec-yt-card-width: 78vw;
    }
}

@supports not (aspect-ratio: 9 / 16) {
    .ec-yt-frame,
    .ec-yt-modal-frame {
        height: 0;
        padding-top: 177.7778%;
    }
}


/* iOS/Safari stability fixes */
@supports (-webkit-touch-callout: none) {
    .ec-yt-slider-wrap {
        -webkit-text-size-adjust: 100%;
    }

    .ec-yt-shorts {
        scroll-behavior: auto;
    }

    .ec-yt-thumb-button,
    .ec-yt-modal-close,
    .ec-yt-nav {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    .ec-yt-modal {
        height: 100vh;
        height: 100svh;
    }
}

/* v1.4 mobile fix: keep Shorts vertical (9:16) but let phones use native horizontal swipe. */
.ec-yt-shorts {
    touch-action: auto;
}

@media (hover: none), (pointer: coarse) {
    .ec-yt-shorts {
        cursor: default;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        touch-action: auto;
    }

    .ec-yt-short-card {
        flex: 0 0 min(74vw, 280px);
        width: min(74vw, 280px);
        max-width: min(74vw, 280px);
    }
}

@media (max-width: 600px) {
    .ec-yt-shorts {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        margin-left: -12px;
        margin-right: -12px;
    }

    .ec-yt-short-card {
        flex-basis: 74vw;
        width: 74vw;
        max-width: 74vw;
    }
}

@media (max-width: 380px) {
    .ec-yt-short-card {
        flex-basis: 78vw;
        width: 78vw;
        max-width: 78vw;
    }
}


/* v1.4.1 iPhone modal fix: keep the player inside the viewport instead of letting the 9:16 iframe become taller than the screen. */
.ec-yt-modal {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    overflow: hidden;
}

.ec-yt-modal-panel {
    width: min(420px, 92vw, calc((100vh - 48px) * 0.5625));
    width: min(420px, 92vw, calc((100svh - 48px) * 0.5625));
    width: min(420px, 92vw, calc((100dvh - 48px) * 0.5625));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);
    max-height: calc(100svh - 48px);
    max-height: calc(100dvh - 48px);
}

.ec-yt-modal-frame {
    width: 100%;
    max-height: calc(100vh - 48px);
    max-height: calc(100svh - 48px);
    max-height: calc(100dvh - 48px);
}

@media (max-width: 600px) {
    .ec-yt-modal {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .ec-yt-modal-panel {
        width: min(92vw, calc((100svh - 40px) * 0.5625));
        width: min(92vw, calc((100dvh - 40px) * 0.5625));
    }

    .ec-yt-modal-close {
        right: -6px;
        top: -10px;
        width: 38px;
        height: 38px;
        font-size: 26px;
    }
}


/* v1.4.2 hard one-row carousel fix for themes/builders/mobile Safari.
   Force every item to stay left-to-right in one horizontal track only. */
.ec-yt-slider-wrap[data-ec-youtube-shorts] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    direction: ltr !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] > .ec-yt-shorts {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    direction: ltr !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] > .ec-yt-shorts > .ec-yt-short-card {
    display: block !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: min(var(--ec-yt-card-width), 86vw) !important;
    width: min(var(--ec-yt-card-width), 86vw) !important;
    max-width: min(var(--ec-yt-card-width), 86vw) !important;
    min-width: min(var(--ec-yt-card-width), 86vw) !important;
    float: none !important;
    clear: none !important;
    white-space: normal !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-thumb-button,
.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame {
    display: block !important;
    width: 100% !important;
}

@media (max-width: 600px), (hover: none), (pointer: coarse) {
    .ec-yt-slider-wrap[data-ec-youtube-shorts] > .ec-yt-shorts {
        gap: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
        margin-left: -12px !important;
        margin-right: -12px !important;
    }

    .ec-yt-slider-wrap[data-ec-youtube-shorts] > .ec-yt-shorts > .ec-yt-short-card {
        flex-basis: min(74vw, 280px) !important;
        width: min(74vw, 280px) !important;
        max-width: min(74vw, 280px) !important;
        min-width: min(74vw, 280px) !important;
    }
}


/* v1.4.3 emergency hard lock: one horizontal row only + hide inactive modal even if theme CSS conflicts. */
.ec-yt-slider-wrap[data-ec-youtube-shorts] {
    display: block !important;
    overflow: hidden !important;
    contain: layout paint !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-shorts {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: clamp(12px, 2vw, 18px) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-short-card {
    display: block !important;
    flex: 0 0 min(var(--ec-yt-card-width), 86vw) !important;
    width: min(var(--ec-yt-card-width), 86vw) !important;
    min-width: min(var(--ec-yt-card-width), 86vw) !important;
    max-width: min(var(--ec-yt-card-width), 86vw) !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    white-space: normal !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-short-card > * {
    max-width: 100% !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-modal[aria-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-modal.is-open {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

@media (max-width: 600px), (hover: none), (pointer: coarse) {
    .ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-short-card {
        flex-basis: min(74vw, 280px) !important;
        width: min(74vw, 280px) !important;
        min-width: min(74vw, 280px) !important;
        max-width: min(74vw, 280px) !important;
    }
}


/* v1.4.4 vertical Shorts hard fix: force every thumbnail/player card to be 9:16 portrait, never landscape. */
.ec-yt-slider-wrap[data-ec-youtube-shorts] {
    overflow-x: hidden !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-shorts {
    --ec-yt-card-width: 180px;
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-short-card {
    flex: 0 0 var(--ec-yt-card-width) !important;
    width: var(--ec-yt-card-width) !important;
    min-width: var(--ec-yt-card-width) !important;
    max-width: var(--ec-yt-card-width) !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-top: 177.7778% !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame > img,
.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame > iframe {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
}

@media (max-width: 600px), (hover: none), (pointer: coarse) {
    .ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-shorts {
        --ec-yt-card-width: min(44vw, 180px) !important;
        gap: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
        margin-left: -12px !important;
        margin-right: -12px !important;
    }

    .ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-short-card {
        flex-basis: var(--ec-yt-card-width) !important;
        width: var(--ec-yt-card-width) !important;
        min-width: var(--ec-yt-card-width) !important;
        max-width: var(--ec-yt-card-width) !important;
    }
}


/* v1.4.5: fix black/non-loading thumbnails on mobile and keep inactive popup hidden inline. */
.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame {
    background: #f2f2f2 !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame > img {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1 !important;
    background: #f2f2f2 !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-play {
    z-index: 2 !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-modal[aria-hidden="true"] {
    display: none !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-modal.is-open[aria-hidden="false"] {
    display: flex !important;
}

/* v1.4.6 desktop click fix: keep cards clickable and put the player modal on body without clipping. */
.ec-yt-slider-wrap[data-ec-youtube-shorts] {
    contain: none !important;
    overflow: visible !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-thumb-button {
    position: relative !important;
    z-index: 3 !important;
    pointer-events: auto !important;
}

.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-frame,
.ec-yt-slider-wrap[data-ec-youtube-shorts] .ec-yt-play {
    pointer-events: none !important;
}

body > .ec-yt-modal {
    z-index: 2147483647 !important;
    contain: none !important;
}
