* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { 
    height: 100%; 
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    margin-top: 40px;
    margin-bottom: 0;
     padding: 0 0 120px 0 !important; 
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 120px 30px;
    min-height: 0;
    position: relative;
	max-height: calc(100vh - 180px); 
}

/* 欢迎屏幕 */
.welcome-screen {
    text-align: center;
    padding: 20px;
    padding-top: 70px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.welcome-icon {
    display: flex;
    justify-content: center;
}

.welcome-icon img { 
    max-width: 120px;
    width: 120px;
    height: auto;
    margin: 0 auto 20px auto;
    display: block;
}

.welcome-title { 
    font-size: 26px; 
    font-weight: 700; 
    margin: 10px 0 8px; 
    color: #1a1a2e;
}

.welcome-subtitle { 
    font-size: 16px; 
    font-weight: 600;     /* 加粗 */
    color: #1a1a2e;       /* 深黑色 */
    margin-top: 8px;
    line-height: 1.5;
}
.welcome-subtitle:last-child {
    font-size: 14px;
    font-weight: 600;      /* 加粗 */
    color: #1a1a2e;        /* 深黑色 */
    margin-top: 12px;
    line-height: 1.6;
}

/* 消息样式 */
.message { 
    margin-bottom: 16px; 
    display: flex; 
    flex-direction: column; 
}

.message.user { 
    align-items: flex-end; 
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    max-width: 75%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 14px;
}

.message.bot { 
    align-items: flex-start; 
}

.message.bot .message-content {
    background: #f7f8fa;
    color: #1f2937;
    max-width: 90%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.message-actions { 
    display: flex; 
    gap: 8px; 
    margin-top: 6px; 
    opacity: 0.6; 
}

.action-icon {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    color: #9ca3af;
    cursor: pointer;
}

/* 底部输入框 */
.bottom-container {
    background: #ffffff;
    border-top: 1px solid #eaeef2;
    padding: 12px 20px;
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    z-index: 1000;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

/* 输入框包装器 */
.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-area {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 28px;
    display: flex;
    align-items: center;
    padding: 6px 16px;
}

.input-area:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.chat-input {
    flex: 1;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    resize: none;
    outline: none;
    background: transparent;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    overflow-y: auto;
}

.chat-input::placeholder { 
    color: #9ca3af; 
}

.icon-btn {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.new-chat-circle {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 附件预览 */
.attach-preview {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.attach-preview.show {
    display: flex;
}

.attach-item {
    background: #f9fafb;
    border-radius: 10px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
}

.remove-attach {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
}

/* 代码块 */
.code-block {
    margin: 8px 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.code-header {
    background: #eef2f5;
    padding: 5px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    border-bottom: 1px solid #e5e7eb;
}

.code-header button {
    background: #6b7280;
    border: none;
    border-radius: 4px;
    padding: 2px 10px;
    color: white;
    cursor: pointer;
    font-size: 10px;
}

.code-block pre {
    margin: 0;
    padding: 8px 12px;
    overflow-x: auto;
    background: #f8f9fa;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.4;
}

/* 滚动条 */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #e5e7eb; border-radius: 5px; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; }

/* 底部菜单栏 */
.menu {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    background: linear-gradient(to bottom right, #FB9749, #008000) !important;
    height: 30px !important;
}

/* ============================================
   手机端适配 - 统一处理
   ============================================ */

/* 通用手机端 (宽度 <= 768px) */
@media (max-width: 768px) {
    /* 内容区域 */
    #content {
        margin-top: 40px;
        padding: 0 0 100px 0 !important; 
    }
    
    /* 聊天区域 */
    .chat-messages {
        padding: 15px 15px 100px 15px;
    }
    
    /* 底部输入框容器 */
    .bottom-container {
        bottom: 30px;
        padding: 8px 12px;
    }
    
    /* 输入框包装器 - 减小间距 */
    .input-wrapper {
        gap: 8px;
    }
    
    /* 发送按钮 - 稍小 */
    .send-btn {
        width: 38px !important;
        height: 38px !important;
    }
    
    /* 新对话按钮 - 稍小 */
    .new-chat-circle {
        width: 38px !important;
        height: 38px !important;
        font-size: 18px !important;
    }
    
    /* 图标按钮 */
    .icon-btn {
        width: 34px !important;
        height: 34px !important;
    }
    
    /* 输入区域 */
    .input-area {
        padding: 4px 12px !important;
    }
    
    /* 输入框 */
    .chat-input {
        min-height: 38px !important;
        padding: 8px 0 !important;
        font-size: 13px !important;
    }
    
    /* Logo */
    .welcome-icon img {
        max-width: 90px;
        width: 90px;
    }
    
    .welcome-title {
        font-size: 22px;
    }
    
    .welcome-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}
    .welcome-subtitle:last-child {
        font-size: 12px;
        font-weight: 600;
        color: #1a1a2e;
    }
} 
    /* 消息间距 */
    .message {
        margin-bottom: 12px;
    }
    
    .message.bot .message-content {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* 小屏手机 (宽度 <= 480px) - 解决按钮被遮挡 */
@media (max-width: 480px) {
    .input-wrapper {
        gap: 6px;
    }
    
    .send-btn {
        width: 34px !important;
        height: 34px !important;
    }
    
    .new-chat-circle {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
    }
    
    .icon-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
    
    .input-area {
        padding: 4px 10px !important;
    }
    
    .chat-input {
        min-height: 34px !important;
        font-size: 12px !important;
    }
}

/* 超小屏 (宽度 <= 380px) */
@media (max-width: 380px) {
    .input-wrapper {
        gap: 4px;
    }
    
    .send-btn, .new-chat-circle {
        width: 32px !important;
        height: 32px !important;
    }
    
    .icon-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}
/* ============================================
   针对 OPPO 等窄屏手机（宽度 < 450px）强制修复
   ============================================ */

@media (max-width: 450px) {
    /* 输入框容器 - 强制不换行 */
    .input-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: 100% !important;
        overflow: visible !important;
    }
    
    /* 发送按钮 - 确保显示 */
    .send-btn {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        flex-shrink: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    }
    
    /* 新对话按钮 */
    .new-chat-circle {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        flex-shrink: 0 !important;
        display: flex !important;
    }
    
    /* 图标按钮 */
    .icon-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* 输入区域 - 自适应剩余宽度 */
    .input-area {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 4px 10px !important;
    }
    
    /* 输入框 */
    .chat-input {
        min-height: 36px !important;
        padding: 6px 0 !important;
        font-size: 12px !important;
    }
}
/* ============================================
   苹果手机修复 - 按钮可点击
   ============================================ */

/* 确保所有按钮可点击 */
button,
.send-btn,
.new-chat-circle,
.icon-btn,
.top-link,
.nav-link,
.welcome-btn,
.lang-select-footer {
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 1001 !important;
    position: relative !important;
}

/* 修复底部输入框区域 */
.bottom-container {
    z-index: 1002 !important;
    pointer-events: auto !important;
}

/* 修复菜单栏点击 */
.menu,
.menu * {
    pointer-events: auto !important;
    z-index: 1003 !important;
}
/* ============================================
   底部空缺 - 使用伪元素（电脑端和手机端）
   ============================================ */

/* 电脑端 */
.chat-messages::after {
    content: '';
    display: block;
    height: 100px;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}

/* 手机端 - 自动应用这个，高度更小 */
@media (max-width: 768px) {
    .chat-messages::after {
        height: 70px;  /* 手机端空缺更小，更合适 */
    }
}
.attach-item,
.attach-item span,
.attach-item .attach-name {
    color: #333 !important;
}
/* 强制所有附件文字为黑色 */
.attach-item,
.attach-item *,
.message-content span[style*="background:#f3f4f6"] {
    color: #333 !important;
}