.chat-section { background: var(--surface); }
.chat-section:nth-of-type(2) { padding-block: clamp(36px, 5vw, 68px); }
.chat-box {
    width: min(100%, 820px);
    margin-inline: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 15px 36px #14294915;
    overflow: hidden;
}
.chat-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px clamp(16px, 3vw, 26px);
    border-bottom: 1px solid var(--line);
}
.chat-head h2 { font-size: clamp(20px, 2vw, 27px); margin-bottom: 4px; }
.chat-head p { font-size: .9rem; }
.chat-identity { display: flex; gap: 12px; align-items: center; min-width: 0; }
.chat-avatar { display: block; flex: none; width: 52px; height: 52px; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.chat-log {
    display: flex;
    flex-direction: column;
    gap: 11px;
    height: 220px;
    background: var(--surface);
    overflow: auto;
    padding: 17px clamp(15px, 3vw, 24px);
}
.chat-bubble {
    width: fit-content;
    max-width: min(92%, 68ch);
    padding: 10px 14px;
    margin: 0;
    border-radius: 14px;
    background: var(--white);
    border: 1px solid var(--line);
    font-size: .94rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.chat-bubble--user { align-self: flex-end; background: var(--pale); color: var(--ink); }
.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
    padding: 15px clamp(15px, 3vw, 24px) 4px;
}
.chat-form textarea {
    display: block;
    width: 100%;
    resize: vertical;
    max-height: 150px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #a8b6ca;
    border-radius: 9px;
}
.chat-form .button:disabled, .chat-reset:disabled { opacity: .6; cursor: wait; }
.chat-status { grid-column: 1 / -1; font-size: .88rem; margin: 0; }
.chat-status:empty { display: none; }
.chat-meta { padding: 8px clamp(15px, 3vw, 24px) 16px; font-size: .82rem; }
.chat-meta p { margin-bottom: 6px; }
.chat-reset { color: var(--blue-dark); }
.chat-meta > div { display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; }
.chat-reset { border: 0; padding: 3px 0; background: transparent; text-decoration: underline; }
.chat-sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.chat-widget { position: fixed; right: clamp(12px, 3vw, 32px); bottom: clamp(12px, 3vw, 28px); max-width: calc(100% - 32px); z-index: 3; }
.chat-widget .chat-box { width: 430px; max-width: 100%; }
.chat-widget .chat-log { height: min(235px, 30dvh); }
.chat-widget .chat-head { padding-block: 13px; }
.chat-widget .chat-head h2 { font-size: 20px; }
.chat-close { border: 0; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 24px; width: 36px; height: 36px; line-height: 1; }
.chat-launch { box-shadow: 0 10px 26px #14294936; padding: 5px 15px 5px 6px; }
.chat-launch .chat-avatar { width: 34px; height: 34px; }

@media (max-width: 450px) {
    .chat-form { grid-template-columns: 1fr; }
    .chat-form .button { justify-self: start; }
    .chat-widget .chat-form { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
    .chat-widget .chat-form .button { padding-inline: 10px; }
    .chat-widget .chat-box { max-height: calc(100dvh - 24px); overflow-y: auto; }
}
