:root { --sidebar-width: 268px; --border-color: #e5e7eb; --bg-page: #ffffff; --bg-sidebar: #f7f7f8; --bg-hover: #ececf1; --text-primary: #1f2937; --text-secondary: #6b7280; --text-muted: #9ca3af; --bubble-user: #f1f5f9; --bubble-assistant: #ffffff; --code-bg: #f6f8fa; } * { box-sizing: border-box; } html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; color: var(--text-primary); background: var(--bg-page); -webkit-font-smoothing: antialiased; } /* ---------------- 滚动条:细一些,减少视觉噪音 ---------------- */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: #9ca3af; } /* ---------------- 消息正文排版 ---------------- */ /* * 消息正文:Markdown 渲染后的样式。 * * 注意这里**不能**再用 `white-space: pre-wrap` —— * 那是「按纯文本显示」时代的写法,用来保留原文换行。 * 现在内容已经是
/
/
的换行被重复计算,代码块行距翻倍 * 换行现在由 Markdown 自己负责(marked 的 breaks: true 把单换行转
)。 */ .message-content { line-height: 1.75; word-break: break-word; overflow-wrap: anywhere; } /* 段落之间留出间距,同时去掉首尾多余空隙,避免气泡上下被撑开 */ .message-content > :first-child { margin-top: 0; } .message-content > :last-child { margin-bottom: 0; } .message-content p { margin: 0 0 10px; } .message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 { margin: 16px 0 8px; font-weight: 600; line-height: 1.4; } .message-content h1 { font-size: 1.5em; } .message-content h2 { font-size: 1.3em; } .message-content h3 { font-size: 1.15em; } .message-content h4, .message-content h5, .message-content h6 { font-size: 1em; } .message-content ul, .message-content ol { margin: 0 0 10px; padding-left: 1.6em; } .message-content li { margin: 3px 0; } .message-content blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid #d1d5db; color: var(--text-secondary); } .message-content hr { border: none; border-top: 1px solid var(--border-color); margin: 14px 0; } /* 行内代码 */ .message-content code { background: var(--code-bg); padding: 2px 5px; border-radius: 4px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 0.9em; } /* * 代码块。注意要写在行内代码规则**之后**并覆盖 background/padding, * 否则会同时命中两条规则,出现「块里又套了一层底色」。 */ .message-content pre { background: #f6f8fa; border: 1px solid var(--border-color); border-radius: 8px; padding: 12px 14px; margin: 0 0 10px; /* 代码不换行,过长时横向滚动;纵向交给外层消息列表 */ overflow-x: auto; line-height: 1.6; } .message-content pre code { background: none; padding: 0; border-radius: 0; font-size: 12.5px; white-space: pre; } /* 表格 */ .message-content table { border-collapse: collapse; margin: 0 0 10px; display: block; overflow-x: auto; max-width: 100%; } .message-content th, .message-content td { border: 1px solid var(--border-color); padding: 6px 10px; text-align: left; } .message-content th { background: #f9fafb; font-weight: 600; } .message-content a { color: #0f766e; text-decoration: none; } .message-content a:hover { text-decoration: underline; } /* ---------------- 打字光标 ---------------- */ .typing-cursor::after { content: '▍'; margin-left: 1px; animation: blink 1s step-end infinite; color: var(--text-secondary); } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } /* ---------------- 通用工具类 ---------------- */ .text-secondary { color: var(--text-secondary); } .text-muted { color: var(--text-muted); } .flex-center { display: flex; align-items: center; justify-content: center; } .empty-hint { color: var(--text-muted); font-size: 13px; text-align: center; }