.epm-root {
    position: relative;
    z-index: 999999;
}

.epm-popup {
    position: fixed;
    z-index: 999999;
    display: none;
    width: min(92vw, var(--epm-width, 420px));
    max-height: calc(100vh - 48px);
    overflow: visible;
    box-sizing: border-box;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: #1d2327;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

.epm-root > .epm-popup.epm-content-image {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* A page anchor keeps non-following popups at their original document location. */
.epm-root.epm-static-anchor {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
}
.epm-root.epm-static-anchor > .epm-popup.epm-no-follow {
    position: relative;
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    margin: 0;
    transform: none;
}

/* Clipping also keeps the banner from intercepting clicks on the header,
   even when the theme puts its header in a different stacking context. */
.epm-root.epm-static-anchor > .epm-popup.epm-no-follow.epm-under-header {
    -webkit-clip-path: inset(var(--epm-header-cut) -96px -96px -96px);
    clip-path: inset(var(--epm-header-cut) -96px -96px -96px);
}

.epm-popup.is-visible {
    display: block;
}

.epm-popup > .epm-close {
    appearance: none;
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    cursor: pointer;
    font-size: 0;
    line-height: 1;
    box-shadow: none;
}
.epm-popup > .epm-close::before,
.epm-popup > .epm-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 1px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}
.epm-popup > .epm-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.epm-popup > .epm-close:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 3px;
}

.epm-media {
    margin: 0;
    opacity: var(--epm-opacity, 1);
}

.epm-image-link,
.epm-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 48px);
    object-fit: contain;
}

.epm-image-link {
    color: inherit;
    text-decoration: none;
}

.epm-content-text {
    background: transparent;
    box-shadow: none;
}

.epm-content-text > .epm-text-content {
    background: #fff;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
    opacity: var(--epm-opacity, 1);
}

.epm-text-content {
    box-sizing: border-box;
    padding: 28px;
    border-radius: 8px;
}

.epm-text-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0 0 12px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.epm-text-heading {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: 0;
}

.epm-text-body {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.75;
}

.epm-text-body p {
    margin: 0 0 10px;
}

.epm-text-body p:last-child {
    margin-bottom: 0;
}

.epm-action-link {
    color: inherit;
}

.epm-text-content .epm-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: 18px;
    padding: 0 18px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
}

.epm-template-clean .epm-text-content {
    border: 1px solid rgba(29, 35, 39, 0.12);
    background: #fff;
    color: #1d2327;
}

.epm-template-clean .epm-text-content .epm-action-link {
    background: #1d2327;
    color: #fff;
}

.epm-template-campaign .epm-text-content {
    background: linear-gradient(135deg, #fff8e5 0%, #ffffff 58%, #e7f6f2 100%);
    color: #173b35;
}

.epm-template-campaign .epm-text-kicker {
    background: #ffdf6e;
    color: #3b2a00;
}

.epm-template-campaign .epm-text-content .epm-action-link {
    background: #0f766e;
    color: #fff;
}

.epm-template-important .epm-text-content {
    border-left: 6px solid #c2410c;
    background: #fff7ed;
    color: #3b2416;
}

.epm-template-important .epm-text-kicker {
    background: #c2410c;
    color: #fff;
}

.epm-template-important .epm-text-content .epm-action-link {
    background: #9a3412;
    color: #fff;
}

.epm-position-top-left { top: 24px; left: 24px; }
.epm-position-top-center { top: 24px; left: 50%; transform: translateX(-50%); }
.epm-position-top-right { top: 24px; right: 24px; }
.epm-position-middle-left { top: 50%; left: 24px; transform: translateY(-50%); }
.epm-position-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.epm-position-middle-right { top: 50%; right: 24px; transform: translateY(-50%); }
.epm-position-bottom-left { bottom: 24px; left: 24px; }
.epm-position-bottom-center { bottom: 24px; left: 50%; transform: translateX(-50%); }
.epm-position-bottom-right { right: 24px; bottom: 24px; }

.epm-position-edge-left-top,
.epm-position-edge-left-middle,
.epm-position-edge-left-bottom,
.epm-position-edge-right-top,
.epm-position-edge-right-middle,
.epm-position-edge-right-bottom,
.epm-type-edge-banner {
    width: min(86vw, 280px);
}

.epm-position-edge-left-top { top: 90px; left: 0; border-radius: 0 8px 8px 0; }
.epm-position-edge-left-middle { top: 50%; left: 0; transform: translateY(-50%); border-radius: 0 8px 8px 0; }
.epm-position-edge-left-bottom { bottom: 90px; left: 0; border-radius: 0 8px 8px 0; }
.epm-position-edge-right-top { top: 90px; right: 0; border-radius: 8px 0 0 8px; }
.epm-position-edge-right-middle { top: 50%; right: 0; transform: translateY(-50%); border-radius: 8px 0 0 8px; }
.epm-position-edge-right-bottom { right: 0; bottom: 90px; border-radius: 8px 0 0 8px; }

.epm-type-bottom-bar {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 44vh;
    border-radius: 0;
}

.epm-type-modal {
    top: 50%;
    left: 50%;
    width: min(92vw, 560px);
    transform: translate(-50%, -50%);
}

.epm-type-bubble {
    width: min(86vw, 320px);
    border-radius: 18px;
}

.epm-type-bubble::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 32px;
    width: 20px;
    height: 20px;
    background: #fff;
    transform: rotate(45deg);
}

.epm-animation-fade.is-visible {
    animation: epm-fade 260ms ease both;
}

.epm-animation-slide-up.is-visible {
    animation: epm-slide-up 320ms ease both;
}

.epm-animation-slide-side.is-visible {
    animation: epm-slide-side 320ms ease both;
}

.epm-animation-zoom.is-visible {
    animation: epm-zoom 260ms ease both;
}

@keyframes epm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes epm-slide-up {
    from { opacity: 0; margin-bottom: -24px; }
    to { opacity: 1; margin-bottom: 0; }
}

@keyframes epm-slide-side {
    from { opacity: 0; margin-right: -28px; }
    to { opacity: 1; margin-right: 0; }
}

@keyframes epm-zoom {
    from { opacity: 0; scale: 0.94; }
    to { opacity: 1; scale: 1; }
}

/* Desktop positions share a smaller display area; mobile rules below stay independent. */
@media (min-width: 768px) {
    .epm-root > .epm-popup {
        --epm-pc-screen-height: 100vh;
        --epm-pc-side-gap: clamp(24px, var(--epm-pc-side-margin, clamp(24px, 3vw, 64px)), 40vw);
        width: min(calc(var(--epm-pc-viewport-width, 100vw) - var(--epm-pc-side-gap) * 2), var(--epm-width, 420px));
        --epm-pc-top-gap: max(24px, calc(var(--epm-pc-top-reserve, 30vh) + 16px));
        max-height: max(1px, calc(var(--epm-pc-screen-height) - var(--epm-pc-top-gap) - 24px));
        --epm-area-left: var(--epm-pc-side-gap);
        --epm-area-top: var(--epm-pc-top-gap);
        --epm-area-width: max(1px, calc(var(--epm-pc-viewport-width, 100vw) - var(--epm-pc-side-gap) * 2));
        --epm-area-height: max(1px, calc(var(--epm-pc-screen-height) - var(--epm-pc-top-gap) - 24px));
        --epm-desired-width: var(--epm-width, 420px);
    }
    @supports (height: 100dvh) { .epm-root > .epm-popup { --epm-pc-screen-height: 100dvh; } }
    .epm-position-top-left, .epm-position-middle-left, .epm-position-bottom-left { --epm-grid-col: 1; --epm-width-divisor: 3; }
    .epm-position-top-center, .epm-position-center, .epm-position-bottom-center { --epm-grid-col: 3; --epm-width-divisor: 1; }
    .epm-position-top-right, .epm-position-middle-right, .epm-position-bottom-right { --epm-grid-col: 5; --epm-width-divisor: 3; }
    .epm-position-top-left, .epm-position-top-center, .epm-position-top-right { --epm-grid-row: 1; --epm-height-divisor: 3; }
    .epm-position-middle-left, .epm-position-center, .epm-position-middle-right { --epm-grid-row: 3; --epm-height-divisor: 1; }
    .epm-position-bottom-left, .epm-position-bottom-center, .epm-position-bottom-right { --epm-grid-row: 5; --epm-height-divisor: 3; }
    .epm-root > .epm-popup .epm-media,
    .epm-root > .epm-popup .epm-image-link,
    .epm-root > .epm-popup .epm-media img { max-height: inherit; }
    .epm-root > .epm-popup .epm-text-content { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
}

@media (max-width: 767px) {
    .epm-popup {
        --epm-screen-height: var(--epm-stable-height, 100vh);
        --epm-top-gap: max(calc(24px + env(safe-area-inset-top, 0px)), var(--epm-auto-top-gap, calc(max(24px, var(--epm-mobile-top-offset, 96px)) + env(safe-area-inset-top, 0px))));
        --epm-bottom-gap: calc(max(24px, var(--epm-mobile-bottom-offset, 24px)) + env(safe-area-inset-bottom, 0px));
        width: min(calc(100vw - 48px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), var(--epm-mobile-width, var(--epm-width, 420px)));
        padding: 0;
        --epm-area-left: calc(24px + env(safe-area-inset-left, 0px));
        --epm-area-top: var(--epm-top-gap);
        --epm-area-width: max(1px, calc(var(--epm-pc-viewport-width, 100vw) - 48px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
        --epm-area-height: max(1px, calc(var(--epm-screen-height) - var(--epm-top-gap) - var(--epm-bottom-gap)));
        --epm-desired-width: var(--epm-mobile-width, var(--epm-width, 420px));
    }
    /* Small viewport height stays constant while the address bar opens/closes. */
    @supports (height: 100svh) { .epm-popup { --epm-screen-height: 100svh; } }
    .epm-text-content { padding: 22px; }
    .epm-text-heading { font-size: 20px; }
    .epm-text-body { font-size: 14px; }
    .epm-popup.epm-mobile-position-top-left,
    .epm-popup.epm-mobile-position-top-center,
    .epm-popup.epm-mobile-position-top-right,
    .epm-popup.epm-mobile-position-middle-left,
    .epm-popup.epm-mobile-position-center,
    .epm-popup.epm-mobile-position-middle-right,
    .epm-popup.epm-mobile-position-bottom-left,
    .epm-popup.epm-mobile-position-bottom-center,
    .epm-popup.epm-mobile-position-bottom-right {
        top: auto; right: auto; bottom: auto; left: auto; transform: none;
        max-height: max(1px, calc(var(--epm-screen-height) - var(--epm-top-gap) - var(--epm-bottom-gap)));
    }
    .epm-mobile-position-top-left, .epm-mobile-position-middle-left, .epm-mobile-position-bottom-left { --epm-grid-col: 1; --epm-width-divisor: 3; }
    .epm-mobile-position-top-center, .epm-mobile-position-center, .epm-mobile-position-bottom-center { --epm-grid-col: 3; --epm-width-divisor: 1; }
    .epm-mobile-position-top-right, .epm-mobile-position-middle-right, .epm-mobile-position-bottom-right { --epm-grid-col: 5; --epm-width-divisor: 3; }
    .epm-mobile-position-top-left, .epm-mobile-position-top-center, .epm-mobile-position-top-right { --epm-grid-row: 1; --epm-height-divisor: 3; }
    .epm-mobile-position-middle-left, .epm-mobile-position-center, .epm-mobile-position-middle-right { --epm-grid-row: 3; --epm-height-divisor: 1; }
    .epm-mobile-position-bottom-left, .epm-mobile-position-bottom-center, .epm-mobile-position-bottom-right { --epm-grid-row: 5; --epm-height-divisor: 3; }
    .epm-popup .epm-media,
    .epm-popup .epm-image-link,
    .epm-popup .epm-media img { max-height: inherit; }
    .epm-popup .epm-text-content { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
}

@media (min-width: 768px) {
    .epm-cell-align-left { --epm-cell-shift: -0.666666667; }
    .epm-cell-align-center { --epm-cell-shift: 0; }
    .epm-cell-align-right { --epm-cell-shift: 0.666666667; }
}
@media (max-width: 767px) {
    .epm-mobile-cell-align-left { --epm-cell-shift: -0.666666667; }
    .epm-mobile-cell-align-center { --epm-cell-shift: 0; }
    .epm-mobile-cell-align-right { --epm-cell-shift: 0.666666667; }
}
/* Anchors stay fixed until the banner would exceed the usable viewport. */
.epm-root > .epm-popup {
    --epm-render-width: min(var(--epm-area-width), var(--epm-desired-width), var(--epm-image-max-width, 100000px));
    --epm-target-x: calc(var(--epm-area-left) + var(--epm-area-width) * (var(--epm-grid-col, 3) + var(--epm-cell-shift, 0)) / 6);
    --epm-center-x: clamp(calc(var(--epm-area-left) + var(--epm-render-width) / 2), var(--epm-target-x), calc(var(--epm-area-left) + var(--epm-area-width) - var(--epm-render-width) / 2));
    --epm-center-y: calc(var(--epm-area-top) + var(--epm-area-height) * var(--epm-grid-row, 3) / 6);
    top: var(--epm-center-y);
    left: var(--epm-center-x);
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: var(--epm-render-width);
    max-height: max(1px, calc(var(--epm-area-height) / var(--epm-height-divisor, 1)));
}
.epm-root > .epm-popup.epm-content-image {
    --epm-image-max-width: calc(var(--epm-area-height) * var(--epm-image-ratio, 10000));
    --epm-render-height: calc(var(--epm-render-width) / var(--epm-image-ratio, 10000));
    --epm-center-y: clamp(calc(var(--epm-area-top) + var(--epm-render-height) / 2), calc(var(--epm-area-top) + var(--epm-area-height) * var(--epm-grid-row, 3) / 6), calc(var(--epm-area-top) + var(--epm-area-height) - var(--epm-render-height) / 2));
    max-height: var(--epm-area-height);
}
.epm-text-content { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { .epm-popup.is-visible { animation: none; } }

/* Animate the clickable content, keeping popup coordinates and close controls stable. */
.epm-hover-zoom { --epm-link-transform: scale(1.04); }
.epm-hover-lift { --epm-link-transform: translateY(-4px); }
.epm-hover-brighten { --epm-link-filter: brightness(1.15); }
.epm-popup:not(.epm-hover-none) .epm-action-link[href]:not([href=""]) {
    transition: transform 180ms ease, filter 180ms ease;
}
.epm-popup:not(.epm-hover-none) .epm-action-link[href]:not([href=""]):focus-visible {
    transform: var(--epm-link-transform, none);
    filter: var(--epm-link-filter, none);
}
@media (hover: hover) and (pointer: fine) {
    .epm-popup:not(.epm-hover-none) .epm-action-link[href]:not([href=""]):hover {
        transform: var(--epm-link-transform, none);
        filter: var(--epm-link-filter, none);
    }
}
@media (prefers-reduced-motion: reduce) {
    .epm-popup:not(.epm-hover-none) .epm-action-link[href]:not([href=""]) {
        transition: none !important;
        transform: none !important;
    }
}
