/* ==========================================================================
   Grimoire RP - 暗金古籍双角色与旁白沉浸式视觉小说 CSS 样式系统
   ========================================================================== */

:root {
  /* 基础与背景 */
  --bg-primary: #140e0b;
  --bg-radial: radial-gradient(circle at 50% 18%, #2a1f16 0%, #170f0b 60%, #0d0806 100%);
  --bg-parchment: #2b2017;
  --bg-parchment-light: #3a2b20;

  /* 暗金色调系统 */
  --gold-primary: #d4af37;
  --gold-light: #e8c37d;
  --gold-pale: #fdf3cf;
  --gold-dark: #8c6d28;
  --bronze-border: #634b32;
  --bronze-deep: #443221;

  /* 角色 A (冷峻午夜蓝) */
  --char-a-bg: rgba(20, 26, 38, 0.92);
  --char-a-accent: #60a5fa;
  --char-a-border: rgba(96, 165, 250, 0.35);
  --char-a-glow: rgba(96, 165, 250, 0.2);

  /* 角色 B (炽烈深绯红) */
  --char-b-bg: rgba(43, 19, 23, 0.92);
  --char-b-accent: #f87171;
  --char-b-border: rgba(248, 113, 113, 0.35);
  --char-b-glow: rgba(248, 113, 113, 0.2);

  /* 用户与旁白 */
  --user-bg: #35261c;
  --user-border: #6e543b;
  --narrator-color: #cbb292;

  /* 字体族 */
  --font-serif: "Cinzel", "Songti SC", "SimSun", "Noto Serif SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* 空间与尺寸 */
  --header-height: 58px;
  --footer-height: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 重置与移动端基础保障 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-primary);
  background-image: var(--bg-radial);
  color: #e5ded6;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* 允许文本框和气泡内文字长按选中复制 */
input, textarea, .bubble-text, .narrator-text {
  -webkit-user-select: text;
  user-select: text;
}

/* 古籍网格微弱暗纹背景 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(212, 175, 55, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 1;
}

/* 应用主容器 (单手全屏响应式) */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 540px; /* 居中大屏平板展示 */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  z-index: 2;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  border-left: 1px solid rgba(107, 83, 56, 0.25);
  border-right: 1px solid rgba(107, 83, 56, 0.25);
}

/* ==========================================================================
   1. 顶部导航栏 (Header - 58px)
   ========================================================================== */
.app-header {
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  padding-right: 14px;
  background: linear-gradient(180deg, rgba(28, 19, 13, 0.96) 0%, rgba(20, 14, 10, 0.9) 100%);
  border-bottom: 1px solid var(--bronze-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 10;
  backdrop-filter: blur(8px);
}

.header-btn {
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.header-btn:active {
  background: rgba(212, 175, 55, 0.15);
  transform: scale(0.95);
}

.header-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--gold-light);
}

/* 中央标题胶囊（古卷铭牌样式） */
.title-capsule {
  flex: 1;
  max-width: 240px;
  height: 34px;
  margin: 0 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2f2117 0%, #201710 100%);
  border: 1px solid var(--gold-dark);
  border-radius: 17px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(212, 175, 55, 0.15);
  padding: 0 12px;
}

.title-capsule::before, .title-capsule::after {
  content: "✦";
  font-size: 8px;
  color: var(--gold-dark);
  margin: 0 4px;
}

.title-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--gold-light);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.title-input:focus {
  color: var(--gold-pale);
}

/* 顶部右侧控制区 */
.header-right-zone {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* API 预设快速切换胶囊 */
.preset-capsule {
  height: 32px;
  max-width: 140px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(36, 25, 17, 0.88);
  border: 1px solid var(--gold-dark);
  border-radius: 16px;
  padding: 0 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(212, 175, 55, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-capsule:hover {
  border-color: var(--gold-light);
}

.preset-capsule-icon {
  font-size: 11px;
}

.header-preset-select {
  background: transparent;
  border: none;
  color: var(--gold-light);
  font-size: 11.5px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-preset-select option {
  background: #1e140d;
  color: #eeddc9;
}

/* 魔导共鸣晶石状态指示器 */
.crystal-indicator {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.crystal-gem {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: #4b3e34;
  border: 1.5px solid #826c59;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

/* 连麦/倾听中 - 翡翠绿呼吸光晕 */
.crystal-indicator.active .crystal-gem {
  background: #10b981;
  border-color: #a7f3d0;
  box-shadow: 0 0 12px #10b981, 0 0 20px rgba(16, 185, 129, 0.6);
  animation: crystalPulse 2s infinite ease-in-out;
}

/* 思考中 - 秘法琥珀金光晕 */
.crystal-indicator.thinking .crystal-gem {
  background: #f59e0b;
  border-color: #fde68a;
  box-shadow: 0 0 12px #f59e0b, 0 0 22px rgba(245, 158, 11, 0.6);
  animation: crystalPulse 1.2s infinite ease-in-out;
}

@keyframes crystalPulse {
  0%, 100% { transform: rotate(45deg) scale(0.95); opacity: 0.85; }
  50% { transform: rotate(45deg) scale(1.15); opacity: 1; }
}

/* ==========================================================================
   2. 消息流视口 (Message Viewport)
   ========================================================================== */
.message-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 110px 14px; /* 留出底部 Dock 的悬浮高度 */
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 滚动条暗色优雅微调 */
.message-viewport::-webkit-scrollbar {
  width: 4px;
}
.message-viewport::-webkit-scrollbar-thumb {
  background: var(--bronze-border);
  border-radius: 2px;
}

/* 欢迎引导卡片 */
.welcome-card {
  text-align: center;
  padding: 24px 18px;
  background: rgba(32, 23, 16, 0.7);
  border: 1px solid var(--bronze-border);
  border-radius: 12px;
  margin: 10px 0 20px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold-light);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.welcome-desc {
  font-size: 13px;
  color: #a89a8c;
  line-height: 1.6;
}

/* 消息行基础结构 */
.message-row {
  display: flex;
  width: 100%;
  animation: fadeInMsg 0.28s ease-out;
}

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

/* 旁白流 (居中、衬线斜体、古籍分割线) */
.message-row.narrator-row {
  justify-content: center;
  padding: 4px 12px;
}

.narrator-box {
  width: 100%;
  max-width: 90%;
  text-align: center;
}

.narrator-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dark);
  font-size: 10px;
  letter-spacing: 4px;
  margin: 6px 0;
  opacity: 0.7;
}

.narrator-divider::before, .narrator-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
  margin: 0 10px;
}

.narrator-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14.5px;
  color: var(--narrator-color);
  line-height: 1.7;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 对话气泡（角色 A、角色 B、用户） */
.dialogue-wrapper {
  display: flex;
  gap: 10px;
  max-width: 86%;
}

.message-row.user-row {
  justify-content: flex-end;
}

.message-row.char-row {
  justify-content: flex-start;
}

/* 头像徽章 */
.avatar-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: bold;
  border: 1.5px solid var(--gold-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
  overflow: hidden;
  background: #2a1f18;
}

.avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 角色 A (蓝徽) */
.char-a-row .avatar-badge {
  border-color: #93c5fd;
  background: radial-gradient(circle, #1e3a8a 0%, #0f172a 100%);
  color: #bfdbfe;
}

/* 角色 B (红徽) */
.char-b-row .avatar-badge {
  border-color: #fca5a5;
  background: radial-gradient(circle, #881337 0%, #3b0714 100%);
  color: #fecdd3;
}

/* 用户 (金铜徽) */
.user-row .avatar-badge {
  border-color: var(--gold-light);
  background: radial-gradient(circle, #583c26 0%, #291b12 100%);
  color: var(--gold-pale);
}

/* 气泡正文体 */
.bubble-content {
  display: flex;
  flex-direction: column;
}

/* 角色铭牌与情绪标签 */
.speaker-tag {
  font-size: 11.5px;
  color: var(--gold-light);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-serif);
}

.char-a-row .speaker-tag {
  color: #93c5fd;
}

.char-b-row .speaker-tag {
  color: #fca5a5;
}

.emotion-label {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10.5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.char-a-row .emotion-label {
  border-color: rgba(96, 165, 250, 0.3);
}

.char-b-row .emotion-label {
  border-color: rgba(248, 113, 113, 0.3);
}

/* 气泡实体框 */
.speech-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.6;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

/* 角色 A 气泡 (深蓝午夜皮革) */
.char-a-bubble {
  background: var(--char-a-bg);
  border: 1px solid var(--char-a-border);
  border-left: 3.5px solid var(--char-a-accent);
  color: #e2e8f0;
}

/* 角色 B 气泡 (深绯红丝绒) */
.char-b-bubble {
  background: var(--char-b-bg);
  border: 1px solid var(--char-b-border);
  border-left: 3.5px solid var(--char-b-accent);
  color: #ffe4e6;
}

/* 用户气泡 (温润羊皮纸) */
.user-bubble {
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  color: #f5ede4;
  border-top-right-radius: 4px;
}

/* 正在输入打字机光标 */
.typing-cursor::after {
  content: "▋";
  color: var(--gold-light);
  animation: blinkCursor 0.8s infinite;
  margin-left: 2px;
  font-size: 12px;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ==========================================================================
   3. 底部语音状态栏 (Footer Dock - 48px ~ 52px 悬浮药丸)
   ========================================================================== */
.footer-dock-wrapper {
  position: absolute;
  bottom: calc(14px + var(--safe-bottom));
  left: 14px;
  right: 14px;
  max-width: 512px;
  margin: 0 auto;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 主悬浮药丸 */
.dock-pill {
  height: var(--footer-height);
  background: linear-gradient(180deg, rgba(34, 24, 18, 0.94) 0%, rgba(20, 14, 10, 0.96) 100%);
  border: 1px solid var(--gold-dark);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(212, 175, 55, 0.12);
  border-radius: 26px;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 14px;
}

/* 药丸左侧：状态文字 */
.dock-status-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.dock-mic-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  flex-shrink: 0;
}

.dock-mic-icon.active {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.dock-text {
  font-size: 13px;
  color: var(--gold-light);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

/* 药丸中间：琥珀金声波画布 */
.dock-wave-canvas {
  width: 140px;
  height: 32px;
  flex-shrink: 0;
}

/* 药丸右侧：快捷动作按钮组 */
.dock-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dock-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bronze-border);
  background: #2b1f17;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dock-circle-btn:active {
  background: var(--gold-dark);
  color: #fff;
  transform: scale(0.92);
}

.dock-circle-btn.primary {
  background: linear-gradient(135deg, #d4af37 0%, #92400e 100%);
  border-color: #fde68a;
  color: #140e0b;
}

/* 文字模式弹出的备用输入托盘 */
.keyboard-tray {
  display: none;
  background: rgba(26, 18, 13, 0.96);
  border: 1px solid var(--bronze-border);
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  gap: 8px;
  align-items: center;
}

.keyboard-tray.open {
  display: flex;
  animation: slideUpTray 0.2s ease-out;
}

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

.tray-input {
  flex: 1;
  height: 38px;
  background: #261911;
  border: 1px solid var(--bronze-border);
  border-radius: 19px;
  padding: 0 14px;
  color: #f3ece4;
  outline: none;
  font-size: 14px;
}

.tray-input:focus {
  border-color: var(--gold-primary);
}

.tray-send-btn {
  height: 38px;
  padding: 0 16px;
  background: linear-gradient(135deg, #d4af37 0%, #a16207 100%);
  color: #1a120c;
  border: none;
  border-radius: 19px;
  font-size: 13.5px;
  font-weight: bold;
  cursor: pointer;
}

/* ==========================================================================
   4. 抽屉式侧边栏 (Drawer / Sidebar)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 82%;
  max-width: 320px;
  background: #17100b;
  border-right: 1px solid var(--gold-dark);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  z-index: 101;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 18px 16px 14px 16px;
  border-bottom: 1px solid var(--bronze-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--gold-light);
  letter-spacing: 1px;
}

.new-session-btn {
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(146, 64, 14, 0.25) 100%);
  border: 1px solid var(--gold-primary);
  border-radius: 6px;
  color: var(--gold-pale);
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.new-session-btn:active {
  background: var(--gold-primary);
  color: #140e0b;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(36, 26, 18, 0.5);
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.session-item:hover, .session-item.active {
  background: rgba(212, 175, 55, 0.14);
  border-color: var(--gold-dark);
}

.session-item-title {
  font-size: 13.5px;
  color: #dfd7cf;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.session-item.active .session-item-title {
  color: var(--gold-light);
  font-weight: 600;
}

.session-del-btn {
  background: transparent;
  border: none;
  color: #8c7664;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
}

.session-del-btn:hover {
  color: #ef4444;
}

.drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--bronze-border);
}

.settings-entry-btn {
  width: 100%;
  height: 42px;
  background: #251b13;
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
  color: var(--gold-light);
  font-size: 14px;
  font-family: var(--font-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-entry-btn:active {
  background: var(--gold-dark);
  color: #fff;
}

/* ==========================================================================
   5. 典籍设置弹窗 (Settings Modal)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.settings-card {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: #1c130d;
  border: 1px solid var(--gold-primary);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 24px rgba(212, 175, 55, 0.2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popModal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.settings-header {
  padding: 14px 18px;
  background: linear-gradient(180deg, #2b1f16 0%, #1d140e 100%);
  border-bottom: 1px solid var(--bronze-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--gold-light);
  letter-spacing: 1px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--gold-light);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section-title {
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--gold-light);
  border-left: 3px solid var(--gold-primary);
  padding-left: 8px;
  margin-bottom: 0;
  letter-spacing: 0.5px;
}

.settings-card-section {
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(107, 83, 56, 0.4);
}

.settings-card-section:last-child {
  border-bottom: none;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.preset-action-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-action-btn {
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(43, 31, 22, 0.9);
  border: 1px solid var(--bronze-border);
  color: var(--gold-light);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-action-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
}

.preset-action-btn.danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.preset-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 12.5px;
  color: #bfaea0;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #241810;
  border: 1px solid var(--bronze-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: #f1eae2;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
}

.form-textarea {
  min-height: 64px;
  resize: vertical;
}

/* 语音输入与试听控件 */
.voice-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-audition {
  height: 38px;
  padding: 0 12px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(146, 64, 14, 0.28) 100%);
  border: 1px solid var(--gold-dark);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-audition:active {
  background: var(--gold-primary);
  color: #140e0b;
  transform: scale(0.95);
}

/* 快捷推荐音色标签 */
.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.voice-tag-pill {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 10px;
  background: rgba(40, 28, 20, 0.7);
  border: 1px solid rgba(107, 83, 56, 0.4);
  color: #cbb292;
  cursor: pointer;
  transition: all 0.15s ease;
}

.voice-tag-pill:hover, .voice-tag-pill.active {
  border-color: var(--gold-light);
  color: var(--gold-pale);
  background: rgba(212, 175, 55, 0.2);
}

/* 相册上传头像控件 */
.avatar-uploader-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview-box {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-primary);
  background: #2f2117;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-file-btn {
  padding: 6px 12px;
  background: #332317;
  border: 1px solid var(--bronze-border);
  border-radius: 6px;
  color: var(--gold-light);
  font-size: 12.5px;
  cursor: pointer;
}

.upload-file-btn:active {
  background: var(--gold-dark);
}

.file-hidden-input {
  display: none;
}

.settings-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--bronze-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #17100b;
}

.save-settings-btn {
  padding: 8px 20px;
  background: linear-gradient(135deg, #d4af37 0%, #a16207 100%);
  color: #140e0b;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13.5px;
  cursor: pointer;
}

.save-settings-btn:active {
  transform: scale(0.97);
}

.backup-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.backup-btn {
  flex: 1;
  padding: 8px 10px;
  background: #2b1f16;
  border: 1px solid var(--bronze-border);
  border-radius: 6px;
  color: var(--gold-light);
  font-size: 12.5px;
  cursor: pointer;
  text-align: center;
}

.backup-btn:active {
  background: var(--gold-dark);
}

/* 提示 Toast */
.toast-notice {
  position: fixed;
  top: calc(70px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(36, 25, 17, 0.95);
  border: 1px solid var(--gold-primary);
  color: var(--gold-pale);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 300;
  max-width: 90%;
  text-align: center;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   ============  v2 双模式 / 供应商 / 上下文控制 扩展样式  ====================
   ========================================================================== */

/* ---------- 0. 模式切换与全局覆盖 ---------- */
body.mode-normal {
  --bg-primary: #0f1115;
  --bg-radial: radial-gradient(circle at 50% 0%, #1b1f27 0%, #11141a 55%, #0a0c10 100%);
  --gold-primary: #c9a227;
  --gold-light: #e8c37d;
  --gold-pale: #fdf3cf;
  --gold-dark: #8c6d28;
  --bronze-border: #3a3630;
  --bronze-deep: #26231f;
  --narrator-color: #cbb292;
}

body.mode-normal {
  background-color: var(--bg-primary);
  background-image: var(--bg-radial);
  color: #e8edf5;
}

body.mode-story {
  background-color: var(--bg-primary);
  background-image: var(--bg-radial);
}

.mode-normal .story-only { display: none !important; }
.mode-story .normal-only { display: none !important; }

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.mode-normal #storyView { display: none; }
.mode-story #chatView { display: none; }

/* 正常模式顶栏更像现代 Chat UI */
.mode-normal .app-header {
  background: linear-gradient(180deg, rgba(22, 25, 31, 0.97) 0%, rgba(15, 17, 22, 0.92) 100%);
  border-bottom-color: #2a2e37;
}

.mode-normal .header-btn,
.mode-normal .header-btn svg {
  color: #c3cbd8;
  stroke: #c3cbd8;
}

.mode-normal .title-capsule {
  background: linear-gradient(180deg, #1d212a 0%, #171a21 100%);
  border-color: #343a46;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.mode-normal .title-capsule::before,
.mode-normal .title-capsule::after {
  color: #6b7280;
}

.mode-normal .title-input {
  color: #eef2f8;
  font-family: var(--font-sans);
  font-size: 13.5px;
}

/* ---------- 1. 顶栏中心：标题 + 副标题 ---------- */
.header-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px 2px 0;
}

.header-center .title-capsule {
  flex: none;
  width: 100%;
  max-width: 220px;
  height: 27px;
  margin: 0;
  border-radius: 14px;
  padding: 0 7px;
}

.header-center .title-capsule::before,
.header-center .title-capsule::after {
  font-size: 7px;
  margin: 0 2px;
}

.header-center .title-input {
  font-size: 13px;
  font-weight: 600;
}

.header-subtitle {
  max-width: 100%;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
  background: transparent;
  border: none;
  color: #9aa3b2;
  font-size: 10.5px;
  font-family: var(--font-sans);
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mode-story .header-subtitle { color: #a99272; }

.header-subtitle-icon {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.9;
}

.header-subtitle-icon svg { width: 100%; height: 100%; }

.header-subtitle-chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.6;
}

.header-subtitle span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 2. 正常模式消息流 ---------- */
.chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.chat-stream::-webkit-scrollbar { width: 4px; }
.chat-stream::-webkit-scrollbar-thumb {
  background: #343a46;
  border-radius: 2px;
}

.chat-welcome { margin-top: 8px; }

.mode-normal .welcome-card {
  background: rgba(23, 26, 33, 0.85);
  border-color: #2a2f3a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.mode-normal .welcome-title { color: #e8c37d; }

.chat-msg {
  display: flex;
  width: 100%;
  gap: 9px;
  animation: fadeInMsg 0.24s ease-out;
}

.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }

.chat-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1b1f27;
  border: 1px solid #3a4150;
  color: #e8c37d;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-avatar svg { width: 19px; height: 19px; }

.chat-body {
  min-width: 0;
  max-width: calc(100% - 46px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-msg.user .chat-body { align-items: flex-end; }

.chat-meta {
  height: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 2px 3px;
  font-size: 10.5px;
  color: #7f8898;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.chat-meta .chat-model {
  color: #5f6878;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-bubble {
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.72;
  color: #e9edf4;
  background: #181b22;
  border: 1px solid #2a2f3a;
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  word-break: break-word;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #4a3a22 0%, #332716 100%);
  border-color: #6b5338;
  color: #fbf3e4;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
}

.chat-msg.error .chat-bubble { border-color: rgba(239, 68, 68, 0.55); }

.chat-content { min-width: 0; }
.chat-content.is-streaming { white-space: pre-wrap; }
.chat-content:empty::before { content: "…"; color: #6b7280; }

.chat-content p { margin: 0 0 0.65em; }
.chat-content p:last-child { margin-bottom: 0; }
.chat-content h1, .chat-content h2, .chat-content h3 {
  margin: 0.9em 0 0.45em;
  font-size: 1.08em;
  line-height: 1.35;
  color: #f3e6c9;
}
.chat-content h1:first-child, .chat-content h2:first-child, .chat-content h3:first-child { margin-top: 0; }
.chat-content ul, .chat-content ol { margin: 0.3em 0 0.7em; padding-left: 1.35em; }
.chat-content li { margin: 0.18em 0; }
.chat-content blockquote {
  margin: 0.6em 0;
  padding: 4px 10px;
  border-left: 3px solid var(--gold-dark);
  background: rgba(212, 175, 55, 0.06);
  color: #c9c0b0;
  border-radius: 0 6px 6px 0;
}
.chat-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 4px;
}
.chat-content pre {
  margin: 0.7em 0;
  padding: 10px 12px;
  background: #0d0f13;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chat-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}
.chat-content a { color: #7fb0ff; text-decoration: underline; text-underline-offset: 2px; }
.chat-content hr { border: none; border-top: 1px solid #2f3542; margin: 0.9em 0; }
.chat-content table { border-collapse: collapse; margin: 0.6em 0; font-size: 0.94em; }
.chat-content th, .chat-content td { border: 1px solid #2f3542; padding: 4px 8px; }
.chat-content th { background: rgba(255, 255, 255, 0.04); }

.chat-content.is-streaming::after {
  content: "▋";
  color: var(--gold-light);
  animation: blinkCursor 0.8s infinite;
  margin-left: 2px;
  font-size: 11px;
}

/* 深度思考折叠栏 */
.think-fold {
  width: 100%;
  margin: 0 0 8px;
  background: #12151b;
  border: 1px solid #272d38;
  border-radius: 11px;
  overflow: hidden;
  color: #939dac;
  font-size: 12.5px;
}

.think-fold > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}

.think-fold > summary::-webkit-details-marker { display: none; }

.think-fold.is-thinking > summary {
  color: #c9b47e;
  animation: thinkBreathe 1.8s ease-in-out infinite;
}

@keyframes thinkBreathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

.think-label { flex: 1; min-width: 0; }
.think-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
  opacity: 0.65;
  flex-shrink: 0;
}
.think-fold[open] .think-chevron { transform: rotate(180deg); }

.think-content {
  padding: 2px 12px 11px;
  color: #8d97a7;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px dashed rgba(255, 255, 255, 0.07);
  padding-top: 8px;
}

/* 消息操作栏 */
.chat-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
  opacity: 0.82;
}

.chat-actions button {
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: #7f8898;
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
}

.chat-actions button:active,
.chat-actions button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #c9d2df;
}

.chat-actions button svg { width: 13px; height: 13px; }

/* 前情提要 / 记忆摘要卡片 */
.summary-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.09) 0%, rgba(212, 175, 55, 0.03) 100%);
  border: 1px dashed rgba(212, 175, 55, 0.38);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #c9b28e;
  line-height: 1.65;
  animation: fadeInMsg 0.25s ease-out;
}

.summary-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}
.summary-card > summary::-webkit-details-marker { display: none; }
.summary-card .summary-body {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed rgba(212, 175, 55, 0.22);
  color: #b9a486;
  white-space: pre-wrap;
}

.mode-normal .summary-card {
  background: rgba(212, 175, 55, 0.055);
  border-color: rgba(212, 175, 55, 0.3);
}

/* ---------- 3. 底部输入条（正常模式） ---------- */
.composer-wrap {
  position: relative;
  z-index: 15;
  padding: 8px 12px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(15, 17, 22, 0) 0%, rgba(15, 17, 22, 0.92) 28%, rgba(15, 17, 22, 1) 100%);
}

.composer {
  background: #171a21;
  border: 1px solid #2c313c;
  border-radius: 21px;
  padding: 9px 10px 7px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer:focus-within {
  border-color: #4a5162;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(212, 175, 55, 0.07);
}

.composer-input {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 132px;
  padding: 2px 4px 6px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #eef2f8;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.composer-input::placeholder { color: #626b7a; }

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
}

.composer-spacer { flex: 1; }

.provider-chip {
  height: 31px;
  max-width: 150px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  background: #1d212a;
  border: 1px solid #303644;
  border-radius: 16px;
  color: #b9c2d0;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
}

.provider-chip:active { background: #242936; }

.provider-chip-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-flex;
  color: #e8c37d;
}

.provider-chip-icon svg { width: 100%; height: 100%; }
.provider-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-capsule {
  height: 31px;
  padding: 0 10px;
  border-radius: 16px;
  background: #1d212a;
  border: 1px solid #303644;
  color: #9aa4b5;
  font-size: 10.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.context-capsule.ctx-low { color: #7fc79a; border-color: rgba(52, 211, 153, 0.25); }
.context-capsule.ctx-mid { color: #e3b96b; border-color: rgba(245, 158, 11, 0.28); }
.context-capsule.ctx-high { color: #f28b8b; border-color: rgba(239, 68, 68, 0.35); }

.composer-circle-btn,
.composer-send-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #303644;
  background: #1d212a;
  color: #c3cbd8;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.composer-circle-btn svg,
.composer-send-btn svg { width: 18px; height: 18px; }

.composer-circle-btn:active { transform: scale(0.92); background: #262c38; }

.composer-send-btn {
  background: linear-gradient(135deg, #e8c37d 0%, #c9a227 100%);
  border-color: #e8c37d;
  color: #1a120c;
}

.composer-send-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.composer-send-btn:not(:disabled):active { transform: scale(0.92); }

.stop-square-icon {
  display: none;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #1a120c;
}

.composer-send-btn.busy .send-arrow-icon { display: none; }
.composer-send-btn.busy .stop-square-icon { display: block; }

/* ---------- Token 用量提示（发送框下方） ---------- */
.usage-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 6px 0 0;
  padding: 2px 5px 0;
  background: transparent;
  border: 0;
  color: #7f8796;
  font-family: var(--font-sans);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.1px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}

.usage-hint:active { color: #c9a227; }
.usage-hint-total { white-space: nowrap; }
.usage-hint-cache { white-space: nowrap; color: #687080; }
.usage-hint-cache.cache-known { color: #b7a06a; }

.mode-normal .usage-hint { color: #757575; }
.mode-normal .usage-hint:active { color: #d8d8d8; }
.mode-normal .usage-hint-cache { color: #666666; }
.mode-normal .usage-hint-cache.cache-known { color: #a99b73; }

.usage-popover {
  position: absolute;
  right: 12px;
  bottom: calc(100% - 2px);
  width: min(302px, calc(100vw - 24px));
  padding: 12px 14px 11px;
  background: rgba(32, 24, 18, 0.98);
  border: 1px solid rgba(201, 162, 74, 0.45);
  border-radius: 15px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.72);
  color: #dec9a5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.985);
  transform-origin: bottom right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 40;
}

.usage-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.usage-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.usage-popover-title {
  color: #f2e6cf;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.usage-popover-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: -4px -6px -4px 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #a99677;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.usage-popover-close:active { background: rgba(255, 255, 255, 0.07); }

.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  color: #a99576;
  font-size: 11.5px;
}

.usage-row b {
  color: #eee0c8;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-row-total {
  padding-top: 6px;
  color: #d7c19a;
  font-size: 12px;
}

.usage-row-total b { color: #f4dfb7; font-size: 12.5px; font-weight: 600; }

.usage-divider {
  height: 1px;
  margin: 5px 0 3px;
  background: linear-gradient(90deg, rgba(201, 162, 74, 0.45), rgba(201, 162, 74, 0.06));
}

.usage-footnote {
  margin: 7px 0 0;
  color: #857661;
  font-size: 9.5px;
  line-height: 1.45;
}

.mode-normal .usage-popover {
  background: rgba(30, 30, 30, 0.98);
  border-color: #3b3b3b;
  color: #bdbdbd;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.76);
}
.mode-normal .usage-popover-title { color: #f0f0f0; }
.mode-normal .usage-popover-close { color: #999999; }
.mode-normal .usage-row { color: #9b9b9b; }
.mode-normal .usage-row b { color: #e8e8e8; }
.mode-normal .usage-row-total { color: #c9c9c9; }
.mode-normal .usage-row-total b { color: #ffffff; }
.mode-normal .usage-divider { background: linear-gradient(90deg, #464646, rgba(70, 70, 70, 0.05)); }
.mode-normal .usage-footnote { color: #777777; }

/* ---------- 4. 剧情模式容器 ---------- */
.view-story { position: relative; }
.view-story .message-viewport { padding-bottom: 116px; }

/* ---------- 5. 抽屉模式切换与会话徽章 ---------- */
.drawer-mode-switch {
  display: flex;
  gap: 6px;
  padding: 10px 12px 4px;
}

.mode-tab {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--bronze-border);
  background: rgba(36, 26, 18, 0.55);
  color: #b7a48c;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(146, 64, 14, 0.22) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-pale);
  font-weight: 600;
}

.session-item {
  gap: 8px;
}

.session-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-item-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #8c7664;
}

.session-mode-badge {
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.28);
  color: #c9a86a;
  font-size: 9.5px;
  line-height: 15px;
}

/* ---------- 6. 供应商管理页（图二） ---------- */
.provider-page {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  background-image: var(--bg-radial);
  padding-top: var(--safe-top);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.provider-page.open {
  transform: translateX(0);
  visibility: visible;
}

.provider-page-header {
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid var(--bronze-border);
  background: rgba(20, 15, 11, 0.94);
  backdrop-filter: blur(10px);
}

.mode-normal .provider-page-header,
body.mode-normal .provider-page-header {
  background: rgba(19, 22, 28, 0.94);
  border-bottom-color: #2a2f3a;
}

.provider-back-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--gold-light);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.provider-back-btn:active { background: rgba(212, 175, 55, 0.12); }

.provider-page-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--gold-light);
  letter-spacing: 1.5px;
  font-weight: 600;
}

.provider-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.provider-header-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: #c9b28e;
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-header-btn:active { background: rgba(212, 175, 55, 0.12); }
.provider-header-btn.add { font-size: 26px; color: var(--gold-light); }

.provider-search-wrap {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 11px 14px 9px;
  background: linear-gradient(180deg, rgba(15, 12, 9, 0.98) 0%, rgba(15, 12, 9, 0.86) 100%);
}

body.mode-normal .provider-search-wrap {
  background: linear-gradient(180deg, rgba(16, 19, 24, 0.98) 0%, rgba(16, 19, 24, 0.88) 100%);
}

.provider-search-box {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  background: #241b13;
  border: 1px solid var(--bronze-border);
  border-radius: 20px;
}

body.mode-normal .provider-search-box {
  background: #1a1e26;
  border-color: #2e3542;
}

.provider-search-box svg {
  width: 17px;
  height: 17px;
  color: #8c7664;
  flex-shrink: 0;
}

.provider-search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #eee6da;
  font-size: 13.5px;
  font-family: inherit;
}

.provider-search-box input::placeholder { color: #7a6c5e; }

.provider-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.provider-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(36, 27, 20, 0.72);
  border: 1px solid rgba(107, 83, 56, 0.5);
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
  touch-action: pan-y;
}

body.mode-normal .provider-card {
  background: rgba(26, 30, 38, 0.82);
  border-color: #2e3542;
}

.provider-card:active { transform: scale(0.995); }
.provider-card.active-provider { border-color: var(--gold-primary); box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.18), 0 3px 16px rgba(0, 0, 0, 0.3); }
.provider-card.dragging { opacity: 0.62; transform: scale(0.98); }
.provider-card.drag-over { border-color: var(--gold-light); }

.provider-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.16) 0%, rgba(146, 64, 14, 0.1) 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--gold-light);
}

.provider-icon svg { width: 23px; height: 23px; }

.provider-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.provider-name {
  font-size: 14.5px;
  font-weight: 600;
  color: #efe4d6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mode-normal .provider-name { color: #e8edf5; }

.provider-model-summary {
  font-size: 10.5px;
  color: #9c8a78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mode-normal .provider-model-summary { color: #7f8898; }

.provider-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.status-pill,
.count-pill {
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 9.5px;
  line-height: 18px;
  white-space: nowrap;
  cursor: pointer;
}

.status-pill.enabled {
  color: #6ee7a8;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-pill.disabled {
  color: #f0a0a0;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.count-pill {
  color: #8fb6f5;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  cursor: default;
}

.drag-handle {
  width: 30px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #756557;
  font-size: 17px;
  letter-spacing: 0;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
  border-radius: 8px;
}

.drag-handle:active { color: var(--gold-light); background: rgba(212, 175, 55, 0.08); }

.provider-page-hint {
  padding: 0 18px calc(12px + var(--safe-bottom));
  font-size: 10.5px;
  color: #7a6c5e;
  text-align: center;
}

.provider-empty {
  text-align: center;
  padding: 40px 20px;
  color: #8c7664;
  font-size: 13px;
}

/* 供应商详情弹窗 */
.provider-detail-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: #1c130d;
  border: 1px solid var(--gold-primary);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.9), 0 0 24px rgba(212, 175, 55, 0.18);
  animation: popModal 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

body.mode-normal .provider-detail-card {
  background: #171a21;
  border-color: #3a4150;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.85);
}

.provider-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.provider-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px calc(11px + var(--safe-bottom) * 0.2);
  border-top: 1px solid var(--bronze-border);
  background: #17100b;
}

body.mode-normal .provider-detail-footer { background: #14171d; border-top-color: #2a2f3a; }

.provider-delete-btn {
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #f28b8b;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: #d8cbbb;
}

.switch-row.compact { padding: 4px 0 0; font-size: 12px; }

.switch-row input[type="checkbox"] {
  width: 42px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: #3a2c20;
  border: 1px solid #5b4634;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d8cbbb;
  transition: transform 0.2s ease;
}

.switch-row input[type="checkbox"]:checked {
  background: rgba(212, 175, 55, 0.55);
  border-color: var(--gold-light);
}

.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
  background: #fff8e6;
}

.model-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 8px;
  font-size: 12.5px;
  color: #c9b28e;
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-row {
  border: 1px solid rgba(107, 83, 56, 0.5);
  background: rgba(36, 27, 20, 0.55);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.mode-normal .model-row {
  background: rgba(26, 30, 38, 0.75);
  border-color: #2e3542;
}

.model-row-top {
  display: flex;
  gap: 6px;
  align-items: center;
}

.model-row-top .form-input { flex: 1; min-width: 0; }

.model-remove-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 7px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: transparent;
  color: #f28b8b;
  font-size: 16px;
  cursor: pointer;
}

.model-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.model-row-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  color: #9c8a78;
}

.model-row-grid .form-input {
  padding: 6px 8px;
  font-size: 12px;
}

.model-row-flags {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.model-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #b7a48c;
}

.model-flag input { accent-color: var(--gold-primary); width: 15px; height: 15px; }

/* ---------- 7. 底部弹层（快速切换 / 上下文 / 更多） ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop.open { display: flex; }

.sheet {
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  overflow-y: auto;
  background: #17100b;
  border: 1px solid var(--bronze-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 6px 16px calc(18px + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7);
  animation: sheetUp 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-overflow-scrolling: touch;
}

body.mode-normal .sheet {
  background: #14171d;
  border-color: #2a2f3a;
}

@keyframes sheetUp {
  from { transform: translateY(28px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #4a3a2a;
  margin: 6px auto 4px;
}

body.mode-normal .sheet-handle { background: #3a4150; }

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 10px;
}

.sheet-header h3 {
  font-size: 15px;
  font-family: var(--font-serif);
  color: var(--gold-light);
  letter-spacing: 0.5px;
}

body.mode-normal .sheet-header h3 { color: #e8edf5; font-family: var(--font-sans); font-size: 14.5px; }

.sheet-close {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: #a8947c;
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
}

.sheet-close:active { background: rgba(255, 255, 255, 0.06); }

.sheet-wide-btn {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--bronze-border);
  background: #241b13;
  color: var(--gold-light);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

body.mode-normal .sheet-wide-btn { background: #1d212a; border-color: #303644; color: #c3cbd8; }

/* 快速切换列表 */
.quick-switch-list { display: flex; flex-direction: column; gap: 10px; }

.quick-provider-group {
  border: 1px solid rgba(107, 83, 56, 0.35);
  border-radius: 12px;
  overflow: hidden;
}

body.mode-normal .quick-provider-group { border-color: #2e3542; }

.quick-provider-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: rgba(212, 175, 55, 0.06);
  font-size: 12px;
  color: #c9b28e;
}

.quick-provider-head .provider-icon { width: 26px; height: 26px; min-width: 26px; border-radius: 8px; }
.quick-provider-head .provider-icon svg { width: 16px; height: 16px; }

.quick-model-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border: none;
  border-top: 1px solid rgba(107, 83, 56, 0.22);
  background: transparent;
  color: #d8cbbb;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

body.mode-normal .quick-model-item { border-top-color: #262b34; color: #c3cbd8; }

.quick-model-item:active { background: rgba(212, 175, 55, 0.08); }

.quick-model-item.active {
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-light);
}

.quick-model-item .qm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-model-item .qm-meta { font-size: 10px; color: #8b7a68; flex-shrink: 0; }
.quick-model-item .qm-check { color: var(--gold-light); font-size: 15px; }

/* 上下文面板 */
.ctx-usage-card {
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 14px;
}

body.mode-normal .ctx-usage-card { background: rgba(255, 255, 255, 0.035); border-color: #2e3542; }

.ctx-usage-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

#ctxUsageText {
  font-size: 16px;
  font-weight: 600;
  color: #e8c37d;
  font-variant-numeric: tabular-nums;
}

#ctxModelInfo { font-size: 10px; color: #9c8a78; text-align: right; }

.ctx-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ctx-progress span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6ee7a8 0%, #e8c37d 60%, #f28b8b 100%);
  transition: width 0.25s ease;
}

.ctx-breakdown {
  margin-top: 6px;
  font-size: 10px;
  color: #8b7a68;
  font-variant-numeric: tabular-nums;
}

.ctx-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(107, 83, 56, 0.28);
}

.ctx-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: #d8cbbb;
}

.range-value { color: var(--gold-light); font-weight: 600; font-variant-numeric: tabular-nums; }

.form-range {
  width: 100%;
  height: 26px;
  accent-color: var(--gold-primary);
  background: transparent;
  cursor: pointer;
}

.compress-now-btn {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border-radius: 11px;
  border: 1px solid var(--gold-primary);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(146, 64, 14, 0.24) 100%);
  color: var(--gold-pale);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.compress-now-btn:disabled { opacity: 0.5; cursor: default; }
.compress-now-btn:active { transform: scale(0.985); }

.ctx-warning {
  margin-top: 10px;
  font-size: 10.5px;
  line-height: 1.6;
  color: #8b7a68;
}

/* 更多功能列表 */
.action-list { display: flex; flex-direction: column; gap: 6px; }

.action-item {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: rgba(36, 27, 20, 0.45);
  color: #e3d7c8;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

body.mode-normal .action-item { background: rgba(255, 255, 255, 0.035); color: #d5dce8; }

.action-item:active { background: rgba(212, 175, 55, 0.12); border-color: rgba(212, 175, 55, 0.3); }

/* ---------- 8. 设置页新增控件 ---------- */
.current-provider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-top: 8px;
  background: rgba(36, 27, 20, 0.55);
  border: 1px solid var(--bronze-border);
  border-radius: 10px;
}

body.mode-normal .current-provider-row { background: rgba(255, 255, 255, 0.035); border-color: #2e3542; }

.current-provider-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.28);
  color: var(--gold-light);
  flex-shrink: 0;
}

.current-provider-icon svg { width: 21px; height: 21px; }

.current-provider-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.current-provider-text strong {
  font-size: 13px;
  color: #eee4d6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-provider-text span {
  font-size: 10.5px;
  color: #9c8a78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-hint {
  font-size: 10.5px;
  line-height: 1.6;
  color: #8b7a68;
  margin-top: 5px;
}

.avatar-placeholder {
  font-size: 18px;
  font-weight: bold;
}

.char-a-placeholder { color: #93c5fd; }
.char-b-placeholder { color: #fca5a5; }

/* 供应商说明 */
.doc-card { max-width: 460px; }
.doc-body { gap: 10px; font-size: 12.5px; color: #cbbfae; line-height: 1.7; }
.doc-body p { margin: 2px 0; }
.doc-body ul { padding-left: 18px; margin: 2px 0 8px; }
.doc-body li { margin: 3px 0; }
.doc-body code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11.5px;
  word-break: break-all;
}

/* ---------- 9. 小屏适配与无障碍 ---------- */
@media (max-width: 380px) {
  .header-center .title-capsule { max-width: 150px; }
  .context-capsule { font-size: 9.5px; padding: 0 8px; }
  .provider-chip { max-width: 112px; }
  .dock-wave-canvas { width: 100px; }
  .chat-body { max-width: calc(100% - 42px); }
}

@media (min-width: 560px) {
  .app-container { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 保证所有可点区域至少 44px（视觉上可小于，但命中区由 padding 扩展） */
.header-btn,
.dock-circle-btn,
.provider-chip,
.context-capsule,
.composer-circle-btn,
.composer-send-btn,
.action-item,
.quick-model-item,
.compress-now-btn {
  min-height: 32px;
}


/* v2 patches */
#providerDetailModal, #providerDocModal { z-index: 340; }
.toast-notice { z-index: 500; }

.dock-circle-btn.primary.active {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-color: #6ee7b7;
  color: #ecfff7;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

.provider-detail-card .settings-header { flex-shrink: 0; }
.provider-detail-body { flex: 1 1 auto; }

@media (max-height: 640px) {
  .sheet { max-height: 92vh; }
  .settings-card { max-height: 92vh; }
}

/* ==========================================================================
   ============  参考图一 / 图二 的视觉校准（正常模式 + 供应商页）  ==========
   ========================================================================== */

/* ---------- 正常模式：更接近图一的中性深灰 Chat UI ---------- */
body.mode-normal {
  --bg-primary: #141414;
  --bg-radial: radial-gradient(circle at 50% 0%, #1c1c1c 0%, #151515 55%, #101010 100%);
  --header-height: 66px;
}

body.mode-normal .app-header {
  background: #141414;
  border-bottom: 1px solid #262626;
  box-shadow: none;
  padding-left: 8px;
  padding-right: 8px;
}

.mode-normal .header-btn,
.mode-normal .header-btn svg {
  color: #e4e4e4;
  stroke: #e4e4e4;
}

.mode-normal .header-btn:active { background: rgba(255, 255, 255, 0.08); }

.mode-normal .header-center {
  align-items: flex-start;
  justify-content: center;
  padding: 3px 0 0 4px;
}

.mode-normal .header-center .title-capsule {
  height: 30px;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.mode-normal .header-center .title-capsule::before,
.mode-normal .header-center .title-capsule::after { display: none; }

.mode-normal .header-center .title-input {
  text-align: left;
  color: #f2f2f2;
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

.mode-normal .header-subtitle {
  justify-content: flex-start;
  height: 17px;
  padding: 0;
  color: #9b9b9b;
  font-size: 10.5px;
}

.mode-normal .header-subtitle-icon { width: 13px; height: 13px; }
.mode-normal .header-subtitle-chevron { width: 9px; height: 9px; color: #777; }
.mode-normal .header-right-zone { gap: 0; }

/* AI 头像 / 名称 */
.mode-normal .chat-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  margin-top: 4px;
  background: #1f1f1f;
  border: 1px solid #303030;
}
.mode-normal .chat-avatar svg { width: 21px; height: 21px; }
.mode-normal .chat-avatar .provider-letter { font-size: 17px; }

.mode-normal .chat-meta {
  height: auto;
  margin: 0 2px 5px;
  color: #bdbdbd;
  font-size: 12px;
}

.mode-normal .chat-model-name {
  color: #ededed;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.mode-normal .chat-msg.user .chat-meta {
  justify-content: flex-end;
  margin-right: 4px;
}

/* 用户头像：图一右侧的渐变小圆 */
.chat-avatar.user-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  margin-top: 17px;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  border: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.mode-normal .chat-avatar.user-avatar { background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%); }

/* 气泡：AI 深灰、用户暗酒红（图一） */
.mode-normal .chat-bubble {
  background: #1f1f1f;
  border: 1px solid #2b2b2b;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  color: #ececec;
  font-size: 15px;
  line-height: 1.78;
  box-shadow: none;
  padding: 11px 14px;
}

.mode-normal .chat-msg.user .chat-bubble {
  background: #5a2b3a;
  border: 1px solid #6b3346;
  border-radius: 18px;
  border-bottom-right-radius: 6px;
  color: #f7e9ee;
}

.mode-normal .chat-msg.user .chat-body { align-items: flex-end; }

.mode-normal .chat-content p { margin-bottom: 0.7em; }
.mode-normal .chat-content h1,
.mode-normal .chat-content h2,
.mode-normal .chat-content h3,
.mode-normal .chat-content h4 {
  color: #f4f4f4;
  font-weight: 700;
  letter-spacing: 0;
}
.mode-normal .chat-content strong { color: #ffffff; }
.mode-normal .chat-content code {
  background: #2a2a2a;
  border-color: #383838;
  color: #e6e6e6;
}
.mode-normal .chat-content pre {
  background: #171717;
  border-color: #303030;
}
.mode-normal .chat-content blockquote {
  border-left-color: #5f5f5f;
  background: #232323;
  color: #c8c8c8;
}
.mode-normal .chat-content a { color: #8ab4f8; }
.mode-normal .chat-content hr { border-top-color: #333; }

/* 思考折叠：图一的胶囊样式 */
.mode-normal .think-fold {
  width: fit-content;
  max-width: 100%;
  background: #242424;
  border: 1px solid #303030;
  border-radius: 999px;
  color: #cfcfcf;
  margin-bottom: 7px;
}
.mode-normal .think-fold[open] { border-radius: 14px; }
.mode-normal .think-fold > summary {
  padding: 6px 12px;
  gap: 5px;
  font-size: 12.5px;
}
.mode-normal .think-fold.is-thinking > summary { color: #d8d8d8; }
.mode-normal .think-content {
  color: #b7b7b7;
  border-top-color: #383838;
  padding: 8px 13px 10px;
  font-size: 12.5px;
}
.mode-normal .think-chevron { color: #a5a5a5; }

/* 动作栏 */
.mode-normal .chat-actions { opacity: 0.9; margin-top: 3px; }
.mode-normal .chat-actions button { color: #8d8d8d; height: 30px; }
.mode-normal .chat-actions button:active,
.mode-normal .chat-actions button:hover { background: #252525; color: #dcdcdc; }

/* 前情提要卡片 */
.mode-normal .summary-card {
  background: #1e1e1e;
  border: 1px dashed #3a3a3a;
  color: #b9b9b9;
}
.mode-normal .summary-card .summary-body { color: #a8a8a8; border-top-color: #333; }

/* 输入条：图一的深灰圆角 + 图标按钮 */
.mode-normal .composer-wrap {
  background: linear-gradient(180deg, rgba(20, 20, 20, 0) 0%, rgba(20, 20, 20, 0.94) 30%, #141414 100%);
}

.mode-normal .composer {
  background: #1c1c1c;
  border: 1px solid #2f2f2f;
  border-radius: 24px;
  padding: 10px 12px 8px;
  box-shadow: none;
}
.mode-normal .composer:focus-within {
  border-color: #454545;
  box-shadow: none;
}
.mode-normal .composer-input {
  font-size: 15.5px;
  color: #f0f0f0;
}
.mode-normal .composer-input::placeholder { color: #7a7a7a; }

.mode-normal .provider-chip {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border: none;
  color: #4d6bfe;
}
.mode-normal .provider-chip:active { background: #252525; }
.mode-normal .provider-chip-icon { width: 23px; height: 23px; }
.mode-normal .provider-chip-label { display: none; }

.mode-normal .context-capsule {
  height: 30px;
  padding: 0 11px;
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #a9a9a9;
  font-size: 10.5px;
  border-radius: 15px;
}
.mode-normal .context-capsule.ctx-low { color: #9fd8b0; border-color: #33503d; }
.mode-normal .context-capsule.ctx-mid { color: #d8b877; border-color: #4d4128; }
.mode-normal .context-capsule.ctx-high { color: #e59a9a; border-color: #543030; }

.mode-normal .composer-circle-btn {
  background: transparent;
  border: none;
  color: #d8d8d8;
}
.mode-normal .composer-circle-btn:active { background: #262626; }

.mode-normal .composer-send-btn {
  background: #e9e9e9;
  border-color: #e9e9e9;
  color: #111111;
}
.mode-normal .composer-send-btn:disabled { opacity: 0.3; }
.mode-normal .stop-square-icon { background: #111111; }

/* 欢迎卡片 */
.mode-normal .welcome-card {
  background: #1b1b1b;
  border-color: #2d2d2d;
  box-shadow: none;
}
.mode-normal .welcome-title { color: #f0f0f0; }
.mode-normal .welcome-desc { color: #9a9a9a; }

/* ==========================================================================
   图二：供应商管理页
   ========================================================================== */
.provider-page {
  background: #131110;
  background-image: none;
}
.provider-page.open { visibility: visible; }

.provider-page-header {
  height: 58px;
  min-height: 58px;
  padding: 0 12px;
  background: #131110;
  border-bottom: none;
  justify-content: space-between;
}

.provider-back-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2b2826;
  color: #e8e3df;
}
.provider-back-btn svg { width: 23px; height: 23px; }
.provider-back-btn:active { background: #363230; }

.provider-header-actions { gap: 4px; }
.provider-header-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #e4dfda;
}
.provider-header-btn svg { width: 23px; height: 23px; display: block; }
.provider-header-btn:active { background: #2b2826; }
.provider-header-btn.add { color: #f0ece8; }

.provider-page-heading {
  padding: 4px 20px 12px;
  color: #f4f1ee;
  font-size: 31px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-family: var(--font-sans);
}

.provider-search-wrap {
  padding: 0 18px 14px;
  background: #131110;
}
.provider-search-box {
  height: 54px;
  padding: 0 18px;
  background: #1b1817;
  border: 1px solid #4b4541;
  border-radius: 27px;
  gap: 12px;
}
.provider-search-box svg {
  width: 22px;
  height: 22px;
  color: #cfc9c4;
}
.provider-search-box input {
  color: #f0ece8;
  font-size: 16px;
}
.provider-search-box input::placeholder { color: #b6afaa; }

.provider-list {
  padding: 2px 18px 24px;
  gap: 12px;
}

.provider-card {
  padding: 14px;
  gap: 13px;
  background: #292523;
  border: 1px solid #3a3431;
  border-radius: 14px;
  box-shadow: none;
}
.provider-card.active-provider {
  border-color: #6b5a3a;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.12);
}

.provider-page .provider-icon,
.quick-switch-sheet .provider-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: #3a3330;
  border: none;
  color: #f0ece8;
}
.provider-page .provider-icon svg,
.quick-switch-sheet .provider-icon svg { width: 25px; height: 25px; }
.provider-letter {
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
  color: #f2eeea;
}

.provider-main { gap: 7px; }
.provider-name {
  color: #f4f1ee;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}
.provider-pills {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.status-pill,
.count-pill {
  height: 22px;
  line-height: 20px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 500;
}
.status-pill.enabled {
  color: #3ddc84;
  background: transparent;
  border: 1px solid #2f6b48;
}
.status-pill.disabled {
  color: #ef9a9a;
  background: transparent;
  border: 1px solid #6b3535;
}
.count-pill {
  color: #6f8ff0;
  background: transparent;
  border: 1px solid #344a7a;
}

.drag-handle {
  width: 30px;
  height: 44px;
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 4px;
  align-content: center;
  justify-content: end;
  color: #9b948f;
  padding: 0;
  flex-shrink: 0;
}
.drag-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.drag-handle:active { background: transparent; color: #cfc9c4; }

.provider-page-hint { color: #7f7873; }

/* 快速切换里的品牌色图标 */
.quick-provider-head {
  background: #201d1b;
  color: #e8e3df;
}
.quick-switch-sheet { background: #171412; border-color: #302b28; }
.quick-model-item { color: #ddd7d2; }
.quick-model-item:active { background: #262220; }
.quick-model-item.active { background: #2b2521; color: #f2c98a; }
.quick-model-item .qm-meta { color: #958d87; }

/* 设置里的当前供应商图标也跟随品牌色 */
.current-provider-icon {
  background: #2a2522;
  border-color: #3a3431;
}
.current-provider-icon .provider-letter { font-size: 16px; }

/* 正常模式下的供应商详情弹窗保持深灰 */
.mode-normal .provider-detail-card {
  background: #1a1a1a;
  border-color: #3a3a3a;
}
.mode-normal .provider-detail-footer { background: #161616; border-top-color: #2c2c2c; }
.mode-normal .form-input,
.mode-normal .form-textarea,
.mode-normal .form-select {
  background: #242424;
  border-color: #383838;
  color: #f0f0f0;
}
.mode-normal .provider-search-box { background: #1b1817; }

/* 供应商详情/说明弹窗永远在供应商页之上 */
#providerDetailModal, #providerDocModal { z-index: 340; }


/* 图一：消息操作栏为图标按钮 */
.mode-normal .chat-actions button,
.chat-actions button {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
}
.chat-actions button svg { width: 15px; height: 15px; }

/* ==========================================================================
   视觉校准 2：细节修正
   ========================================================================== */

/* 自定义供应商的首字标记：在不同容器里用合适的字号 */
.header-subtitle-icon .provider-letter { font-size: 11px; font-weight: 600; }
.provider-chip-icon .provider-letter { font-size: 18px; font-weight: 500; }
.chat-avatar .provider-letter { font-size: 17px; }
.settingsCurrentProviderIcon .provider-letter,
.current-provider-icon .provider-letter { font-size: 16px; }

/* 图二：启用 / 模型数胶囊带轻微底色 */
.provider-page .status-pill.enabled {
  background: rgba(16, 185, 129, 0.12);
}
.provider-page .status-pill.disabled {
  background: rgba(239, 68, 68, 0.1);
}
.provider-page .count-pill {
  background: rgba(59, 130, 246, 0.12);
}

/* 正常模式下，供应商详情弹窗也保持图二的中性灰 */
.mode-normal .provider-detail-card .settings-header {
  background: #1d1d1d;
  border-bottom-color: #2e2e2e;
}
.mode-normal .provider-detail-card .settings-title { color: #f0f0f0; }
.mode-normal .provider-detail-card .form-label { color: #b5b5b5; }
.mode-normal .provider-detail-card .form-input,
.mode-normal .provider-detail-card .form-select,
.mode-normal .provider-detail-card .form-textarea {
  background: #242424;
  border-color: #3a3a3a;
  color: #f0f0f0;
}
.mode-normal .provider-detail-card .form-input:focus,
.mode-normal .provider-detail-card .form-select:focus {
  border-color: #6a6a6a;
  box-shadow: none;
}
.mode-normal .provider-detail-card .btn-audition {
  background: #2a2a2a;
  border-color: #3b3b3b;
  color: #dedede;
}
.mode-normal .provider-detail-card .switch-row { color: #d4d4d4; }
.mode-normal .provider-detail-card .settings-hint { color: #8f8f8f; }

/* 正常模式下，设置弹窗也去掉过重的金色 */
.mode-normal .settings-card {
  background: #1a1a1a;
  border-color: #3a3a3a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85);
}
.mode-normal .settings-header {
  background: #1f1f1f;
  border-bottom-color: #2e2e2e;
}
.mode-normal .settings-title { color: #f0f0f0; }
.mode-normal .settings-section-title { color: #e8c37d; }
.mode-normal .settings-body { background: #1a1a1a; }
.mode-normal .settings-footer { background: #161616; border-top-color: #2c2c2c; }

/* 抽屉在正常模式下用中性深灰 */
.mode-normal .drawer-panel {
  background: #151515;
  border-right-color: #2e2e2e;
}
.mode-normal .drawer-header { border-bottom-color: #2a2a2a; }
.mode-normal .drawer-title { color: #f0f0f0; }
.mode-normal .drawer-footer { border-top-color: #2a2a2a; }
.mode-normal .settings-entry-btn {
  background: #1f1f1f;
  border-color: #333;
  color: #e4d7c5;
}
.mode-normal .session-item { background: #1d1d1d; }
.mode-normal .session-item:hover,
.mode-normal .session-item.active { background: #262626; border-color: #3a3a3a; }
.mode-normal .session-item.active .session-item-title { color: #f0e2c8; }
.mode-normal .mode-tab { background: #1d1d1d; border-color: #333; color: #bdbdbd; }
.mode-normal .mode-tab.active {
  background: #2c2823;
  border-color: #8c6d28;
  color: #f0e2c8;
}

/* 思考胶囊在正常模式下更接近图一的紧凑尺寸 */
.mode-normal .think-fold > summary { min-height: 32px; }
.mode-normal .think-fold.is-thinking > summary { color: #dedede; }

/* ==========================================================================
   多助手管理（图二 / 图三）
   ========================================================================== */
.assistant-page {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  flex-direction: column;
  background: #131110;
  padding-top: var(--safe-top);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
  color: #f2eeea;
}
.assistant-page.open { transform: translateX(0); visibility: visible; }
#assistantDetailPage { z-index: 330; background: #1a1210; }
#assistantBasicPage, #assistantPromptPage, #assistantStoryPage { z-index: 340; background: #131110; }

.assistant-page-header {
  height: 58px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: transparent;
}
.assistant-circle-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #2b2826;
  color: #e8e3df;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.assistant-circle-btn svg { width: 23px; height: 23px; }
.assistant-circle-btn:active { background: #363230; }
.assistant-add-btn { color: #f0ece8; background: transparent; }
.assistant-add-btn:active { background: #2b2826; }

.assistant-page-heading {
  padding: 4px 20px 12px;
  color: #f4f1ee;
  font-size: 31px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-family: var(--font-sans);
}
.assistant-search-wrap { padding: 0 18px 14px; }
.assistant-search-box {
  height: 54px;
  padding: 0 18px;
  background: #1b1817;
  border: 1px solid #4b4541;
  border-radius: 27px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.assistant-search-box svg { width: 22px; height: 22px; color: #cfc9c4; flex-shrink: 0; }
.assistant-search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #f0ece8;
  font-family: inherit;
  font-size: 16px;
}
.assistant-search-box input::placeholder { color: #b6afaa; }

.assistant-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.assistant-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 12px 13px 13px;
  background: #292523;
  border: 1px solid #3a3431;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}
.assistant-card:active { transform: scale(0.995); background: #302b28; }
.assistant-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  background: linear-gradient(135deg, #8bd450, #3fbf8f);
  user-select: none;
}
.assistant-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.assistant-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.assistant-card-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.assistant-card-name {
  flex: 1;
  min-width: 0;
  color: #f4f1ee;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-current-pill {
  flex-shrink: 0;
  height: 20px;
  line-height: 18px;
  padding: 0 8px;
  border-radius: 10px;
  color: #f0d59a;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  font-size: 10.5px;
}
.assistant-card-sub {
  color: #9c918a;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-card-menu {
  width: 38px;
  height: 42px;
  border: none;
  background: transparent;
  color: #cfc9c4;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.assistant-card-menu:active { background: #3a3431; }
.assistant-card-menu svg { width: 22px; height: 22px; }
.assistant-page-hint {
  padding: 0 18px calc(12px + var(--safe-bottom));
  color: #7f7873;
  font-size: 10.5px;
  text-align: center;
}
.assistant-empty { text-align: center; padding: 44px 20px; color: #8c817b; font-size: 13px; }

/* 图三：详情菜单 */
.assistant-detail-header {
  height: 58px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.assistant-detail-header-title {
  color: #f2eeea;
  font-size: 19px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px calc(28px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.assistant-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 26px;
}
.assistant-hero-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 34px;
  font-weight: 500;
  background: linear-gradient(135deg, #8bd450, #3fbf8f);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.assistant-hero-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.assistant-hero-name {
  margin-top: 14px;
  color: #f4f1ee;
  font-size: 22px;
  font-weight: 500;
  text-align: center;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-current-badge {
  margin-top: 9px;
  height: 24px;
  line-height: 22px;
  padding: 0 10px;
  border-radius: 12px;
  color: #f0d59a;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  font-size: 11px;
}
.assistant-set-active {
  margin-top: 10px;
  height: 30px;
  padding: 0 15px;
  border-radius: 15px;
  border: 1px solid #5a4a38;
  background: #2a211b;
  color: #e7d4ae;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.assistant-set-active:active { background: #34291f; }
.assistant-current-badge[hidden], .assistant-set-active[hidden] { display: none; }

.assistant-menu-list { display: flex; flex-direction: column; gap: 9px; }
.assistant-menu-item {
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: #2a211e;
  border: 1px solid #3b302b;
  border-radius: 14px;
  color: #f2eeea;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.assistant-menu-item:active { background: #332824; }
.assistant-menu-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e4c79a;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.07);
}
.assistant-menu-icon svg { width: 25px; height: 25px; }
.assistant-menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.assistant-menu-text strong { font-size: 15.5px; font-weight: 500; color: #f2eeea; }
.assistant-menu-text small { font-size: 11.5px; line-height: 1.35; color: #9c918a; }
.assistant-chevron { width: 21px; height: 21px; color: #b8aea7; flex-shrink: 0; }
.assistant-menu-item.is-disabled { opacity: 0.48; cursor: default; }
.assistant-soon {
  flex-shrink: 0;
  font-size: 10px;
  color: #b9aea6;
  border: 1px solid #4a3f39;
  border-radius: 9px;
  padding: 2px 6px;
}

/* 子页 */
.assistant-page-header-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  color: #f2eeea;
  font-weight: 500;
}
.assistant-header-spacer { width: 44px; height: 44px; }
.assistant-sub-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px calc(30px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.assistant-sub-body .form-group { margin-bottom: 20px; }
.assistant-sub-body .form-label { color: #b9b2ac; font-size: 12.5px; }
.assistant-sub-body .form-input,
.assistant-sub-body .form-select,
.assistant-sub-body .form-textarea {
  background: #211d1b;
  border-color: #3d3632;
  color: #f0ece8;
}
.assistant-sub-body .form-input:focus,
.assistant-sub-body .form-select:focus,
.assistant-sub-body .form-textarea:focus { border-color: #6b5a3a; }
.assistant-sub-body .settings-hint { color: #8f8580; }
.assistant-avatar-editor { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.assistant-avatar.large { width: 68px; height: 68px; min-width: 68px; font-size: 26px; }
.assistant-text-btn {
  border: none;
  background: transparent;
  color: #9c918a;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 4px;
  cursor: pointer;
}
.assistant-text-btn:active { color: #e4c79a; }
.assistant-prompt-textarea { min-height: 260px; line-height: 1.55; resize: vertical; }
.assistant-save-btn { width: 100%; margin-top: 8px; }
.assistant-action-sheet { background: #211b18; border-color: #3b302b; }
.assistant-action-sheet .action-item { text-align: left; }
.assistant-action-sheet .action-danger { color: #f28b8b; }

/* 设置弹窗中的当前助手 */
.settings-active-assistant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 12px;
}
.settings-assistant-avatar { width: 40px; height: 40px; min-width: 40px; font-size: 17px; }
.settings-active-assistant-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-active-assistant-text strong { color: #f0f0f0; font-size: 14px; font-weight: 600; }
.settings-active-assistant-text span { color: #8f8f8f; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-story .settings-active-assistant { background: #241b13; border-color: #443221; }
.mode-story .settings-active-assistant-text strong { color: #efe4d6; }
.mini-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border: 1px solid #6b5a3a;
  border-radius: 7px;
  color: #d8bd8a;
  font-size: 9px;
  line-height: 14px;
  vertical-align: 1px;
}
#assistantActionSheet { z-index: 360; }
.assistant-action-sheet .action-item { background: #2a211e; border-color: #3b302b; color: #f2eeea; }
.assistant-action-sheet .action-item:active { background: #342824; }
.assistant-action-sheet .action-danger { color: #f28b8b; }
#assistantActionSheet .action-item { background: #2a211e; border-color: #3b302b; color: #f2eeea; }
#assistantActionSheet .action-item:active { background: #342824; }
#assistantActionSheet .action-danger { color: #f28b8b; }
.story-cast-hint { line-height: 1.65; margin-bottom: 14px; }
.story-cast-card {
  padding: 14px;
  margin-bottom: 14px;
  background: #211c19;
  border: 1px solid #3b302b;
  border-radius: 14px;
}
.story-cast-title {
  margin: 0 0 12px;
  color: #f0d59a;
  font-size: 14.5px;
  font-weight: 600;
}
.story-cast-card .form-group:last-child { margin-bottom: 0; }
.story-cast-card .settings-hint { margin-top: 6px; }
