/* ============================================================
   da-mobile.css — 移动端适配 (< 640px)
   关键：main.da-page 覆盖 index.html 的 main 规则，防止布局崩溃
   值：64px = Tailwind h-16（导航栏精确高度）
   ============================================================ */

@media (max-width: 640px) {
    /* ===== DA 页面专用：覆盖 index.html 的 main 移动端规则 ===== */
    /* index.html 设置了 padding: 56px 16px 24px + gap: 16px */
    /* 这些值会压扁聊天区域、造成导航栏重叠 */
    main.da-page {
        padding: 0;
        gap: 0;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .da-header { padding: 8px 10px; min-height: 42px; }
    .da-header-title { font-size: 14px; }

    .safehouse-banner { padding: 5px 8px; font-size: 11px; }
    .capability-indicator { padding: 3px 8px; font-size: 10px; }

    .intent-understanding {
        padding: 5px 8px; margin: 0 8px 3px;
        font-size: 11px; max-height: 90px;
    }
    .intent-header { gap: 3px; margin-bottom: 2px; }
    .intent-title { font-size: 11px; }
    .intent-content { padding: 3px 6px; font-size: 10px; }

    .web-search-panel { padding: 5px 8px; margin: 0 8px 3px; max-height: 100px; }

    .chat-messages { padding: 8px 14px; }
    .message-row { margin-bottom: 8px; overflow: hidden; position: relative; }
    .message-bubble { max-width: 88%; gap: 6px; }
    .msg-avatar { width: 26px; height: 26px; }
    .msg-card {
        padding: 8px 10px; font-size: 13px;
        line-height: 1.5; border-radius: 12px;
    }
    .message-row.user .msg-card { border-bottom-right-radius: 3px; }
    .message-row.ai .msg-card { border-bottom-left-radius: 3px; }
    .msg-body { gap: 2px; }

    .thinking-block .thinking-body { font-size: 10px; padding: 4px 8px 8px; }

    .execution-panel { max-height: 100px; }
    .execution-panel .exec-step { font-size: 11px; }

    .input-area {
        padding: 10px 14px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
        border-radius: 14px 14px 0 0;
        gap: 5px;
    }

    .input-wrapper textarea {
        min-width: 0; width: 100%; box-sizing: border-box;
        padding: 7px 8px; font-size: 16px; /* prevent iOS zoom */
        min-height: 38px; max-height: 160px; border-radius: 8px;
    }
    .input-wrapper textarea::placeholder { font-size: 13px; }

    .voice-btn { width: 36px; height: 38px; padding: 0; }
    .voice-btn svg { width: 16px; height: 16px; }
    .file-attach-btn { width: 28px; height: 38px; }
    .file-attach-btn svg { width: 14px; height: 14px; }
    .send-btn { padding: 6px 8px; font-size: 12px; border-radius: 8px; min-height: 38px; }
    .send-btn .send-btn-label { font-size: 11px; }
    .send-btn.stop { padding: 6px 10px; }
    .image-preview-chips { padding: 4px 8px 0; }
    .image-preview-chip { width: 44px; height: 44px; }

    .voice-wave-container { bottom: 90px; }

    .history-panel {
        width: 100%; max-height: 75vh;
        border-radius: 14px 14px 0 0;
        bottom: 0; top: auto;
        transform: translate(-50%, 0) scale(0.95);
    }
    .history-panel.show { transform: translate(-50%, 0) scale(1); }

    .conversation-item { padding: 8px 10px; }
    .empty-state { padding: 20px 10px; }
    .empty-state-text { font-size: 13px; }
    .empty-state-hint { font-size: 10px; }
    .da-empty-logo { width: 56px; height: 56px; }

    /* 防止消息体内部元素溢出 */
    .message-row.ai .msg-body { overflow: hidden; }

    /* 思考折叠块：移动端微调 */
    .thinking-block .thinking-header { padding: 4px 6px; font-size: 10px; }
}