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

.essp-popup {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #162033;
}

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

.essp-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.64);
}

.essp-popup__dialog {
    position: relative;
    width: min(940px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    overflow: auto;
    margin: 14px auto;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    padding: 24px;
}

.essp-popup__close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: #f3f4f6;
    color: #162033;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.essp-popup__close:hover,
.essp-popup__close:focus {
    background: #e5e7eb;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.essp-popup__header {
    padding-right: 52px;
    margin-bottom: 20px;
}

.essp-popup__eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #2563eb;
}

.essp-popup__title {
    margin: 0;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.05;
    font-weight: 800;
    color: #111827;
}

.essp-popup__subtitle {
    max-width: 720px;
    margin: 10px 0 0;
    font-size: 16px;
    line-height: 1.5;
    color: #4b5563;
}

.essp-popup__body {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 0.95fr);
    gap: 24px;
    align-items: start;
}

.essp-popup__media,
.essp-popup__content {
    min-width: 0;
}

.essp-popup__preview {
    display: block;
    width: 100%;
    height: auto;
    max-height: 460px;
    object-fit: contain;
    border-radius: 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.essp-popup__choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.essp-popup__choice {
    display: block;
    width: 100%;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.essp-popup__choice.is-active {
    border-color: #2563eb;
}

.essp-popup__choice:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.essp-popup__choice img {
    display: block;
    width: 100%;
    height: 74px;
    object-fit: cover;
    border-radius: 7px;
}

.essp-popup__label {
    display: block;
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
}

.essp-popup__caption {
    width: 100%;
    min-height: 180px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    line-height: 1.55;
    color: #162033;
    background: #fff;
    resize: vertical;
}

.essp-popup__caption:focus {
    border-color: #2563eb;
    outline: 2px solid rgba(37, 99, 235, 0.18);
}

.essp-popup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.essp-popup__button,
.essp-popup__share-links button {
    appearance: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.essp-popup__button:hover,
.essp-popup__share-links button:hover {
    background: #f9fafb;
}

.essp-popup__button:focus,
.essp-popup__share-links button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.essp-popup__button--primary {
    border-color: #1d4ed8;
    background: #1d4ed8;
    color: #fff;
}

.essp-popup__button--primary:hover {
    background: #1e40af;
}

.essp-popup__hint {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #6b7280;
}

.essp-popup__share-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

.essp-popup__status {
    min-height: 20px;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #166534;
    font-weight: 700;
}

body.essp-popup-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .essp-popup__dialog {
        width: min(100vw - 18px, 560px);
        margin: 9px auto;
        padding: 18px;
        border-radius: 14px;
    }

    .essp-popup__body {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .essp-popup__choice img {
        height: 64px;
    }

    .essp-popup__actions,
    .essp-popup__share-links {
        display: grid;
        grid-template-columns: 1fr;
    }

    .essp-popup__button,
    .essp-popup__share-links button {
        width: 100%;
    }
}
