html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.chat-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    padding: 10px 20px;
    cursor: pointer;
}

.chat-modal {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000;
    display: none;
    width: min(420px, calc(100vw - 32px));
    height: min(760px, calc(100dvh - 48px));
    max-width: 100%;
    max-height: 760px;
    overflow: hidden;
    border: 1px solid rgba(73, 48, 32, .12);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(34, 22, 15, .28);
}

.chat-modal-content,
#ch-plugin,
#ch-plugin-script {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

#ch-plugin-script-iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    border: 0;
    background: #fff;
}

.chat-modal-close {
    position: absolute;
    top: 14px;
    right: 12px;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 0 2px;
    border: 1px solid #e8e0d8;
    border-radius: 14px;
    outline: 0;
    background: rgba(255, 255, 255, .96);
    color: #6d6057;
    box-shadow: 0 5px 15px rgba(57, 38, 25, .1);
    font-family: Arial, sans-serif;
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, transform .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-modal-close:hover,
.chat-modal-close:focus-visible {
    background: #f6f1ec;
    color: #392a22;
    transform: translateY(-1px);
}

body.modal-open {
    overflow: hidden !important;
}

@media (max-width: 768px) {
    .chat-button {
        right: 16px;
        bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .chat-modal {
        inset: 0;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .chat-modal-content,
    #ch-plugin,
    #ch-plugin-script,
    #ch-plugin-script-iframe {
        width: 100%;
        height: 100%;
        border-radius: 0;
        background: #fff;
    }

    .chat-modal-close {
        top: max(14px, calc(env(safe-area-inset-top) + 8px));
        right: 10px;
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-modal-close {
        transition: none;
    }
}
