#story-modal.smp-modal {
    --w: min(390px, 92vw);
    --h: min(88dvh, 860px);
    --safe-t: max(14px, env(safe-area-inset-top));
    --safe-b: max(26px, env(safe-area-inset-bottom));

    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;

    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 18px !important;

    padding: 24px !important;
    margin: 0 !important;

    background: rgba(8, 8, 8, .52) !important;
    backdrop-filter: blur(12px);

    direction: rtl !important;
    box-sizing: border-box !important;
}

#story-modal.smp-modal.is-open {
    display: flex !important;
}

#story-modal,
#story-modal * {
    box-sizing: border-box;
}

#story-modal button {
    font: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Shell / Swiper */
.smp-shell {
    position: relative;
    order: 2;

    width: var(--w);
    height: var(--h);
    max-width: 100%;
    max-height: 100%;

    overflow: hidden;
    border-radius: 22px;
    background: #000;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
    isolation: isolate;
}

.smp-swiper,
.smp-swiper .swiper-wrapper,
.smp-slide {
    width: 100%;
    height: 100%;
}

.smp-slide {
    position: relative;
    overflow: hidden;
    background: #000;
}

.smp-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Video Loader */
#story-modal .smp-loader {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;

    width: 38px;
    height: 38px;

    border: 3px solid rgba(255, 255, 255, .28);
    border-top-color: #fff;
    border-radius: 50%;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translate(-50%, -50%);
    animation: smp-loader-spin .8s linear infinite;
    transition: opacity .15s ease, visibility .15s ease;
}

#story-modal .smp-loader.is-visible {
    opacity: 1;
    visibility: visible;
}

@keyframes smp-loader-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Overlay Layers */
.smp-shade {
    position: absolute;
    inset: 0;
    z-index: 2;

    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 25%),
        linear-gradient(to top, rgba(0, 0, 0, .76), transparent 42%);
}

.smp-ui {
    position: absolute;
    inset: 0;
    z-index: 5;

    pointer-events: none;
}

/* Top Bar */
.smp-top {
    position: absolute;
    z-index: 9;
    top: 29px;
    left: 14px;
    right: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    direction: rtl;
}

.smp-top strong {
    min-width: 0;

    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-shadow: 0 2px 10px #000;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Buttons Base */
.smp-close,
.smp-volume,
.smp-nav {
    display: grid !important;
    place-items: center !important;

    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;

    appearance: none !important;
    cursor: pointer !important;
    line-height: 1 !important;
}

.smp-close,
.smp-volume {
    width: 40px !important;
    height: 40px !important;

    border-radius: 12px !important;
    background: rgba(10, 10, 10, .54) !important;
    color: #fff !important;
    box-shadow: none !important;
    backdrop-filter: blur(8px);
}

.smp-close {
    position: absolute !important;
    z-index: 20 !important;
    top: 29px !important;
    right: 14px !important;
}

.smp-volume {
    position: relative !important;
    flex: 0 0 40px !important;
    pointer-events: auto !important;
}

.smp-close svg,
.smp-volume svg,
.smp-feedback svg {
    display: block !important;

    width: 22px !important;
    height: 22px !important;

    fill: none !important;
    stroke: #fff !important;
    stroke-width: 1.9 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;

    opacity: 1 !important;
    visibility: visible !important;
}

.smp-close:focus {
    outline: none !important;
}

.smp-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .9) !important;
    outline-offset: 2px !important;
}

.smp-close:hover,
.smp-volume:hover {
    background: rgba(0, 0, 0, .75) !important;
}

/* Navigation Buttons */
.smp-nav {
    position: relative !important;
    align-self: center !important;
    z-index: 10 !important;

    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    flex: 0 0 42px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;

    appearance: none !important;
    background: rgba(255, 255, 255, .94) !important;
    color: #111 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .24) !important;

    line-height: 0 !important;
    cursor: pointer !important;
    overflow: hidden !important;
}

.smp-nav svg {
    display: block !important;

    width: 26px !important;
    height: 26px !important;
    flex: 0 0 26px !important;

    margin: 0 !important;
    padding: 0 !important;

    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.25 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;

    transform: none !important;
    pointer-events: none !important;
}

.smp-nav--prev {
    order: 1;
}

.smp-nav--next {
    order: 3;
}

.smp-nav:hover {
    background: #fff !important;
}

.smp-nav:focus {
    outline: none !important;
}

.smp-nav:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .9) !important;
    outline-offset: 3px !important;
}

.smp-nav.swiper-button-disabled {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}


/* Sound Feedback */
.smp-feedback {
    position: absolute;
    z-index: 20;
    top: 50%;
    left: 50%;

    width: 68px;
    height: 68px;

    display: grid;
    place-items: center;

    border-radius: 50%;
    background: rgba(0, 0, 0, .48);
    backdrop-filter: blur(10px);

    opacity: 0;
    transform: translate(-50%, -50%) scale(.88);
    transition: .18s;
}

.smp-feedback.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.smp-feedback svg {
    width: 30px !important;
    height: 30px !important;
}

/* Meta / Caption / Timeline */
.smp-meta {
    position: absolute;
    z-index: 9;
    left: 14px;
    right: 14px;
    bottom: clamp(34px, 6vh, 64px);

    display: flex;
    flex-direction: column;
    gap: 9px;

    direction: rtl;
    pointer-events: none;
}

.smp-title,
.smp-caption {
    color: #fff;
    text-align: right;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .65);
}

.smp-title {
    font-size: 15px;
    font-weight: 750;
    line-height: 1.55;
}

.smp-caption {
    font-size: 13px;
    line-height: 1.65;
}

.smp-timeline {
    display: flex;
    align-items: center;
    gap: 8px;

    width: 100%;

    direction: rtl;
    pointer-events: auto;
}

.smp-current,
.smp-duration {
    flex: 0 0 42px;
    min-width: 42px;
    max-width: 42px;

    color: #fff;
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;

    font-variant-numeric: normal;
    font-feature-settings: normal;

    direction: rtl;
    unicode-bidi: plaintext;
    text-align: center;
    text-shadow: 0 2px 8px #000;
}

.smp-range {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: 4px;

    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 99px;

    appearance: none;
    background: linear-gradient(
        to left,
        #fff 0 var(--progress, 0%),
        rgba(255, 255, 255, .32) var(--progress, 0%) 100%
    );

    cursor: pointer;
    direction: rtl;
}

/* CTA / Product Card */
.smp-cta,
.smp-product {
    pointer-events: auto !important;
    text-decoration: none !important;
}

.smp-cta {
    align-self: center;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 132px;
    min-height: 44px;
    padding: 10px 20px;

    border-radius: 13px;
    background: #fff;
    color: #111 !important;
    font-size: 14px;
    font-weight: 750;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}

.smp-product {
    width: 100%;
    min-height: 72px;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 7px 10px;

    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    color: #111 !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .3);
}

.smp-product__image {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;

    overflow: hidden;
    border-radius: 11px;
    background: #eee;
}

.smp-product__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smp-product__title {
    min-width: 0;
    flex: 1;

    color: #111;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.55;
    text-align: right;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow: hidden;
}

.smp-product__action {
    flex: 0 0 auto;

    padding: 8px 10px;

    border-radius: 10px;
    background: #111;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.smp-cta:hover,
.smp-product:hover {
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 767px) {
    #story-modal.smp-modal {
        padding: 0 !important;
        gap: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    .smp-shell {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .smp-nav {
        display: none !important;
        line-height: 0 !important;
        cursor: pointer !important;
        overflow: hidden !important;
        transition: opacity .18s ease, visibility .18s ease, background-color .18s ease !important;
    }

    .smp-close {
        top: calc(var(--safe-t) + 20px) !important;
        right: 12px !important;
    }

    .smp-top {
        top: calc(var(--safe-t) + 20px);
        left: 12px;
        right: 62px;
    }

    .smp-meta {
        left: 12px;
        right: 12px;
        bottom: calc(var(--safe-b) + 28px);
    }

    .smp-product {
        min-height: 68px;
    }

    .smp-product__image {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .smp-feedback,
    .smp-cta,
    .smp-product,
    #story-modal .smp-loader {
        transition: none !important;
        animation: none !important;
    }
}
