/* ============================================================
   聊天组件样式 —— 与站点艺术设计语言统一
   主色：#202223 → #000000（站点 btn-primary / 公告弹窗同源渐变）
   点缀：祖母绿 #10b981（AG徽章同源，用于交互强调与在线态）
   ============================================================ */

.chat-widget-root {
    position: relative;
    z-index: 1200;
    --chat-safe-bottom: 24px;
    --chat-widget-bottom: 96px;
}

/* ============ 悬浮入口 / 迷你气泡 ============ */
.chat-floating-entry,
.chat-mini-bubble {
    position: fixed;
    right: 24px;
    bottom: var(--chat-safe-bottom);
    z-index: 1200;
    border: 0;
    color: #fff;
    display: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #2b2e30 0%, #202223 46%, #050606 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 18px 40px -12px rgba(15, 23, 42, 0.42),
        0 4px 12px rgba(15, 23, 42, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease, opacity 0.2s ease;
}

/* 呼吸光环：邀请点击的柔和脉冲，不干扰拖动（仅作用于伪元素） */
.chat-floating-entry::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.38);
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
    animation: chatEntryPulse 3.4s ease-out infinite;
}

@keyframes chatEntryPulse {
    0% { opacity: 0; transform: scale(0.92); }
    14% { opacity: 0.65; }
    46%, 100% { opacity: 0; transform: scale(1.5); }
}

.chat-floating-entry.is-open::before,
.chat-floating-entry.is-dragging::before {
    display: none;
}

.chat-floating-entry:hover,
.chat-mini-bubble:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 24px 48px -14px rgba(15, 23, 42, 0.48),
        0 6px 16px rgba(15, 23, 42, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-floating-entry.is-open,
.chat-mini-bubble.is-open {
    box-shadow:
        0 20px 44px -14px rgba(15, 23, 42, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background: linear-gradient(145deg, #1b1d1f 0%, #141516 55%, #000000 100%);
}

.chat-floating-entry {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    cursor: grab;
    /* 手机：按住气泡时把触摸交给拖拽逻辑，阻止浏览器将其当作页面滚动手势 */
    touch-action: none;
}

.chat-mini-bubble {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.chat-floating-entry.is-ready,
.chat-mini-bubble.is-ready {
    display: flex;
}

.chat-floating-entry.is-dragging {
    cursor: grabbing;
    transform: scale(0.97);
    box-shadow:
        0 14px 28px -10px rgba(15, 23, 42, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.chat-entry-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.chat-entry-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: currentColor;
}

.chat-floating-entry .chat-entry-icon {
    width: 31px;
    height: 31px;
}

.chat-floating-entry .chat-entry-badge,
.chat-mini-bubble .chat-entry-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(225, 29, 72, 0.4);
}

/* ============ 聊天面板 ============ */
.chat-widget {
    position: fixed;
    right: 24px;
    bottom: var(--chat-widget-bottom);
    z-index: 1199;
    width: min(430px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    height: min(680px, calc(100vh - 118px));
    background: #ffffff;
    border-radius: 24px;
    box-shadow:
        0 32px 80px -20px rgba(15, 23, 42, 0.38),
        0 4px 16px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.chat-widget.is-open {
    display: flex;
}

.chat-widget.is-maximized {
    right: 12px !important;
    left: 12px;
    bottom: 12px;
    width: auto;
    max-width: none;
    height: auto;
    top: 68px;
}

/* 头部：站点公告弹窗同源黑金渐变 */
.chat-widget-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, #202223 0%, #161718 52%, #000000 100%);
    color: #fff;
    position: relative;
}

.chat-widget-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.4), transparent);
}

.chat-widget-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.chat-widget-title strong {
    font-size: 16px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget-title span {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
}

.chat-widget-header-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chat-connection-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 0 10px;
    height: 28px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.chat-connection-pill.is-online {
    background: rgba(16, 185, 129, 0.22);
}

.chat-connection-pill.is-connecting,
.chat-connection-pill.is-reconnecting {
    background: rgba(245, 158, 11, 0.22);
}

.chat-connection-pill.is-offline {
    background: rgba(245, 158, 11, 0.22);
}

.chat-connection-pill.is-error {
    background: rgba(239, 68, 68, 0.22);
}

.chat-widget-actions {
    display: flex;
    gap: 6px;
}

.chat-control-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.94);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.chat-control-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

.chat-control-btn.is-danger:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(254, 202, 202, 0.3);
}

.chat-control-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-control-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============ 消息区 ============ */
.chat-widget-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 85% -5%, rgba(16, 185, 129, 0.05), transparent 32%),
        linear-gradient(180deg, #fbfbfc 0%, #f4f5f6 100%);
}

.chat-feedback-banner {
    margin: 14px 16px 0;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.5;
}

.chat-feedback-banner.is-hidden {
    display: none;
}

.chat-feedback-banner.is-info {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.chat-feedback-banner.is-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.chat-feedback-banner.is-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.chat-feedback-banner.is-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.chat-message-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message-list::-webkit-scrollbar {
    width: 5px;
}

.chat-message-list::-webkit-scrollbar-thumb {
    background: rgba(32, 34, 35, 0.18);
    border-radius: 999px;
}

.chat-message-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-time-divider {
    align-self: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(32, 34, 35, 0.08);
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

.chat-empty-state {
    margin: auto 0;
    padding: 22px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(32, 34, 35, 0.07);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: #4b5563;
}

.chat-empty-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: linear-gradient(145deg, #eceef0, #ffffff);
    border: 1px solid rgba(32, 34, 35, 0.08);
    color: #202223;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.chat-empty-state strong {
    font-size: 16px;
    color: #202223;
    letter-spacing: 0.02em;
}

.chat-empty-state p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
}

.chat-message {
    max-width: 82%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-message.is-self {
    align-self: flex-end;
}

.chat-message.is-other {
    align-self: flex-start;
}

.chat-message-author {
    padding-left: 4px;
    font-size: 12px;
    color: #6b7280;
}

.chat-system-message {
    align-self: center;
    max-width: 90%;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(32, 34, 35, 0.06);
    color: #4b5563;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* 消息气泡：白 / 站点黑渐变，带方向性小圆角 */
.chat-message-card,
.chat-message-bubble {
    border-radius: 18px;
    padding: 12px 14px;
    background: #fff;
    color: #202223;
    border: 1px solid rgba(32, 34, 35, 0.08);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    word-break: break-word;
    line-height: 1.65;
}

.chat-message.is-other .chat-message-bubble,
.chat-message.is-other .chat-message-card {
    border-radius: 18px 18px 18px 6px;
}

.chat-message.is-self .chat-message-bubble,
.chat-message.is-self .chat-message-card {
    border-radius: 18px 18px 6px 18px;
    background: linear-gradient(145deg, #2b2e30 0%, #202223 52%, #000000 100%);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.chat-message-bubble.is-queued,
.chat-message-card.is-queued {
    border-style: dashed;
    border-color: rgba(245, 158, 11, 0.65);
}

.chat-message-bubble.is-failed,
.chat-message-card.is-failed {
    border-color: rgba(239, 68, 68, 0.58);
    background: #fff7f7;
    color: #7f1d1d;
}

.chat-message.is-self .chat-message-bubble.is-failed,
.chat-message.is-self .chat-message-card.is-failed {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fff;
}

.chat-message-card img {
    width: 100%;
    border-radius: 14px;
    display: block;
    margin-bottom: 10px;
    max-height: 220px;
    object-fit: cover;
}

.chat-card-tag {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 0 10px;
    height: 24px;
    border-radius: 999px;
    align-items: center;
    background: rgba(32, 34, 35, 0.07);
    color: inherit;
    font-size: 11px;
    font-weight: 600;
}

.chat-card-price {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
}

.chat-message-card strong,
.chat-message-card p {
    display: block;
}

.chat-message-card p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.92;
}

.chat-image-message {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.chat-image-message img {
    display: block;
    width: 100%;
    max-width: 240px;
    border-radius: 14px;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    font-size: 11px;
    color: #6b7280;
}

.chat-message.is-self .chat-message-meta {
    justify-content: flex-end;
}

.chat-message-actions {
    display: flex;
    gap: 8px;
}

.chat-message-actions button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 11px;
}

.chat-message-skeleton .chat-message-bubble {
    min-height: 58px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 0%, rgba(255, 255, 255, 0.98) 45%, rgba(226, 232, 240, 0.6) 100%);
    background-size: 240px 100%;
    border: 0;
    animation: chatSkeleton 1.2s infinite linear;
}

.chat-message-skeleton .chat-message-meta span {
    width: 44px;
    height: 10px;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.9);
}

@keyframes chatSkeleton {
    0% {
        background-position: 240px 0;
    }
    100% {
        background-position: -240px 0;
    }
}

/* ============ 输入区 ============ */
.chat-input-panel {
    border-top: 1px solid rgba(32, 34, 35, 0.08);
    background: rgba(255, 255, 255, 0.96);
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.chat-status-line {
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
}

.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-quick-actions.is-hidden {
    display: none;
}

.chat-quick-action {
    border: 1px solid rgba(32, 34, 35, 0.12);
    background: #fff;
    color: #202223;
    border-radius: 999px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chat-quick-action:hover {
    border-color: rgba(5, 150, 105, 0.35);
    background: rgba(16, 185, 129, 0.07);
    color: #047857;
}

.chat-image-preview.is-hidden {
    display: none;
}

.chat-image-preview-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(32, 34, 35, 0.1);
    background: rgba(251, 251, 252, 0.95);
}

.chat-image-preview-card img {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-image-preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #4b5563;
}

.chat-image-preview-info strong {
    font-size: 13px;
    color: #202223;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-image-preview-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.chat-image-preview-actions button {
    min-width: 88px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(32, 34, 35, 0.12);
    background: #fff;
    color: #202223;
    font-size: 12px;
    padding: 0 12px;
}

.chat-image-preview-actions button.is-primary {
    background: linear-gradient(135deg, #202223, #000000);
    color: #fff;
    border-color: #202223;
}

.chat-image-preview-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chat-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-toolbar-button {
    border: 1px solid rgba(32, 34, 35, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #fafbfb 100%);
    border-radius: 14px;
    min-width: 78px;
    height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: #202223;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat-toolbar-button:hover {
    background: #fff;
    border-color: rgba(5, 150, 105, 0.35);
    box-shadow: 0 10px 22px rgba(5, 150, 105, 0.12);
    transform: translateY(-1px);
}

.chat-toolbar-button.is-active {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(5, 150, 105, 0.35);
    box-shadow: 0 10px 22px rgba(5, 150, 105, 0.12);
    color: #047857;
}

.chat-toolbar-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.chat-toolbar input[type="file"] {
    display: none;
}

.chat-upload-trigger.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chat-toolbar-button-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    flex-shrink: 0;
}

.chat-toolbar-button-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.chat-toolbar-button-text {
    line-height: 1;
    white-space: nowrap;
}

.chat-compose-meta {
    display: flex;
    flex: 1;
    min-width: 0;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: #6b7280;
}

/* ============ 表情面板 ============ */
.chat-emoji-panel {
    display: none;
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 1210;
    width: 220px;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(32, 34, 35, 0.1);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom left;
    transition: opacity 0.16s ease, transform 0.16s ease;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-emoji-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-emoji-panel.is-closing {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
}

.chat-emoji-panel.is-below {
    transform-origin: top left;
}

.chat-emoji-panel::after {
    content: "";
    position: absolute;
    left: var(--chat-emoji-arrow-left, 28px);
    top: 100%;
    width: 12px;
    height: 12px;
    background: inherit;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    transform: translateY(-6px) rotate(45deg);
}

.chat-emoji-panel.is-below::after {
    top: auto;
    bottom: 100%;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    transform: translateY(6px) rotate(45deg);
}

.chat-emoji-panel button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(32, 34, 35, 0.08);
    background: #fff;
    font-size: 17px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-emoji-panel button:hover {
    border-color: rgba(5, 150, 105, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(5, 150, 105, 0.1);
}

/* ============ 输入框与发送 ============ */
.chat-compose-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.chat-compose-row textarea {
    flex: 1;
    min-height: 90px;
    resize: none;
    border-radius: 18px;
    border: 1px solid rgba(32, 34, 35, 0.1);
    padding: 13px 14px;
    background: #f8fafc;
    color: #202223;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat-compose-row textarea:focus {
    outline: none;
    border-color: rgba(5, 150, 105, 0.4);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.09);
    background: #fff;
}

.chat-compose-row textarea:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.chat-compose-row button.send-btn {
    min-width: 88px;
    border-radius: 18px;
    border: 0;
    background: linear-gradient(145deg, #2b2e30 0%, #202223 52%, #000000 100%);
    color: #fff;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.chat-compose-row button.send-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.24);
}

.chat-compose-row button.send-btn:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============ 图片灯箱 ============ */
.chat-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
}

.chat-image-lightbox.is-hidden {
    display: none;
}

.chat-image-lightbox img {
    display: block;
    max-width: min(88vw, 760px);
    max-height: 74vh;
    border-radius: 18px;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
}

.chat-lightbox-close {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 14px;
}

.chat-lightbox-caption {
    color: #e2e8f0;
    font-size: 13px;
    text-align: center;
}

/* ============ 窄屏适配 ============ */
@media (max-width: 768px) {
    .chat-widget-root {
        --chat-safe-bottom: 16px;
        --chat-widget-bottom: 88px;
    }

    .chat-widget {
        right: 12px;
        left: 12px;
        bottom: var(--chat-widget-bottom);
        width: auto;
        max-width: none;
        height: min(72vh, 620px);
        border-radius: 22px;
    }

    .chat-floating-entry,
    .chat-mini-bubble {
        bottom: var(--chat-safe-bottom);
        bottom: 16px;
    }

    .chat-floating-entry {
        width: 52px;
        height: 52px;
    }

    .chat-mini-bubble {
        width: 46px;
        height: 46px;
    }

    .chat-message {
        max-width: 90%;
    }

    .chat-widget-header {
        padding: 16px 16px 14px;
    }

    .chat-widget-header-side {
        gap: 8px;
    }

    .chat-control-btn {
        width: 32px;
        height: 32px;
        border-radius: 11px;
    }

    .chat-connection-pill {
        display: none;
    }

    /* ===== 输入区整体压缩，把纵向空间还给聊天消息区 ===== */
    .chat-input-panel {
        padding: 10px 10px 12px;
        gap: 7px;
    }

    .chat-status-line {
        font-size: 11px;
        line-height: 1.4;
    }

    /* 快捷回复：单行横滑，不再折行占多行 */
    .chat-quick-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -2px;
        padding: 0 2px;
    }

    .chat-quick-actions::-webkit-scrollbar {
        display: none;
    }

    .chat-quick-action {
        flex: 0 0 auto;
        min-height: 30px;
        padding: 0 11px;
        font-size: 11.5px;
    }

    /* 工具栏：按钮缩小，隐藏桌面专用的 Enter 快捷键提示 */
    .chat-toolbar {
        gap: 8px;
    }

    .chat-toolbar-button {
        min-width: 0;
        height: 34px;
        padding: 0 11px;
        border-radius: 11px;
    }

    .chat-compose-meta {
        flex-direction: row;
        align-items: center;
    }

    .chat-compose-meta span:last-child {
        display: none; /* "Enter 发送，Shift+Enter 换行" 对手机无意义 */
    }

    /* 输入框与发送按钮同一行，单行高度 */
    .chat-compose-row {
        flex-direction: row;
        gap: 8px;
    }

    .chat-compose-row textarea {
        min-height: 0;
        height: 46px;
        padding: 11px 14px;
        font-size: 13.5px;
        line-height: 1.4;
        border-radius: 14px;
    }

    .chat-compose-row button.send-btn {
        min-width: 64px;
        height: 46px;
        padding: 0 14px;
        border-radius: 14px;
        font-size: 13px;
    }

    /* 图片预览：横向紧凑卡片 */
    .chat-image-preview-card {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
    }

    .chat-image-preview-card img {
        width: 56px;
        height: 56px;
    }

    .chat-image-preview-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .chat-image-preview-actions button {
        flex: 1;
        min-width: 0;
        height: 32px;
    }

    .chat-emoji-panel {
        width: min(220px, calc(100vw - 24px));
    }
}
