.hwnp-popup {
    --hwnp-delay: 2200ms;
}

@keyframes hwnp-rise-in {
    from {
        opacity: 0;
        pointer-events: none;
        transform: translate3d(0, 28px, 0) scale(0.98);
    }
    to {
        opacity: 1;
        pointer-events: auto;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.hwnp-popup {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 99999;
    width: min(420px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid rgba(123, 73, 39, 0.14);
    border-radius: 8px;
    background:
        radial-gradient(circle at top left, rgba(216, 164, 143, 0.38), transparent 42%),
        linear-gradient(145deg, #ffffff 0%, #fff8f4 50%, #f2ede9 100%);
    box-shadow: 0 24px 60px rgba(39, 38, 38, 0.24);
    color: #272626;
    font-family: inherit;
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    transition: opacity 240ms ease, transform 260ms ease;
}

.hwnp-popup.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 28px, 0) scale(0.98);
}

.hwnp-popup--pending {
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 28px, 0) scale(0.98);
    animation: hwnp-rise-in 260ms ease var(--hwnp-delay) forwards;
}

.hwnp-popup.is-sent {
    background: linear-gradient(145deg, #ffffff 0%, #eff8f1 100%);
}

.hwnp-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(39, 38, 38, 0.08);
    color: #272626;
    cursor: pointer;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hwnp-popup__close span,
.hwnp-popup__close span::after {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    content: "";
}

.hwnp-popup__close span {
    transform: rotate(45deg);
}

.hwnp-popup__close span::after {
    transform: rotate(90deg);
}

.hwnp-popup__close:hover,
.hwnp-popup__close:focus {
    background: #272626;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(39, 38, 38, 0.18);
    transform: translateY(-1px);
}

.hwnp-popup__close:focus-visible,
.hwnp-form__submit:focus-visible,
.hwnp-field input:focus-visible,
.hwnp-choice input:focus-visible + span {
    outline: 2px solid #7b4927;
    outline-offset: 3px;
}

.hwnp-popup__badge {
    display: inline-flex;
    width: max-content;
    max-width: calc(100% - 44px);
    margin-bottom: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #7b4927;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.hwnp-popup__title {
    max-width: calc(100% - 28px);
    margin: 0 0 8px;
    color: #272626;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.16;
}

.hwnp-popup__intro {
    margin: 0 0 10px;
    color: rgba(39, 38, 38, 0.78);
    font-size: 15px;
    line-height: 1.45;
}

.hwnp-popup__perk {
    margin: 0 0 18px;
    color: #7b4927;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

.hwnp-form {
    display: grid;
    gap: 14px;
}

.hwnp-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.hwnp-field {
    display: grid;
    gap: 6px;
    color: #272626;
    font-size: 13px;
    font-weight: 700;
}

.hwnp-field input {
    width: 100%;
    min-height: 43px;
    border: 1px solid rgba(39, 38, 38, 0.16);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.82);
    color: #272626;
    font: inherit;
    font-size: 15px;
    padding: 9px 11px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.hwnp-field input:focus {
    border-color: #7b4927;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(216, 164, 143, 0.26);
}

.hwnp-field--trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.hwnp-categories {
    margin: 0;
    padding: 0;
    border: 0;
}

.hwnp-categories legend {
    margin-bottom: 9px;
    color: #272626;
    font-size: 13px;
    font-weight: 800;
}

.hwnp-categories__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hwnp-choice {
    cursor: pointer;
}

.hwnp-choice input {
    position: absolute;
    opacity: 0;
}

.hwnp-choice span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid rgba(123, 73, 39, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #4f403b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.hwnp-choice input:checked + span {
    border-color: #0b7f31;
    background: #0b7f31;
    color: #ffffff;
    transform: translateY(-1px);
}

.hwnp-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: #be574b;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hwnp-form__submit:hover,
.hwnp-form__submit:focus {
    background: #9f463d;
    box-shadow: 0 12px 26px rgba(190, 87, 75, 0.26);
    transform: translateY(-1px);
}

.hwnp-form__submit:disabled {
    cursor: wait;
    opacity: 0.74;
    transform: none;
}

.hwnp-form__message {
    min-height: 20px;
    margin: -4px 0 0;
    color: #4f403b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.hwnp-form__message.is-error {
    color: #9f2e25;
}

.hwnp-form__message.is-success {
    color: #0b6f2c;
}

@media (max-width: 520px) {
    .hwnp-popup {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        padding: 20px;
    }

    .hwnp-form__grid {
        grid-template-columns: 1fr;
    }

    .hwnp-popup__title {
        font-size: 21px;
    }

    .hwnp-choice span {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hwnp-popup,
    .hwnp-popup__close,
    .hwnp-choice span,
    .hwnp-form__submit {
        transition: none;
    }
}
