.mascot-chat {
    position: absolute;
    right: calc(var(--mascot-right) + 180px);
    bottom: var(--mascot-bottom);
    display: flex;
    flex-direction: column;
    width: 360px;
    max-width: calc(100% - var(--mascot-right) - 196px);
    height: 490px;
    max-height: calc(100dvh - 32px);
    border: 1px solid #dbe3ee;
    border-radius: 20px;
    background: #fff;
    color: #1e293b;
    box-shadow: 0 12px 48px #0f172a24;
    /* Фокус в поле не должен прокручивать всю панель и скрывать шапку. */
    overflow: clip;
    pointer-events: auto;
    font-size: 14px;
    line-height: 1.5;
}

.mascot-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 12px 16px 20px;
    background: #1e40af;
    color: #fff;
    flex-shrink: 0;
}

.mascot-chat__header h2 {margin: 0; font-size: 16px; font-weight: 700; color: inherit;}
.mascot-chat__header p {margin: 3px 0 0; font-size: 12px; color: #dbeafe;}
.mascot-chat button {cursor: pointer;}
.mascot-chat__minimize {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid #ffffff45;
    border-radius: 12px;
    color: #fff;
    background: #ffffff14;
}
.mascot-chat__minimize:hover {background: #ffffff30;}
.mascot-chat svg {width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;}
.mascot-chat__messages {
    flex: 1;
    min-height: 60px;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f8fafc;
}
.mascot-chat__message {
    width: fit-content;
    max-width: 94%;
    margin: 0 0 12px;
    padding: 11px 13px;
    border-radius: 14px;
    overflow-wrap: anywhere;
}
.mascot-chat__message:last-child {margin-bottom: 0;}
.mascot-chat__message--assistant {background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;}
.mascot-chat__message--user {margin-left: auto; background: #dbeafe; border-bottom-right-radius: 4px;}
.mascot-chat__message p {margin: 0;}
.mascot-chat__message a {display: block; color: #1d4ed8; text-decoration: underline; text-underline-offset: 3px; margin-top: 9px;}
.mascot-chat__message a:hover {color: #1e3a8a;}
.mascot-chat__questions {display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 8px; flex-shrink: 0;}
.mascot-chat__questions button {padding: 8px 10px; border: 1px solid #dbe3ee; border-radius: 10px; color: #334155; background: #fff; font-size: 12px;}
.mascot-chat__questions button:hover {background: #eff6ff; border-color: #93c5fd; color: #1e40af;}
.mascot-chat__form {display: flex; gap: 8px; padding: 8px 16px; flex-shrink: 0;}
.mascot-chat__form input {min-width: 0; flex: 1; height: 44px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; color: #0f172a; font-size: 16px;}
.mascot-chat__form button {display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; background: #1d4ed8; border: 0;}
.mascot-chat__form button:disabled {background: #e2e8f0; color: #94a3b8; cursor: default;}
.mascot-chat__note {margin: 0; padding: 0 16px 12px; font-size: 11px; line-height: 1.4; color: #64748b; flex-shrink: 0;}
.mascot-chat :is(button, input, a, [tabindex]):focus-visible {outline: 2px solid #3b82f6; outline-offset: 2px;}
.mascot-chat__header button:focus-visible {outline-color: #fff;}
.site-mascot__button[aria-expanded="true"] {background: #dbeafe; color: #1e40af; border-color: #93c5fd;}

@media (max-width: 640px), (max-height: 550px) {
    .site-mascot[data-chat-open="true"] {--mascot-height: 100px;}
    .mascot-chat {
        right: var(--mascot-right);
        bottom: calc(var(--mascot-bottom) + 160px);
        width: min(360px, calc(100% - 20px));
        max-width: calc(100% - 20px);
        height: 470px;
        max-height: calc(100dvh - 180px);
        border-radius: 16px;
    }
    .mascot-chat__header {padding: 10px 12px 10px 16px;}
}

@media (max-height: 600px) {
    .site-mascot[data-chat-open="true"] .site-mascot__figure,
    .site-mascot[data-chat-open="true"] .site-mascot__hit {visibility: hidden;}
    .mascot-chat {bottom: calc(var(--mascot-bottom) + 54px); max-height: calc(100dvh - 74px);}
    .mascot-chat__questions {padding-top: 6px;}
    .mascot-chat__questions button {padding: 5px 8px;}
}
