       :root {
            --main-color: #5a64ff;
            --btcolor: linear-gradient(113deg, #4c73ff, #6a52ff);
            --text1: #1a1d2e;
            --text2: #4a4e6d;
            --text3: #8d8fa3;
            --line: #e2e4f0;
            --mainbg: #f9f9ff;
            --btactive: #e5e8ff;
            --lightbg: #f5f5f8;
            --shadow: #55537512;
            --card-bg: #ffffff;
            --blur: rgba(255, 255, 255, 0.5);
            --button: #5a64ff24;
            --secondary-tab-active: #eef0ff;
            --secondary-tab-hover: #f6f7ff;
            --user-msg-bg: #e2e5fd;
            --ai-msg-bg: #ffffff;
            --success-color: #2ecc71;
            --error-color: #e74c3c;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'HarmonyOS_Sans', 'Microsoft YaHei', 'Arial Unicode MS', sans-serif;
        }
        .chat-file-preview-item{
                display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: var(--mainbg);
    border-radius: 8px;
    max-width: 200px;
        }
        body {
            display: flex;
            height: 100vh;
            width: 100vw;
            overflow: hidden;
            background: linear-gradient(0deg, #bbb2ff, #7a6fff);
            color: var(--text1);
            transition: background 0.3s ease;
        }
        .icon {
            display: inline-block;
            width: 1.2em;
            height: 1.2em;
            fill: currentColor;
        }
        /* 新增：包裹多个附件的外层容器，支持横向排列自动换行 */
        .message-attachments-wrapper {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 8px;
            white-space: normal; /* 抵抗父级 pre-line 的影响，避免产生多余换行符 */
        }

        .message-file-attachment {
            display: inline-flex; /* 修改为 inline-flex 兼容旧的历史记录 */
            align-items: center;
            background: #fff;
            border-radius: 8px;
            border: 1px solid var(--line);
            padding: 8px;
            max-width: 200px;
            overflow: hidden;
            margin-top: 5px;
            margin-right: 8px;
            vertical-align: top;
        }

        /* 当附件在 wrapper 内时，由 wrapper 的 gap 统一控制间距 */
        .message-attachments-wrapper .message-file-attachment {
            margin: 0; 
        }
        .message-file-attachment span {
            font-size: 14px;
            color: var(--text2);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 200px; /* 对话框内的文件名限制 */
        }
        .main-layout {
            display: flex;
            flex-grow: 1;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        }

        .sidebar {
            width: 250px;
            display: flex;
            flex-direction: column;
            padding: 25px 0;
            flex-shrink: 0;
	        margin-left: 60px;
        }

        .logo {
            display: flex;
            align-items: flex-start;
            gap: 15px;
            padding: 0 25px 25px;
            border-bottom: 1px solid #00000012;
            margin-bottom: 20px;
	        flex-direction: column;
        }

        .logo h1 {
            font-size: 1.6rem;
            font-weight: 700;
	        color: #fff;
            letter-spacing: -0.5px;
	        margin-top: 20px;
        }

        .logo svg {
            font-size: 30px;
            background: var(--btcolor);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: pulse 2s infinite;
        }

        .tabs {
            display: flex;
            flex-direction: column;
            background: none;
            max-width: none;
            margin: 0;
            border-radius: 0;
            padding: 0 20px;
            gap: 10px;
        }

        .tab-btn {
            width: 100%;
            padding: 12px 20px;
            background: none;
            border: none;
            color: #fff;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            justify-content: flex-start;
            border-radius: 10px;
            z-index: 1;
            box-shadow: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .tab-btn.active {
            box-shadow: none;
		    background: #00000012;
        }
        .tab-btn:hover:not(.active) {
            background: #00000012;
        }

        .main-content {
            flex-grow: 1;
            padding: 15px;
            overflow-y: hidden;
            min-width: 0;
            display: flex;
            flex-direction: column;
        }

        .tab-content {
            min-height: auto;
            padding: 0;
            min-width: auto;
            flex-grow: 1;
            display: flex;
        }

        .tab-pane { display: none; }
        .tab-pane.active { 
            display: flex; 
            flex-grow: 1;
            animation: fadeIn 0.5s ease;
        }

        .secondary-tabs {
            display: flex;
            background: transparent;
            border-radius: 0;
            margin-bottom: 10px;
            padding: 0 4px;
            border-bottom: 1px solid var(--line);
        }

        .secondary-tab-btn {
            flex: 1;
            padding: 0 15px 15px;
            background: none;
            border: none;
            color: var(--text2);
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;	
            justify-content: center;
            border-radius: 0;
            box-shadow: none;
            position: relative;
        }

        .secondary-tab-btn::after {
            content: '';
            position: absolute;
            left: 50%;
            bottom: -1px;
            transform: translateX(-50%);
            width: 0;
            height: 3px;
            background: var(--main-color);
            border-radius: 2px;
            transition: width 0.3s ease;
        }

        .secondary-tab-btn.active {
            background: transparent;
            color: var(--main-color);
            font-weight: 600;
            box-shadow: none;
        }

        .secondary-tab-btn.active::after {
            width: 50%;
        }

        .secondary-tab-btn:hover {
            color: var(--main-color);
        }
        .secondary-tab-btn:not(.active):hover::after {
            width: 40%;
        }

        .secondary-tab-pane { 
            display: none; 
            flex: 1;
            flex-direction: column;
            max-height: calc(100vh - 100px);
	    }
        .secondary-tab-pane.active { 
	        display: flex; 
    	    overflow-y: auto;
	        overflow-x: hidden;
	    }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }

        .panel {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 20px;
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            height: calc(100vh - 30px);
        }

        .panel h2 {
            font-size: 20px;
            margin-bottom: 10px;
            color: var(--text1);
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .panel-description {
            color: var(--text2);
            margin-bottom: 20px;
            font-size: 14px;
            line-height: 1.6;
        }
        .panel h2 svg {
            color: var(--main-color);
        }

        .panel-title-wrapper {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .reset-btn {
            background: var(--mainbg);
            color: var(--text2);
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 13px;
            border: 1px solid var(--line);
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 5px;
		    font-weight: 500;
        }

        .reset-btn:hover {
            background: var(--button);
            transform: translateY(-1px);
        }
        
        textarea, input[type="text"], input[type="password"], select {
            width: 100%;
            padding: 16px 16px 38px 16px;
            border-radius:12px;
            border: 1px solid var(--line);
            background: var(--mainbg);
            color: var(--text1);
            font-size: 15px;
            resize: vertical;
            transition: all 0.3s;
        }
        textarea { min-height: 160px; }
        
        .settings-item textarea {
            padding: 8px 18px !important;
            min-height: 130px !important;
        }

        textarea:focus, input[type="text"]:focus, input[type="password"]:focus, select:focus {
            outline: none;
            border-color: var(--main-color);
        }
        
        .input-wrapper {
            position: relative;
        }

        .btn-group {
            display: flex;
            gap: 15px;
            margin-top: 20px;
            justify-content: center;
        }

        button {
            padding: 10px 24px;
            border-radius: 24px;
            border: none;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            justify-content: center;
        }

        .btn-primary {
            background: var(--btcolor);
            color: white;
            box-shadow: 0 4px 15px rgba(89, 99, 255, 0.25);
        }

        .btn-primary:hover {
            opacity: 0.92;
            box-shadow: 0 7px 18px rgba(89, 99, 255, 0.35);
        }

        .btn-secondary {
            background: var(--card-bg);
            color: var(--text2);
            border: 1px solid var(--line);
        }

        .btn-secondary:hover {
            background: var(--btactive);
            color: var(--main-color);
            transform: translateY(-2px);
        }
        
        #clearChatBtn:hover, #clearExpandBtn:hover {
             color: #e74c3c;
             border-color: #f5c8c4;
        }

        .btn-disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none !important;
            box-shadow: none !important;
        }
        .upload-container {
            position: relative;
            border: 2px dashed var(--line);
            border-radius: 10px;
            padding: 20px 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
            background: var(--mainbg);
            min-height: 240px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .upload-container:hover {
            border-color: var(--main-color);
            background: var(--btactive);
        }

        .upload-icon {
            font-size: 36px;
            color: var(--main-color);
            margin-bottom: 18px;
            opacity: 0.7;
        }

        .upload-container p { color: var(--text3); font-size: 16px; }

        #imagePreview {
            max-width: 100%;
            max-height: 320px;
            border-radius: 12px;
            display: none;
            object-fit: contain;
            margin: 0 auto;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
        }

        .close-preview {
            position: absolute;
            top: 12px;
            right: 12px;
            color: rgba(0, 0, 0, 0.7);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
            font-size: 30px;
            transition: all 0.3s;
        }

        .close-preview:hover {
            color: rgba(0, 0, 0, 0.9);
            transform: rotate(90deg);
        }

        .response-area {
            margin-top: 30px;
            border-radius: 10px;
            border: 1px solid var(--line);
            min-height: 160px;
            max-height: 400px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
	        height: 100%;
        }

        .response-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--line);
	        padding: 12px 20px;
	        background: var(--card-bg);
            border-radius: 16px 16px 0 0;
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .response-header h3 {
            color: var(--text1);
            font-size: 17px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .response-header h3 svg { color: var(--main-color); }

        .copy-btn {
            background: none;
            border: none;
            color: var(--text2);
            cursor: pointer;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border-radius: 8px;
            background: var(--mainbg);
            transition: all 0.3s;
        }

        .copy-btn:hover {
            background: var(--btactive);
            color: var(--main-color);
            transform: translateY(-1px);
        }

        .response-content {
            color: var(--text2);
            line-height: 1.7;
            font-size: 15px;
	        margin: 20px;
            flex-grow: 1;
        }

        .settings-pane {
            background: var(--card-bg);
            border-radius: 10px;
            padding: 20px;
            width: 100%;
        }
        .settings-pane h2 {
            color: var(--text1);
            font-size: 24px;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 25px;
        }
        .settings-pane h2 svg { color: var(--main-color); }

        .settings-item { margin-bottom: 18px; }

        .settings-item label {
            display: block;
            margin-bottom: 8px;
            color: var(--text1);
            font-weight: 500;
            font-size: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
	        justify-content: space-between;
        }
        .settings-item select {
            -webkit-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238d8fa3' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 16px center;
        }


        .settings-item input, .settings-item textarea, .settings-item select {
            width: 100%;
            padding: 8px 18px;
            border-radius: 6px;
            font-size: 15px;
	        line-height: 1.5;
        }

        .settings-footer {
            display: flex;
            justify-content: flex-end;
            gap: 15px;
            margin-top: 25px;
        }
        
        .alert {
            position: fixed;
            top: 30px;
            left: 50%;
            transform: translateX(-50%);
            border-radius: 12px;
            color: white;
            box-shadow: 0 8px 25px var(--shadow);
            z-index: 1001;
            animation: fadeInOut 3s forwards;
            font-weight: 500;
            display: flex;
            align-items: center;
            padding: 10px 16px;
            gap: 0px;
        }
        .alert.success { 
            background: var(--success-color); 
        }
        .alert.error { background: var(--error-color); }


        @keyframes fadeInOut {
            0% { opacity: 0; transform: translate(-50%, -20px); }
            10% { opacity: 1; transform: translate(-50%, 0); }
            90% { opacity: 1; transform: translate(-50%, 0); }
            100% { opacity: 0; transform: translate(-50%, -20px); }
        }

        .loader {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin { to { transform: rotate(360deg); } }

        .status-indicator {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-left: 8px;
            box-shadow: 0 0 8px;
        }
        
        .status-online { background-color: var(--success-color); color: var(--success-color); }
        .status-offline { background-color: var(--error-color); color: var(--error-color); }

        .chat-history {
            display: flex;
    	    flex-direction: column;
    	    gap: 20px;
    	    flex-grow: 1; 
    	    overflow-y: auto;
    	    border-radius: 4px 4px 10px 10px;
    	    margin-bottom: 10px;
        }
        .chat-history::-webkit-scrollbar {
            width: 10px; 
            height: 10px; 
        }
        .chat-history::-webkit-scrollbar-track {
            background: #ffffff00;
            border-radius: 6px;
        }
        .chat-history::-webkit-scrollbar-thumb {
            background: #dddde5;
            border-radius: 6px;
            border: 2px solid transparent;
            background-clip: content-box;
        }
        .chat-history::-webkit-scrollbar-thumb:hover {
            background: #a9a9b152;
        }
        .chat-history::-webkit-scrollbar-corner {
            background: #00ffd242;
        }
        .history-placeholder {
            color: var(--text3);
            text-align: center;
            padding: 40px;
            font-style: italic;
            opacity: 0.7;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 15px;
            height: 100%;
        }
        .history-placeholder svg { font-size: 32px; }
        
        .message {
            display: flex;
            gap: 15px;
            max-width: 85%;
            animation: fadeIn 0.4s ease;
        }
        
        .user-message { align-self: flex-end; flex-direction: row-reverse; }
        .ai-message { align-self: flex-start; }
        
        .message-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--lightbg);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--main-color);
            font-size: 18px;
            flex-shrink: 0;
	        overflow: hidden;
        }

        .message-bubble {
            padding: 16px 20px;
            border-radius: 12px;
            word-break: break-word;
        }

        .user-message .message-bubble {
            background: var(--user-msg-bg);
            border-top-right-radius: 4px;
	        padding: 15px;
        }
        
        .ai-message .message-bubble {
            background: var(--lightbg);
            border-top-left-radius: 4px;
	        padding: 15px;
        }

        .ai-message.initial .message-bubble {
            background: radial-gradient(185% 45% at 100% 0%, #e6008100, #f9f9fe), linear-gradient(90deg, #D0EFFF, #d4dcff, #ffd9f2);
	        width: 480px;
        }

        .ai-message.initial .message-content strong {
            font-size: 1.25em;
            font-weight: bold;
	        line-height: 1.5;
        }
        
        .message-content {
            line-height: 1.3;
            white-space: pre-line;
            word-break: break-word;
            font-size: 15px;
        }

        .message-content strong {
            font-weight: 700;
        }

        .message-content h1,
        .message-content h2,
        .message-content h3,
        .message-content h4,
        .message-content h5,
        .message-content h6 {
            margin-top: 1em;
            margin-bottom: 0.5em;
            font-weight: bold;
            color: var(--text1);
        }

        .message-content h1 { font-size: 1.6em; }
        .message-content h2 { font-size: 1.4em; }
        .message-content h3 { font-size: 1.2em; }
        .message-content h4 { font-size: 1.1em; }
        .message-content h5 { font-size: 1em; }
        .message-content h6 { font-size: 0.9em; }

        .message-content ul,
        .message-content ol {
            margin-left: 20px;
            padding-left: 0;
            margin-bottom: 0;
        }

        .message-content ul li {
            list-style-type: disc;
            margin-bottom: 0;
        }

        .message-content ol li {
            list-style-type: decimal;
            margin-bottom: 0;
        }

        .message-content pre {
            background-color: #fff;
            border-radius: 8px;
            padding: 15px;
            overflow-x: auto;
            font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
            font-size: 0.9em;
            margin-top: 10px;
            margin-bottom: 10px;
            white-space: pre-wrap;
            word-break: break-all;
        }

        .message-content code {
            background-color: var(--lightbg);
            padding: 3px 6px;
            border-radius: 4px;
            font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
            font-size: 0.9em;
            color: var(--text2);
        }

        .message-content pre code {
            background-color: transparent;
            padding: 0;
            border-radius: 0;
            word-break: break-word;
        }

        .message-content img {
            max-width: 60px;
            max-height: 60px;
            border-radius: 8px;
            margin-right: 10px;
        }
        
        .message-footer {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            margin-top: 5px;
            gap: 15px;
        }
        
        .message-time { font-size: 12px; color: var(--text3); }
        
        .copy-message-btn {
            background: none; border: none;
            color: var(--text3);
            font-size: 14px; cursor: pointer;
            display: flex; align-items: center;
            gap: 4px; padding: 4px;
            border-radius: 6px;
            transition: all 0.3s;
        }
        .message-bubble:hover .copy-message-btn { opacity: 1; }
        .copy-message-btn:hover { background: var(--lightbg);}
        
        /* Chat Input Area */
        .chat-input-area {
            position: relative;
        }
        .chat-input-area .btn-group {
            position: absolute;
            right: 10px;
            bottom: -5px;
            transform: translateY(-50%);
            margin: 0;
            gap: 8px;
        }
        .chat-input-area .btn-group button {
            padding: 8px;
            width: 40px;
            height: 40px;
	        background: none;
            border: none;
        }
        
        #chatFilePreview {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 10px 0;
            border-radius: 8px;
            display: none;
            width: fit-content;
            background: none;
        }
        
        #chatFileDisplay {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            background-color: var(--lightbg);
            color: var(--text2);
            font-size: 20px;
            flex-shrink: 0;
        }

        #chatFileDisplay img {
            max-width: 100%;
            max-height: 100%;
            object-fit: cover;
            border-radius: 6px;
        }

        #chatFileDisplay svg {
            font-size: 20px;
        }

        #chatFilePreview span {
            font-size: 13px;
            color: var(--text2);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 180px;
    display: inline-block;
    vertical-align: middle;
        }
        #removeChatFile {
            font-size: 16px;
            margin-left: auto;
            color: var(--text3);
            cursor: pointer;
        }

        /* AI Vision Layout */
        .vision-layout {
            display: grid;
            gap: 25px;
            grid-template-columns: 0.65fr 1.5fr;
        }

        .vision-layout > div {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        .vision-layout .upload-container {
            margin-bottom: 0;
        }

        .vision-layout .response-area {
            margin-top: 0;
        }

        .vision-buttons {
            display: flex;
            justify-content: flex-end;
            gap: 15px;
            margin-bottom: 10px;
            margin-right: 10px;
        }
        .shezhik {
            overflow-y: auto;
            height: calc(100vh - 210px);
        }
        /* --- AI思考中动画 & 打字机效果样式 --- */
        .typing-dots {
            display: flex;
            gap: 4px;
            padding: 6px 4px;
            align-items: center;
            justify-content: flex-start;
            min-height: 24px;
        }

        .typing-dots span {
            width: 6px;
            height: 6px;
            background: #999;
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out both;
        }
        .tts-container { display: flex; flex-direction: column; gap: 20px; }
        .tts-controls { display: flex; gap: 15px; align-items: center; margin-top: 10px; }
        .tts-controls label { font-size: 14px; font-weight: 500; color: var(--text2); white-space: nowrap; }
        #voiceSelect { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--mainbg); font-size: 14px; }
        .audio-player { margin-top: 20px; display: none; }
        .audio-player audio { width: 100%; }
        .audio-actions { display: flex; justify-content: center; gap: 15px; margin-top: 15px; }
        
        .typing-dots span:nth-child(1) { animation-delay: -0.32s; }
        .typing-dots span:nth-child(2) { animation-delay: -0.16s; }
        .template-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
        .template-label { font-weight: 600; color: var(--text2); font-size: 16px; }
        .template-actions { display: flex; gap: 10px; }
        .template-btn { padding: 6px 12px; font-size: 13px; border-radius: 8px; background: var(--mainbg); border: 1px solid var(--line); cursor: pointer; display: flex; align-items: center; gap: 5px; }
        .template-btn:hover { background: var(--button); color: var(--main-color); }
        .template-description { color: var(--text3); font-size: 13px; margin-top: 8px; margin-bottom: 15px; line-height: 1.5; }
        @keyframes bounce {
            0%, 80%, 100% { transform: scale(0); }
            40% { transform: scale(1); }
        }
        /* 聊天输入框拖拽高亮效果 */
.chat-input-area.drag-over textarea {
    border-color: var(--main-color);
    background: var(--btactive);
    box-shadow: 0 0 10px rgba(90, 100, 255, 0.2);
}
/* --- AI 历史记录侧边栏样式 --- */
        .chat-container-layout {
            display: flex;
            gap: 15px;
            height: 100%;
            overflow: hidden;
        }
        .chat-main-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            overflow: hidden;
        }
        .chat-history-sidebar {
            width: 250px;
            background: var(--lightbg);
            border-radius: 10px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            border: 1px solid var(--line);
            flex-shrink: 0;
            overflow-y: auto;
        }
        .chat-history-item {
            padding: 10px 12px;
            background: var(--card-bg);
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            color: var(--text1);
            transition: all 0.2s;
            /* 注释或删除了之前这里的 white-space, overflow, text-overflow 属性，因为已经在 js 里单独给标题做防溢出了 */
        }
        .chat-history-item:hover { border-color: var(--main-color); }
        .chat-history-item.active {
            background: var(--btactive);
            color: var(--main-color);
            border-color: var(--main-color);
            font-weight: 500;
        }
        /* 本地记录空状态样式 */
.empty-history-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
    gap: 12px;
}

.empty-history-state svg {
    font-size: 28px;
    color: var(--text3);
    opacity: 0.4;
    margin-bottom: 5px;
}

.empty-history-state p {
    color: var(--text3);
    font-size: 14px;
    font-weight: 500;
}

.empty-history-state .btn-start {
    margin-top: 10px;
    padding: 8px 20px;
    font-size: 13px;
    border-radius: 20px;
    background: var(--btcolor);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.empty-history-state .btn-start:hover {
    transform: scale(1.05);
}
        .model-selet {
            margin-bottom: 8px; 
            position: absolute; 
            bottom: 10px; 
            left: 10px;
        }
        /* --- 移动端历史记录侧滑菜单所需样式 --- */
.mobile-history-toggle {
    display: none;
}
.history-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}
.history-overlay.show {
    display: block;
    opacity: 1;
}
/* --- 优化后的代码块专属样式 --- */
.code-block-wrapper {
    background-color: #1e1e1e; /* 统一的深色背景 */
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* 添加柔和阴影提升质感 */
    margin-top: 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: #2d2d2d; /* 顶栏稍微亮一点，形成视觉层次 */
    color: #b4b4b4;
    font-size: 12px;
    user-select: none; /* 防止双击顶栏时选中文本 */
    margin-top: -18px;
}

.code-lang {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-transform: uppercase;
    font-weight: 500;
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: #b4b4b4;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.copy-code-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background-color: transparent !important; /* 强制透明，使用 wrapper 的背景色 */
    border: none !important; /* 清除可能存在的全局边框 */
}

.code-block-wrapper code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #d4d4d4; /* 默认代码文字变为浅灰色 */
    font-size: 14px;
    line-height: 1.6;
    background-color: transparent !important; /* 强制透明 */
    padding: 0 !important;
}
/* ================= 新增：聊天节点进度条样式 ================= */
.chat-history-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.chat-nodes-sidebar {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 6px;
    border-radius: 30px;
    border: 1px solid var(--line);
    max-height: 75%;
    overflow-y: auto;
    transition: all 0.3s ease;
}

/* 隐藏滚动条 */
.chat-nodes-sidebar::-webkit-scrollbar {
    width: 0px;
}

/* 进度条背景连线 */
.chat-nodes-sidebar::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: var(--button);
    z-index: -1;
}

/* 单个数字节点 */
.chat-node-item {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--lightbg);
    border: 2px solid var(--button);
    color: var(--text2);
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.chat-node-item:hover {
    border-color:#5a64ff3d;
    color: var(--main-color);
    transform: scale(1.15);
}

/* 激活高亮状态 */
.chat-node-item.active {
    background: var(--main-color);
    border-color: var(--main-color);
    color: #fff;
}

@media (max-width: 768px) {
    .secondary-tab-btn {
        padding: 0 15px 5px;
    }
    .chat-nodes-sidebar {
        right: -4px;
        border-radius: 20px 0 0 20px;
        padding: 4px;
        background: none;
        border: none;
        backdrop-filter: none;
    }
    .chat-node-item:hover {
        transform: none;
    }
    .chat-container-layout { flex-direction: column; }
    .chat-main-area {
        position: relative; /* 为悬浮按钮提供参考 */
    }
    
    /* 悬浮按钮样式 */
    .mobile-history-toggle {
        display: flex;
        position: absolute;
        top: 0;
        right: 0;
        z-index: 10;
        padding: 8px;
        font-size: 12px;
        background: var(--card-bg);
        border: 1px solid var(--line);
        color: var(--text2);
    }

    /* 将历史记录面板改为侧滑抽屉 */
    .chat-history-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        right: -280px; /* 默认隐藏在屏幕右外侧 */
        width: 260px;
        height: auto;
        z-index: 1001;
        background: var(--lightbg);
        display: flex !important; /* 强制显示为flex */
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 16px 0 0 16px;
        box-shadow: -5px 0 25px rgba(0,0,0,0.15);
        padding: 20px 15px;
        border-right: none;
    }
    
    /* 激活状态滑入 */
    .chat-history-sidebar.show {
        right: 0;
    }
    .main-layout { 
                flex-direction: column-reverse;
            }
    .model-selet {
            top: 0px;
        right: 10px;
        position: relative;
        left: 0;
        }
            .ai-message.initial .message-bubble {
		        width: auto;
	        }
	        .secondary-tab-pane{
		        max-height: calc(100vh - 130px);
	        }
	        .settings-pane h2 {
		        justify-content: center;
            }
	        .settings-pane h2 svg {
		        display: none;
            }
	        .panel {padding: 16px; height: calc(100vh - 74px);}
            .sidebar {
                width: 100%;
                height: auto;
                flex-direction: row;
                padding: 6px 0;
                border-right: none;
                justify-content: center;
                align-items: center;
	            margin-left: 0;
	            background: #fff;
	            box-shadow: 0 -2px 10px #0000000d;
	            position: fixed;
                bottom: 0;
                z-index: 999;
            }
	        textarea {
                min-height: 110px;
                padding: 10px 10px 38px 10px;
            }
	        .shezhik {
		        max-height: 72vh; 
	            padding-right: 10px;
            }
	        .message {
		        gap: 8px;
            }
            .chat-input-area {
	            margin-bottom: 10px;
            }
            .logo {
                display: none;
            }
            .tabs {
                flex-direction: row;
                gap: 5px;
                flex-grow: 1;
                justify-content: space-around;
            }
            .tab-btn {
                flex: 1;
                text-align: center;
                justify-content: center;
                margin-bottom: 0;
                font-size: 12px;
		        padding: 0;
		        gap: 2px;
	            flex-direction: column;
	            color: var(--text3);
	            font-weight: 400;
            }
            .tab-btn.active {
                color: var(--main-color);
		        background: none;
            }
            .tab-btn svg {
                margin-right: 4px;
		        font-size: 16px;
            }
	        .panel h2 {
		        justify-content: center;
            }
	        .panel h2 svg {
		        display: none;
            }
	        .settings-footer {
	            position: fixed;
                bottom: 60.5px;
                background: #fff;
                z-index: 998;
                width: 90%;
                padding: 10px 0;
            }
            body  {
                background: #fff;
            }
            .main-content {
                padding: 0;
                padding-bottom: 80px;
                min-height: calc(100vh - 80px);
            }
            .vision-layout {
                flex-direction: column;
		        display: flex;
            }
	        .upload-container {min-height: 160px;}
            .settings-pane {padding: 20px 10px 20px 20px;}
	        .message-avatar {
		        display: none;
            }
        }