/* ═══════════════════════════════════════════════════════════════
 * D2: NewWord Design Token System
 * 所有颜色/字体/间距统一管理，按语义命名
 * 严禁在业务 CSS 中硬编码颜色值
 * ═══════════════════════════════════════════════════════════════ */

/* ── CSS 层级声明（低 → 高优先级） ── */
@layer reset, tokens, base, layout, components, mobile, overrides;

/* ── Design Tokens ── */
:root {
  /* === 颜色 - 水墨国风 === */
  /* 墨色系（文字）- 暖黑分层 */
  --color-ink-deep: #1a1714;
  --color-ink-heavy: #2e2823;
  --color-ink-mid: #4a443e;
  --color-ink-light: #6a645c;
  --color-ink-wash: #8a847a;
  --color-ink-mist: #b8b2a8;
  --color-ink-ghost: #d8d0c4;
  --color-ink-vapor: #e8e2d8;

  /* 宣纸色系（背景）- 暖白层次 */
  --color-xuan: #f5f3ef;
  --color-xuan-light: #faf8f5;
  --color-xuan-aged: #efeae3;
  --color-xuan-dark: #e4ddd4;

  /* 朱砂色系（强调·印章红）- 沉稳古红 */
  --color-cinnabar: #a83a30;
  --color-cinnabar-bright: #b84a40;
  --color-cinnabar-foreground: #faf8f5;
  --color-cinnabar-bg: rgba(168, 58, 48, 0.08);

  /* 山色系（次要强调·石绿）- 苍翠 */
  --color-mountain: #4a7a6a;
  --color-mountain-light: #6a9a8a;
  --color-mountain-bg: rgba(74, 122, 106, 0.10);

  /* 靛色系（链接·花青）- 沉静 */
  --color-indigo: #3a5a7a;
  --color-indigo-light: #5a7a9a;
  --color-indigo-bg: rgba(58, 90, 122, 0.10);

  /* 金色系（装饰·藤黄）- 暖金 */
  --color-gold: #b8944a;
  --color-gold-light: #d4b06a;
  --color-gold-bg: rgba(184, 148, 74, 0.12);

  /* === 交互色 === */
  --color-focus: var(--color-cinnabar);

  /* 边框 */
  --color-border-ink: #d8d0c4;
  --color-border-light: #e4ddd4;
  --color-border-dark: #b8b2a8;

  /* === 阴影 === */
  --shadow-sm: 0 1px 2px rgba(26, 23, 20, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 23, 20, 0.08);
  --shadow-lg: 0 8px 24px rgba(26, 23, 20, 0.10);
  --shadow-xl: 0 16px 48px rgba(26, 23, 20, 0.14);

  /* === 间距 - 流体式呼吸感 === */
  --space-xs: 2px;
  --space-sm: 6px;
  --space-md: 10px;
  --space-lg: 14px;
  --space-xl: 20px;
  --space-2xl: 28px;
  --space-3xl: 40px;
  --space-4xl: clamp(40px, 6vw, 64px);

  /* === 圆角 - 克制的墨韵 === */
  --radius-sm: 2px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* === 字体 - 使用系统字体，无外链依赖 === */
  --font-serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'SimSun', serif;
  --font-sans: -apple-system, 'PingFang SC', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
  --font-deco: 'STKaiti', 'KaiTi', 'ZCOOL XiaoWei', serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Menlo', monospace;

  /* === 字号 - 流体比例 === */
  --text-xs: clamp(9px, 0.6vw, 11px);
  --text-sm: clamp(11px, 0.75vw, 13px);
  --text-base: clamp(13px, 0.9vw, 15px);
  --text-md: clamp(14px, 1vw, 16px);
  --text-lg: clamp(16px, 1.2vw, 20px);
  --text-xl: clamp(20px, 1.6vw, 28px);
  --text-2xl: clamp(26px, 2.2vw, 36px);
  --text-3xl: clamp(32px, 3vw, 48px);

  /* === 过渡 === */
  --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* === 层级 === */
  --z-dropdown: 100;
  --z-modal: 1000;
  --z-toast: 2000;

  /* === 兼容旧变量名（向后兼容） === */
  --ink-deep: var(--color-ink-deep);
  --ink-heavy: var(--color-ink-heavy);
  --ink-mid: var(--color-ink-mid);
  --ink-light: var(--color-ink-light);
  --ink-wash: var(--color-ink-wash);
  --ink-mist: var(--color-ink-mist);
  --ink-ghost: var(--color-ink-ghost);
  --ink-vapor: var(--color-ink-vapor);
  --xuan: var(--color-xuan);
  --xuan-light: var(--color-xuan-light);
  --xuan-aged: var(--color-xuan-aged);
  --xuan-dark: var(--color-xuan-dark);
  --cinnabar: var(--color-cinnabar);
  --cinnabar-br: var(--color-cinnabar-bright);
  --cinnabar-ft: var(--color-cinnabar-foreground);
  --cinnabar-bg: var(--color-cinnabar-bg);
  --mountain: var(--color-mountain);
  --mountain-lt: var(--color-mountain-light);
  --mountain-bg: var(--color-mountain-bg);
  --indigo: var(--color-indigo);
  --indigo-lt: var(--color-indigo-light);
  --indigo-bg: var(--color-indigo-bg);
  --gold: var(--color-gold);
  --gold-lt: var(--color-gold-light);
  --gold-bg: var(--color-gold-bg);
  --border-ink: var(--color-border-ink);
  --border-lt-ink: var(--color-border-light);
  --border-dk-ink: var(--color-border-dark);
}
/* ═════════════════════════════════════════════════
 * NewWord 基础样式增强
 * 全局样式、滚动条、选中色、焦点样式
 * ═════════════════════════════════════════════════ */
@layer base {
  /* 全局滚动条 - 水墨风格 */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--color-ink-mist);
    border-radius: 3px;
    transition: background 0.2s;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-ink-wash);
  }

  /* 文字选中色 - 墨韵淡彩 */
  ::selection {
    background: rgba(196, 58, 49, 0.18);
    color: var(--color-ink-deep);
  }
  ::-moz-selection {
    background: rgba(196, 58, 49, 0.18);
    color: var(--color-ink-deep);
  }

  /* 全局焦点样式 */
  :focus-visible {
    outline: 2px solid var(--color-cinnabar);
    outline-offset: 2px;
    border-radius: 3px;
  }

  /* 平滑滚动 */
  html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* 减少不必要的动画（偏好设置） */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* 基础交互反馈 */
  button, select, input, textarea {
    transition: border-color var(--transition-fast),
                background var(--transition-fast),
                box-shadow var(--transition-fast),
                color var(--transition-fast),
                transform var(--transition-fast);
  }

  /* 输入框悬停 */
  input:hover, textarea:hover, select:hover {
    border-color: var(--color-ink-mist);
  }

  /* 按钮基础交互 */
  button:active:not(:disabled) {
    transform: scale(0.97);
  }

  /* 链接样式 */
  a {
    color: var(--color-indigo);
    text-decoration: none;
    transition: color var(--transition-fast);
  }
  a:hover {
    color: var(--color-indigo-light);
    text-decoration: underline;
  }

  /* ═══ 入场动效 ═══ */
  @keyframes inkFadeIn {
    from { opacity: 0.6; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes inkSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .sidebar-left {
    animation: inkSlideIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
  }
  .main-content {
    animation: inkFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
  }
  .sidebar-right {
    animation: inkFadeIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
  }
}
@layer layout {
/* ==================== 宪法冻结区：UI样式（严禁修改）==================== */ 
         * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif; } 
         body { display: flex; height: 100vh; background-color: #f5f3ef; background-image: radial-gradient(ellipse 600px 400px at 95% 5%, rgba(46,40,35,0.04) 0%, transparent 70%), radial-gradient(ellipse 500px 350px at 5% 95%, rgba(46,40,35,0.03) 0%, transparent 70%); color: #1a1714; overflow: hidden; }
         .sidebar-left { width: 220px; background-color: #efeae3; border-right: 1px solid #d8d0c4; display: flex; flex-direction: column; position: relative; transition: width 0.25s ease; } 
         .header-title { display: none; } 
         .nav-list { list-style: none; padding: 8px 10px; } 
         .nav-list li { padding: 9px 14px; margin: 3px 0; cursor: pointer; font-size: 13.5px; color: var(--color-ink-wash, #8a847a); transition: all 0.18s ease; border-radius: 8px; letter-spacing: 0.2px; line-height: 1.45; position: relative; } 
         .nav-list li:hover { background-color: var(--color-xuan-aged, #efeae3); color: var(--color-ink-deep, #1a1714); }
         .nav-list li:active { transform: scale(0.97); }
         .nav-list li.active { background-color: var(--color-xuan-aged, #efeae3); color: var(--color-ink-deep, #1a1714); font-weight: 600; box-shadow: inset 3px 0 0 var(--color-ink-deep, #1a1714); }
         .nav-list li::before { content: ''; position: absolute; left: 0; top: 50%; bottom: 50%; width: 3px; background: var(--color-cinnabar, #c43a31); transform: scaleY(0); transition: transform 0.2s cubic-bezier(0.4,0,0.2,1), top 0.2s, bottom 0.2s; border-radius: 0 2px 2px 0; }
         .nav-list li.active::before { top: 6px; bottom: 6px; transform: scaleY(1); }
         .nav-list li:hover::before { top: 20%; bottom: 20%; transform: scaleY(1); background: var(--color-ink-mist, #b8b2a8); }
         .card-fixed { margin: 20px; padding: 15px; background-color: #1a1714; border: 1px solid #1a1714; border-radius: 8px; font-size: 12px; line-height: 1.6; color: #d8d0c4; font-family: 'Courier New', monospace; max-height: calc(100vh - 300px); overflow-y: auto; }
         .card-fixed .log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #8a847a; font-size: 11px; }
         .card-fixed .log-header .log-clear-btn { cursor: pointer; color: #5a544c; padding: 2px 6px; border: 1px solid #444; border-radius: 3px; font-size: 10px; }
         .card-fixed .log-header .log-clear-btn:hover { color: #f5f3ef; border-color: #5a544c; }
         .card-fixed .log-entry { padding: 1px 0; border-bottom: 1px solid #2e2823; word-break: break-all; }
         .card-fixed .log-entry.log-info { color: #d8d0c4; }
         .card-fixed .log-entry.log-warn { color: #b8b2a8; }
         .card-fixed .log-entry.log-error { color: #8a847a; }
         .card-fixed .log-entry.log-summary { color: #ab9d8c; }
         .card-fixed .log-entry.log-fact { color: #b8b2a8; }
         .card-fixed .log-entry.log-mem0 { color: #ab9d8c; }
         .card-fixed .log-entry.log-kg { color: #c9bca9; }
         .card-fixed .log-time { color: #5a544c; font-size: 10px; }
         .card-fixed::-webkit-scrollbar { width: 4px; }
         .card-fixed::-webkit-scrollbar-thumb { background-color: #2e2823; border-radius: 2px; }
         .divider-line { height: 1px; background-color: #d8d0c4; margin: 8px 14px; } 
         .section-label { display: none; } 
         .section-label-bottom { display: none; } 
         .main-content { flex: 1; display: flex; flex-direction: column; background-color: #f5f3ef; position: relative; } 
         .content-header { padding: 15px 25px; font-size: 16px; font-weight: bold; border-bottom: 1px solid #d8d0c4; background-color: #f5f3ef; display: none; } 
         .editor-area { flex: 1; padding: 20px; overflow-y: auto; scroll-behavior: smooth; } 
         .input-bar { display: flex; justify-content: center; padding: 12px 18px 14px; border-top: 1px solid #d8d0c4; background: #f5f3ef; } 
         .prompt-shell { width: min(960px, 100%); min-height: 84px; display: flex; flex-direction: column; gap: 6px; padding: 12px 18px 10px; border: 1.5px solid #b8b2a8; border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: 0 8px 26px rgba(90,84,76,0.10); transition: box-shadow 0.25s ease, border-color 0.25s ease; }
         .prompt-shell:focus-within { border-color: var(--color-ink-wash, #8a847a); box-shadow: 0 8px 32px rgba(90,84,76,0.15); }
         .input-composer { display: flex; min-width: 0; } 
         .input-box { width: 100%; min-width: 0; border: none; padding: 4px 4px 8px; font-size: 15px; line-height: 1.7; outline: none; background: transparent; color: #1a1714; resize: none; overflow-y: auto; field-sizing: content; max-height: 200px; } 
         .input-box::placeholder { color: #8a847a; } 
         .prompt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; } 
         .prompt-tools { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; } 
         .prompt-plus { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #1a1714; font-size: 25px; line-height: 1; font-weight: 300; flex-shrink: 0; } 
         .prompt-divider { width: 1px; height: 20px; background: #d8d0c4; flex-shrink: 0; } 
         .chat-model-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; } 
         .model-row { display: flex; align-items: center; gap: 6px; min-width: 160px; flex-shrink: 0; } 
         .model-label { font-size: 13px; color: #1a1714; white-space: nowrap; font-weight: 600; } 
         .chat-model-select { max-width: 260px; min-width: 140px; border: none; border-radius: 8px; padding: 5px 22px 5px 6px; font-size: 13px; background: transparent; color: #1a1714; outline: none; } 
         .chat-model-select:hover, .chat-model-select:focus { background: #f5f3ef; } 
         .chat-model-hint { max-width: 280px; font-size: 12px; line-height: 1.35; color: #8a847a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } 
         .openrouter-balance-row { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
         .openrouter-balance { font-size: 12px; line-height: 1.35; color: #2e2823; white-space: nowrap; }
        /* 亲密关系折叠面板 */
        .intimacy-arrow.open { transform: rotate(90deg); }
        #intimacyPanel.show { max-height: 500px ; }
         .openrouter-refresh-btn { border: none; background: transparent; color: #1a1714; border-radius: 8px; padding: 4px 6px; font-size: 12px; cursor: pointer; flex-shrink: 0; }
         .openrouter-refresh-btn:disabled { opacity: 0.6; cursor: not-allowed; }
         /* AI 模式切换开关 */
         .ai-mode-toggle { display: flex; align-items: center; border-radius: 8px; background: #efeae3; padding: 2px; flex-shrink: 0; }
         .ai-mode-option { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #8a847a; cursor: pointer; white-space: nowrap; transition: all 0.2s; }
         .ai-mode-option.active { background: #f5f3ef; color: #1a1714; box-shadow: 0 1px 3px rgba(26,23,20,0.1); }
         .ai-mode-option:hover:not(.active) { color: #1a1714; }
         .send-btn { min-width: 42px; height: 34px; border: none; border-radius: 18px; background: #1a1714; color: #f5f3ef; padding: 0 13px; cursor: pointer; font-size: 13px; font-weight: 700; flex-shrink: 0; transition: background 0.2s, transform 0.15s; }
         .send-btn:hover:not(:disabled) { background: #2e2823; }
         .send-btn:active:not(:disabled) { transform: scale(0.95); }
         .send-photo-btn { border: none; background: transparent; color: #5a544c; padding: 0 8px; cursor: pointer; font-size: 16px; flex-shrink: 0; transition: color 0.2s; border-radius: 6px; }
        .send-photo-btn:hover { color: #1a1714; background: rgba(90,84,76,0.08); }

        /* 图片预览栏 */
        .image-preview-bar { display: flex; gap: 6px; padding: 6px 8px; flex-wrap: wrap; background: #f5f3ef; border-radius: 6px 6px 0 0; max-height: 100px; overflow-y: auto; }
        .image-preview-item { position: relative; width: 60px; height: 60px; border-radius: 6px; overflow: hidden; border: 1px solid #d8d0c4; }
        .image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
        .image-preview-item .remove-btn { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: rgba(26,23,20,0.6); color: #f5f3ef; border: none; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
        .image-preview-item .remove-btn:hover { background: rgba(255,0,0,0.8); }

        /* 图片选择器弹窗 */
         /* ==================== 宪法冻结区结束 ==================== */ 

         /* 左侧子菜单样式 */ 
         .has-submenu { 
            background-color: transparent; 
            color: #5a544c; 
            border-right: 3px solid transparent; 
        } 
        .has-submenu.active { 
            background-color: #efeae3; 
            color: #1a1714; 
            border-right-color: #1a1714; 
            font-weight: 600; 
         } 
         .submenu { 
             list-style: none; 
             padding: 4px 10px 6px 18px; 
             display: none; 
             background-color: #f5f3ef; 
             border-bottom: 1px solid #d8d0c4; 
         } 
         .submenu.show {
             display: block;
         }
         .submenu-wrapper {
             list-style: none;
             padding: 0 ;
             margin: 0 ;
             display: none;
         }
         .submenu-wrapper:has(.submenu.show) {
             display: block;
         }
         .submenu li { 
             padding: 7px 12px; 
             margin: 2px 0; 
             font-size: 12.5px; 
             color: #8a847a; 
             cursor: pointer; 
             border-radius: 6px; 
             transition: all 0.15s ease; 
         } 
         .submenu li:hover { 
             background-color: #efeae3; 
             color: #1a1714; 
         } 
         .submenu li.active-character { 
             background-color: #efeae3; 
             font-weight: 600; 
             color: #1a1714; 
             box-shadow: inset 2px 0 0 #1a1714; 
         } 
         .submenu .add-character { 
             color: #b0a088; 
             font-size: 12px; 
         } 
         .submenu .add-character:hover { 
             color: #1a1714; 
             background-color: #efeae3; 
         }
}
@layer components {
.image-picker-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26,23,20,0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; }
        .image-picker-dialog { background: #f5f3ef; border-radius: 12px; width: 90%; max-width: 520px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(26,23,20,0.2); }
        .image-picker-header { padding: 14px 18px; border-bottom: 1px solid #d8d0c4; display: flex; align-items: center; justify-content: space-between; }
        .image-picker-header h3 { margin: 0; font-size: 16px; color: #1a1714; }
        .image-picker-close { border: none; background: transparent; font-size: 20px; color: #8a847a; cursor: pointer; padding: 4px 8px; }
        .image-picker-close:hover { color: #1a1714; }
        .image-picker-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
        .image-picker-section { margin-bottom: 16px; }
        .image-picker-section h4 { margin: 0 0 8px 0; font-size: 13px; color: #5a544c; font-weight: 600; }
        .character-select-grid { display: flex; flex-wrap: wrap; gap: 8px; }
        .character-chip { padding: 6px 14px; border: 1px solid #d8d0c4; border-radius: 16px; cursor: pointer; font-size: 13px; color: #1a1714; transition: all 0.15s; }
        .character-chip:hover { border-color: #1a1714; color: #1a1714; }
        .character-chip.selected { background: #1a1714; color: #f5f3ef; border-color: #1a1714; }
        .photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
        .photo-grid-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; }
        .photo-grid-item .picker-preview {
            display: none;
            position: fixed;
            z-index: 99999;
            width: 320px;
            max-height: 400px;
            border-radius: 10px;
            box-shadow: 0 8px 32px rgba(26,23,20,0.35);
            background: #f5f3ef;
            padding: 6px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        .photo-grid-item:hover .picker-preview {
            display: block;
            opacity: 1;
        }
        .photo-grid-item .picker-preview img {
            width: 100%;
            max-height: 388px;
            object-fit: contain;
            display: block;
            border-radius: 6px;
        }
        .photo-grid-item img { width: 100%; height: 100%; object-fit: cover; }
        .photo-grid-item:hover { border-color: #1a1714; }
        .photo-grid-item.selected { border-color: #1a1714; }
        .photo-grid-item .checkmark { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: #1a1714; color: #f5f3ef; display: none; align-items: center; justify-content: center; font-size: 12px; }
        .photo-grid-item.selected .checkmark { display: flex; }
        .photo-grid-empty { text-align: center; color: #8a847a; font-size: 13px; padding: 20px; }
        .image-picker-upload { border: 2px dashed #c4b89c; border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; color: #8a847a; font-size: 13px; }
        .image-picker-upload:hover { border-color: #1a1714; color: #1a1714; }
        .image-picker-footer { padding: 12px 18px; border-top: 1px solid #d8d0c4; display: flex; justify-content: flex-end; gap: 8px; }
        .image-picker-footer button { padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
        .image-picker-footer .btn-cancel { background: #f5f3ef; color: #5a544c; }
        .image-picker-footer .btn-confirm { background: #1a1714; color: #f5f3ef; }
        .image-picker-footer .btn-confirm:hover { background: #2e2823; }
         .clear-chat-btn { border: none; background: transparent; color: #555; padding: 0 8px; cursor: pointer; font-size: 11px; flex-shrink: 0; transition: color 0.2s; }
         .clear-chat-btn:hover { color: #1a1714; } 

        /* ===== 关系节奏系统 ===== */
        .rhythm-toggle-btn {
            display: flex; align-items: center; gap: 4px;
            border: 1px solid #c0b8ac; background: transparent; color: #8a847a;
            padding: 3px 10px; cursor: pointer; font-size: 11px; border-radius: 6px;
            transition: all 0.2s; flex-shrink: 0;
        }
        .rhythm-toggle-btn:hover { border-color: #8a7d6b; color: #5a544c; }
        .rhythm-toggle-btn.active { background: #1a1714; color: #f5f3ef; border-color: #1a1714; }
        .rhythm-toggle-btn.active .rhythm-icon { color: #4caf50; }
        .rhythm-toggle-btn .rhythm-icon { font-size: 14px; }
        .rhythm-status-panel {
            position: absolute; bottom: 100%; right: 20px; z-index: 100;
            background: #fff; border: 1px solid #d8d0c4; border-radius: 10px;
            padding: 14px; min-width: 320px; max-width: 400px; max-height: 500px; overflow-y: auto;
            box-shadow: 0 -4px 20px rgba(90,84,76,0.12); display: none;
            font-size: 12px; color: #1a1714;
        }
        .rhythm-status-panel.show { display: block; }
        .rhythm-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
        .rhythm-panel-header h5 { margin: 0; font-size: 13px; font-family: 'Noto Serif SC', serif; }
        .rhythm-panel-close { cursor: pointer; color: #8a847a; font-size: 16px; border: none; background: none; }
        .rhythm-section { margin-bottom: 10px; }
        .rhythm-section-title { font-size: 11px; color: #8a847a; margin-bottom: 4px; font-weight: bold; }
        .rhythm-npc-item { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #f0ebe3; }
        .rhythm-npc-name { font-weight: 500; }
        .rhythm-npc-status { color: #5a544c; font-size: 11px; }
        .rhythm-npc-status.warning { color: #e65100; }
        .rhythm-npc-status.danger { color: #c62828; font-weight: bold; }
        .rhythm-debt-item { padding: 4px 8px; margin: 2px 0; background: #f5f3ef; border-radius: 4px; font-size: 11px; }
        .rhythm-debt-item.expired { background: #fff3e0; border-left: 3px solid #ff9800; }
        .rhythm-debt-item.urgent { background: #e3f2fd; border-left: 3px solid #2196f3; }
        .rhythm-suggestion { padding: 8px 12px; background: #e8f5e9; border-radius: 6px; font-size: 12px; color: #2e7d32; margin-top: 8px; }
        .rhythm-empty { color: #8a847a; text-align: center; padding: 20px; font-size: 12px; }
         .input-box:disabled { color: #8a847a; cursor: not-allowed; } 
         .send-btn:disabled { background: #b8b2a8; cursor: not-allowed; opacity: 0.85; } 
        .modal-mask {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            background: rgba(26,23,20, 0.35);
            z-index: 9999;
        }
        .modal-mask.show {
            display: flex;
        }
        .modal-box {
            width: 360px;
            background: #f5f3ef;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 12px 40px rgba(26,23,20, 0.18);
        }
        .modal-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 12px;
        }
        .modal-input {
            width: 100%;
            border: 1px solid #d8d0c4;
            border-radius: 6px;
            padding: 10px 12px;
            font-size: 14px;
            outline: none;
        }
        .modal-input:focus {
            border-color: #1a1714;
        }
        .modal-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 16px;
        }
        .modal-btn {
            border: 1px solid #d8d0c4;
            border-radius: 6px;
            padding: 8px 16px;
            cursor: pointer;
            background: #f5f3ef;
        }
        .modal-btn.primary {
            border-color: #1a1714;
            background: #1a1714;
            color: #f5f3ef;
        }

        .character-content {
            max-width: 920px;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            gap: 16px;
            min-height: 0;
        }
        .character-path {
            color: #8b6aa8;
            font-size: 13px;
            margin: 4px 0 10px;
        }
        .character-profile-panel {
            flex: 1 1 100%;
            min-width: 0;
            min-height: 320px;
            overflow-y: auto;
            border: 2px solid rgba(255, 151, 203, 0.55);
            border-radius: 22px;
            background:
                radial-gradient(circle at 8% 0%, rgba(255, 224, 240, 0.95), transparent 30%),
                radial-gradient(circle at 92% 8%, rgba(202, 233, 255, 0.95), transparent 28%),
                linear-gradient(135deg, #fff7fc 0%, #f5f3ef 48%, #fffdf5 100%);
            padding: 18px;
            box-shadow: 0 14px 36px rgba(187, 129, 208, 0.22);
            position: relative;
        }
        .character-chat-panel {
            flex: 1;
            min-width: 320px;
            min-height: 220px;
            overflow: hidden;
            border: 1px solid rgba(177, 203, 255, 0.8);
            border-radius: 18px;
            background: linear-gradient(180deg, #f5f3ef 0%, #f7faff 100%);
            padding: 14px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 8px 22px rgba(124, 156, 220, 0.13);
        }
        .character-panel-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 10px;
        }
        .character-panel-title h3 {
            color: #1a1714;
            letter-spacing: 1px;
            text-shadow: 0 2px 0 rgba(245,243,239,0.9);
        }
        .character-save-btn {
            border: none;
            border-radius: 999px;
            background: linear-gradient(135deg, #1a1714 0%, #1a1714 100%);
            color: #f5f3ef;
            padding: 9px 18px;
            cursor: pointer;
            font-weight: bold;
            box-shadow: 0 8px 18px rgba(255, 120, 183, 0.28);
            transition: transform 0.15s, box-shadow 0.15s;
        }
        .character-save-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 10px 22px rgba(142, 125, 255, 0.32);
        }
        .character-save-btn.secondary {
            background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
            box-shadow: 0 8px 18px rgba(59, 130, 246, 0.28);
        }
        .character-save-btn.secondary:hover {
            box-shadow: 0 10px 22px rgba(59, 130, 246, 0.32);
        }
        .character-save-btn.copied {
            background: #1a1714 ;
            box-shadow: 0 8px 18px rgba(16, 185, 129, 0.28) ;
        }
        .character-resume {
            display: grid;
            grid-template-columns: 38.2fr 61.8fr;
            gap: 20px;
            align-items: start;
        }
        .character-media-row {
            display: grid;
            grid-template-columns: 220px 1fr;
            gap: 14px;
            align-items: stretch;
            margin-bottom: 16px;
            height: 400px;
        }
        .character-photo-card {
            border: 1px solid var(--color-border-ink);
            border-radius: 12px;
            padding: 10px;
            background: var(--color-xuan-light);
            box-shadow: var(--shadow-sm);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .character-photo-frame {
            flex: 1;
            min-height: 0;
            border: 1px dashed var(--color-ink-mist);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--color-ink-wash);
            background: var(--color-xuan-aged);
            font-size: 13px;
            text-align: center;
            overflow: hidden;
        }
        .character-photo-frame img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }
        .character-gallery-panel {
            border: 1px solid var(--color-border-ink);
            border-radius: 12px;
            padding: 10px;
            background: var(--color-xuan-light);
            box-shadow: var(--shadow-sm);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .character-gallery-panel .character-gallery-grid {
            grid-template-columns: repeat(12, 1fr);
            gap: 3px;
            flex: 1;
        }
        .character-data-section {
            border: 1px solid var(--color-border-ink);
            border-radius: 12px;
            padding: 16px;
            background: var(--color-xuan-light);
            box-shadow: var(--shadow-sm);
        }
        .character-upload-btn {
            width: 100%;
            margin-top: 8px;
            border: 1px solid var(--color-border-ink);
            border-radius: 8px;
            background: var(--color-xuan);
            color: var(--color-ink-heavy);
            padding: 7px 10px;
            cursor: pointer;
            font-weight: 500;
            font-size: 13px;
            transition: background var(--transition-fast), border-color var(--transition-fast);
        }
        .character-upload-btn:hover {
            background: var(--color-xuan-aged);
            border-color: var(--color-ink-mist);
        }
        /* 照片悬停原图浮层 - 紧凑预览卡片 */
        .character-photo-frame {
            position: relative;
            cursor: zoom-in;
        }
        .character-photo-frame .photo-preview {
            display: none;
            position: fixed;
            z-index: 99999;
            width: 320px;
            max-height: 400px;
            border-radius: 10px;
            box-shadow: 0 8px 32px rgba(26,23,20,0.35);
            background: #f5f3ef;
            padding: 6px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        .character-photo-frame:hover .photo-preview {
            display: block;
            opacity: 1;
        }
        .character-photo-frame .photo-preview img {
            width: 100%;
            max-height: 388px;
            object-fit: contain;
            display: block;
            border-radius: 6px;
        }
        /* 相册集 */
        .character-gallery {
            margin-top: 12px;
            border-top: 1px dashed rgba(142, 125, 255, 0.4);
            padding-top: 10px;
        }
        .character-gallery-fullwidth {
            margin-top: 16px;
            padding: 14px;
            border: 1px solid var(--color-border-ink);
            border-radius: 12px;
            background: var(--color-xuan-light);
            box-shadow: var(--shadow-sm);
        }
        .character-gallery-fullwidth .character-gallery-grid {
            grid-template-columns: repeat(8, 1fr);
        }
        .character-gallery-title {
            font-size: 12px;
            color: #1a1714;
            font-weight: 600;
            margin-bottom: 8px;
        }
        .character-gallery-grid {
            display: grid;
            grid-template-columns: repeat(12, 1fr);
            gap: 3px;
        }
        .character-gallery-item {
            position: relative;
            aspect-ratio: 9 / 16;
            border: 1px dashed rgba(142, 125, 255, 0.4);
            border-radius: 6px;
            overflow: visible;
            cursor: zoom-in;
            background: rgba(255,214,235,0.15);
        }
        .character-gallery-item .gallery-thumb {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border-radius: 8px;
        }
        .character-gallery-item .gallery-empty {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            font-size: 11px;
            color: #bbb;
        }
        .character-gallery-item .gallery-remove {
            display: none;
            position: absolute;
            top: 2px;
            right: 2px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: rgba(26,23,20,0.6);
            color: #f5f3ef;
            border: none;
            font-size: 10px;
            cursor: pointer;
            align-items: center;
            justify-content: center;
            line-height: 1;
            z-index: 2;
        }
        .character-gallery-item:hover .gallery-remove {
            display: flex;
        }
        .character-gallery-item .gallery-preview {
            display: none;
            position: fixed;
            z-index: 99999;
            width: 320px;
            max-height: 400px;
            border-radius: 10px;
            box-shadow: 0 8px 32px rgba(26,23,20,0.35);
            background: #f5f3ef;
            padding: 6px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        .character-gallery-item:hover .gallery-preview {
            display: block;
            opacity: 1;
        }
        .character-gallery-item .gallery-preview img {
            width: 100%;
            max-height: 388px;
            object-fit: contain;
            display: block;
            border-radius: 6px;
        }
        /* 图片懒加载占位 */
        .photo-loading, .gallery-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            min-height: 120px;
            color: #aaa;
            font-size: 12px;
            gap: 6px;
        }
        .gallery-loading {
            min-height: 80px;
            width: 100%;
        }
        .photo-loading-spinner {
            width: 20px;
            height: 20px;
            border: 2px solid #d8d0c4;
            border-top-color: #1a1714;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        .gallery-preview-lazy {
            display: none ;
        }
        .character-image-model-select {
            width: 100%;
            margin-top: 10px;
            border: 1px solid rgba(199, 177, 240, 0.78);
            border-radius: 999px;
            padding: 8px 10px;
            color: #1a1714;
            background: rgba(245,243,239,0.92);
            outline: none;
            font-weight: bold;
        }
        .generated-image-card {
            margin-top: 10px;
            border: 1px solid rgba(255, 167, 213, 0.65);
            border-radius: 14px;
            padding: 10px;
            background: rgba(245,243,239,0.72);
        }
        .generated-image-card img {
            width: 220px;
            max-width: 100%;
            border-radius: 12px;
            display: block;
            box-shadow: 0 8px 18px rgba(124, 91, 150, 0.18);
        }
        .generated-image-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }
        .generated-image-actions button {
            border: none;
            border-radius: 999px;
            padding: 7px 12px;
            cursor: pointer;
            font-weight: bold;
        }
        .generated-image-use {
            background: #7a9b3a;
            color: #f5f3ef;
        }
        .generated-image-reject {
            background: #f5f3ef1f0;
            color: #cf1322;
        }
        .generated-image-status {
            margin-top: 8px;
            color: #8b6aa8;
            font-size: 13px;
        }
        .character-section {
            border: 1px solid rgba(220, 198, 255, 0.75);
            border-radius: 16px;
            padding: 12px;
            margin-bottom: 12px;
            background: rgba(245,243,239,0.76);
            box-shadow: 0 4px 14px rgba(158, 132, 216, 0.08);
        }
        .character-section h4 {
            color: #5a544c;
            margin-bottom: 12px;
            font-size: 15px;
            border-left: 4px solid #ff8cc8;
            padding-left: 8px;
        }
        .character-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
        }
        .character-field {
            display: flex;
            flex-direction: column;
            gap: 6px;
            font-size: 13px;
            color: #555;
        }
        .character-field span {
            color: #7c5b96;
            font-weight: bold;
        }
        /* 空字段弱化样式（编辑模式） */
        .character-field-empty {
            opacity: 0.55;
        }
        .character-field-empty input,
        .character-field-empty textarea {
            background: rgba(245, 240, 250, 0.5) ;
            border-style: dashed ;
            border-color: rgba(199, 177, 240, 0.4) ;
        }
        /* 填写率徽章 */
        .fill-badge {
            display: inline-block;
            font-size: 11px;
            font-weight: 600;
            padding: 1px 8px;
            border-radius: 999px;
            margin-left: 6px;
            vertical-align: middle;
        }
        .fill-badge.full { background: rgba(29, 201, 129, 0.14); color: #1a9c68; }
        .fill-badge.partial { background: rgba(239, 170, 23, 0.14); color: #b87d0e; }
        .fill-badge.empty { background: rgba(136, 136, 136, 0.12); color: #8a847a; }
        /* 自定义字段样式 */
        .character-field-custom {
            border: 1px dashed rgba(199, 177, 240, 0.5);
            border-radius: 10px;
            padding: 6px 8px;
            background: rgba(247, 243, 252, 0.5);
        }
        .character-field-custom span {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .character-section h4 {
            display: flex;
            align-items: center;
        }
        .character-field input,
        .character-field select,
        .character-field textarea {
            border: 1px solid rgba(199, 177, 240, 0.78);
            border-radius: 12px;
            padding: 8px 10px;
            font-size: 14px;
            outline: none;
            background: rgba(245,243,239,0.92);
        }
        .character-field textarea {
            min-height: 90px;
            resize: vertical;
            line-height: 1.5;
        }
        .character-field input:focus,
        .character-field select:focus,
        .character-field textarea:focus {
            border-color: #1a1714;
            box-shadow: 0 0 0 3px rgba(255, 120, 183, 0.16);
        }
        .character-field.full {
            grid-column: 1 / -1;
        }
        .character-save-hint {
            color: #7a9b3a;
            font-size: 13px;
            margin-top: 8px;
        }

         /* 聊天样式 */ 
         .chat-messages {
             display: flex;
             flex-direction: column;
             gap: 16px;
             height: 100%;
         }
        .load-more-btn {
            text-align: center;
            padding: 10px;
            margin: 4px 0;
            background: rgba(90,84,76,0.08);
            border: 1px solid rgba(90,84,76,0.2);
            border-radius: 8px;
            color: #1a1714;
            cursor: pointer;
            font-size: 13px;
            user-select: none;
            transition: background 0.15s;
        }
        .load-more-btn:hover {
            background: rgba(90,84,76,0.15);
        } 
        .social-relations-page {
            height: 100%;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .social-relations-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 14px;
            border: 1px solid #d8d0c4;
            border-radius: 10px;
            background: #f5f3ef;
        }
        .social-relations-toolbar h3 {
            margin: 0 0 2px;
            font-size: 15px;
        }
        .social-relations-toolbar p {
            margin: 0;
            color: #8a847a;
            font-size: 12px;
        }
        .social-relations-content {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            flex: 1;
            min-height: 0;
        }
        .social-relations-graph {
            flex: 1;
            min-width: 0;
            min-height: 400px;
            border: 1px solid #d8d0c4;
            border-radius: 10px;
            background: #f5f3ef;
            overflow: auto;
        }
        .social-relations-graph svg {
            width: 100%;
            height: auto;
            display: block;
        }
        /* ===== 动态关系图（Canvas 引擎）===== */
        .social-graph-wrap {
            position: relative;
            overflow: hidden;
        }
        .social-graph-wrap .sg-canvas {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            display: block;
            touch-action: none;
            cursor: grab;
        }
        .social-graph-wrap .sg-tools {
            position: absolute;
            top: 10px;
            right: 10px;
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            justify-content: flex-end;
            z-index: 5;
        }
        .social-graph-wrap .sg-btn {
            padding: 6px 12px;
            font-size: 12px;
            border-radius: 8px;
            border: 1px solid #d8d0c4;
            background: rgba(245,243,239,.92);
            color: #1a1714;
            cursor: pointer;
            font-family: inherit;
        }
        .social-graph-wrap .sg-btn:hover { background: #efe7da; }
        .social-graph-wrap .sg-legend {
            position: absolute;
            left: 10px;
            bottom: 10px;
            font-size: 11px;
            color: #5a544c;
            background: rgba(245,243,239,.92);
            padding: 7px 12px;
            border-radius: 10px;
            border: 1px solid #d8d0c4;
            line-height: 1.9;
            z-index: 5;
            pointer-events: none;
        }
        .social-graph-wrap .sg-legend .row { display: flex; align-items: center; gap: 8px; }
        .social-graph-wrap .sg-legend .sw { width: 26px; height: 3px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
        .social-graph-wrap .sg-legend .sw.dash { background: repeating-linear-gradient(90deg,#8a847a 0 5px,transparent 5px 10px); }
        .social-graph-wrap .sg-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
        .social-graph-wrap .sg-legend .dot.main { background: #1a1714; border: 2px solid #fff; box-shadow: 0 0 0 1px #1a1714; }
        .social-graph-wrap .sg-mobile-tip {
            position: absolute;
            top: 10px;
            left: 10px;
            font-size: 11px;
            color: #8a847a;
            background: rgba(245,243,239,.9);
            padding: 4px 10px;
            border-radius: 99px;
            border: 1px solid #d8d0c4;
            z-index: 5;
            pointer-events: none;
        }
        .social-relations-detail {
            width: 300px;
            flex-shrink: 0;
            max-height: calc(100vh - 280px);
            overflow-y: auto;
        }
        /* 详情卡折叠头：桌面端隐藏（始终展开），手机端显示为可点击条 */
        .sg-detail-head { display: none; }
        .sg-detail-body { display: block; }
        .social-empty {
            padding: 24px;
            color: #8a847a;
            line-height: 1.8;
        }
        .social-legend {
            color: #5a544c;
            font-size: 12px;
        }
        .social-timeline-section {
            margin-top: 4px;
            padding: 10px 14px;
            background: transparent;
            border-top: 1px solid #d8d0c4;
            border-radius: 0;
        }
        .social-timeline-section h4 {
            margin: 0 0 6px 0;
            font-size: 13px;
            color: #8a847a;
            font-weight: 600;
        }
        /* 右侧详情面板内部统一样式 */
        .rel-detail-card {
            background: #f5f3ef;
            border: 1px solid #d8d0c4;
            border-radius: 10px;
            padding: 14px;
        }
        .rel-detail-card .rel-header {
            margin: 0 0 6px;
            font-size: 17px;
            font-weight: 700;
            color: #1a1714;
        }
        .rel-detail-card .rel-meta {
            font-size: 12px;
            color: #8a847a;
            margin-bottom: 14px;
        }
        .rel-detail-card .rel-meta .rel-type {
            color: #1a1714;
            font-weight: 600;
        }
        .rel-bar-row {
            margin-bottom: 12px;
        }
        .rel-bar-label {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4px;
        }
        .rel-bar-label .label-text {
            font-size: 12px;
            color: #8a847a;
        }
        .rel-bar-label .label-value {
            font-size: 13px;
            font-weight: 700;
        }
        .rel-bar-track {
            height: 8px;
            background: #f5f3ef;
            border-radius: 4px;
            overflow: hidden;
        }
        .rel-bar-fill {
            height: 100%;
            border-radius: 4px;
            transition: width 0.3s;
        }
        .rel-section {
            margin-bottom: 12px;
            padding: 10px;
            border-radius: 8px;
        }
        .rel-section-title {
            font-size: 12px;
            font-weight: 700;
            margin-bottom: 6px;
        }
        .rel-stat-row {
            display: flex;
            gap: 8px;
            margin-top: 6px;
        }
        .rel-stat-box {
            flex: 1;
            background: rgba(245,243,239,0.7);
            padding: 5px 8px;
            border-radius: 6px;
            text-align: center;
        }
        .rel-stat-box .stat-label {
            font-size: 10px;
            color: #8a847a;
        }
        .rel-stat-box .stat-value {
            font-size: 13px;
            font-weight: 700;
        }
        .rel-style-grid {
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-bottom: 6px;
        }
        .rel-style-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: #f5f3ef;
            padding: 4px 10px;
            border-radius: 4px;
            border: 1px solid #d8d0c4;
        }
        .rel-style-item .style-label {
            font-size: 10px;
            color: #8a847a;
        }
        .rel-style-item .style-value {
            font-size: 12px;
            font-weight: 600;
        }
        .rel-style-desc {
            font-size: 11px;
            color: #5a544c;
            line-height: 1.5;
            padding: 6px 8px;
            background: rgba(245,243,239,0.5);
            border-radius: 4px;
        }
        .rel-info-row {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
        }
        .rel-info-box {
            flex: 1;
            background: #faf6ef;
            padding: 6px 10px;
            border-radius: 6px;
            text-align: center;
        }
        .rel-info-box .info-label {
            font-size: 10px;
            color: #8a847a;
        }
        .rel-info-box .info-value {
            font-size: 13px;
            font-weight: 600;
            color: #1a1714;
        }
        .rel-history-title {
            font-size: 12px;
            font-weight: 600;
            color: #5a544c;
            margin-bottom: 6px;
        }
            .character-profile-panel {
                flex: none;
                min-width: 0;
            }
        }
         .message-wrapper { 
             display: flex; 
             gap: 0;
             margin-bottom: 12px;
         } 
         .message-wrapper.user { 
             justify-content: flex-end; 
         } 
         .message-wrapper.ai { 
             justify-content: flex-start; 
         } 
         .avatar { 
             display: none;
         } 
         .message { 
             max-width: 90%;
             padding: 0;
             border-radius: 0;
             font-size: 14px;
             line-height: 1.8;
             background: transparent ;
             border: none ;
             box-shadow: none ;
         } 
         .message.user { 
             background-color: transparent ;
             color: #1a1714 ;
         } 
         .message.ai { 
             background-color: transparent ;
             color: #1a1714 ;
         } 
         .message-time {
            font-size: 11px;
            opacity: 0.7;
            margin-top: 4px;
            text-align: right;
        }
        .message-actions {
            display: flex;
            gap: 2px;
            margin-bottom: 4px;
            opacity: 0;
            transition: opacity 0.15s;
        }
        .message-wrapper:hover .message-actions {
            opacity: 1;
        }
        .msg-action-btn {
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            border-radius: 6px;
            background: transparent;
            color: #8a847a;
            cursor: pointer;
            font-size: 14px;
            transition: background 0.15s, color 0.15s;
            flex-shrink: 0;
        }
        .msg-action-btn:hover {
            background: #d8d0c4;
            color: #1a1714;
        }
        .msg-action-btn.copied {
            color: #2e2823;
        }
        .message-wrapper.user .msg-action-btn:hover {
            background: rgba(245,243,239,0.2);
            color: #f5f3ef;
        } 
         .input-box:focus {
            border-color: #1a1714;
        }
        .setting-summary-box {
            background: #f5f3ef;
            border: 1px solid #d8d0c4;
            border-radius: 10px;
            padding: 12px 14px;
            margin: 10px 0 14px;
        }
        .setting-summary-box.empty {
            background: #f5f3ef;
            border-style: dashed;
        }
        .setting-summary-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 13px;
            font-weight: 600;
            color: #1a1714;
        }
        .setting-summary-btn {
            font-size: 12px;
            padding: 4px 10px;
            border: 1px solid #c4b89c;
            border-radius: 6px;
            background: #f5f3ef;
            color: #5a544c;
            cursor: pointer;
            transition: all 0.15s;
        }
        .setting-summary-btn:hover {
            background: #1a1714;
            color: #f5f3ef;
            border-color: #1a1714;
        }
        .setting-summary-text {
            font-size: 13px;
            line-height: 1.6;
            color: #5a544c;
            white-space: pre-wrap;
        }
        .setting-summary-box.empty .setting-summary-text {
            color: #b0a088;
            font-style: italic;
        }
        /* 世界观设定卡片样式 */ 
         .world-card { 
             background-color: #f5f3ef; 
             border: 2px solid #1a1714; 
             border-radius: 12px; 
             padding: 20px; 
             margin-bottom: 16px; 
             box-shadow: 0 2px 8px rgba(26,23,20,0.1); 
         } 
         .world-card h3 { 
             color: #1a1714; 
             font-size: 16px; 
             margin-bottom: 15px; 
             padding-bottom: 10px; 
             border-bottom: 1px solid #d8d0c4; 
         } 
         .world-card .setting-item { 
             display: flex; 
             margin-bottom: 10px; 
             line-height: 1.6; 
         } 
         .world-card .setting-label { 
             font-weight: bold; 
             color: #1a1714; 
             min-width: 80px; 
         } 
         .world-card .setting-value { 
             color: #5a544c; 
         } 
         .world-card.pending .setting-value { 
             color: #f90; 
             background-color: #f5f3ef8e6; 
             padding: 2px 6px; 
             border-radius: 4px; 
         } 
         .confirm-hint { 
             color: #f90; 
             font-size: 13px; 
             margin-top: 10px; 
             font-style: italic; 
         } 
        /* 世界观可编辑表单样式 */
        .world-edit-row {
            display: flex;
            gap: 8px;
            align-items: flex-start;
            margin-bottom: 8px;
        }
        .world-edit-key {
            flex: 0 0 140px;
            border: 1px solid #c4b89c;
            border-radius: 6px;
            padding: 6px 8px;
            font-size: 13px;
            font-weight: bold;
            color: #1a1714;
            background: #f7faff;
        }
        .world-edit-value {
            flex: 1;
            border: 1px solid #c4b89c;
            border-radius: 6px;
            padding: 6px 8px;
            font-size: 13px;
            color: #1a1714;
            min-height: 36px;
            resize: vertical;
            font-family: inherit;
            line-height: 1.5;
        }
        .world-edit-key:focus, .world-edit-value:focus {
            border-color: #1a1714;
            outline: none;
        }
        .world-edit-remove {
            border: 1px solid #ffcdd2;
            background: #f5f3ef;
            color: #1a1714;
            border-radius: 6px;
            padding: 6px 10px;
            cursor: pointer;
            font-size: 12px;
            align-self: flex-start;
        }
        .world-edit-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
            margin-top: 12px;
            padding-top: 10px;
            border-top: 1px dashed #e0e6ef;
        }
        .world-edit-btn {
            border: 1px solid #1a1714;
            background: #1a1714;
            color: #f5f3ef;
            border-radius: 6px;
            padding: 7px 14px;
            cursor: pointer;
            font-size: 13px;
        }
        .world-edit-btn.secondary {
            background: #f5f3ef;
            color: #1a1714;
        }
        .world-edit-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }
        .world-edit-status {
            font-size: 12px;
            color: #2e2823;
            margin-left: 4px;
        }
        .world-edit-tip {
            font-size: 12px;
            color: #8a847a;
            margin: 6px 0 10px;
        }
        .auth-mask {
            position: fixed;
            inset: 0;
            background: linear-gradient(135deg, #f5f3ef, #f5f3ef);
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .auth-mask.hidden { display: none; }
        .auth-box {
            width: 380px;
            background: #f5f3ef;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            box-shadow: 0 18px 50px rgba(24, 119, 242, 0.15);
            padding: 24px;
        }
        .auth-title { font-size: 20px; font-weight: bold; margin-bottom: 6px; }
        .auth-subtitle { font-size: 13px; color: #5a544c; margin-bottom: 18px; }
        .auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
        .auth-tab { flex: 1; border: 1px solid #d8d0c4; background: #f5f3ef; border-radius: 8px; padding: 9px; cursor: pointer; }
        .auth-tab.active { background: #1a1714; color: #f5f3ef; border-color: #1a1714; }
        .auth-input { width: 100%; margin-bottom: 10px; border: 1px solid #d8d0c4; border-radius: 8px; padding: 10px 12px; outline: none; }
        .auth-input:focus { border-color: #1a1714; }
        .auth-submit { width: 100%; background: #1a1714; color: #f5f3ef; border: none; border-radius: 8px; padding: 11px; font-weight: bold; cursor: pointer; }
        .auth-error { min-height: 20px; color: #1a1714; font-size: 13px; margin-top: 10px; }
        .user-bar { padding: 10px 20px; font-size: 12px; border-bottom: 1px solid #d8d0c4; background: #f5f3ef; color: #555; }
        .user-link { color: #1a1714; cursor: pointer; margin-left: 8px; }
        .admin-panel {
            position: fixed;
            inset: 48px;
            z-index: 9998;
            display: none;
            background: #f5f3ef;
            border: 1px solid #d8d0c4;
            border-radius: 12px;
            box-shadow: 0 18px 60px rgba(26,23,20,.18);
            padding: 20px;
            overflow: auto;
        }
        .admin-panel.show { display: block; }
        .admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 14px; }
        .admin-table th, .admin-table td { border-bottom: 1px solid #d8d0c4; padding: 10px; text-align: left; }
        .admin-btn { border: 1px solid #d8d0c4; background: #f5f3ef; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
        .admin-btn.danger { color: #1a1714; border-color: #ffcdd2; }
        .admin-btn.success { color: #2e2823; border-color: rgba(46,40,35,0.12); }

            .character-profile-panel,
            .character-resume {
                grid-template-columns: 1fr;
            }
            .summary-toolbar {
                padding: 8px 10px;
                flex-direction: row;
                align-items: flex-start;
                gap: 6px;
            }
            .summary-card {
                align-items: flex-start;
                flex-direction: row;
                gap: 4px;
            }
            .summary-card-brief {
                white-space: normal;
            }
            @media (max-width: 768px) {
            /* ===== 手机端社会关系页：上下堆叠，图占主屏 ===== */
            .social-relations-toolbar {
                padding: 6px 10px;
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
                flex-wrap: wrap;
            }
            .social-relations-toolbar h3 {
                font-size: 14px;
            }
            .sg-toolbar-desc {
                display: none;
            }
            .sg-toolbar-btns {
                display: flex;
                gap: 6px;
                flex-wrap: nowrap;
            }
            .sg-toolbar-btns .timeline-btn {
                padding: 5px 10px;
                font-size: 12px;
                white-space: nowrap;
            }
            .social-relations-content {
                flex-direction: column;
                align-items: stretch;
            }
            .social-relations-graph.social-graph-wrap {
                width: 100%;
                flex: 1 1 auto;
                height: calc(100vh - 330px);
                min-height: 320px;
                max-height: 72vh;
                overflow: hidden;
                -webkit-overflow-scrolling: auto;
            }
            /* 详情卡折叠后，图自动放大占屏 */
            .social-relations-content:has(.sg-detail-body.collapsed) .social-relations-graph.social-graph-wrap {
                height: calc(100vh - 240px);
                max-height: 86vh;
            }
            .social-graph-wrap .sg-btn {
                padding: 8px 12px;
                font-size: 12px;
            }
            .social-graph-wrap .sg-legend {
                font-size: 10px;
                padding: 5px 9px;
                line-height: 1.7;
                bottom: 8px;
                left: 8px;
            }
            .social-graph-wrap .sg-legend .sw { width: 18px; }
            .social-graph-wrap .sg-mobile-tip {
                top: 8px;
                left: 8px;
                font-size: 10.5px;
            }
            /* 详情卡：底部面板，可折叠 */
            .social-relations-detail {
                width: 100%;
                max-height: 42vh;
                overflow-y: auto;
                flex-shrink: 0;
            }
            .sg-detail-head {
                display: flex;
                position: sticky;
                top: 0;
                z-index: 2;
                align-items: center;
                justify-content: space-between;
                padding: 10px 14px;
                background: #f5f3ef;
                border-bottom: 1px solid #d8d0c4;
                cursor: pointer;
                font-weight: 600;
                font-size: 14px;
                color: #1a1714;
            }
            .sg-detail-head .sg-detail-arrow {
                color: #8a847a;
                transition: transform .2s;
                font-size: 13px;
            }
            .sg-detail-head.collapsed .sg-detail-arrow { transform: rotate(-90deg); }
            .sg-detail-body.collapsed { display: none; }
            .social-relations-graph svg {
                width: 100%;
                height: 100%;
                display: block;
            }
            }
            /* === 人物信息卡移动端适配 === */
            .character-resume {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            .character-photo-frame {
                height: 160px;
            }
            .character-photo-card {
                padding: 6px;
            }
            .character-gallery-panel .character-gallery-grid {
                grid-template-columns: repeat(12, 1fr);
                gap: 3px;
            }
            .character-section {
                padding: 8px;
                margin-bottom: 8px;
                border-radius: 10px;
            }
            .character-section h4 {
                font-size: 13px;
                margin-bottom: 8px;
            }
            .character-grid {
                grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
                gap: 8px;
            }
            .character-field {
                font-size: 12px;
                gap: 3px;
            }
            .character-field input,
            .character-field select,
            .character-field textarea {
                padding: 6px 8px;
                font-size: 13px;
                border-radius: 8px;
            }
            .character-field textarea {
                min-height: 60px;
            }
            .character-upload-btn {
                font-size: 11px;
                padding: 5px 8px;
            }
            .character-gallery-grid {
                grid-template-columns: repeat(12, 1fr);
                gap: 3px;
            }
            .world-card {
                padding: 14px;
                border-radius: 14px;
            }
            .world-card .setting-item {
                grid-template-columns: 1fr;
                gap: 6px;
            }
            .admin-panel {
                inset: 12px;
                padding: 14px;
            }
        }

        /* ============ UI 特效系统 ============ */

        /* 1. 标签切换淡入效果（简洁版） */
        .editor-area {
            position: relative;
        }
        .editor-area.tab-fade-in {
            animation: tabFadeIn 0.25s ease-out both;
        }
        @keyframes tabFadeIn {
            0% { opacity: 0; transform: translateY(6px); }
            100% { opacity: 1; transform: translateY(0); }
        }

        /* 2. 消息气泡入场动画 */
        .message-wrapper {
            animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
        }
        @keyframes msgSlideIn {
            0%   { transform: translateY(16px); opacity: 0; }
            100% { transform: translateY(0); opacity: 1; }
        }
        .message-wrapper.user {
            animation-name: msgSlideInRight;
        }
        @keyframes msgSlideInRight {
            0%   { transform: translateX(24px) translateY(8px); opacity: 0; }
            100% { transform: translateX(0) translateY(0); opacity: 1; }
        }
        .message-wrapper.ai {
            animation-name: msgSlideInLeft;
        }
        @keyframes msgSlideInLeft {
            0%   { transform: translateX(-24px) translateY(8px); opacity: 0; }
            100% { transform: translateX(0) translateY(0); opacity: 1; }
        }

        /* AI 流式打字光标 */
        .typing-cursor::after {
            content: '▊';
            animation: blink 0.8s steps(2) infinite;
            color: #1a1714;
            font-weight: normal;
        }
        @keyframes blink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0; }
        }

        /* 3. 按钮波纹涟漪效果 */
        .ripple-btn {
            position: relative;
            overflow: hidden;
        }
        .ripple-effect {
            position: absolute;
            border-radius: 50%;
            background: rgba(245,243,239,0.4);
            transform: scale(0);
            animation: rippleExpand 0.5s ease-out;
            pointer-events: none;
        }
        @keyframes rippleExpand {
            to { transform: scale(2.5); opacity: 0; }
        }

        /* 4. 侧边菜单项滑入 */
        .nav-list li {
            position: relative;
            overflow: hidden;
        }
        .nav-list li::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: #1a1714;
            transform: scaleY(0);
            transition: transform 0.25s ease;
        }
        .nav-list li.active::before {
            transform: scaleY(1);
        }
        .nav-list li:hover::before {
            transform: scaleY(0.6);
        }

        /* 5. 登录框入场动画 */
        .auth-mask {
            animation: authFadeIn 0.4s ease forwards;
        }
        .auth-box {
            animation: authBoxIn 0.6s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
        }
        @keyframes authFadeIn {
            from { opacity: 0; }
            to   { opacity: 1; }
        }
        @keyframes authBoxIn {
            0%   { transform: translateY(30px) scale(0.95); opacity: 0; }
            100% { transform: translateY(0) scale(1); opacity: 1; }
        }
        .auth-box.floating {
            animation: authFloat 3s ease-in-out infinite;
        }
        @keyframes authFloat {
            0%, 100% { transform: translateY(0); }
            50%      { transform: translateY(-6px); }
        }

        /* 登录成功溶解过渡 */
        .auth-mask.dissolving {
            animation: dissolve 0.6s ease forwards;
        }
        @keyframes dissolve {
            0%   { opacity: 1; filter: blur(0); }
            100% { opacity: 0; filter: blur(20px); transform: scale(1.1); }
        }

        /* 6. Tab 标签下划线指示器 */
        .auth-tabs {
            position: relative;
        }
        .auth-tab-indicator {
            position: absolute;
            bottom: 0;
            height: 2px;
            background: #1a1714;
            border-radius: 1px;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* 7. 发送按钮脉冲（有待发图片时） */
        .send-btn.has-images {
            animation: pulseBlue 1.5s ease-in-out infinite;
        }
        @keyframes pulseBlue {
            0%, 100% { box-shadow: 0 0 0 0 rgba(24, 119, 242, 0.3); }
            50%      { box-shadow: 0 0 0 6px rgba(24, 119, 242, 0); }
        }

        /* 8. 内容区淡入 */
        .content-fade-in {
            animation: contentFadeIn 0.3s ease forwards;
        }
        @keyframes contentFadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        /* 9. Toast 通知 */
        .toast-notification {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 99999;
            padding: 12px 20px;
            border-radius: 10px;
            background: #1a1714;
            color: #f5f3ef;
            font-size: 14px;
            box-shadow: 0 4px 20px rgba(26,23,20,0.15);
            animation: toastIn 0.3s ease forwards, toastOut 0.3s ease 2.5s forwards;
        }
        @keyframes toastIn {
            from { transform: translateX(100%); opacity: 0; }
            to   { transform: translateX(0); opacity: 1; }
        }
        @keyframes toastOut {
            from { transform: translateX(0); opacity: 1; }
            to   { transform: translateX(100%); opacity: 0; }
        }

        /* ================================================================ */
        .auth-mask {
            background: radial-gradient(ellipse at center, rgba(62,39,35,0.6), rgba(20,15,10,0.9)) ;
        }
        .auth-box {
            background: linear-gradient(160deg, #f5f3ef 0%, #efeae3 50%, #e4ddd4 100%) ;
            border: 1px solid #c0b8ac ;
            border-radius: 14px ;
            box-shadow: 0 10px 40px rgba(90,84,76,0.2), 0 2px 8px rgba(26,23,20,0.1) ;
            padding: 32px 36px ;
        }
        .auth-title {
            color: #1a1714 ;
            font-family: 'Noto Serif SC', serif ;
            font-size: 24px ;
            text-shadow: none ;
            letter-spacing: 3px ;
        }
        .auth-subtitle { color: #8a847a ; font-size: 12px ; }
        .auth-input {
            background: rgba(245,243,239,0.8) ;
            border: 1px solid #c0b8ac ;
            color: #1a1714 ;
            border-radius: 6px ;
        }
        .auth-input:focus {
            border-color: #1a1714 ;
            box-shadow: 0 0 0 3px rgba(184,115,42,0.1) ;
        }
        .auth-input::placeholder { color: #c4b8a6 ; }
        .auth-submit {
            background: linear-gradient(180deg, #1a1714, #a06220) ;
            color: #f5f3ef ;
            border: none ;
            border-radius: 8px ;
            font-weight: 600 ;
            letter-spacing: 2px ;
            box-shadow: 0 2px 8px rgba(184,115,42,0.2) ;
        }
        .auth-submit:hover {
            background: linear-gradient(180deg, #c68438, #1a1714) ;
        }
        .auth-tab { color: #8a847a ; }
        .auth-tab.active { color: #1a1714 ; border-bottom-color: #1a1714 ; }

        /* 用户栏 */
        .user-bar {
            color: #5a544c ;
            font-size: 12px ;
            padding: 6px 20px ;
            background: rgba(212,165,116,0.06) ;
        }
        .user-bar a, .user-bar .user-link { color: #1a1714 ; }

        /* --- 故事卡片 --- */
        .btn-card {
            border: 1px solid #d8d0c4 ;
            border-radius: 10px ;
            padding: 15px ;
            cursor: pointer ;
            transition: all 0.2s ;
            background: #f5f3ef ;
            box-shadow: 0 2px 8px rgba(90,84,76,0.06) ;
        }
        .btn-card:hover {
            border-color: #c0b8ac ;
            background: #f5f3ef ;
            box-shadow: 0 6px 20px rgba(90,84,76,0.12) ;
            transform: translateY(-2px) ;
        }
        .btn-primary {
            border-color: #1a1714 ;
            background: #efeae3 ;
        }
        .btn-title { font-weight: 700 ; color: #1a1714 ; font-family: 'Noto Serif SC', serif ; }
        .btn-desc { font-size: 13px ; color: #8a847a ; }

        /* --- 记忆管理 --- */
        .memory-item {
            display: flex ;
            gap: 8px ;
            padding: 10px 14px ;
            border-bottom: 1px solid #d8d0c4 ;
            align-items: flex-start ;
            font-size: 14px ;
            transition: background 0.15s ;
        }
        .memory-item:hover { background: #efeae3 ; }
        .memory-item-num { color: #8a847a ; font-size: 12px ; }
        .memory-item-content {
            flex: 1 ;
            color: #1a1714 ;
            line-height: 1.65 ;
            word-break: break-all ;
            font-size: 14px ;
        }
        .memory-item-time { color: #8a847a ; font-size: 11px ; }
        .memory-item-del {
            background: none ;
            border: 1px solid #c0b8ac ;
            color: #8a847a ;
            border-radius: 4px ;
            padding: 2px 10px ;
            font-size: 11px ;
            cursor: pointer ;
            transition: all 0.2s ;
        }
        .memory-item-del:hover {
            border-color: #e57373 ;
            color: #1a1714 ;
            background: rgba(198,40,40,0.05) ;
        }
        .memory-item.foreshadowing {
            border-left: 3px solid #d4933e ;
            background: linear-gradient(90deg, rgba(212,147,62,0.04) 0%, transparent 30%) ;
        }
        .memory-item.trait {
            border-left: 3px solid #3a6ea5 ;
            background: linear-gradient(90deg, rgba(58,110,165,0.04) 0%, transparent 30%) ;
        }
        .memory-item.important {
            border-left: 3px solid #e65100 ;
            background: linear-gradient(90deg, rgba(230,81,0,0.05) 0%, transparent 30%) ;
        }
        .memory-tag {
            display: inline-block ;
            font-size: 11px ;
            padding: 2px 10px ;
            border-radius: 10px ;
            margin-right: 6px ;
            font-weight: 600 ;
            letter-spacing: 0.3px ;
        }
        .memory-tag.foreshadowing {
            background: #f5f3ef3e0 ;
            color: #e65100 ;
            border: 1px solid #ffb74d ;
        }
        .memory-tag.trait {
            background: rgba(26,23,20,0.08) ;
            color: #2e2823 ;
            border: 1px solid #64b5f6 ;
        }
        .memory-tag.important {
            background: #f5f3ef8e1 ;
            color: #e65100 ;
            border: 1px solid #ff9800 ;
        }
        .mem-filter-btn {
            background: #f5f3ef ;
            border: 1px solid #d8d0c4 ;
            color: #5a544c ;
            border-radius: 6px ;
            padding: 5px 14px ;
            cursor: pointer ;
            font-size: 12.5px ;
            transition: all 0.2s ;
            font-family: 'Noto Sans SC', sans-serif ;
        }
        .mem-filter-btn:hover { background: #efeae3 ; border-color: #c0b8ac ; }
        .mem-filter-btn.active {
            background: #1a1714 ;
            border-color: #1a1714 ;
            color: #f5f3ef ;
            font-weight: 500 ;
        }
        .mem-del-chapter-btn {
            background: #f5f3ef5f5 ;
            border: 1px solid #f0c7c7 ;
            color: #1a1714 ;
            border-radius: 6px ;
            padding: 5px 14px ;
            cursor: pointer ;
            font-size: 12.5px ;
            transition: all 0.2s ;
        }
        .mem-del-chapter-btn:hover { background: #ffe8e8 ; border-color: #e57373 ; }
        .memory-pagination button {
            background: #f5f3ef ;
            border: 1px solid #d8d0c4 ;
            color: #5a544c ;
            padding: 4px 14px ;
            border-radius: 6px ;
            cursor: pointer ;
            font-size: 12px ;
            transition: all 0.2s ;
        }
        .memory-pagination button:hover { background: #efeae3 ; }
        .memory-pagination button.active {
            background: #1a1714 ;
            border-color: #1a1714 ;
            color: #f5f3ef ;
        }

        /* --- 时间轴 --- */
        .timeline-panel {
            border: 1px solid #d8d0c4 ;
            border-radius: 10px ;
            background: #f5f3ef ;
        }
        .timeline-panel-header { background: #f5f3ef ; border-bottom-color: #d8d0c4 ; }
        .timeline-entry { border: 1px solid #d8d0c4 ; border-radius: 8px ; background: #f5f3ef ; }
        .timeline-entry-completed { background: #f0f8f0 ; border-color: rgba(46,40,35,0.12) ; }
        .timeline-input, .timeline-textarea {
            border: 1px solid #c0b8ac ;
            border-radius: 6px ;
        }
        .timeline-input:focus, .timeline-textarea:focus {
            border-color: #1a1714 ;
            box-shadow: 0 0 0 3px rgba(184,115,42,0.1) ;
        }
        .timeline-btn { background: #1a1714 ; color: #f5f3ef ; border-radius: 6px ; }
        .timeline-btn.secondary { background: #efeae3 ; color: #1a1714 ; border-color: #e4ddd4 ; }

        /* --- AI 模型选择器 --- */
        .provider-btn.active {
            background: #1a1714 ;
            color: #f5f3ef ;
        }
        .chat-model-select { color: #1a1714 ; }
        .chat-model-select option { background: #f5f3ef ; color: #1a1714 ; }
        .model-label { color: #1a1714 ; font-weight: 600 ; }
        .ai-mode-toggle { background: #e4ddd4 ; }
        .ai-mode-option.active { background: #f5f3ef ; color: #1a1714 ; }

        /* 图片预览 */
        .image-picker-dialog {
            border-radius: 14px ;
            box-shadow: 0 8px 32px rgba(90,84,76,0.2) ;
        }
        .character-chip:hover { border-color: #1a1714 ; color: #1a1714 ; }
        .character-chip.selected { background: #1a1714 ; border-color: #1a1714 ; }
        .photo-grid-item:hover { border-color: #1a1714 ; }
        .photo-grid-item.selected { border-color: #1a1714 ; }
        .photo-grid-item .checkmark { background: #1a1714 ; }

        /* 旧翻页兼容 */
        .page-flip-out, .page-flip-in { display: none ; }

        /* 动画 */
        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .editor-area > * { animation: fadeInUp 0.4s ease; }

        /* 用户信息栏 */
        .sync-status { color: #8a847a ; font-size: 11px ; }

     
body[data-theme="jiangnan"] .auth-mask { background: radial-gradient(ellipse at center, rgba(46,82,72,0.5), rgba(30,42,38,0.85)) ; }
}
@layer mobile {
@media (max-width: 1180px) { .prompt-shell { width: 100%; } .chat-model-hint { display: none; } } 
         @media (max-width: 720px) { .prompt-tools { gap: 7px; } .model-label { display: none; } .chat-model-select { max-width: 155px; } } 
         .timeline-split { height: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 0; } 
         .timeline-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid #d8d0c4; border-radius: 10px; background: #f5f3ef; overflow: hidden; } 
         .timeline-panel-header { padding: 14px 16px; border-bottom: 1px solid #d8d0c4; background: #f5f3ef; } 
         .timeline-panel-header h3 { margin: 0; font-size: 17px; } 
         .timeline-panel-header p { margin: 6px 0 0; font-size: 13px; color: #5a544c; line-height: 1.45; } 
         .timeline-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; } 
         .timeline-entry { border: 1px solid #d8d0c4; border-radius: 8px; padding: 12px; background: #f5f3ef; display: grid; gap: 8px; }
         .timeline-entry-completed { background: #f0f8f0; border-color: rgba(46,40,35,0.12); }
         .timeline-entry-completed .timeline-textarea { background: #f5f3ef; color: #8a847a; }
         .timeline-entry-row { display: grid; grid-template-columns: 120px 1fr auto auto; gap: 8px; align-items: center; }
         .timeline-completed-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #2e2823; cursor: pointer; white-space: nowrap; }
         .timeline-completed-label input { cursor: pointer; } 
         .timeline-input, .timeline-textarea { border: 1px solid #d8d0c4; border-radius: 6px; padding: 8px 10px; font-size: 13px; outline: none; width: 100%; box-sizing: border-box; } 
         .timeline-textarea { resize: vertical; min-height: 78px; line-height: 1.5; } 
         .timeline-entry-remove { border: 1px solid #f0c7c7; background: #f5f3ef5f5; color: #1a1714; border-radius: 6px; padding: 7px 10px; cursor: pointer; } 
         .timeline-actions { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid #d8d0c4; background: #f5f3ef; } 
         .timeline-btn { border: none; background: #1a1714; color: #f5f3ef; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: bold; } 
         .timeline-btn.secondary { background: #f5f3ef; color: #1a1714; border: 1px solid #b8b2a8; } 
         .timeline-status { font-size: 13px; color: #2e2823; } 
         @media (max-width: 1100px) { .timeline-split { grid-template-columns: 1fr; } } 
         .summary-page { height: 100%; display: flex; flex-direction: column; gap: 12px; } 
         .summary-toolbar { border: 1px solid #d8d0c4; border-radius: 10px; background: #f5f3ef; padding: 14px 16px; } 
         .summary-toolbar h3 { margin: 0 0 6px; font-size: 17px; } 
         .summary-toolbar p { margin: 0; color: #5a544c; font-size: 13px; line-height: 1.5; } 
         .summary-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; } 
         .summary-card { border: 1px solid #d8d0c4; border-radius: 8px; background: #f5f3ef; padding: 10px 12px; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 10px; min-width: 0; } 
         .summary-card:hover { border-color: #1a1714; background: #f5f3ef; } 
         .summary-card-time { color: #1a1714; font-weight: bold; font-size: 13px; flex-shrink: 0; } 
         .summary-card-count { color: #8a847a; font-size: 13px; flex-shrink: 0; } 
         .summary-card-brief { color: #1a1714; font-size: 14px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } 
         .summary-marker { margin: 8px 0 10px 46px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #b8b2a8; background: #f5f3ef; color: #1a1714; border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; } 
         .summary-marker:hover { background: #efeae3; } 
         .message.summary-target { outline: 2px solid #ffc107; box-shadow: 0 0 0 4px rgba(255,193,7,.18); } 
         .sidebar-right { width: 260px; background-color: #efeae3; border-left: 1px solid #d8d0c4; padding: 20px; display: flex; flex-direction: column; gap: 20px; } 
         .btn-card { border: 1px solid #d8d0c4; border-radius: 8px; padding: 15px; cursor: pointer; transition: all 0.2s; } 
         .btn-card:hover { border-color: #c4b89c; background-color: #f5f3ef; } 
         .btn-primary { border-color: #1a1714; background-color: #efeae3; } 
         .btn-title { font-weight: bold; margin-bottom: 5px; font-size: 15px; } 
         .btn-desc { font-size: 13px; color: #5a544c; } 
        @media (max-width: 1180px) {
            .character-content {
                flex-direction: column;
                height: auto;
                min-height: 100%;
            }
        @media (max-width: 768px) and (orientation: portrait) {
            html, body {
                width: 100%;
                height: 100dvh;
                overflow: hidden;
            }
            body {
                flex-direction: column;
                background: #f6f8fb;
            }
            .sidebar-left {
                width: 100%;
                max-height: 98px;
                flex: 0 0 auto;
                border-right: none;
                border-bottom: 1px solid #d8d0c4;
                overflow: visible;
                z-index: 20;
            }
            .header-title,
            .section-label,
            .section-label-bottom,
            .divider-line,
            .card-fixed {
                display: none ;
            }
            .nav-list {
                display: flex;
                gap: 7px;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 9px 10px;
                white-space: nowrap;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
            }
            .nav-list::-webkit-scrollbar {
                display: none;
            }
            .nav-list li {
                flex: 0 0 auto;
                padding: 8px 12px;
                border-radius: 999px;
                background: #f3f6fb;
                border: 1px solid #e4eaf2;
                font-size: 13px;
                color: #5a544c;
            }
            .nav-list li.active {
                background: #1a1714;
                color: #f5f3ef;
                border-color: #1a1714;
                border-right: none;
            }
            .submenu {
                position: fixed;
                left: 10px;
                right: 10px;
                top: 98px;
                z-index: 100;
                padding: 8px;
                border: 1px solid #dce7f7;
                border-radius: 14px;
                background: rgba(255,255,255,.98);
                box-shadow: 0 12px 30px rgba(15,23,42,.12);
                overflow-x: auto;
                overflow-y: auto;
                max-height: 40vh;
                white-space: nowrap;
            }
            .submenu.show {
                display: flex;
                gap: 6px;
            }
            .submenu-wrapper {
                width: 0;
                height: 0;
                padding: 0;
                margin: 0;
                overflow: visible;
                flex: 0 0 0;
            }
            .submenu li {
                flex: 0 0 auto;
                padding: 7px 10px;
                border-radius: 999px;
                border-left: none;
                background: #f6f8fb;
            }
            .main-content {
                width: 100%;
                flex: 1 1 auto;
                min-height: 0;
                order: 2;
            }
            .user-bar {
                padding: 7px 10px;
                font-size: 11px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .content-header {
                padding: 6px 12px;
                font-size: 13px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .editor-area {
                padding: 10px 10px 80px;
                min-height: 0;
            }
            .chat-messages {
                gap: 10px;
            }
            .message {
                max-width: 84%;
                padding: 9px 12px;
                font-size: 14px;
                border-radius: 15px;
            }
            .avatar {
                width: 30px;
                height: 30px;
                font-size: 12px;
            }
            .input-bar {
                padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
            }
            .prompt-shell {
                width: 100%;
                min-height: 68px;
                border-radius: 16px;
                padding: 8px 8px 6px;
                box-shadow: 0 6px 20px rgba(90,84,76,.09);
            }
            .input-box {
                font-size: 14px;
                padding-bottom: 5px;
            }
            .prompt-toolbar {
                gap: 6px;
            }
            .prompt-tools {
                gap: 4px;
                overflow: hidden;
                flex-wrap: nowrap;
                align-items: center;
            }
            .prompt-plus {
                width: 24px;
                height: 24px;
                font-size: 22px;
            }
            .prompt-divider {
                height: 18px;
            }
            .chat-model-wrap {
                min-width: 0;
                gap: 2px;
                order: 1;
                flex: 1 1 auto;
                min-width: 0;
                margin-top: 2px;
                flex-direction: row;
                align-items: center;
                max-height: 60px;
                overflow: hidden;
                transition: max-height 0.25s ease;
            }
            .chat-model-wrap.expanded {
                max-height: 300px;
            }
            .model-row {
                min-width: 0;
                flex: 1 1 0;
                display: flex;
                align-items: center;
                gap: 2px;
                overflow: hidden;
            }
            .send-row {
                order: 2;
                flex: 0 0 auto;
                display: flex;
                align-items: center;
                gap: 4px;
                margin-top: 0;
            }
            .provider-toggle {
                width: 100%;
                justify-content: space-between;
            }
            .provider-btn {
                flex: 1;
                padding: 6px 4px ;
                font-size: 11px ;
                white-space: nowrap;
            }
            .model-label,
            .chat-model-hint {
                display: none ;
            }
            .openrouter-balance-row {
                display: none ;
            }
            .ai-mode-toggle { padding: 1px; }
            .ai-mode-option { padding: 3px 6px; font-size: 11px; }
            .chat-model-select {
                max-width: 100%;
                min-width: 0;
                width: 100%;
                font-size: 10px;
                padding: 2px 12px 2px 2px;
                border-radius: 4px;
                background: #f5f7fa;
                border: 1px solid #e0e5ec;
                -webkit-appearance: menulist;
                appearance: menulist;
                touch-action: manipulation;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .send-btn {
                min-width: 38px;
                height: 28px;
                padding: 0 10px;
                font-size: 11px;
            }
            .sidebar-right {
                width: 100%;
                height: auto;
                min-height: 20px;
                flex: 0 0 auto;
                order: 3;
                flex-direction: row;
                gap: 4px;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 1px 8px calc(1px + env(safe-area-inset-bottom));
                border-left: none;
                border-top: 1px solid #d8d0c4;
                -webkit-overflow-scrolling: touch;
            }
            .sidebar-right .btn-card {
                min-width: 90px;
                max-width: 160px;
                flex: 1 1 auto;
                padding: 1px 8px;
                border-radius: 4px;
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: center;
                gap: 4px;
                text-align: center;
            }
            .btn-title {
                font-size: 10px;
                margin-bottom: 0;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .btn-desc {
                font-size: 7px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .timeline-split,
            .character-content {
                grid-template-columns: 1fr ;
                flex-direction: column;
                height: auto;
                min-height: 100%;
            }
            .timeline-entry-row {
                grid-template-columns: 1fr;
            }
            .timeline-actions {
                flex-wrap: wrap;
            }
}
/* ═════════════════════════════════════
 * 主题系统（不使用 @layer，确保覆盖优先级）
 * ═════════════════════════════════════ */
        /* ================================================================ */

        /* --- 全局：暖白底 + 字体 --- */
        body {
            background-color: #f5f3ef ;
            background-image: none ;
            font-family: 'Noto Sans SC', -apple-system, sans-serif ;
        }

        /* --- 左侧栏：暖白书脊 --- */
        .sidebar-left {
            background: linear-gradient(180deg, #f5f3ef 0%, #efeae3 100%) ;
            border-right: 1px solid #d8d0c4 ;
            box-shadow: 1px 0 8px rgba(90,84,76,0.04) ;
        }
        .sidebar-left::before, .sidebar-left::after { display: none ; }

        /* --- 导航项：简洁暖色标签 --- */
        .nav-list { padding: 8px 10px ; }
        .nav-list li {
            background: transparent ;
            color: #5a544c ;
            font-weight: 500 ;
            border-radius: 6px ;
            margin: 2px 0 ;
            padding: 9px 14px ;
            box-shadow: none ;
            border: none ;
            transform: none ;
            transition: all 0.2s ease ;
            font-size: 13.5px ;
            letter-spacing: 0.2px ;
        }
        .nav-list li::after, .nav-list li::before { display: none ; }
        .nav-list li:hover {
            background: #efeae3 ;
            color: #1a1714 ;
            transform: none ;
            box-shadow: none ;
        }
        .nav-list li.active {
            background: #e4ddd4 ;
            color: #1a1714 ;
            font-weight: 600 ;
            box-shadow: inset 3px 0 0 #1a1714 ;
            transform: none ;
            filter: none ;
        }

        /* 子菜单 */
        .submenu { background-color: transparent ; border-bottom: none ; }
        .submenu li {
            color: #8a847a ;
            font-size: 12.5px ;
            padding: 6px 12px ;
        }
        .submenu li:hover { background: #efeae3 ; color: #5a544c ; }
        .submenu li.active-character {
            background: #efeae3 ;
            color: #1a1714 ;
            font-weight: 500 ;
            box-shadow: inset 2px 0 0 #1a1714 ;
        }
        .submenu .add-character, .nav-list .add-character {
            background: transparent ;
            color: #1a1714 ;
            border: 1px dashed #c0b8ac ;
            border-radius: 6px ;
            font-size: 12px ;
            margin: 4px 0 4px 8px ;
            text-align: center ;
        }
        .submenu .add-character:hover, .nav-list .add-character:hover {
            background: #efeae3 ;
            border-color: #1a1714 ;
        }

        /* 角色删除按钮 */
        .char-del-btn {
            background: none ;
            border: none ;
            color: #8a847a ;
            cursor: pointer ;
            font-size: 14px ;
            padding: 2px 6px ;
            opacity: 0.4 ;
            transition: all 0.2s ;
            border-radius: 4px ;
            line-height: 1 ;
        }
        .char-del-btn:hover {
            opacity: 1 ;
            color: #1a1714 ;
            background: rgba(198,40,40,0.08) ;
        }

        /* --- 主内容区：书页正文 --- */
        .main-content {
            background: transparent ;
            box-shadow: none ;
        }
        .main-content::after { display: none ; }

        .content-header {
            background: transparent ;
            border-bottom: 1px solid #d8d0c4 ;
            font-family: 'Noto Serif SC', 'Songti SC', serif ;
            color: #1a1714 ;
        }

        .editor-area {
            background: transparent ;
            color: #1a1714 ;
            font-family: 'Noto Sans SC', sans-serif ;
        }
        .editor-area p, .editor-area div, .editor-area span, .editor-area td, .editor-area th, .editor-area label {
            color: #1a1714 ;
        }
        .editor-area input, .editor-area textarea, .editor-area select {
            background: rgba(255,253,248,0.8) ;
            border-color: #c0b8ac ;
            color: #1a1714 ;
            border-radius: 6px ;
            transition: all 0.2s ;
        }
        .editor-area input:focus, .editor-area textarea:focus, .editor-area select:focus {
            border-color: #1a1714 ;
            box-shadow: 0 0 0 3px rgba(184,115,42,0.1) ;
        }

        /* 滚动条 */
        .editor-area::-webkit-scrollbar { width: 8px; }
        .editor-area::-webkit-scrollbar-track { background: rgba(90,84,76,0.06); border-radius: 4px; }
        .editor-area::-webkit-scrollbar-thumb { background: rgba(90,84,76,0.2); border-radius: 4px; }
        .editor-area::-webkit-scrollbar-thumb:hover { background: rgba(90,84,76,0.35); }

        /* --- 对话气泡（无气泡纯文字） --- */
        .message.user {
            background-color: transparent ;
            color: #1a1714 ;
            border: none ;
            border-radius: 0 ;
            box-shadow: none ;
        }
        .message.ai {
            background-color: transparent ;
            color: #1a1714 ;
            border: none ;
            border-radius: 0 ;
            box-shadow: none ;
        }
        .avatar { display: none ; }
        .message-time { color: rgba(90,84,76,0.3) ; }

        /* --- 输入栏 --- */
        .input-bar {
            background: linear-gradient(180deg, transparent 0%, #f5f3ef 30%) ;
            border-top: 1px solid #d8d0c4 ;
        }
        .prompt-shell {
            background: rgba(245,243,239,0.95) ;
            border: 1.5px solid #c0b8ac ;
            border-radius: 18px ;
            box-shadow: 0 4px 16px rgba(90,84,76,0.08) ;
            transition: border-color 0.2s, box-shadow 0.2s ;
        }
        .prompt-shell:focus-within {
            border-color: #1a1714 ;
            box-shadow: 0 4px 20px rgba(184,115,42,0.12), 0 0 0 3px rgba(184,115,42,0.08) ;
        }
        .input-box { color: #1a1714 ; font-family: 'Noto Sans SC', sans-serif ; }
        .input-box::placeholder { color: #8a847a ; }
        .send-btn {
            background: #1a1714 ;
            color: #f5f3ef ;
            border-radius: 16px ;
        }
        .send-btn:hover:not(:disabled) {
            background: #1a1714 ;
        }

        /* --- 系统日志面板 --- */
        .card-fixed {
            background: linear-gradient(135deg, #1a1714, #2e2823) ;
            border: 1px solid #2e2823 ;
            border-radius: 6px ;
            box-shadow: inset 0 2px 8px rgba(26,23,20,0.4) ;
        }
        .card-fixed .log-header { color: #8a847a ; }

        /* 分割线 */
        .divider-line {
            background: linear-gradient(90deg, transparent, #d8d0c4, transparent) ;
            height: 1px ;
        }

        /* --- 登录页 --- */
/* ==================== 江南主题覆盖 ==================== */
/* 当 body[data-theme="jiangnan"] 时，覆盖水墨国风的所有颜色 */
body[data-theme="jiangnan"] {
  --ink-deep: #2a3a35; --ink-heavy: #3a4a42; --ink-mid: #4a5a52;
  --ink-light: #6a7a72; --ink-wash: #7a8a82; --ink-mist: #a8b8b0;
  --ink-ghost: #b8c8c0; --ink-vapor: #c4d4ce;
  --xuan: #eef2ed; --xuan-light: #f4f7f3; --xuan-aged: #e4ebe6; --xuan-dark: #d8e0da;
  --cinnabar: #6a9e8e; --cinnabar-br: #4a7c6e; --cinnabar-ft: #8ab4a4;
  --cinnabar-bg: rgba(106,158,142,0.08);
  --mountain: #2e2823; --mountain-lt: #5a8a7a; --mountain-bg: rgba(106,158,142,0.08);
  --indigo: #2e5248; --indigo-lt: #4a7c6e; --indigo-bg: rgba(46,82,72,0.08);
  --gold: #6a9e8e; --gold-lt: #8ab4a4; --gold-bg: rgba(106,158,142,0.1);
  --border-ink: #c4d4ce; --border-lt-ink: #d8e0da; --border-dk-ink: #b4c4be;
}
/* Body & background */
body[data-theme="jiangnan"] {
  background-color: #eef2ed ;
  background-image: radial-gradient(ellipse 600px 400px at 95% 5%, rgba(42,58,53,0.04) 0%, transparent 70%), radial-gradient(ellipse 500px 350px at 5% 95%, rgba(106,158,142,0.03) 0%, transparent 70%) ;
  color: #4a5a52 ;
}
/* Sidebar */
body[data-theme="jiangnan"] .sidebar-left { background-color: #e4ebe6 ; border-right: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .nav-list li { color: #6a7a72 ; }
body[data-theme="jiangnan"] .nav-list li:hover { background-color: #dfeae5 ; color: #4a5a52 ; }
body[data-theme="jiangnan"] .nav-list li.active { background-color: #d4ddd7 ; color: #4a7c6e ; box-shadow: inset 3px 0 0 #6a9e8e ; }
/* Mobile nav */
body[data-theme="jiangnan"] .nav-list li { background: #dfeae5 ; border: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .nav-list li.active { background: #6a9e8e ; color: #f4f7f3 ; border-color: #6a9e8e ; }
/* System log card */
body[data-theme="jiangnan"] .card-fixed { background-color: #1e2a26 ; border: 1px solid #3a4a42 ; color: #6a9e8e ; }
body[data-theme="jiangnan"] .card-fixed .log-header { color: #7a8a82 ; }
body[data-theme="jiangnan"] .card-fixed .log-header .log-clear-btn { color: #7a8a82 ; border-color: #3a4a42 ; }
body[data-theme="jiangnan"] .card-fixed .log-header .log-clear-btn:hover { color: #f4f7f3 ; border-color: #6a7a72 ; }
body[data-theme="jiangnan"] .card-fixed .log-entry { border-bottom-color: #1e2a26 ; }
body[data-theme="jiangnan"] .card-fixed::-webkit-scrollbar-thumb { background-color: #3a4a42 ; }
/* Divider */
body[data-theme="jiangnan"] .divider-line { background-color: #c4d4ce ; }
/* Main content */
body[data-theme="jiangnan"] .main-content { background-color: #eef2ed ; }
body[data-theme="jiangnan"] .content-header { background-color: #eef2ed ; border-bottom: 1px solid #c4d4ce ; }
/* Input bar */
body[data-theme="jiangnan"] .input-bar { border-top: 1px solid #c4d4ce ; background: #eef2ed ; }
body[data-theme="jiangnan"] .prompt-shell { border: 1.5px solid #b4c4be ; background: rgba(244,247,243,.96) ; box-shadow: 0 8px 26px rgba(106,158,142,0.10) ; }
body[data-theme="jiangnan"] .input-box { color: #2a3a35 ; }
body[data-theme="jiangnan"] .input-box::placeholder { color: #7a8a82 ; }
body[data-theme="jiangnan"] .prompt-divider { background: #c4d4ce ; }
body[data-theme="jiangnan"] .model-label { color: #2a3a35 ; }
body[data-theme="jiangnan"] .chat-model-select { color: #2a3a35 ; }
body[data-theme="jiangnan"] .chat-model-select:hover, body[data-theme="jiangnan"] .chat-model-select:focus { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .chat-model-hint { color: #7a8a82 ; }
body[data-theme="jiangnan"] .openrouter-balance { color: #2e2823 ; }
body[data-theme="jiangnan"] .openrouter-refresh-btn { color: #6a9e8e ; }
body[data-theme="jiangnan"] .ai-mode-toggle { background: #dfeae5 ; }
body[data-theme="jiangnan"] .ai-mode-option { color: #7a8a82 ; }
body[data-theme="jiangnan"] .ai-mode-option.active { background: #f4f7f3 ; color: #2a3a35 ; }
body[data-theme="jiangnan"] .ai-mode-option:hover:not(.active) { color: #4a5a52 ; }
body[data-theme="jiangnan"] .send-btn { background: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .send-btn:hover:not(:disabled) { background: #4a7c6e ; }
body[data-theme="jiangnan"] .send-photo-btn { color: #6a7a72 ; }
body[data-theme="jiangnan"] .send-photo-btn:hover { color: #6a9e8e ; background: rgba(106,158,142,0.08) ; }
body[data-theme="jiangnan"] .image-preview-bar { background: #eef2ed ; }
body[data-theme="jiangnan"] .image-preview-item { border: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .image-picker-dialog { background: #f4f7f3 ; }
body[data-theme="jiangnan"] .image-picker-header { border-bottom: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .image-picker-header h3 { color: #4a5a52 ; }
body[data-theme="jiangnan"] .image-picker-close { color: #7a8a82 ; }
/* Chat messages */
body[data-theme="jiangnan"] .chat-message.user { background: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .chat-message.assistant { background: #eef2ed ; border: 1px solid #d8e0da ; color: #2a3a35 ; }
body[data-theme="jiangnan"] .chat-message .msg-role { color: #6a9e8e ; }
/* Login/register page */
body[data-theme="jiangnan"] .auth-box { background: linear-gradient(160deg, #f4f7f3 0%, #eef2ed 50%, #e4ebe6 100%) ; border: 1px solid #c4d4ce ; box-shadow: 0 10px 40px rgba(46,82,72,0.15), 0 2px 8px rgba(26,23,20,0.08) ; }
body[data-theme="jiangnan"] .auth-title { color: #4a7c6e ; }
body[data-theme="jiangnan"] .auth-subtitle { color: #7a8a82 ; }
body[data-theme="jiangnan"] .auth-input { background: rgba(244,247,243,0.8) ; border: 1px solid #b4c4be ; color: #2a3a35 ; }
body[data-theme="jiangnan"] .auth-input:focus { border-color: #6a9e8e ; box-shadow: 0 0 0 3px rgba(106,158,142,0.12) ; }
body[data-theme="jiangnan"] .auth-input::placeholder { color: #a8b8b0 ; }
body[data-theme="jiangnan"] .auth-submit { background: linear-gradient(180deg, #6a9e8e, #4a7c6e) ; color: #f4f7f3 ; box-shadow: 0 2px 8px rgba(106,158,142,0.25) ; }
body[data-theme="jiangnan"] .auth-submit:hover { background: linear-gradient(180deg, #4a7c6e, #2e5248) ; }
body[data-theme="jiangnan"] .auth-tab { color: #7a8a82 ; }
body[data-theme="jiangnan"] .auth-tab.active { color: #4a7c6e ; border-bottom-color: #6a9e8e ; }
body[data-theme="jiangnan"] .auth-tab-indicator { background: #6a9e8e ; }
body[data-theme="jiangnan"] .auth-error { color: #5a544c ; }
/* User bar */
body[data-theme="jiangnan"] .user-bar { color: #6a7a72 ; background: rgba(106,158,142,0.06) ; }
body[data-theme="jiangnan"] .user-bar a, body[data-theme="jiangnan"] .user-bar .user-link { color: #4a7c6e ; }
/* Story cards */
body[data-theme="jiangnan"] .btn-card { border: 1px solid #d8e0da ; background: #f4f7f3 ; box-shadow: 0 2px 8px rgba(46,82,72,0.06) ; }
body[data-theme="jiangnan"] .btn-card:hover { border-color: #b4c4be ; background: #f8fbf8 ; box-shadow: 0 6px 20px rgba(46,82,72,0.12) ; }
body[data-theme="jiangnan"] .btn-primary { border-color: #6a9e8e ; background: rgba(106,158,142,0.06) ; }
body[data-theme="jiangnan"] .btn-title { color: #2a3a35 ; }
body[data-theme="jiangnan"] .btn-desc { color: #7a8a82 ; }
/* Memory management */
body[data-theme="jiangnan"] .memory-item { border-bottom: 1px solid #d8e0da ; }
body[data-theme="jiangnan"] .memory-item:hover { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .memory-item-num { color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-content { color: #2a3a35 ; }
body[data-theme="jiangnan"] .memory-item-time { color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-del { border: 1px solid #b4c4be ; color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-del:hover { border-color: #5a544c ; color: #5a544c ; background: rgba(90,84,76,0.05) ; }
body[data-theme="jiangnan"] .memory-item.foreshadowing { border-left-color: #8a847a ; background: linear-gradient(90deg, rgba(138,132,122,0.04) 0%, transparent 30%) ; }
body[data-theme="jiangnan"] .memory-item.trait { border-left-color: #6a9e8e ; background: linear-gradient(90deg, rgba(106,158,142,0.04) 0%, transparent 30%) ; }
body[data-theme="jiangnan"] .memory-item.important { border-left-color: #e65100 ; }
body[data-theme="jiangnan"] .memory-tag.foreshadowing { background: rgba(212,147,62,0.12) ; color: #5a544c ; }
body[data-theme="jiangnan"] .memory-tag.trait { background: rgba(106,158,142,0.12) ; color: #4a7c6e ; }
body[data-theme="jiangnan"] .memory-tag.important { background: rgba(230,81,0,0.12) ; color: #e65100 ; }
/* Provider toggle */
body[data-theme="jiangnan"] .provider-toggle { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .provider-btn.active { background: #2e5248 ; }
body[data-theme="jiangnan"] .provider-btn:not(.active) { color: #6a7a72 ; }
/* User center tabs */
body[data-theme="jiangnan"] .uc-tab.active { background: #6a9e8e ; }
body[data-theme="jiangnan"] .uc-tab:not(.active) { color: #7a8a82 ; }
/* SVG and graph elements */
body[data-theme="jiangnan"] svg .node-circle { fill: #6a9e8e ; }
body[data-theme="jiangnan"] svg .link-line { stroke: #a8b8b0 ; }
body[data-theme="jiangnan"] svg text { fill: #4a5a52 ; }
/* Scrollbar */
body[data-theme="jiangnan"] ::-webkit-scrollbar-thumb { background: rgba(106,158,142,0.15) ; }
/* Loading dots */
body[data-theme="jiangnan"] .typing-dot { background: #6a9e8e ; }
/* Context menu */
body[data-theme="jiangnan"] .context-menu { background: #f4f7f3 ; border: 1px solid #c4d4ce ; box-shadow: 0 4px 16px rgba(46,82,72,0.12) ; }
body[data-theme="jiangnan"] .context-menu-item:hover { background: #e4ebe6 ; }
/* Modal/dialog */
body[data-theme="jiangnan"] .modal-overlay { background: rgba(30,42,38,0.6) ; }
body[data-theme="jiangnan"] .modal-content { background: #f4f7f3 ; border: 1px solid #c4d4ce ; box-shadow: 0 12px 48px rgba(46,82,72,0.2) ; }
/* Toast notifications */
body[data-theme="jiangnan"] .toast { background: #2a3a35 ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .toast.success { border-left: 3px solid #6a9e8e ; }
body[data-theme="jiangnan"] .toast.error { border-left: 3px solid #5a544c ; }
/* Generic text color overrides for common hardcoded values */
body[data-theme="jiangnan"] .story-card-item .sc-title { color: #2a3a35 ; }
body[data-theme="jiangnan"] .story-card-item .sc-desc { color: #7a8a82 ; }
body[data-theme="jiangnan"] .story-card-item .sc-meta { color: #a8b8b0 ; }
body[data-theme="jiangnan"] .story-selector { background: #e4ebe6 ; border: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .story-card-item { background: #f4f7f3 ; border: 1px solid #d8e0da ; }
body[data-theme="jiangnan"] .story-card-item:hover { border-color: #6a9e8e ; }
body[data-theme="jiangnan"] .story-card-item.active { border-color: #6a9e8e ; background: rgba(106,158,142,0.06) ; }
/* New story button */
body[data-theme="jiangnan"] .new-story-btn { border: 1px dashed #b4c4be ; color: #6a9e8e ; background: transparent ; }
body[data-theme="jiangnan"] .new-story-btn:hover { border-color: #6a9e8e ; background: rgba(106,158,142,0.06) ; }
/* Brand/logo */
body[data-theme="jiangnan"] .brand-icon { background: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .brand-name { color: #2a3a35 ; }
body[data-theme="jiangnan"] .brand-sub { color: #6a9e8e ; }

/* Chat messages & avatars */
body[data-theme="jiangnan"] .message.user { background-color: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .message.ai { background-color: #f4f7f3 ; color: #2a3a35 ; border-color: #d8e0da ; }
body[data-theme="jiangnan"] .avatar.user { background-color: #6a9e8e ; }
body[data-theme="jiangnan"] .avatar.ai { background-color: #4a5a52 ; }
body[data-theme="jiangnan"] .message-time { color: rgba(42,58,53,0.4) ; }
body[data-theme="jiangnan"] .message-actions { background: rgba(106,158,142,0.06) ; }
body[data-theme="jiangnan"] .msg-action-btn { color: #6a7a72 ; }
body[data-theme="jiangnan"] .msg-action-btn:hover { background: rgba(106,158,142,0.12) ; color: #4a7c6e ; }
/* Input bar */
body[data-theme="jiangnan"] .input-bar { background: linear-gradient(180deg, transparent 0%, #eef2ed 30%) ; border-top: 1px solid #c4d4ce ; }
body[data-theme="jiangnan"] .prompt-shell { background: rgba(244,247,243,0.95) ; border-color: #b4c4be ; box-shadow: 0 8px 26px rgba(106,158,142,0.10) ; }
body[data-theme="jiangnan"] .input-box { color: #2a3a35 ; }
body[data-theme="jiangnan"] .input-box::placeholder { color: #7a8a82 ; }
body[data-theme="jiangnan"] .prompt-divider { background: #c4d4ce ; }
body[data-theme="jiangnan"] .model-label { color: #2a3a35 ; }
body[data-theme="jiangnan"] .chat-model-select { color: #2a3a35 ; border-color: #b4c4be ; }
body[data-theme="jiangnan"] .chat-model-select:hover, body[data-theme="jiangnan"] .chat-model-select:focus { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .chat-model-hint { color: #7a8a82 ; }
body[data-theme="jiangnan"] .openrouter-balance { color: #2e2823 ; }
body[data-theme="jiangnan"] .openrouter-refresh-btn { color: #6a9e8e ; }
body[data-theme="jiangnan"] .ai-mode-toggle { background: #dfeae5 ; }
body[data-theme="jiangnan"] .ai-mode-option { color: #7a8a82 ; }
body[data-theme="jiangnan"] .ai-mode-option.active { background: #f4f7f3 ; color: #2a3a35 ; }
body[data-theme="jiangnan"] .send-btn { background: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .send-btn:hover:not(:disabled) { background: #4a7c6e ; }
body[data-theme="jiangnan"] .send-photo-btn { color: #6a7a72 ; }
body[data-theme="jiangnan"] .send-photo-btn:hover { color: #6a9e8e ; background: rgba(106,158,142,0.08) ; }
body[data-theme="jiangnan"] .provider-toggle { background: #dfeae5 ; }
body[data-theme="jiangnan"] .provider-btn.active { background: #2e5248 ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .provider-btn:not(.active) { color: #6a7a72 ; }
body[data-theme="jiangnan"] .image-preview-bar { background: #eef2ed ; }
body[data-theme="jiangnan"] .image-preview-item { border-color: #c4d4ce ; }
body[data-theme="jiangnan"] .image-picker-dialog { background: #f4f7f3 ; border-color: #c4d4ce ; }
body[data-theme="jiangnan"] .image-picker-header { border-bottom-color: #c4d4ce ; }
body[data-theme="jiangnan"] .image-picker-header h3 { color: #4a5a52 ; }
body[data-theme="jiangnan"] .image-picker-close { color: #7a8a82 ; }
/* Load more button */
body[data-theme="jiangnan"] .load-more-btn { background: rgba(106,158,142,0.08) ; color: #6a9e8e ; }
body[data-theme="jiangnan"] .load-more-btn:hover { background: rgba(106,158,142,0.14) ; }
/* Scrollbar */
body[data-theme="jiangnan"] ::-webkit-scrollbar-thumb { background: rgba(106,158,142,0.15) ; }
body[data-theme="jiangnan"] .editor-area::-webkit-scrollbar-thumb { background: rgba(106,158,142,0.15) ; }
body[data-theme="jiangnan"] .editor-area::-webkit-scrollbar-thumb:hover { background: rgba(106,158,142,0.3) ; }
/* User bar */
body[data-theme="jiangnan"] .user-bar { color: #6a7a72 ; background: rgba(106,158,142,0.06) ; }
body[data-theme="jiangnan"] .user-bar a, body[data-theme="jiangnan"] .user-bar .user-link { color: #4a7c6e ; }
body[data-theme="jiangnan"] .sync-status { color: #7a8a82 ; }
/* Story cards */
body[data-theme="jiangnan"] .btn-card { border-color: #d8e0da ; background: #f4f7f3 ; box-shadow: 0 2px 8px rgba(46,82,72,0.06) ; }
body[data-theme="jiangnan"] .btn-card:hover { border-color: #b4c4be ; background: #f8fbf8 ; box-shadow: 0 6px 20px rgba(46,82,72,0.12) ; }
body[data-theme="jiangnan"] .btn-primary { border-color: #6a9e8e ; background: rgba(106,158,142,0.06) ; }
body[data-theme="jiangnan"] .btn-title { color: #2a3a35 ; }
body[data-theme="jiangnan"] .btn-desc { color: #7a8a82 ; }
/* Memory management */
body[data-theme="jiangnan"] .memory-item { border-bottom-color: #d8e0da ; }
body[data-theme="jiangnan"] .memory-item:hover { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .memory-item-num { color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-content { color: #2a3a35 ; }
body[data-theme="jiangnan"] .memory-item-time { color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-del { border-color: #b4c4be ; color: #7a8a82 ; }
body[data-theme="jiangnan"] .memory-item-del:hover { border-color: #5a544c ; color: #5a544c ; }
body[data-theme="jiangnan"] .memory-pagination button { background: #f4f7f3 ; border-color: #d8e0da ; color: #6a7a72 ; }
body[data-theme="jiangnan"] .memory-pagination button:hover { background: #e4ebe6 ; }
body[data-theme="jiangnan"] .memory-pagination button.active { background: #6a9e8e ; border-color: #6a9e8e ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .mem-filter-btn { background: #f4f7f3 ; border-color: #d8e0da ; color: #6a7a72 ; }
body[data-theme="jiangnan"] .mem-filter-btn:hover { background: #e4ebe6 ; border-color: #b4c4be ; }
body[data-theme="jiangnan"] .mem-filter-btn.active { background: #6a9e8e ; border-color: #6a9e8e ; color: #f4f7f3 ; }
/* Context menu */
body[data-theme="jiangnan"] .context-menu { background: #f4f7f3 ; border-color: #c4d4ce ; }
body[data-theme="jiangnan"] .context-menu-item:hover { background: #e4ebe6 ; }
/* Modal/dialog */
body[data-theme="jiangnan"] .modal-overlay { background: rgba(30,42,38,0.5) ; }
body[data-theme="jiangnan"] .modal-content { background: #f4f7f3 ; border-color: #c4d4ce ; }
/* Toast */
body[data-theme="jiangnan"] .toast { background: #2a3a35 ; color: #f4f7f3 ; }
body[data-theme="jiangnan"] .theme-toggle-btn { background: #f4f7f3 ; border-color: #c4d4ce ; color: #4a7c6e ; }



/* Theme toggle button */
.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 8px 14px; padding: 8px 12px;
  border: 1px solid var(--border-ink); border-radius: 8px;
  background: var(--xuan-light); color: var(--ink-mid);
  font-size: 12px; cursor: pointer; font-family: inherit;
  transition: all 0.2s; user-select: none;
}
.theme-toggle-btn:hover { border-color: var(--ink-mid); color: var(--ink-mid); }
.theme-toggle-btn:active { transform: scale(0.98); }
.theme-toggle-btn .theme-icon { font-size: 14px; }


@layer themes {
/* ==================== NewWord 暖阳书房主题 v2 ==================== */
/* 模板A：温暖如午后阳光照在旧书页上，奶白底色配赤陶橙强调 */

:root {
    --bg-primary: #faf6f0;
    --bg-secondary: #f2ebe0;
    --bg-tertiary: #e8ddca;
    --bg-card: #fffdf8;
    --bg-hover: #e8ddca;
    --bg-active: #f0e0c8;
    
    --text-primary: #4a3c2e;
    --text-secondary: #6b5b4e;
    --text-muted: #8a7560;
    --text-accent: #c87f4a;
    
    --accent-primary: #c87f4a;
    --accent-secondary: #a86638;
    --accent-success: #7a9b3a;
    --accent-warning: #c4880f;
    --accent-danger: #b44a3a;
    
    --border-subtle: #e0d5c5;
    --border-medium: #d4c4a8;
    --border-accent: #c4b89c;
    
    --shadow-sm: 0 1px 4px rgba(74, 60, 46, 0.08);
    --shadow-md: 0 3px 12px rgba(74, 60, 46, 0.12);
    --shadow-lg: 0 8px 30px rgba(74, 60, 46, 0.16);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    --font-ui: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', Georgia, serif;
    --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* ===== 基础覆盖 ===== */
* { font-family: var(--font-body); }

body {
    background-color: var(--bg-primary) ;
    color: var(--text-primary) ;
}

/* ===== 登录界面 ===== */
.auth-mask {
    background: linear-gradient(160deg, #faf6f0 0%, #f2ebe0 40%, #e8ddca 100%) ;
}

.auth-box {
    background: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    box-shadow: var(--shadow-lg) ;
    border-radius: var(--radius-lg) ;
}

.auth-title {
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
    font-size: 22px ;
}

.auth-subtitle {
    color: var(--text-secondary) ;
    font-size: 13px ;
    line-height: 1.6 ;
}

.auth-tab {
    background: var(--bg-primary) ;
    border-color: var(--border-medium) ;
    color: var(--text-secondary) ;
    font-family: var(--font-ui) ;
}

.auth-tab.active {
    background: var(--accent-primary) ;
    color: #fff ;
    border-color: var(--accent-primary) ;
}

.auth-submit {
    background: var(--accent-primary) ;
    color: #fff ;
    font-weight: 600 ;
    border-radius: var(--radius-sm) ;
    letter-spacing: 1px;
}

.auth-submit:hover {
    background: var(--accent-secondary) ;
}

.auth-input {
    background: var(--bg-primary) ;
    border-color: var(--border-medium) ;
    color: var(--text-primary) ;
    border-radius: var(--radius-sm) ;
}

.auth-input:focus {
    border-color: var(--accent-primary) ;
    box-shadow: 0 0 0 2px rgba(200, 127, 74, 0.15) ;
}

.auth-input::placeholder {
    color: var(--text-muted) ;
}

.auth-error {
    color: var(--accent-danger) ;
}

/* ===== 用户栏 ===== */
.user-bar {
    background: var(--bg-secondary) ;
    border-bottom: 1px solid var(--border-subtle) ;
    color: var(--text-secondary) ;
}

.user-link {
    color: var(--accent-primary) ;
}

/* ===== 左侧边栏 ===== */
.sidebar-left {
    width: 220px;
    background-color: var(--bg-secondary) ;
    border-right: 1px solid var(--border-subtle) ;
}

.header-title {
    background-color: var(--bg-secondary) ;
    border-bottom: 1px solid var(--border-subtle) ;
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
    font-size: 14px ;
    letter-spacing: 0.5px;
}

.nav-list li {
    color: var(--text-secondary) ;
    font-size: 13px ;
    padding: 10px 20px ;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 2px 8px 2px 0;
    transition: all 0.2s ease;
}

.nav-list li:hover {
    background-color: var(--bg-hover) ;
    color: var(--text-primary) ;
}

.nav-list li.active {
    background-color: var(--bg-active) ;
    color: var(--accent-primary) ;
    border-right: 3px solid var(--accent-primary) ;
    font-weight: 600 ;
}

/* 子菜单 */
.submenu {
    background-color: var(--bg-tertiary) ;
    border-bottom: 1px solid var(--border-subtle) ;
}

.submenu li {
    color: var(--text-secondary) ;
}

.submenu li:hover {
    background-color: var(--bg-hover) ;
    border-left-color: var(--accent-primary) ;
    color: var(--text-primary) ;
}

.submenu li.active-character {
    background-color: var(--bg-active) ;
    border-left-color: var(--accent-primary) ;
    color: var(--accent-primary) ;
}

/* ===== 系统日志卡片 ===== */
.card-fixed {
    background-color: #2a2520 ;
    border: 1px solid #3d352c ;
    border-radius: var(--radius-md) ;
    font-family: var(--font-mono) ;
    color: var(--text-secondary) ;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2) ;
}

.card-fixed .log-header {
    color: var(--text-muted) ;
}

.card-fixed .log-header .log-clear-btn {
    border-color: #4a4035 ;
    color: var(--text-muted) ;
}

.card-fixed .log-header .log-clear-btn:hover {
    color: #e8dcc8 ;
    border-color: #6a5f50 ;
}

.card-fixed .log-entry.log-info { color: #81c995 ; }
.card-fixed .log-entry.log-warn { color: #fdd663 ; }
.card-fixed .log-entry.log-error { color: #f28b82 ; }
.card-fixed .log-entry.log-summary { color: #8ab4f8 ; }
.card-fixed .log-entry.log-fact { color: #c58af9 ; }
.card-fixed .log-entry.log-mem0 { color: #ff8a80 ; }
.card-fixed .log-entry.log-kg { color: #ffd54f ; }
.card-fixed .log-time { color: #6a5f50 ; }

/* ===== 主内容区 ===== */
.main-content {
    background-color: var(--bg-primary) ;
}

.content-header {
    background-color: var(--bg-secondary) ;
    border-bottom: 1px solid var(--border-subtle) ;
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
    font-size: 15px ;
    font-weight: 600 ;
}

.editor-area {
    background-color: var(--bg-primary) ;
}

/* ===== 输入栏 ===== */
.input-bar {
    background-color: var(--bg-secondary) ;
    border-top: 1px solid var(--border-subtle) ;
    padding: 14px 20px ;
}

.prompt-shell {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-medium) ;
    border-radius: var(--radius-lg) ;
    box-shadow: var(--shadow-sm) ;
    padding: 14px 20px 12px ;
}

.prompt-shell:focus-within {
    border-color: var(--accent-primary) ;
    box-shadow: 0 0 0 2px rgba(200, 127, 74, 0.12), var(--shadow-md) ;
}

.input-box {
    color: var(--text-primary) ;
    font-size: 15px ;
    line-height: 1.7 ;
}

.input-box::placeholder {
    color: var(--text-muted) ;
}

/* 工具栏 */
.prompt-plus {
    color: var(--text-muted) ;
}

.prompt-divider {
    background-color: var(--border-medium) ;
}

.model-label {
    color: var(--text-secondary) ;
    font-family: var(--font-ui) ;
}

.chat-model-select {
    color: var(--text-primary) ;
    background-color: var(--bg-hover) ;
    border-radius: var(--radius-sm) ;
    padding: 6px 10px ;
    border: 1px solid var(--border-subtle) ;
}

.chat-model-select:hover, .chat-model-select:focus {
    background-color: var(--bg-active) ;
}

.chat-model-hint {
    color: var(--text-muted) ;
}

/* AI 模式切换 */
.ai-mode-toggle {
    background-color: var(--bg-tertiary) ;
    border-radius: var(--radius-sm) ;
}

.ai-mode-option {
    color: var(--text-muted) ;
}

.ai-mode-option.active {
    background-color: var(--bg-card) ;
    color: var(--text-primary) ;
    box-shadow: var(--shadow-sm) ;
}

/* 余额 */
.openrouter-balance {
    color: var(--accent-success) ;
    font-family: var(--font-mono) ;
    font-size: 11px ;
}

.openrouter-refresh-btn {
    color: var(--accent-primary) ;
}

/* 发送按钮 */
.send-btn {
    background-color: var(--accent-primary) ;
    color: #fff ;
    border-radius: var(--radius-lg) ;
    font-weight: 600 ;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--accent-secondary) ;
    box-shadow: 0 2px 8px rgba(200, 127, 74, 0.25);
}

.send-btn:disabled {
    background-color: var(--border-medium) ;
    color: var(--text-muted) ;
    opacity: 0.7;
}

.clear-chat-btn {
    color: var(--text-muted) ;
}

.clear-chat-btn:hover {
    color: var(--accent-danger) ;
}

/* ===== 右侧边栏 ===== */
.sidebar-right {
    background-color: var(--bg-secondary) ;
    border-left: 1px solid var(--border-subtle) ;
}

.btn-card {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    border-radius: var(--radius-md) ;
    color: var(--text-primary) ;
    transition: all 0.2s ease;
}

.btn-card:hover {
    background-color: var(--bg-hover) ;
    border-color: var(--border-accent) ;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: rgba(200, 127, 74, 0.1) ;
    border-color: var(--accent-primary) ;
    color: var(--accent-primary) ;
}

.btn-primary:hover {
    background-color: rgba(200, 127, 74, 0.18) ;
}

.btn-title {
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
}

.btn-desc {
    color: var(--text-secondary) ;
}

/* ===== 时间线面板 ===== */
.timeline-split {
    gap: 12px;
}

.timeline-panel {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    border-radius: var(--radius-md) ;
    box-shadow: var(--shadow-sm) ;
}

.timeline-panel-header {
    background-color: var(--bg-secondary) ;
    border-bottom: 1px solid var(--border-subtle) ;
}

.timeline-panel-header h3 {
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
}

.timeline-panel-header p {
    color: var(--text-secondary) ;
}

.timeline-entry {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    border-radius: var(--radius-sm) ;
}

.timeline-entry-completed {
    background-color: rgba(122, 155, 58, 0.08) ;
    border-color: rgba(122, 155, 58, 0.25) ;
}

.timeline-input, .timeline-textarea {
    background-color: var(--bg-primary) ;
    border: 1px solid var(--border-medium) ;
    color: var(--text-primary) ;
    border-radius: var(--radius-sm) ;
}

.timeline-input:focus, .timeline-textarea:focus {
    border-color: var(--accent-primary) ;
    outline: none;
}

.timeline-entry-remove {
    background-color: rgba(180, 74, 58, 0.08) ;
    border-color: rgba(180, 74, 58, 0.25) ;
    color: var(--accent-danger) ;
}

.timeline-actions {
    background-color: var(--bg-secondary) ;
    border-top: 1px solid var(--border-subtle) ;
}

.timeline-btn {
    background-color: var(--accent-primary) ;
    color: #fff ;
    border-radius: var(--radius-sm) ;
    font-weight: 600 ;
}

.timeline-btn.secondary {
    background-color: var(--bg-hover) ;
    color: var(--accent-primary) ;
    border: 1px solid var(--border-medium) ;
}

.timeline-status {
    color: var(--accent-success) ;
}

/* ===== 摘要页面 ===== */
.summary-page {
    gap: 10px;
}

.summary-toolbar {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    border-radius: var(--radius-md) ;
}

.summary-toolbar h3 {
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
}

.summary-toolbar p {
    color: var(--text-secondary) ;
}

.summary-card {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    border-radius: var(--radius-sm) ;
}

.summary-card:hover {
    border-color: var(--accent-primary) ;
    background-color: var(--bg-hover) ;
}

.summary-card-time {
    color: var(--accent-primary) ;
    font-family: var(--font-mono) ;
}

.summary-card-count {
    color: var(--text-muted) ;
}

.summary-card-brief {
    color: var(--text-primary) ;
}

.summary-marker {
    background-color: rgba(200, 127, 74, 0.1) ;
    border-color: rgba(200, 127, 74, 0.25) ;
    color: var(--accent-primary) ;
}

.summary-marker:hover {
    background-color: rgba(200, 127, 74, 0.18) ;
}

/* ===== 角色面板 ===== */
.character-profile-panel {
    background: 
        radial-gradient(circle at 8% 0%, rgba(200, 127, 74, 0.06), transparent 30%),
        radial-gradient(circle at 92% 8%, rgba(168, 102, 56, 0.06), transparent 28%),
        linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 48%, var(--bg-tertiary) 100%) ;
    border: 1px solid var(--border-subtle) ;
    box-shadow: var(--shadow-md) ;
}

.character-path {
    color: var(--accent-secondary) ;
}

/* ===== 模态框 ===== */
.modal-mask {
    background: rgba(74, 60, 46, 0.35) ;
}

.modal-box {
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-medium) ;
    border-radius: var(--radius-lg) ;
    box-shadow: var(--shadow-lg) ;
}

.modal-title {
    color: var(--text-primary) ;
    font-family: var(--font-ui) ;
}

.modal-input {
    background-color: var(--bg-primary) ;
    border: 1px solid var(--border-medium) ;
    color: var(--text-primary) ;
    border-radius: var(--radius-sm) ;
}

.modal-input:focus {
    border-color: var(--accent-primary) ;
}

.modal-btn {
    background-color: var(--bg-hover) ;
    border-color: var(--border-medium) ;
    color: var(--text-primary) ;
}

.modal-btn.primary {
    background-color: var(--accent-primary) ;
    border-color: var(--accent-primary) ;
    color: #fff ;
}

/* ===== 分割线 ===== */
.divider-line {
    background-color: var(--border-subtle) ;
}

.section-label, .section-label-bottom {
    color: var(--text-muted) ;
    font-family: var(--font-ui) ;
    font-size: 11px ;
    letter-spacing: 0.5px;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-accent);
}

/* ===== 消息气泡 ===== */
.message {
    border-radius: var(--radius-md) ;
    background-color: var(--bg-card) ;
    border: 1px solid var(--border-subtle) ;
    color: var(--text-primary) ;
    box-shadow: var(--shadow-sm) ;
}

.message.user {
    background-color: rgba(200, 127, 74, 0.08) ;
    border-color: rgba(200, 127, 74, 0.2) ;
}

.message.assistant {
    background-color: var(--bg-card) ;
}

/* ===== 响应式 ===== */
@media (max-width: 1180px) {
    .prompt-shell {
        width: 100% ;
    }
}

@media (max-width: 720px) {
    .chat-model-hint { display: none ; }
}

/* ===== 加载动画 ===== */
@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.loading-indicator {
    animation: pulse-glow 1.5s ease-in-out infinite;
    color: var(--accent-primary) ;
}

/* ===== 选中高亮 ===== */
::selection {
    background-color: rgba(200, 127, 74, 0.2);
    color: var(--text-primary);
}

/* ===== 思考过程折叠块 ===== */
.think-block {
    background: rgba(200, 127, 74, 0.06) ;
    border: 1px solid rgba(200, 127, 74, 0.15) ;
    border-radius: 8px ;
}

.think-summary {
    color: #b09070 ;
    font-size: 12px ;
}

.think-content {
    color: #8a7560 ;
    font-size: 12px ;
    line-height: 1.6 ;
}

/* ===== 世界观卡片 ===== */
.world-card {
    background-color: var(--bg-card) ;
    border: 2px solid var(--accent-primary) ;
    border-radius: var(--radius-md) ;
    box-shadow: var(--shadow-sm) ;
}

.world-card h3 {
    color: var(--accent-primary) ;
    border-bottom: 1px solid var(--border-subtle) ;
}

/* ===== 加载更多按钮 ===== */
.load-more-btn {
    background: rgba(200, 127, 74, 0.08) ;
    border: 1px solid rgba(200, 127, 74, 0.2) ;
    color: var(--accent-primary) ;
}

.load-more-btn:hover {
    background: rgba(200, 127, 74, 0.15) ;
}
}
