/* 机器人沿用主页面主题，原头像、模拟会话和上传流程保持不变。 */
.dmh-ai-robot { font-size: 14px; color: var(--text); }
.dmh-ai-robot, .dmh-ai-robot * { box-sizing: border-box; }
.dmh-ai-mini {
    display: block;
    position: fixed;
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 10000;
    width: 180px;
    height: 46px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--control-radius);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(119, 55, 39, 0.16);
}
.dmh-ai-mini-content { display: flex; height: 100%; align-items: center; justify-content: space-between; gap: 8px; }
.dmh-ai-mini-icon, .dmh-ai-mini-arrow, .dmh-ai-header-icon { display: flex; flex: 0 0 24px; align-items: center; justify-content: center; }
.dmh-ai-mini-text { flex: 1; font-size: 16px; font-weight: 600; text-align: center; }

/* 对话、输入和平台按钮按正常文档流排列，窗口变矮时只压缩对话区。 */
.dmh-ai-window {
    display: none;
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 10001;
    width: min(400px, calc(100% - 24px - env(safe-area-inset-right, 0px)));
    height: 540px;
    max-height: calc(100vh - 32px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: 0 8px 32px rgba(74, 54, 48, 0.18);
}
.dmh-ai-robot.is-open .dmh-ai-window { display: flex; }
.dmh-ai-robot.is-open .dmh-ai-mini { display: none; }
.dmh-ai-header {
    display: flex;
    flex: 0 0 48px;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0 4px 0 14px;
    background: var(--accent);
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
}
.dmh-ai-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmh-ai-close { display: flex; width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; border-radius: var(--control-radius); background: transparent; color: #fff; }
.dmh-ai-header button:focus-visible { outline-color: #fff; outline-offset: -4px; }
.dmh-ai-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 12px;
    background: #fcf8f5;
    font-size: 14px;
    line-height: 1.7;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-border) transparent;
}
.dmh-ai-input-area { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.dmh-ai-upload { display: flex; flex: 0 0 32px; height: 40px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--control-radius); background: transparent; color: var(--accent); }
.dmh-ai-input { flex: 1; min-width: 0; width: 0; height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--control-radius); background: #fff; color: var(--text); font-size: 16px; }
.dmh-ai-input::placeholder { color: var(--muted); font-size: 14px; }
.dmh-ai-send { flex: 0 0 auto; height: 40px; padding: 0 17px; border: 0; border-radius: var(--control-radius); background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; }
.dmh-ai-footer { display: flex; flex: 0 0 auto; gap: 10px; padding: 0 10px 10px; background: var(--surface); }
.dmh-ai-platform { display: flex; flex: 1; min-width: 0; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 8px; border: 0; border-radius: var(--control-radius); color: #fff; font-size: 14px; font-weight: 500; }
.dmh-ai-platform svg { flex-shrink: 0; }
.dmh-ai-platform-douyin { background: #202020; }
.dmh-ai-platform-kuaishou { background: linear-gradient(110deg, #ff9000, #ff5500); }

/* 收到的消息使用白底，发出的文字与图片使用浅桃色底。 */
.dmh-ai-message { margin: 0 0 18px; }
.dmh-ai-message-row { display: flex; align-items: flex-start; gap: 8px; }
.dmh-ai-avatar-wrap { position: relative; flex: 0 0 36px; height: 36px; }
.dmh-ai-avatar { display: block; width: 36px; height: 36px; border: 2px solid #fff; border-radius: 50%; object-fit: cover; }
.dmh-ai-status-dot { position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: #4c9850; }
.dmh-ai-message-main { flex: 1; min-width: 0; }
.dmh-ai-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.dmh-ai-name { font-weight: 600; }
.dmh-ai-status { padding: 1px 7px; border-radius: 4px; background: #eaf3e7; color: #39803d; font-size: 11px; }
.dmh-ai-bubble { padding: 10px 12px; border: 1px solid #f0e9e4; border-radius: 4px 8px 8px 8px; background: #fff; box-shadow: 0 2px 3px rgba(74, 54, 48, 0.03); overflow-wrap: anywhere; }
.dmh-ai-user-message { display: flex; justify-content: flex-end; margin: 0 0 18px; }
.dmh-ai-user-bubble, .dmh-ai-user-image-bubble { max-width: 76%; border: 1px solid #f5ded3; border-radius: 8px 4px 8px 8px; background: var(--accent-soft); }
.dmh-ai-user-bubble { padding: 10px 12px; color: var(--text); overflow-wrap: anywhere; }
.dmh-ai-user-image-bubble { padding: 8px; }
.dmh-ai-user-image { display: block; max-width: 100%; width: auto; height: auto; max-height: 180px; border-radius: 4px; object-fit: contain; }
.dmh-ai-completion-title { margin-bottom: 6px; color: var(--accent); font-weight: 600; }
.dmh-ai-download-label { margin-bottom: 10px; }
.dmh-ai-download-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dmh-ai-download-row > span { min-width: 56px; }
.dmh-ai-download-btn { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 6px 16px; border-radius: var(--control-radius); background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; text-decoration: none; }
.dmh-ai-download-note { margin-top: 10px; color: var(--muted); font-size: 12px; }
@media (hover: hover) {
    .dmh-ai-mini:hover, .dmh-ai-send:hover, .dmh-ai-download-btn:hover { background: var(--accent-hover); }
    .dmh-ai-close:hover { background: rgba(255, 255, 255, 0.15); }
    .dmh-ai-upload:hover { background: var(--accent-soft); }
    .dmh-ai-platform:hover { filter: brightness(0.94); }
}
@media print { .dmh-ai-robot { display: none; } }
