.wlt-popup-root,
.wlt-popup-root * {
    box-sizing: border-box;
}

.wlt-popup-root[hidden] {
    display: none !important;
}

.wlt-popup-root {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    padding-top: calc(var(--wlt-edge-y, 24px) + env(safe-area-inset-top, 0px));
    padding-right: calc(var(--wlt-edge-x, 24px) + env(safe-area-inset-right, 0px));
    padding-bottom: calc(var(--wlt-edge-y, 24px) + env(safe-area-inset-bottom, 0px));
    padding-left: calc(var(--wlt-edge-x, 24px) + env(safe-area-inset-left, 0px));
    font-family: inherit;
    overscroll-behavior: contain;
}

.wlt-popup-overlay {
    position: absolute;
    inset: 0;
    background: var(--wlt-overlay, #000);
    opacity: var(--wlt-overlay-opacity, .55);
}

.wlt-popup-box {
    position: relative;
    z-index: 1;
    width: min(100%, var(--wlt-width, 620px));
    max-width: 100%;
    max-height: calc(100vh - (2 * var(--wlt-edge-y, 24px)));
    max-height: calc(100dvh - (2 * var(--wlt-edge-y, 24px)) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: clamp(24px, 4vw, 42px);
    border-radius: var(--wlt-radius, 18px);
    background: var(--wlt-bg, #fff);
    color: var(--wlt-text, #222);
    box-shadow: 0 20px 70px rgba(0,0,0,.28);
    transform: translate(var(--wlt-shift-x, 0px), var(--wlt-shift-y, 0px));
    overflow-wrap: anywhere;
    -webkit-overflow-scrolling: touch;
}

.wlt-popup-h-left { justify-content: flex-start; }
.wlt-popup-h-center { justify-content: center; }
.wlt-popup-h-right { justify-content: flex-end; }
.wlt-popup-v-top { align-items: flex-start; }
.wlt-popup-v-center { align-items: center; }
.wlt-popup-v-bottom { align-items: flex-end; }

.wlt-popup-title {
    margin: 0 0 14px;
    padding: 0;
    color: inherit;
    font-size: var(--wlt-h-size, 30px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.wlt-popup-text {
    margin: 0 0 24px;
    color: inherit;
    font-size: var(--wlt-p-size, 17px);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.wlt-popup-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 0 22px;
    border-radius: max(0px, calc(var(--wlt-radius, 18px) * .6));
}

.wlt-popup-button {
    display: inline-block;
    max-width: 100%;
    padding: 13px 22px;
    border: 0;
    border-radius: max(4px, calc(var(--wlt-radius, 18px) * .5));
    background: var(--wlt-btn, #006b63);
    color: var(--wlt-btn-text, #fff) !important;
    font-size: var(--wlt-b-size, 16px);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: opacity .15s ease, transform .15s ease;
}

.wlt-popup-button:hover,
.wlt-popup-button:focus-visible {
    opacity: .9;
    transform: translateY(-1px);
}

.wlt-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--wlt-text, #222);
    font: inherit;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

.wlt-popup-close:hover,
.wlt-popup-close:focus-visible {
    background: rgba(0,0,0,.06);
}

.wlt-popup-position-bottom-bar {
    align-items: flex-end !important;
    justify-content: stretch !important;
    padding-right: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: 0;
}

.wlt-popup-position-bottom-bar .wlt-popup-box {
    width: 100%;
    max-width: none;
    max-height: min(70dvh, 520px);
    transform: none;
    border-radius: var(--wlt-radius, 18px) var(--wlt-radius, 18px) 0 0;
}

@media (max-width: 767px) {
    .wlt-popup-root {
        padding-top: calc(var(--wlt-edge-y-mob, 16px) + env(safe-area-inset-top, 0px));
        padding-right: calc(var(--wlt-edge-x-mob, 16px) + env(safe-area-inset-right, 0px));
        padding-bottom: calc(var(--wlt-edge-y-mob, 16px) + env(safe-area-inset-bottom, 0px));
        padding-left: calc(var(--wlt-edge-x-mob, 16px) + env(safe-area-inset-left, 0px));
    }

    .wlt-popup-box {
        width: min(100%, var(--wlt-width-mob, 480px));
        max-height: calc(100vh - (2 * var(--wlt-edge-y-mob, 16px)));
        max-height: calc(100dvh - (2 * var(--wlt-edge-y-mob, 16px)) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: clamp(20px, 6vw, 30px);
        transform: translate(var(--wlt-shift-x-mob, 0px), var(--wlt-shift-y-mob, 0px));
    }

    .wlt-popup-title {
        font-size: var(--wlt-h-size-mob, 24px);
    }

    .wlt-popup-text {
        font-size: var(--wlt-p-size-mob, 16px);
    }

    .wlt-popup-button {
        font-size: var(--wlt-b-size-mob, 15px);
    }

    .wlt-popup-position-bottom-bar {
        padding-right: 0;
        padding-left: 0;
    }

    .wlt-popup-position-bottom-bar .wlt-popup-box {
        width: 100%;
        max-width: none;
        transform: none;
    }
}

@media (max-width: 420px) {
    .wlt-popup-box {
        padding: 24px 20px 22px;
    }

    .wlt-popup-button {
        width: 100%;
    }
}

/* Keep the CTA visible even when a theme applies aggressive link/button styles. */
a.wlt-popup-button,
a.wlt-popup-button:link,
a.wlt-popup-button:visited {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1;
    height: auto;
}

@media (max-width: 420px) {
    a.wlt-popup-button,
    a.wlt-popup-button:link,
    a.wlt-popup-button:visited {
        display: block !important;
        width: 100%;
    }
}

/* v2.0.4: also protect real <button> CTA variants from theme resets. */
button.wlt-popup-button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1;
    width: auto;
    min-height: 0;
    height: auto;
    appearance: none;
    -webkit-appearance: none;
}

@media (max-width: 420px) {
    button.wlt-popup-button {
        display: block !important;
        width: 100%;
    }
}

/* Rich-text formatting inside the popup body (since 2.1.5). */
.wlt-popup-text p {
    margin: 0 0 12px;
}

.wlt-popup-text p:last-child,
.wlt-popup-text ul:last-child,
.wlt-popup-text ol:last-child {
    margin-bottom: 0;
}

.wlt-popup-text ul,
.wlt-popup-text ol {
    margin: 0 0 12px 1.4em;
    padding: 0;
}

.wlt-popup-text li {
    margin: 0 0 4px;
}

.wlt-popup-text a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: .12em;
}
