claude-code-cchui/src/app/globals.css
gaoziman ead84a1921 feat(组件): 新增 Mermaid 图表渲染组件
- 创建 MermaidBlock 组件支持流程图渲染
- 实现亮色/暗色双主题配色方案
- 支持主题切换时自动重新渲染
- 添加防抖处理优化流式输出体验
- 添加 Mermaid 背景色 CSS 变量
2025-12-27 22:31:52 +08:00

703 lines
15 KiB
CSS

@import "tailwindcss";
/* ========================================
LionCode UI - 设计令牌
基于原型图: https://openclaude.me/chat
======================================== */
:root {
/* 品牌色 */
--color-primary: #E06B3E;
--color-primary-hover: #D4643E;
--color-primary-light: #FEF3EF;
--color-primary-alpha: rgba(224, 107, 62, 0.1);
/* 背景色 */
--color-bg-primary: #FFFFFF;
--color-bg-secondary: #FAFAF9;
--color-bg-tertiary: #F7F7F8;
--color-bg-hover: #F3F4F6;
/* 文字色 */
--color-text-primary: #111827;
--color-text-secondary: #6B7280;
--color-text-tertiary: #9CA3AF;
--color-text-placeholder: #A0AEC0;
/* 边框色 */
--color-border: #E5E5E5;
--color-border-light: #F0F0F0;
--color-border-focus: #E06B3E;
/* 消息气泡色 */
--color-message-user: #EDE4DE;
--color-message-assistant-bg: #F7F7F6;
--color-message-assistant-border: #E8E8E8;
/* 阴影 */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
--shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.1);
--shadow-input: 0 2px 8px rgba(0, 0, 0, 0.04);
--shadow-input-focus: 0 4px 16px rgba(224, 107, 62, 0.1);
/* 布局 */
--sidebar-width: 280px;
--header-height: 56px;
--input-max-width: 900px;
/* 圆角 */
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
--radius-2xl: 18px;
--radius-full: 9999px;
/* 过渡 */
--transition-fast: 0.15s ease;
--transition-base: 0.2s ease;
--transition-slow: 0.3s ease;
/* 字体大小 */
--font-size-base: 15px;
/* ========================================
代码块颜色 - Claude 风格亮色主题
======================================== */
--color-code-bg: #F5F3F0;
--color-code-toolbar-bg: #EDEAE6;
--color-code-border: #E0DDD8;
--color-code-line-number: #A8A29E;
--color-code-line-border: #E0DDD8;
--color-code-text: #374151;
--color-code-toolbar-text: #78716C;
--color-code-toolbar-text-hover: #57534E;
--color-code-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
/* Mac 红黄绿按钮 - 亮色主题隐藏 */
--color-code-traffic-light-display: none;
/* Mermaid 图表背景 - 亮色主题,与代码块背景保持一致 */
--color-mermaid-bg: #F5F3F0;
}
/* ========================================
暗色模式
主背景色: #29252B
======================================== */
[data-theme="dark"] {
/* 品牌色 - 保持不变 */
--color-primary: #E06B3E;
--color-primary-hover: #E8805A;
--color-primary-light: rgba(224, 107, 62, 0.15);
--color-primary-alpha: rgba(224, 107, 62, 0.2);
/* 背景色 */
--color-bg-primary: #29252B;
--color-bg-secondary: #201D23;
--color-bg-tertiary: #332E38;
--color-bg-hover: #3A353E;
/* 文字色 */
--color-text-primary: #F5F5F5;
--color-text-secondary: #A8A8A8;
--color-text-tertiary: #6B6B6B;
--color-text-placeholder: #5A5A5A;
/* 边框色 */
--color-border: #3A353E;
--color-border-light: #332E38;
--color-border-focus: #E06B3E;
/* 消息气泡色 */
--color-message-user: #4A4352;
--color-message-assistant-bg: #332E38;
--color-message-assistant-border: #3A353E;
/* 阴影 - 暗色模式下增强 */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
--shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.4);
--shadow-input: 0 2px 8px rgba(0, 0, 0, 0.2);
--shadow-input-focus: 0 4px 16px rgba(224, 107, 62, 0.2);
/* ========================================
代码块颜色 - Mac Style 紫灰主题
与页面背景 #29252B 协调
======================================== */
--color-code-bg: #322D38;
--color-code-toolbar-bg: #29252B;
--color-code-border: #3A353E;
--color-code-line-number: #5A5560;
--color-code-line-border: #3A353E;
--color-code-text: #D4D4D8;
--color-code-toolbar-text: #8B8592;
--color-code-toolbar-text-hover: #D4D4D8;
--color-code-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
/* Mac 红黄绿按钮 - 暗色主题显示 */
--color-code-traffic-light-display: flex;
/* Mermaid 图表背景 - 暗色主题 */
--color-mermaid-bg: #3A353E;
}
@theme inline {
/* 品牌色 */
--color-primary: var(--color-primary);
--color-primary-hover: var(--color-primary-hover);
--color-primary-light: var(--color-primary-light);
/* 背景色 */
--color-background: var(--color-bg-secondary);
--color-foreground: var(--color-text-primary);
/* 字体 */
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
--font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
}
/* ========================================
全局样式
======================================== */
* {
box-sizing: border-box;
}
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
background-color: var(--color-bg-secondary);
color: var(--color-text-primary);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: var(--font-size-base);
line-height: 1.5;
min-height: 100vh;
}
/* ========================================
自定义滚动条
======================================== */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background-color: var(--color-border);
border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--color-text-tertiary);
}
/* 更细的滚动条 - 用于小区域 */
.scrollbar-thin::-webkit-scrollbar {
width: 4px;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.15);
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.25);
}
/* ========================================
动画
======================================== */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes popUp {
from {
opacity: 0;
transform: translateY(8px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.animate-fade-in {
animation: fadeIn var(--transition-base);
}
.animate-slide-up {
animation: slideUp var(--transition-base);
}
.animate-slide-down {
animation: slideDown var(--transition-fast);
}
.animate-pop-up {
animation: popUp 0.15s ease-out;
}
/* Modal 动画 */
@keyframes fadeInFast {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fadeOutFast {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes scaleInFast {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}
.animate-fade-in-fast {
animation: fadeInFast 0.15s ease-out;
}
.animate-fade-out-fast {
animation: fadeOutFast 0.15s ease-out;
}
.animate-scale-in-fast {
animation: scaleInFast 0.15s ease-out;
}
.animate-scale-in {
animation: scaleInFast 0.2s ease-out;
}
/* 卡片淡入上浮动画 */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-fade-in-up {
animation: fadeInUp 0.3s ease-out both;
}
/* ========================================
响应式设计
======================================== */
@media (max-width: 768px) {
:root {
--sidebar-width: 0px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
:root {
--sidebar-width: 220px;
}
}
/* ========================================
按钮样式
======================================== */
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 16px;
background-color: var(--color-primary);
color: white;
font-size: 14px;
font-weight: 500;
border-radius: var(--radius-md);
border: none;
cursor: pointer;
transition: background-color var(--transition-fast);
}
.btn-primary:hover {
background-color: var(--color-primary-hover);
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 16px;
background-color: transparent;
color: var(--color-text-secondary);
font-size: 14px;
font-weight: 500;
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
cursor: pointer;
transition: all var(--transition-fast);
}
.btn-ghost:hover {
background-color: var(--color-bg-hover);
color: var(--color-text-primary);
}
.btn-danger {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 16px;
background-color: #DC2626;
color: white;
font-size: 14px;
font-weight: 500;
border-radius: var(--radius-md);
border: none;
cursor: pointer;
transition: background-color var(--transition-fast);
}
.btn-danger:hover {
background-color: #B91C1C;
}
/* ========================================
设置页面选择器
======================================== */
.settings-select {
appearance: none;
background-color: var(--color-bg-primary);
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
padding: 8px 32px 8px 12px;
font-size: 14px;
color: var(--color-text-primary);
cursor: pointer;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 8px center;
min-width: 140px;
}
.settings-select:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: var(--shadow-input-focus);
}
/* ========================================
设置页面输入框
======================================== */
.settings-input {
appearance: none;
background-color: var(--color-bg-primary);
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
padding: 8px 12px;
font-size: 14px;
color: var(--color-text-primary);
}
.settings-input::placeholder {
color: var(--color-text-placeholder);
}
.settings-input:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: var(--shadow-input-focus);
}
.settings-input:disabled {
background-color: var(--color-bg-tertiary);
cursor: not-allowed;
}
/* ========================================
Prism.js 代码高亮样式
======================================== */
/* 基础样式 */
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
font-family: 'SF Mono', Monaco, 'Courier New', monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
tab-size: 4;
hyphens: none;
}
/* ========================================
亮色主题语法高亮 (Claude Style)
======================================== */
:root code[class*="language-"],
:root pre[class*="language-"] {
color: #374151;
}
:root .token.comment,
:root .token.prolog,
:root .token.doctype,
:root .token.cdata {
color: #9CA3AF;
font-style: italic;
}
:root .token.punctuation {
color: #6B7280;
}
:root .token.property,
:root .token.tag,
:root .token.boolean,
:root .token.number,
:root .token.constant,
:root .token.symbol,
:root .token.deleted {
color: #2563EB;
}
:root .token.selector,
:root .token.attr-name,
:root .token.string,
:root .token.char,
:root .token.builtin,
:root .token.inserted {
color: #059669;
}
:root .token.operator,
:root .token.entity,
:root .token.url,
:root .language-css .token.string,
:root .style .token.string {
color: #374151;
}
:root .token.atrule,
:root .token.attr-value,
:root .token.keyword {
color: #D97706;
font-weight: 500;
}
:root .token.function,
:root .token.class-name {
color: #7C3AED;
}
:root .token.regex,
:root .token.important,
:root .token.variable {
color: #DC2626;
}
:root .token.important,
:root .token.bold {
font-weight: bold;
}
:root .token.italic {
font-style: italic;
}
/* ========================================
暗色主题语法高亮 (Mac Style - 紫灰主题)
======================================== */
[data-theme="dark"] code[class*="language-"],
[data-theme="dark"] pre[class*="language-"] {
color: #D4D4D8;
}
[data-theme="dark"] .token.comment,
[data-theme="dark"] .token.prolog,
[data-theme="dark"] .token.doctype,
[data-theme="dark"] .token.cdata {
color: #6B6672;
font-style: italic;
}
[data-theme="dark"] .token.punctuation {
color: #A8A3AE;
}
[data-theme="dark"] .token.property,
[data-theme="dark"] .token.tag,
[data-theme="dark"] .token.boolean,
[data-theme="dark"] .token.number,
[data-theme="dark"] .token.constant,
[data-theme="dark"] .token.symbol,
[data-theme="dark"] .token.deleted {
color: #E8A87C;
}
[data-theme="dark"] .token.selector,
[data-theme="dark"] .token.attr-name,
[data-theme="dark"] .token.string,
[data-theme="dark"] .token.char,
[data-theme="dark"] .token.builtin,
[data-theme="dark"] .token.inserted {
color: #9DD68D;
}
[data-theme="dark"] .token.operator,
[data-theme="dark"] .token.entity,
[data-theme="dark"] .token.url,
[data-theme="dark"] .language-css .token.string,
[data-theme="dark"] .style .token.string {
color: #7DD3C0;
}
[data-theme="dark"] .token.atrule,
[data-theme="dark"] .token.attr-value,
[data-theme="dark"] .token.keyword {
color: #D4A5E8;
font-weight: 500;
}
[data-theme="dark"] .token.function,
[data-theme="dark"] .token.class-name {
color: #7EB8E8;
}
[data-theme="dark"] .token.regex,
[data-theme="dark"] .token.important,
[data-theme="dark"] .token.variable {
color: #E88A95;
}
[data-theme="dark"] .token.important,
[data-theme="dark"] .token.bold {
font-weight: bold;
}
[data-theme="dark"] .token.italic {
font-style: italic;
}
/* ========================================
消息搜索高亮动画
用于搜索跳转后高亮显示目标消息
风格:轻量闪烁,类似搜索引擎高亮
======================================== */
@keyframes messageHighlight {
0% {
background-color: rgba(255, 235, 120, 0.6);
}
100% {
background-color: transparent;
}
}
.message-highlight {
animation: messageHighlight 2.5s ease-out forwards;
border-radius: var(--radius-md);
}
/* 暗色模式下使用更暗的黄色 */
[data-theme="dark"] .message-highlight {
animation-name: messageHighlightDark;
}
@keyframes messageHighlightDark {
0% {
background-color: rgba(255, 200, 50, 0.25);
}
100% {
background-color: transparent;
}
}
/* ========================================
AI 图片生成加载动画
用于 Gemini 等图片生成模型
======================================== */
/* 闪光效果动画 - 从左到右的光线扫过 */
@keyframes shimmer {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
.animate-shimmer {
animation: shimmer 2s infinite;
}
/* 进度条动画 - 模拟加载进度 */
@keyframes progress {
0% {
width: 0%;
}
20% {
width: 15%;
}
40% {
width: 35%;
}
60% {
width: 55%;
}
80% {
width: 75%;
}
100% {
width: 90%;
}
}
.animate-progress {
animation: progress 8s ease-in-out infinite;
}