.emg-stories {
    --emg-highlight-size: 88px;
    --emg-highlight-size-tablet: 82px;
    --emg-highlight-size-mobile: 76px;
    --emg-ring: #007557;
    --emg-viewed: #b9c1be;
    --emg-label: #1f2926;
    --emg-ring-width: 3px;
    --emg-modal-radius: 22px;
    width: 100%;
    direction: rtl;
    font-family: inherit;
}

.emg-stories__highlight-wrap {
    display: flex;
    width: 100%;
    padding: 8px 4px 12px;
    box-sizing: border-box;
}

.emg-stories--align-right .emg-stories__highlight-wrap { justify-content: flex-start; }
.emg-stories--align-center .emg-stories__highlight-wrap { justify-content: center; }
.emg-stories--align-left .emg-stories__highlight-wrap { justify-content: flex-end; }

.emg-story-highlight {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    min-width: max(132px, var(--emg-highlight-size));
    color: var(--emg-label);
    font: inherit;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.emg-story-highlight__ring {
    position: relative;
    display: block;
    width: var(--emg-highlight-size);
    height: var(--emg-highlight-size);
    flex: 0 0 var(--emg-highlight-size);
    padding: var(--emg-ring-width);
    border-radius: 50%;
    background: var(--emg-ring);
    background: linear-gradient(135deg, color-mix(in srgb, var(--emg-ring) 62%, white), var(--emg-ring) 68%, color-mix(in srgb, var(--emg-ring) 84%, black));
    box-sizing: border-box;
    box-shadow: 0 7px 24px color-mix(in srgb, var(--emg-ring) 24%, transparent);
    transition: transform .2s ease, filter .2s ease, background .2s ease, box-shadow .2s ease;
}

.emg-story-highlight__ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid color-mix(in srgb, var(--emg-ring) 22%, transparent);
    border-radius: inherit;
    pointer-events: none;
}

.emg-story-highlight:hover .emg-story-highlight__ring {
    transform: translateY(-2px) scale(1.025);
    filter: brightness(1.03);
    box-shadow: 0 11px 30px color-mix(in srgb, var(--emg-ring) 30%, transparent);
}

.emg-story-highlight:active .emg-story-highlight__ring {
    transform: translateY(0) scale(.985);
}

.emg-story-highlight:focus-visible {
    outline: 2px solid var(--emg-ring);
    outline-offset: 6px;
    border-radius: 10px;
}

.emg-story-highlight.is-viewed .emg-story-highlight__ring {
    background: var(--emg-viewed);
    box-shadow: 0 7px 22px color-mix(in srgb, var(--emg-viewed) 24%, transparent);
}

.emg-story-highlight.is-viewed .emg-story-highlight__ring::before {
    border-color: color-mix(in srgb, var(--emg-viewed) 28%, transparent);
}

.emg-story-highlight__image-wrap {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #edf1ef;
    box-sizing: border-box;
}

.emg-story-highlight__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #171a19;
}

.emg-story-highlight__cover-video { pointer-events: none; }

.emg-story-highlight__fallback {
    color: #8b9692;
    font-size: 18px;
}

.emg-story-highlight__count {
    position: absolute;
    right: -3px;
    bottom: 1px;
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #17231f;
    color: #fff;
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    direction: ltr;
    box-sizing: border-box;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}

.emg-story-highlight__label {
    display: block;
    max-width: 190px;
    color: var(--emg-label);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
    white-space: normal;
}

.emg-stories-empty {
    direction: rtl;
    padding: 13px 15px;
    border: 1px dashed #c8d0cd;
    border-radius: 12px;
    color: #52605b;
    background: #f7faf9;
    font-size: 13px;
    line-height: 1.8;
}

/* Viewer lives under body so Elementor and theme containers cannot clip it. */
.emg-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    background: rgba(7, 10, 9, .94);
    direction: rtl;
    overscroll-behavior: contain;
    transition: opacity .18s ease, visibility .18s ease;
}

.emg-story-viewer.is-open { visibility: visible; opacity: 1; }

.emg-story-viewer__stage {
    position: relative;
    width: min(430px, 92vw);
    height: min(86vh, 780px);
    min-width: 280px;
    max-width: 92vw;
    max-height: 86vh;
    overflow: hidden;
    border-radius: var(--emg-modal-radius);
    background: #0b0d0c;
    box-shadow: 0 25px 80px rgba(0, 0, 0, .46);
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    transition: width .18s ease, height .18s ease, border-radius .18s ease;
}

.emg-story-viewer__media-wrap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #0b0d0c;
}

.emg-story-viewer__media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #0b0d0c;
}

.emg-story-viewer__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .52) 0%, rgba(0, 0, 0, .04) 29%, transparent 66%, rgba(0, 0, 0, .38) 100%);
}

.emg-story-viewer__top {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 4;
    padding: 12px 13px 0;
}

.emg-story-viewer__progress { display: flex; gap: 4px; direction: ltr; }
.emg-story-viewer__progress-item { flex: 1; height: 3px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .3); }
.emg-story-viewer__progress-bar { width: 0%; height: 100%; border-radius: inherit; background: #fff; }
.emg-story-viewer__progress-item.is-complete .emg-story-viewer__progress-bar { width: 100%; }

.emg-story-viewer__header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 11px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

.emg-story-viewer__thumb {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 2px solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    object-fit: cover;
    background: #222;
}

.emg-story-viewer__title { flex: 1; overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.emg-story-viewer__title:empty { display: none; }
.emg-story-viewer__counter { flex: 0 0 auto; font-size: 11px; opacity: .82; direction: ltr; }

.emg-story-viewer__close {
    all: unset !important;
    box-sizing: border-box !important;
    position: absolute !important;
    top: 54px !important;
    left: 14px !important;
    z-index: 9 !important;
    display: grid !important;
    place-items: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, .4) !important;
    color: #fff !important;
    font-family: Arial, sans-serif !important;
    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.emg-story-viewer__close:hover { background: rgba(0, 0, 0, .62) !important; }
.emg-story-viewer__close:focus-visible { outline: 2px solid #fff !important; outline-offset: 3px !important; }

.emg-story-viewer__hit {
    position: absolute;
    top: 92px;
    bottom: 0;
    z-index: 3;
    width: 38%;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.emg-story-viewer__prev { right: 0; }
.emg-story-viewer__next { left: 0; }

.emg-story-viewer__cta {
    position: absolute;
    bottom: 24px;
    left: 50%;
    z-index: 8;
    min-width: 170px;
    max-width: 82%;
    padding: 11px 20px;
    border-radius: 999px;
    background: #fff;
    color: #101613 !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .24);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    text-decoration: none !important;
    transform: translateX(-50%);
}

.emg-story-viewer__cta:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.emg-story-viewer__pause {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: auto;
}

body.emg-story-viewer-open { overflow: hidden !important; }

@media (max-width: 1024px) {
    .emg-story-highlight__ring {
        width: var(--emg-highlight-size-tablet);
        height: var(--emg-highlight-size-tablet);
        flex-basis: var(--emg-highlight-size-tablet);
    }
}

@media (max-width: 767px) {
    .emg-stories__highlight-wrap { padding-top: 6px; }
    .emg-story-highlight { min-width: max(124px, var(--emg-highlight-size-mobile)); }
    .emg-story-highlight__ring {
        width: var(--emg-highlight-size-mobile);
        height: var(--emg-highlight-size-mobile);
        flex-basis: var(--emg-highlight-size-mobile);
    }
    .emg-story-highlight__label { font-size: 12px; }
    .emg-story-viewer { background: #000; }
    .emg-story-viewer__stage {
        width: 100vw !important;
        height: 100svh !important;
        min-width: 0;
        max-width: none;
        max-height: none;
        border-radius: 0 !important;
        box-shadow: none;
    }
    .emg-story-viewer__top { padding-top: max(12px, env(safe-area-inset-top)); }
    .emg-story-viewer__close { top: max(54px, calc(env(safe-area-inset-top) + 42px)) !important; }
    .emg-story-viewer__cta { bottom: max(24px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .emg-story-viewer,
    .emg-story-viewer__stage,
    .emg-story-highlight__ring { transition: none; }
}
