:root {
    --cefo-purple: #5111b4;
    --cefo-purple-dark: #35106f;
    --cefo-red: #e32636;
    --cefo-yellow: #ffd54a;
    --cefo-ink: #211331;
    --cefo-soft: #fff7e6;
}

.cefo-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.cefo-popup-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.cefo-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 8, 29, 0.72);
}

.cefo-panel {
    position: relative;
    width: min(440px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    overflow: auto;
    margin-right: 0;
    padding: 30px;
    color: #fff;
    background:
        radial-gradient(circle at 18% 0%, rgba(255, 213, 74, 0.26), transparent 28%),
        linear-gradient(160deg, var(--cefo-purple), var(--cefo-purple-dark));
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
    transform: translateX(110%);
    transition: transform 520ms cubic-bezier(0.2, 0.85, 0.2, 1);
}

.cefo-popup-visible .cefo-panel {
    transform: translateX(0);
}

.cefo-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    color: #fff;
    background: transparent;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.cefo-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: 18px;
    padding: 6px 12px;
    color: var(--cefo-ink);
    background: var(--cefo-yellow);
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 0;
}

.cefo-step {
    display: none;
}

.cefo-step-active {
    display: block;
}

.cefo-step-active form {
    min-height: 0;
}

.cefo-step h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 27px;
    line-height: 1.16;
    font-weight: 800;
    letter-spacing: 0;
}

.cefo-subtitle {
    margin: 0 0 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.5;
}

.cefo-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-bottom: 14px;
}

.cefo-option {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.cefo-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cefo-option span {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    font-size: 13px;
    line-height: 1.2;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.cefo-option input:checked + span,
.cefo-option span:hover {
    border-color: var(--cefo-yellow);
    color: var(--cefo-ink);
    background: var(--cefo-yellow);
}

.cefo-other-wrap {
    display: none;
    margin: 0 0 14px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.cefo-other-visible {
    display: block;
}

.cefo-other-wrap input,
.cefo-step input[type="email"] {
    width: 100%;
    min-height: 46px;
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 4px;
    color: var(--cefo-ink);
    background: #fff;
    font-size: 15px;
}

.cefo-consent {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin: 13px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.35;
}

.cefo-consent input {
    margin-top: 2px;
}

.cefo-primary {
    position: relative;
    width: 100%;
    min-height: 48px;
    margin-top: 15px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: var(--cefo-red);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
}

.cefo-primary:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.cefo-error {
    min-height: 20px;
    margin-top: 8px;
    color: #ffd8dc;
    font-size: 13px;
    font-weight: 700;
}

.cefo-error:empty {
    display: none;
}

.cefo-loading .cefo-primary {
    opacity: 0.7;
    pointer-events: none;
}

.cefo-loading .cefo-primary::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 9px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: cefo-spin 700ms linear infinite;
}

@keyframes cefo-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 560px) {
    .cefo-popup {
        align-items: flex-end;
        justify-content: center;
    }

    .cefo-panel {
        width: 100%;
        max-height: calc(100vh - 18px);
        max-height: calc(100dvh - 18px);
        padding: 18px 16px 14px;
        transform: translateY(110%);
    }

    .cefo-popup-visible .cefo-panel {
        transform: translateY(0);
    }

    .cefo-step h2 {
        font-size: 21px;
        margin-bottom: 7px;
    }

    .cefo-badge {
        min-height: 28px;
        margin-bottom: 10px;
        padding: 4px 10px;
        font-size: 12px;
    }

    .cefo-subtitle {
        margin-bottom: 12px;
        font-size: 13px;
        line-height: 1.35;
    }

    .cefo-options {
        grid-template-columns: 1fr;
        max-height: min(39vh, 290px);
        overflow-y: auto;
        gap: 7px;
        margin: 0 -4px 10px 0;
        padding-right: 4px;
        overscroll-behavior: contain;
    }

    .cefo-option span {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .cefo-other-wrap input,
    .cefo-step input[type="email"] {
        min-height: 42px;
        padding: 9px 10px;
    }

    .cefo-error {
        min-height: 18px;
        margin-top: 6px;
    }

    .cefo-primary {
        position: sticky;
        bottom: 0;
        min-height: 46px;
        margin-top: 10px;
        z-index: 2;
        box-shadow: 0 -10px 18px rgba(53, 16, 111, 0.25);
    }
}
