tavern-harness 0.1.32 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /* ============================================================
2
2
  Tavern Harness — 全局样式(酒馆主题)
3
- 设计语言:暖色木质 + 渐变色玻璃 + 微妙纹理
3
+ 设计语言:暖色木质 + 纯色悬浮卡片 + 清晰层级
4
4
  ============================================================ */
5
5
 
6
6
  :root {
@@ -208,20 +208,39 @@ body {
208
208
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
209
209
  }
210
210
 
211
- ::-webkit-scrollbar {
212
- width: 9px;
213
- height: 9px;
211
+ /* 原生滚动条完全隐藏:改用 autoHideScrollbars.ts 绘制的悬浮细条,
212
+ 既不占布局宽度,也能在静止后自动淡出。 */
213
+ * {
214
+ scrollbar-width: none;
214
215
  }
215
- ::-webkit-scrollbar-thumb {
216
- background: var(--border);
217
- border-radius: 8px;
218
- border: 2px solid transparent;
219
- background-clip: content-box;
216
+ *::-webkit-scrollbar {
217
+ display: none;
218
+ width: 0;
219
+ height: 0;
220
+ }
221
+ .th-scrollbar-layer {
222
+ position: fixed;
223
+ inset: 0;
224
+ z-index: 9500;
225
+ overflow: hidden;
226
+ pointer-events: none;
227
+ }
228
+ .th-scrollbar-thumb {
229
+ position: absolute;
230
+ border-radius: 999px;
231
+ background: color-mix(in srgb, var(--text-muted) 62%, transparent);
232
+ opacity: 0;
233
+ transition: opacity 0.3s ease;
234
+ will-change: top, left, width, height;
220
235
  }
221
- ::-webkit-scrollbar-thumb:hover {
222
- background: var(--text-faint);
223
- border: 2px solid transparent;
224
- background-clip: content-box;
236
+ .th-scrollbar-thumb.is-visible {
237
+ opacity: 1;
238
+ }
239
+ .th-scrollbar-thumb--v {
240
+ width: 6px;
241
+ }
242
+ .th-scrollbar-thumb--h {
243
+ height: 6px;
225
244
  }
226
245
 
227
246
  button {
@@ -369,8 +388,10 @@ html.wechat-android .model-option-name {
369
388
  position: relative;
370
389
  z-index: 1;
371
390
  display: grid;
372
- grid-template-columns: var(--sidebar-w, 356px) 1fr;
391
+ grid-template-columns: var(--sidebar-w, 356px) minmax(0, 1fr);
392
+ gap: 14px;
373
393
  height: 100dvh;
394
+ padding: 14px;
374
395
  }
375
396
 
376
397
  /* ---------- 侧边栏 ---------- */
@@ -383,32 +404,49 @@ html.wechat-android .model-option-name {
383
404
  会把整个侧边栏撑高、把底部搜索框挤出屏幕;必须显式允许收缩 */
384
405
  min-height: 0;
385
406
  overflow: hidden;
386
- border-right: 1px solid var(--border);
387
- /* 侧边栏保持不透明:透出背景噪点会让会话列表文字对比变弱,
388
- 纯 surface 底色更干净、文字更清晰。 */
407
+ border: 1px solid var(--border);
408
+ border-radius: var(--radius-lg);
389
409
  background: var(--surface);
410
+ box-shadow: var(--shadow-shell);
390
411
  }
391
- /* 拖拽手柄 */
412
+ /* 拖拽手柄:固定定位在两张卡片之间的 14px 间隙中央。
413
+ 之所以用 fixed,是因为 .sidebar 有 overflow: hidden,绝对定位的
414
+ 手柄会被圆角裁掉;fixed 相对视口定位还能避开裁剪。 */
392
415
  .sidebar-resizer {
393
- position: absolute;
394
- top: 0;
395
- right: -4px;
396
- width: 8px;
397
- height: 100%;
416
+ position: fixed;
417
+ top: 14px;
418
+ left: calc(var(--sidebar-w, 356px) + 16px);
419
+ width: 10px;
420
+ height: calc(100dvh - 28px);
421
+ display: flex;
422
+ align-items: center;
423
+ justify-content: center;
398
424
  cursor: col-resize;
425
+ touch-action: none;
399
426
  z-index: 30;
400
- transition: background 0.15s;
401
427
  }
402
- .sidebar-resizer:hover {
403
- background: color-mix(in srgb, var(--primary) 30%, transparent);
428
+ /* 小竖条本体:默认低调,悬停 / 拖拽时点亮并略微伸长 */
429
+ .sidebar-resizer::before {
430
+ content: '';
431
+ width: 4px;
432
+ height: 56px;
433
+ border-radius: 999px;
434
+ background: color-mix(in srgb, var(--text-faint) 55%, transparent);
435
+ transition: background 0.18s ease, width 0.18s ease, height 0.18s ease;
436
+ }
437
+ .sidebar-resizer:hover::before {
438
+ background: var(--primary);
439
+ height: 76px;
440
+ }
441
+ body.resizing .sidebar-resizer::before {
442
+ width: 5px;
443
+ height: 76px;
444
+ background: var(--primary);
404
445
  }
405
446
  body.resizing {
406
447
  cursor: col-resize;
407
448
  user-select: none;
408
449
  }
409
- body.resizing .sidebar-resizer {
410
- background: color-mix(in srgb, var(--primary) 45%, transparent);
411
- }
412
450
  .sidebar-head {
413
451
  padding: 14px 14px 10px;
414
452
  }
@@ -460,7 +498,7 @@ body.resizing .sidebar-resizer {
460
498
  width: 38px;
461
499
  height: 38px;
462
500
  border-radius: 50%;
463
- background: radial-gradient(circle at 35% 30%, var(--grad-from), var(--grad-to) 88%);
501
+ background: var(--grad-from);
464
502
  display: grid;
465
503
  place-items: center;
466
504
  color: #fff;
@@ -1012,12 +1050,13 @@ body.resizing .sidebar-resizer {
1012
1050
  }
1013
1051
  .select {
1014
1052
  appearance: none;
1053
+ /* 自绘箭头:距右边框留出约 14px,避免按钮贴在边框上 */
1015
1054
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
1016
1055
  linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
1017
- background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
1056
+ background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%;
1018
1057
  background-size: 5px 5px;
1019
1058
  background-repeat: no-repeat;
1020
- padding-right: 28px;
1059
+ padding-right: 32px;
1021
1060
  cursor: pointer;
1022
1061
  }
1023
1062
  .check {
@@ -1059,11 +1098,14 @@ body.resizing .sidebar-resizer {
1059
1098
  display: flex;
1060
1099
  flex-direction: column;
1061
1100
  min-width: 0;
1062
- height: 100dvh;
1101
+ min-height: 0;
1102
+ height: 100%;
1063
1103
  position: relative;
1064
- /* 与侧边栏一致:实色底,不再叠 backdrop-filter。半透明磨砂在这里
1065
- 实际看不出差别,反而多一层合成开销。 */
1104
+ overflow: hidden;
1105
+ border: 1px solid var(--border);
1106
+ border-radius: var(--radius-lg);
1066
1107
  background: var(--surface);
1108
+ box-shadow: var(--shadow-shell);
1067
1109
  }
1068
1110
 
1069
1111
  /* 右侧所有 Tab 共用同一块主区域实色底。 */
@@ -1075,6 +1117,7 @@ body.resizing .sidebar-resizer {
1075
1117
  flex: 1;
1076
1118
  min-width: 0;
1077
1119
  min-height: 0;
1120
+ position: relative;
1078
1121
  }
1079
1122
  .view-slot[data-active='false'] {
1080
1123
  display: none;
@@ -1116,14 +1159,31 @@ body.resizing .sidebar-resizer {
1116
1159
 
1117
1160
  /* ---------- 聊天头部 ---------- */
1118
1161
  .chat-header {
1162
+ position: absolute;
1163
+ inset: var(--chat-header-offset, 12px) var(--chat-header-offset, 12px) auto;
1119
1164
  display: flex;
1120
1165
  align-items: center;
1121
1166
  gap: 12px;
1167
+ min-height: var(--chat-header-h, 65px);
1122
1168
  padding: 12px 22px;
1123
- border-bottom: 1px solid var(--border);
1124
- background: transparent;
1169
+ border: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
1170
+ border-radius: var(--radius);
1171
+ background: color-mix(in srgb, var(--surface) 38%, transparent);
1172
+ -webkit-backdrop-filter: blur(22px) saturate(160%);
1173
+ backdrop-filter: blur(22px) saturate(160%);
1174
+ box-shadow: 0 6px 20px rgb(0 0 0 / 18%);
1175
+ overflow: visible;
1125
1176
  z-index: 5;
1126
1177
  }
1178
+
1179
+ .chat-header-group {
1180
+ right: calc(210px + var(--chat-header-offset, 12px));
1181
+ }
1182
+
1183
+ /* 消息滚动层从悬浮卡片背后穿过,内容初始位置仍避开标题栏。 */
1184
+ .view-slot > .chat-main-row .chat-scroll {
1185
+ padding-top: calc(20px + var(--chat-header-h, 65px) + var(--chat-header-offset, 12px));
1186
+ }
1127
1187
  .avatar {
1128
1188
  width: 40px;
1129
1189
  height: 40px;
@@ -1290,8 +1350,11 @@ body.resizing .sidebar-resizer {
1290
1350
  .dash-hero::before {
1291
1351
  content: '';
1292
1352
  position: absolute;
1293
- inset: -40% -20%;
1294
- background: radial-gradient(ellipse at 50% -20%, color-mix(in srgb, var(--glow) 42%, transparent), transparent 65%);
1353
+ top: 0;
1354
+ right: 0;
1355
+ left: 0;
1356
+ height: 4px;
1357
+ background: var(--primary);
1295
1358
  pointer-events: none;
1296
1359
  }
1297
1360
  .dash-hero h1 {
@@ -1310,7 +1373,7 @@ body.resizing .sidebar-resizer {
1310
1373
  white-space: pre-line;
1311
1374
  line-height: 1.7;
1312
1375
  }
1313
- /* 欢迎语中的强调句:衬线 + 琥珀渐变 + 微放大,克制而醒目 */
1376
+ /* 欢迎语中的强调句:衬线 + 品牌色 + 微放大,克制而醒目 */
1314
1377
  .dash-hero-accent {
1315
1378
  display: block;
1316
1379
  margin-top: 6px;
@@ -1319,17 +1382,6 @@ body.resizing .sidebar-resizer {
1319
1382
  font-weight: var(--font-weight-semibold);
1320
1383
  letter-spacing: 0.3px;
1321
1384
  color: var(--text-accent);
1322
- background: linear-gradient(
1323
- 100deg,
1324
- color-mix(in srgb, var(--primary) 88%, #fff) 0%,
1325
- var(--primary) 42%,
1326
- color-mix(in srgb, var(--primary) 70%, #ffd9a8) 100%
1327
- );
1328
- -webkit-background-clip: text;
1329
- background-clip: text;
1330
- -webkit-text-fill-color: transparent;
1331
- color: var(--text-accent);
1332
- filter: drop-shadow(0 1px 0 color-mix(in srgb, var(--bg) 40%, transparent));
1333
1385
  }
1334
1386
  .dash-hero .actions {
1335
1387
  position: relative;
@@ -1475,7 +1527,7 @@ body.resizing .sidebar-resizer {
1475
1527
  flex: 1;
1476
1528
  max-width: 120px;
1477
1529
  height: 1px;
1478
- background: linear-gradient(to right, var(--border), transparent);
1530
+ background: var(--border);
1479
1531
  }
1480
1532
 
1481
1533
  /* ---------- 彩色首字母(低饱和度暖色调,与暖核桃木夜风格统一) ---------- */
@@ -1571,7 +1623,7 @@ body.resizing .sidebar-resizer {
1571
1623
  place-items: center;
1572
1624
  font-size: calc(var(--font-size-display) * 2);
1573
1625
  border-radius: 50%;
1574
- background: linear-gradient(160deg, #ffe9a8, #f5c24d 55%, #d99a2b);
1626
+ background: #f5c24d;
1575
1627
  box-shadow:
1576
1628
  0 0 0 6px rgba(255, 233, 168, 0.25),
1577
1629
  0 0 0 12px rgba(255, 233, 168, 0.12),
@@ -1587,7 +1639,7 @@ body.resizing .sidebar-resizer {
1587
1639
  position: absolute;
1588
1640
  inset: -34px;
1589
1641
  border-radius: 50%;
1590
- background: radial-gradient(circle, rgba(255, 210, 110, 0.55), transparent 62%);
1642
+ background: rgba(255, 210, 110, 0.22);
1591
1643
  animation: trophyGlow 2.2s ease-in-out infinite;
1592
1644
  }
1593
1645
  @keyframes trophyIn {
@@ -1776,6 +1828,7 @@ hr.sep {
1776
1828
  left: 0;
1777
1829
  right: 0;
1778
1830
  display: block;
1831
+ padding: 0;
1779
1832
  /* 默认等于布局视口;键盘收起、Edge 底部工具栏尚未归位时,
1780
1833
  mobileViewport.ts 会写入 --app-height 先按最终高度排版。 */
1781
1834
  height: var(--app-height, 100%);
@@ -1786,6 +1839,9 @@ hr.sep {
1786
1839
  height: calc(100% - var(--mobile-topbar-h) - env(safe-area-inset-top));
1787
1840
  min-height: 0;
1788
1841
  margin-top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top));
1842
+ border: 0;
1843
+ border-radius: 0;
1844
+ box-shadow: none;
1789
1845
  }
1790
1846
 
1791
1847
  .chat-main-row {
@@ -1918,6 +1974,8 @@ hr.sep {
1918
1974
  height: calc(var(--app-height, 100%) - var(--mobile-topbar-h) - env(safe-area-inset-top));
1919
1975
  transform: translateX(-105%);
1920
1976
  transition: transform 0.2s ease;
1977
+ border-left: 0;
1978
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
1921
1979
  box-shadow: var(--shadow-lg);
1922
1980
  }
1923
1981
 
@@ -1934,11 +1992,18 @@ hr.sep {
1934
1992
  }
1935
1993
 
1936
1994
  .chat-header {
1937
- min-height: 60px;
1995
+ --chat-header-h: 60px;
1996
+ --chat-header-offset: 8px;
1997
+ min-height: var(--chat-header-h);
1938
1998
  padding: 8px 12px;
1999
+ border-radius: var(--radius);
1939
2000
  gap: 8px;
1940
2001
  }
1941
2002
 
2003
+ .chat-header-group {
2004
+ right: var(--chat-header-offset);
2005
+ }
2006
+
1942
2007
  .chat-header .tinfo {
1943
2008
  flex: 1 1 auto;
1944
2009
  min-width: 0;
@@ -2039,8 +2104,8 @@ hr.sep {
2039
2104
  background: var(--danger-soft);
2040
2105
  }
2041
2106
 
2042
- .chat-scroll {
2043
- padding-top: 14px;
2107
+ .view-slot > .chat-main-row .chat-scroll {
2108
+ padding-top: calc(14px + var(--chat-header-h, 60px) + var(--chat-header-offset, 8px));
2044
2109
  }
2045
2110
 
2046
2111
  .chat-col {
@@ -1,27 +1,53 @@
1
+ import type { ThemePaletteId } from '../types/models';
2
+
1
3
  export type ThemeMode = 'system' | 'light' | 'dark';
4
+ export type { ThemePaletteId } from '../types/models';
2
5
 
3
6
  interface ThemePalette {
4
- /** 深色模式主色(烛光发光色,浅亮) */
5
7
  primary: string;
6
- /** 浅色模式主色(在羊皮纸背景上有足够对比的深色变体) */
7
8
  primaryLight: string;
8
9
  primaryDim: string;
9
10
  accentSoft: string;
10
- /** 聊天栏气泡渐变端点 */
11
11
  gradientFrom: string;
12
12
  gradientTo: string;
13
13
  glow: string;
14
+ lightBg: string;
15
+ lightBgDeep: string;
16
+ lightSurface: string;
17
+ lightSurface2: string;
18
+ lightSurface3: string;
19
+ darkBg: string;
20
+ darkBgDeep: string;
21
+ darkSurface: string;
22
+ darkSurface2: string;
23
+ darkSurface3: string;
14
24
  }
15
25
 
16
- /** 固定主题色:赛博琥珀(与 MyAgent-Android 温暖烛光一致) */
17
- const AMBER_PALETTE: ThemePalette = {
18
- primary: '#FFCB8B',
19
- primaryLight: '#9A5B17',
20
- primaryDim: '#C88A3F',
21
- accentSoft: 'rgba(255,203,139,0.16)',
22
- gradientFrom: '#d9a673',
23
- gradientTo: '#d9a673',
24
- glow: 'rgba(255,178,96,0.34)',
26
+ const PALETTES: Record<ThemePaletteId, ThemePalette> = {
27
+ amber: {
28
+ primary: '#FFCB8B', primaryLight: '#9A5B17', primaryDim: '#C88A3F', accentSoft: 'rgba(255,203,139,0.16)',
29
+ gradientFrom: '#d9a673', gradientTo: '#d9a673', glow: 'rgba(255,178,96,0.34)',
30
+ lightBg: '#F7F0E4', lightBgDeep: '#E9DDCA', lightSurface: '#FFFDF8', lightSurface2: '#F3E7D5', lightSurface3: '#DFCFB8',
31
+ darkBg: '#20160E', darkBgDeep: '#0f0b06', darkSurface: '#211A10', darkSurface2: '#2B2215', darkSurface3: '#362A1A',
32
+ },
33
+ jade: {
34
+ primary: '#8EDDB8', primaryLight: '#217052', primaryDim: '#55A982', accentSoft: 'rgba(142,221,184,0.16)',
35
+ gradientFrom: '#68C49A', gradientTo: '#9BD6B9', glow: 'rgba(75,205,145,0.30)',
36
+ lightBg: '#F2F4F3', lightBgDeep: '#DDE1DF', lightSurface: '#FFFFFF', lightSurface2: '#E9ECEA', lightSurface3: '#D3D8D5',
37
+ darkBg: '#151918', darkBgDeep: '#0B0E0D', darkSurface: '#1D2220', darkSurface2: '#282E2B', darkSurface3: '#353C38',
38
+ },
39
+ rose: {
40
+ primary: '#F2A6B8', primaryLight: '#9B405A', primaryDim: '#C97088', accentSoft: 'rgba(242,166,184,0.16)',
41
+ gradientFrom: '#DF8FA7', gradientTo: '#F0B0A4', glow: 'rgba(235,123,157,0.30)',
42
+ lightBg: '#F8EFF1', lightBgDeep: '#EBD9DE', lightSurface: '#FFFCFD', lightSurface2: '#F4E4E8', lightSurface3: '#E2CAD1',
43
+ darkBg: '#201216', darkBgDeep: '#12090C', darkSurface: '#29191E', darkSurface2: '#362128', darkSurface3: '#452B34',
44
+ },
45
+ indigo: {
46
+ primary: '#AEBBFF', primaryLight: '#4D5FA8', primaryDim: '#7889D5', accentSoft: 'rgba(174,187,255,0.16)',
47
+ gradientFrom: '#899CF0', gradientTo: '#B39DEB', glow: 'rgba(123,145,255,0.32)',
48
+ lightBg: '#F0F1F8', lightBgDeep: '#DCDFF0', lightSurface: '#FDFDFF', lightSurface2: '#E7E9F5', lightSurface3: '#CDD1E5',
49
+ darkBg: '#111522', darkBgDeep: '#090B13', darkSurface: '#191E2D', darkSurface2: '#22283B', darkSurface3: '#2D354D',
50
+ },
25
51
  };
26
52
 
27
53
  function isDarkMode(mode: ThemeMode): boolean {
@@ -48,17 +74,17 @@ export function watchSystemTheme(onChange: () => void): void {
48
74
  }
49
75
 
50
76
  const THEME_CACHE_KEY = 'tav-theme-mode';
77
+ const THEME_PALETTE_CACHE_KEY = 'tav-theme-palette';
51
78
 
52
- /** 同步写出主题模式缓存,供下次页面加载首帧直接取用(消除刷新闪动) */
53
- export function cacheThemeMode(mode: ThemeMode): void {
79
+ export function cacheTheme(mode: ThemeMode, palette: ThemePaletteId): void {
54
80
  try {
55
81
  localStorage.setItem(THEME_CACHE_KEY, mode);
82
+ localStorage.setItem(THEME_PALETTE_CACHE_KEY, palette);
56
83
  } catch {
57
84
  // 隐私模式等环境下忽略
58
85
  }
59
86
  }
60
87
 
61
- /** 读取缓存的主题模式(可能为 null) */
62
88
  function cachedThemeMode(): ThemeMode | null {
63
89
  try {
64
90
  const v = localStorage.getItem(THEME_CACHE_KEY);
@@ -68,19 +94,39 @@ function cachedThemeMode(): ThemeMode | null {
68
94
  }
69
95
  }
70
96
 
71
- /** 应用主题 CSS 变量到 :root(固定使用琥珀色主题) */
72
- export function applyTheme(mode: ThemeMode): void {
97
+ function cachedThemePalette(): ThemePaletteId {
98
+ try {
99
+ const v = localStorage.getItem(THEME_PALETTE_CACHE_KEY);
100
+ return v === 'jade' || v === 'rose' || v === 'indigo' ? v : 'amber';
101
+ } catch {
102
+ return 'amber';
103
+ }
104
+ }
105
+
106
+ export function applyTheme(mode: ThemeMode, palette: ThemePaletteId = 'amber'): void {
73
107
  const dark = isDarkMode(mode);
74
- const p = AMBER_PALETTE;
108
+ const p = PALETTES[palette];
75
109
  const root = document.documentElement;
76
110
  const is = (light: string, darkV: string) => (dark ? darkV : light);
111
+ const lightText = palette === 'amber' ? '#30251C' : palette === 'jade' ? '#26312D' : palette === 'rose' ? '#38262C' : '#252A3D';
112
+ const lightTextDim = palette === 'amber' ? '#66574A' : palette === 'jade' ? '#5B6661' : palette === 'rose' ? '#705761' : '#5B6178';
113
+ const bubbleUser = palette === 'jade'
114
+ ? is('color-mix(in srgb, var(--primary) 10%, #D8DDDA)', 'color-mix(in srgb, var(--primary) 12%, #3A403D)')
115
+ : 'color-mix(in srgb, var(--primary) 20%, transparent)';
116
+ const bubbleNpc = palette === 'jade'
117
+ ? is('#FFFFFF', '#202624')
118
+ : is('color-mix(in srgb, var(--primary) 4%, var(--surface))', 'color-mix(in srgb, var(--primary) 7%, var(--surface))');
119
+ const bubbleBorder = palette === 'jade'
120
+ ? is('color-mix(in srgb, var(--primary) 10%, #B8C0BC)', 'color-mix(in srgb, var(--primary) 13%, #59615D)')
121
+ : is('color-mix(in srgb, var(--primary) 14%, var(--border))', 'color-mix(in srgb, var(--primary) 18%, var(--border))');
77
122
 
78
123
  root.dataset.theme = dark ? 'dark' : 'light';
124
+ root.dataset.palette = palette;
79
125
  root.style.colorScheme = dark ? 'dark' : 'light';
80
- root.style.backgroundColor = dark ? '#20160E' : '#F7F0E4';
126
+ root.style.backgroundColor = dark ? p.darkBg : p.lightBg;
81
127
  document.querySelector<HTMLMetaElement>('meta[name="theme-color"]')?.setAttribute(
82
128
  'content',
83
- dark ? '#20160E' : '#F7F0E4',
129
+ dark ? p.darkBg : p.lightBg,
84
130
  );
85
131
 
86
132
  const vars: Record<string, string> = {
@@ -92,32 +138,44 @@ export function applyTheme(mode: ThemeMode): void {
92
138
  '--grad-to': is(p.primaryLight, p.gradientTo),
93
139
  '--glow': is('color-mix(in srgb, var(--primary) 28%, transparent)', p.glow),
94
140
 
95
- '--bg': is('#F7F0E4', '#17120A'),
96
- '--bg-deep': is('#E9DDCA', '#0f0b06'),
97
- '--surface': is('#FFFDF8', '#211A10'),
98
- '--surface-2': is('#F3E7D5', '#2B2215'),
99
- '--surface-3': is('#DFCFB8', '#362A1A'),
141
+ '--bg': is(p.lightBg, p.darkBg),
142
+ '--bg-deep': is(p.lightBgDeep, p.darkBgDeep),
143
+ '--surface': is(p.lightSurface, p.darkSurface),
144
+ '--surface-2': is(p.lightSurface2, p.darkSurface2),
145
+ '--surface-3': is(p.lightSurface3, p.darkSurface3),
100
146
  '--border': is('rgba(60,40,10,0.14)', 'rgba(255,214,160,0.13)'),
101
147
  '--border-soft': is('rgba(60,40,10,0.08)', 'rgba(255,214,160,0.07)'),
102
148
 
103
- '--text': is('#30251C', '#F2EADC'),
104
- '--text-dim': is('#66574A', '#AA9C86'),
105
- '--text-faint': is('#887665', '#6f6352'),
149
+ '--text': is(lightText, '#F1F0EC'),
150
+ '--text-dim': is(lightTextDim, '#AAA8A2'),
151
+ '--text-faint': is(`color-mix(in srgb, ${lightTextDim} 76%, transparent)`, '#74736F'),
106
152
 
107
- // 用户气泡:全场唯一保留品牌色的实心块。浓度提到 20% 才和
108
- // 思考/工具的浅色卡片拉开层级(11% 时与 --surface-2 只差 3 个色阶)
109
- '--bubble-user': 'color-mix(in srgb, var(--primary) 20%, transparent)',
110
- '--bubble-border-user': is('color-mix(in srgb, var(--primary) 34%, transparent)', 'color-mix(in srgb, var(--primary) 30%, transparent)'),
111
- '--bubble-npc': is('#FDFBF5', '#241C12'),
112
- '--bubble-border': is('rgba(60,40,10,0.12)', 'rgba(255,214,160,0.10)'),
153
+ // 翡翠配色中,普通消息使用白/灰中性色,绿色仅保留为强调色,
154
+ // 避免与成功状态的功能绿混淆。
155
+ '--bubble-user': bubbleUser,
156
+ '--bubble-border-user': palette === 'jade'
157
+ ? is('color-mix(in srgb, var(--primary) 18%, #A9B1AD)', 'color-mix(in srgb, var(--primary) 20%, #68706C)')
158
+ : is('color-mix(in srgb, var(--primary) 34%, transparent)', 'color-mix(in srgb, var(--primary) 30%, transparent)'),
159
+ '--bubble-npc': bubbleNpc,
160
+ '--bubble-border': bubbleBorder,
113
161
 
114
162
  // 思考过程:暖紫。借头像色板里的 #A98DB5,浅色模式下压深以保证
115
163
  // 12.5px 小字可读,深色模式下提亮。紫色是唯一没被语义占用的色相
116
164
  //(琥珀=用户 / 绿=成功 / 红=失败),和用户气泡区分度最大。
117
165
  '--think': is('#7A5E8C', '#C6A9D6'),
118
166
 
119
- '--code-bg': is('#ece4d2', '#282015'),
120
- '--code-bg-inline': is('#e6dcc6', '#382C1B'),
167
+ '--code-bg': is(
168
+ 'color-mix(in srgb, var(--primary) 5%, var(--surface-2))',
169
+ 'color-mix(in srgb, var(--primary) 7%, var(--surface-2))',
170
+ ),
171
+ '--code-bg-inline': is(
172
+ 'color-mix(in srgb, var(--primary) 8%, var(--surface-3))',
173
+ 'color-mix(in srgb, var(--primary) 11%, var(--surface-3))',
174
+ ),
175
+ '--code-keyword': 'var(--primary)',
176
+ '--code-string': 'color-mix(in srgb, var(--success) 82%, var(--text))',
177
+ '--code-number': 'color-mix(in srgb, var(--primary) 62%, var(--think))',
178
+ '--code-type': 'color-mix(in srgb, var(--primary) 48%, var(--text))',
121
179
  '--tag-bg': is('color-mix(in srgb, var(--primary) 11%, transparent)', 'color-mix(in srgb, var(--primary) 13%, transparent)'),
122
180
  '--tag-text': is('var(--primary)', 'color-mix(in srgb, var(--primary) 78%, #e8cfa0)'),
123
181
 
@@ -130,15 +188,10 @@ export function applyTheme(mode: ThemeMode): void {
130
188
 
131
189
  '--shadow': is('0 1px 2px rgba(60,40,10,0.05), 0 4px 16px rgba(60,40,10,0.10)', '0 2px 10px rgba(0,0,0,0.35), 0 8px 30px rgba(0,0,0,0.45)'),
132
190
  '--shadow-lg': is('0 2px 4px rgba(60,40,10,0.06), 0 16px 44px rgba(60,40,10,0.16)', '0 8px 24px rgba(0,0,0,0.5), 0 24px 70px rgba(0,0,0,0.65)'),
191
+ '--shadow-shell': is('0 1px 3px rgba(60,40,10,0.10), 0 3px 7px -2px rgba(60,40,10,0.14)', '0 1px 3px rgba(0,0,0,0.38), 0 3px 7px -2px rgba(0,0,0,0.48)'),
133
192
  };
134
193
 
135
194
  Object.entries(vars).forEach(([k, v]) => root.style.setProperty(k, v));
136
-
137
- // 琥珀主题的暗色背景(暖木色)
138
- if (dark) {
139
- root.style.setProperty('--bg', '#20160E');
140
- root.style.setProperty('--surface', '#211A10');
141
- }
142
195
  }
143
196
 
144
197
  /** 首帧同步应用主题(无缓存时按系统偏好),避免刷新出现主题闪动 */
@@ -149,5 +202,5 @@ export function applyThemeFromCache(): void {
149
202
  (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches
150
203
  ? 'dark'
151
204
  : 'light');
152
- applyTheme(mode);
205
+ applyTheme(mode, cachedThemePalette());
153
206
  }