@charset "UTF-8";

/* ========== 全局CSS变量系统 · 三模式统一版 ========== */

:root {
  /* ==========================
     基础颜色（原保留）
  ========================== */
  --el-color-white: #ffffff;
  --el-color-black: #000000;
  --el-color-primary-rgb: 64, 158, 255;
  --el-color-success-rgb: 103, 194, 58;
  --el-color-warning-rgb: 230, 162, 60;
  --el-color-danger-rgb: 245, 108, 108;
  --el-color-error-rgb: 245, 108, 108;
  --el-color-info-rgb: 144, 147, 153;

  /* ==========================
     字体 / 层级 / 边框 / 过渡 / 组件尺寸（原保留）
  ========================== */
  --el-font-size-extra-large: 30px;
  --el-font-size-large: 18px;
  --el-font-size-medium: 16px;
  --el-font-size-base: 14px;
  --el-font-size-small: 13px;
  --el-font-size-extra-small: 12px;
  --el-font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  --el-font-weight-primary: 500;
  --el-font-line-height-primary: 24px;

  --el-index-normal: 1;
  --el-index-top: 1000;
  --el-index-popper: 2000;
  --el-index-fixed: 999;
  --el-index-backdrop: 1000;

  --el-border-radius-base: 4px;
  --el-border-radius-small: 2px;
  --el-border-radius-round: 20px;
  --el-border-radius-circle: 50%;
  --el-border-width: 1px;
  --el-border-style: solid;

  --el-transition-duration: 0.3s;
  --el-transition-duration-fast: 0.2s;
  --el-transition-function-ease-in-out-bezier: cubic-bezier(0.645, 0.045, 0.355, 1);
  --el-transition-function-fast-bezier: cubic-bezier(0.23, 1, 0.32, 1);
  --el-transition-all: all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);
  --el-transition-fade: opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);
  --el-transition-md-fade: transform var(--el-transition-duration) var(--el-transition-function-fast-bezier), opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);
  --el-transition-fade-linear: opacity var(--el-transition-duration-fast) linear;
  --el-transition-border: border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);
  --el-transition-box-shadow: box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);
  --el-transition-color: color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);

  --el-component-size-large: 40px;
  --el-component-size: 32px;
  --el-component-size-small: 24px;

  /* ==========================
     Element 标准主题色（原保留）
  ========================== */
  color-scheme: light;
  --el-color-primary: #409eff;
  --el-color-primary-light-3: #79bbff;
  --el-color-primary-light-5: #a0cfff;
  --el-color-primary-light-7: #c6e2ff;
  --el-color-primary-light-8: #d9ecff;
  --el-color-primary-light-9: #ecf5ff;
  --el-color-primary-dark-2: #337ecc;

  --el-color-success: #67c23a;
  --el-color-success-light-3: #95d475;
  --el-color-success-light-5: #b3e09d;
  --el-color-success-light-7: #d1ecb7;
  --el-color-success-light-8: #e1f2d7;
  --el-color-success-light-9: #f0f9eb;
  --el-color-success-dark-2: #529829;

  --el-color-warning: #e6a23c;
  --el-color-warning-light-3: #eebe77;
  --el-color-warning-light-5: #f3d19e;
  --el-color-warning-light-7: #f8e3b9;
  --el-color-warning-light-8: #faeacd;
  --el-color-warning-light-9: #fdf6ec;
  --el-color-warning-dark-2: #b88230;

  --el-color-danger: #f56c6c;
  --el-color-danger-light-3: #f89898;
  --el-color-danger-light-5: #fab6b6;
  --el-color-danger-light-7: #fcd3d3;
  --el-color-danger-light-8: #fde2e2;
  --el-color-danger-light-9: #fef0f0;
  --el-color-danger-dark-2: #c45656;

  --el-color-error: #f56c6c;
  --el-color-error-light-3: #f89898;
  --el-color-error-light-5: #fab6b6;
  --el-color-error-light-7: #fcd3d3;
  --el-color-error-light-8: #fde2e2;
  --el-color-error-light-9: #fef0f0;
  --el-color-error-dark-2: #c45656;

  --el-color-info: #909399;
  --el-color-info-light-3: #b1b3b8;
  --el-color-info-light-5: #c8c9cc;
  --el-color-info-light-7: #dedfe0;
  --el-color-info-light-8: #e9e9eb;
  --el-color-info-light-9: #f4f4f5;
  --el-color-info-dark-2: #73767a;

  /* ==========================
     1. 中性色扩充（分层灰度，解决界面单调、分割、底色问题）
     从深→浅，用于分割线、卡片、列表、侧边栏、次要背景
  ========================== */
  --gray-100: #f9fafb;
  --gray-200: #f4f5f7;
  --gray-300: #e5e6eb;
  --gray-400: #c9cdd4;
  --gray-500: #86909c;
  --gray-600: #6b7785;
  --gray-700: #4e5969;
  --gray-800: #272e3b;
  --gray-900: #1d2129;

  /* ==========================
     2. 功能辅助色（新增标签、提示、次要操作色）
     蓝/紫/青/橙 国风低饱和配色，不抢主视觉
  ========================== */
  --color-purple: #8c78e8;
  --color-purple-light: #b4a6f2;
  --color-cyan: #36cbcb;
  --color-cyan-light: #86e2e2;
  --color-orange: #ff7d37;
  --color-orange-light: #ffb388;

  /* ==========================
     3. 古籍国风主题色组（原金色体系全面扩容）
     主金/古铜/朱砂/石青/赭石 传统国风五色，适配阅读器
  ========================== */
  /* 主金色（原有保留并分级） */
  --zj-color-accent: #c8a960;
  --zj-color-accent-light: #d4b886;
  --zj-color-accent-lighter: #e6d2a8;
  --zj-color-accent-dark: #9a8548;
  --zj-color-accent-darker: #726336;
  --zj-color-accent-rgb: 200, 169, 96;

  /* 古铜色（边框、分割、按钮描边） */
  --zj-color-bronze: #a08c6c;
  --zj-color-bronze-light: #bfa98a;
  /* 朱砂红（印章、重点标注、警示） */
  --zj-color-vermilion: #b82e2e;
  --zj-color-vermilion-light: #d95353;
  /* 石青（古籍笺纸、侧边栏、次要标题） */
  --zj-color-stoneblue: #4a6c8c;
  --zj-color-stoneblue-light: #6b8cae;
  /* 赭石（正文底色、卡片背景） */
  --zj-color-ochre: #b99b7b;
  --zj-color-ochre-light: #d1b99f;

  /* ==========================
     4. 阅读高亮专用色（人名/地名/事件/引用/批注）
  ========================== */
  --highlight-person: #a83232;    /* 人物 */
  --highlight-place: #2d6b9e;     /* 地名 */
  --highlight-event: #725a2e;     /* 历史事件 */
  --highlight-quote: #547044;      /* 引文/典籍 */
  --highlight-note: #8066a0;      /* 批注/注释 */

  /* ==========================
     5. 交互状态色（hover / active / focus）
  ========================== */
  --state-hover-opacity: 0.08;
  --state-active-opacity: 0.12;
  --state-focus-ring: rgba(200, 169, 96, 0.4);

  /* ==========================
     原有背景/文字/边框/填充/阴影（保留）
  ========================== */
  --el-bg-color: #ffffff;
  --el-bg-color-page: #f2f3f5;
  --el-bg-color-overlay: #ffffff;

  --el-text-color-primary: #303133;
  --el-text-color-regular: #606266;
  --el-text-color-secondary: #909399;
  --el-text-color-placeholder: #a8abb2;
  --el-text-color-disabled: #c0c4cc;

  --el-border-color: #dcdfe6;
  --el-border-color-light: #e4e7ed;
  --el-border-color-lighter: #ebeef5;
  --el-border-color-extra-light: #f2f6fc;
  --el-border-color-dark: #d4d7de;
  --el-border-color-darker: #cdd0d6;

  --el-fill-color: #f0f2f5;
  --el-fill-color-light: #f5f7fa;
  --el-fill-color-lighter: #fafafa;
  --el-fill-color-extra-light: #fafcff;
  --el-fill-color-dark: #ebedf0;
  --el-fill-color-darker: #e6e8eb;
  --el-fill-color-blank: #ffffff;

  --el-box-shadow: 0 12px 32px 4px rgba(0, 0, 0, 0.04), 0 8px 20px rgba(0, 0, 0, 0.08);
  --el-box-shadow-light: 0 0 12px rgba(0, 0, 0, 0.12);
  --el-box-shadow-lighter: 0 0 6px rgba(0, 0, 0, 0.12);
  --el-box-shadow-dark: 0 16px 48px 16px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.12), 0 8px 16px -8px rgba(0, 0, 0, 0.16);

  --el-disabled-bg-color: var(--el-fill-color-light);
  --el-disabled-text-color: var(--el-text-color-placeholder);
  --el-disabled-border-color: var(--el-border-color-light);

  --el-overlay-color: rgba(0, 0, 0, 0.8);
  --el-overlay-color-light: rgba(0, 0, 0, 0.7);
  --el-overlay-color-lighter: rgba(0, 0, 0, 0.5);
  --el-mask-color: rgba(255, 255, 255, 0.9);
  --el-mask-color-extra-light: rgba(255, 255, 255, 0.3);

  /* ==========================
     资治通鉴阅读器 基础定制（原保留+补充）
  ========================== */
  --zj-border-radius: 8px;
  --zj-border-radius-lg: 12px;
  --zj-spacing-xs: 4px;
  --zj-spacing-sm: 8px;
  --zj-spacing-md: 16px;
  --zj-spacing-lg: 24px;
  --zj-spacing-xl: 32px;
  --zj-spacing-xxl: 40px;
  --zj-spacing-xxxl: 65px;
  --zj-font-size-title: 22px;
  --zj-font-size-content: 17px;
  --zj-font-line-height: 1.8;
  --zj-font-family-content: "KaiTi", "STKaiti", "楷体", serif;

  /* ==========================
     三模式 全局变量 - 正常模式（默认，新增分级色）
  ========================== */
  --bg-main: #f2f2f2;
  --bg-content: #ffffff;
  --bg-card: #fdfbf5;
  --bg-sidebar: #f7f3eb;

  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-anno: #7a6b58;

  --accent: #c8a960;
  --border: #e0e0e0;
  --border-divider: #dcd0bc;

  --control-bg: #f5f5f5;
  --control-hover: #4788b7;
  --control-active: #3a739c;

  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ==========================
   护眼模式（全量适配新增颜色）
========================== */
.eye-mode {
  color-scheme: light;
  --bg-main: #f5f1e6;
  --bg-content: #faf7ee;
  --bg-card: #fcf8ed;
  --bg-sidebar: #f3ede0;

  --text-primary: #2c2c2c;
  --text-secondary: #5c5c5c;
  --text-muted: #8c887e;
  --text-anno: #70634f;

  --accent: #b89a50;
  --border: #d4c8b8;
  --border-divider: #c8b9a3;

  --control-bg: #f0ebe0;
  --control-hover: #6a9e6a;
  --control-active: #588c58;

  --shadow-light: 0 2px 8px rgba(150, 130, 90, 0.08);
  --shadow-medium: 0 4px 16px rgba(150, 130, 90, 0.12);

  /* 中性色变暗适配 */
  --gray-100: #f7f2e8;
  --gray-200: #f0e9d8;
  --gray-300: #e0d4bc;
  --gray-400: #bfa98a;
  --gray-500: #8c7e68;
  --gray-600: #72634e;
  --gray-700: #5a4f3e;
  --gray-800: #3d3529;
  --gray-900: #2b251d;
}

/* ==========================
   夜间模式（深色主题全量适配）
========================== */
.night-mode {
  color-scheme: dark;
  --bg-main: #1a1917;
  --bg-content: #252320;
  --bg-card: #2e2b27;
  --bg-sidebar: #35322e;

  --text-primary: #e6e2d8;
  --text-secondary: #b8b4aa;
  --text-muted: #88847a;
  --text-anno: #a89c88;

  --accent: #d4b866;
  --border: #44403a;
  --border-divider: #59544c;

  --control-bg: #35322e;
  --control-hover: #82724d;
  --control-active: #9a8558;

  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);

  /* 中性色深色适配 */
  --gray-100: #3a3733;
  --gray-200: #47433e;
  --gray-300: #59544c;
  --gray-400: #726c62;
  --gray-500: #918b80;
  --gray-600: #a8a295;
  --gray-700: #c0b9aa;
  --gray-800: #d8d0bf;
  --gray-900: #e6e2d8;
}

/* ========== 古典装饰元素 ========== */
.ancient-border {
  position: relative;
  border: 2px solid var(--ancient-gold);
  border-radius: 4px;
  padding: 16px;
  background: linear-gradient(135deg, var(--ancient-cream) 0%, var(--ancient-paper) 100%);
}

.ancient-border::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(200, 169, 96, 0.3);
  pointer-events: none;
}

.ancient-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  opacity: 0.6;
}

.ancient-corner-top-left {
  top: -2px;
  left: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath d='M0 30 Q15 15 30 0 L60 0 L60 30 Q45 15 30 30 Q15 45 0 30 Z' fill='none' stroke='%23c8a960' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
}

.ancient-corner-top-right {
  top: -2px;
  right: -2px;
  transform: scaleX(-1);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath d='M0 30 Q15 15 30 0 L60 0 L60 30 Q45 15 30 30 Q15 45 0 30 Z' fill='none' stroke='%23c8a960' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
}

.ancient-corner-bottom-left {
  bottom: -2px;
  left: -2px;
  transform: scaleY(-1);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath d='M0 30 Q15 15 30 0 L60 0 L60 30 Q45 15 30 30 Q15 45 0 30 Z' fill='none' stroke='%23c8a960' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
}

.ancient-corner-bottom-right {
  bottom: -2px;
  right: -2px;
  transform: scale(-1, -1);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath d='M0 30 Q15 15 30 0 L60 0 L60 30 Q45 15 30 30 Q15 45 0 30 Z' fill='none' stroke='%23c8a960' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
}

.ancient-cloud-bg {
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M20 50 Q30 30 50 35 Q70 40 80 50 Q70 60 50 55 Q30 50 20 50' fill='none' stroke='%23c8a960' stroke-width='0.5' opacity='0.1'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M0 70 Q10 50 30 55 Q50 60 60 70 Q50 80 30 75 Q10 70 0 70' fill='none' stroke='%23c8a960' stroke-width='0.5' opacity='0.1'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: top center, bottom center;
  background-size: 150px 60px, 120px 50px;
}

.ancient-meander-border {
  position: relative;
  padding: 20px;
}

.ancient-scroll {
  position: relative;
  border-radius: 4px;
  padding: 24px;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

.ancient-scroll::before,
.ancient-scroll::after {
  content: '';
  position: absolute;
  left: 10%;
  width: 80%;
  height: 20px;
  background: linear-gradient(to right, 
    transparent 0%, 
    rgba(139, 115, 85, 0.3) 10%, 
    rgba(139, 115, 85, 0.5) 50%, 
    rgba(139, 115, 85, 0.3) 90%, 
    transparent 100%);
  border-radius: 50%;
}

.ancient-scroll::before { top: -8px; }

/* .ancient-lantern {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  color: var(--ancient-red);
}

.ancient-lantern::before {
  content: '🏮';
  font-size: 32px;
  animation: lantern-swing 3s ease-in-out infinite;
} */

@keyframes lantern-swing {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.ancient-screen-bg {
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(200, 169, 96, 0.03) 20%, 
    rgba(200, 169, 96, 0.06) 50%, 
    rgba(200, 169, 96, 0.03) 80%, 
    transparent 100%);
}

.ancient-divider {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.ancient-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--ancient-gold) 20%, 
    var(--ancient-gold) 80%, 
    transparent 100%);
}

.ancient-divider::after {
  content: '❖';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ancient-gold);
  font-size: 16px;
  background: var(--bg-main);
  padding: 0 12px;
}

.book-shelf {
  background: linear-gradient(180deg, #8b7355 0%, #6b533c 100%);
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.book-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.book-item {
  width: 24px;
  height: 40px;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
              inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.book-item:nth-child(1) { background: linear-gradient(180deg, #c41e3a 0%, #8b0000 100%); }
.book-item:nth-child(2) { background: linear-gradient(180deg, #228b22 0%, #006400 100%); }
.book-item:nth-child(3) { background: linear-gradient(180deg, #4169e1 0%, #1e90ff 100%); }
.book-item:nth-child(4) { background: linear-gradient(180deg, #daa520 0%, #b8860b 100%); }
.book-item:nth-child(5) { background: linear-gradient(180deg, #8b4513 0%, #654321 100%); }
.book-item:nth-child(6) { background: linear-gradient(180deg, #9932cc 0%, #8a2be2 100%); }

/* ========== 全局重置与基础 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  line-height: 1.7;
  background-color: var(--bg-main);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-main);
}

/* ========== 顶部导航 ========== */
.top-bar {
  background-color: var(--bg-content);
  padding: 0.6rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--el-box-shadow-light);
  z-index: var(--el-index-top);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo h1 {
  font-size: 1.8rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  cursor: pointer;
  transition: var(--el-transition-color);
}

.logo p {
  font-size: 0.7rem;
  opacity: 0.8;
  color: var(--text-secondary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.nav a,
.nav .nav-btn {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  cursor: pointer;
  transition: var(--el-transition-color);
}

.nav a:hover,
.nav .nav-btn:hover,
.logo h1:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.nav-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-primary);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--control-bg);
  padding: 4px 12px;
  border-radius: var(--el-border-radius-round);
  transition: var(--el-transition-all);
  color: var(--text-primary);
}

.user-avatar:hover {
  background: var(--control-hover);
}

.avatar-icon {
  font-size: 1.2rem;
}

.settings-btn {
  background-color: var(--control-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--el-border-radius-round);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: var(--el-transition-all);
}

.settings-btn:hover {
  background-color: var(--control-hover);
  color: var(--accent);
  border-color: var(--accent);
}

/* ========== 功能控制栏 ========== */
.control-bar {
  background-color: var(--bg-content);
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  gap: 1rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.control-left {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.control-right {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  cursor: pointer;
  color: var(--text-primary);
}

.reading-timer {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ========== 设置面板 ========== */
.settings-panel {
  position: fixed;
  top: 18%;
  right: 10%;
  background-color: var(--bg-content);
  padding: var(--zj-spacing-md);
  border-radius: var(--zj-border-radius);
  box-shadow: var(--el-box-shadow);
  z-index: var(--el-index-popper);
  display: none;
  max-width: 500px;
  border: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--zj-spacing-md);
  padding-bottom: var(--zj-spacing-sm);
  border-bottom: 1px solid var(--border);
}

.settings-header h4,
.settings-panel h4 {
  margin: 0;
  color: var(--accent);
  font-size: 1rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--zj-border-radius);
  transition: var(--el-transition-all);
}

.close-btn:hover {
  background-color: var(--control-hover);
  color: var(--accent);
}

.setting-item {
  margin-bottom: var(--zj-spacing-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-item label {
  flex: 1;
  min-width: 100px;
  color: var(--text-primary);
}

.setting-item input[type="range"] {
  flex: 2;
  background-color: var(--control-bg);
  accent-color: var(--accent);
}

.setting-item span {
  flex: 0 0 60px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ========== 主内容区 ========== */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  background-color: var(--bg-main);
  position: relative;
}

/* 侧边栏折叠按钮 */
.nav-toggle-btn2 {
    position: fixed;
    left: 0px;
    top: 9%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 45px;
    border: none;
    border-left: 1px solid var(--border);
    background: var(--bg-content);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    color: var(--text-secondary);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle-btn2:hover {
    background: var(--control-bg);
    color: var(--accent);
    box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-50%) scale(1.05);
}

.nav-toggle-btn2:active {
    transform: translateY(-50%) scale(0.98);
}

.nav-toggle-btn2 svg {
    width: 25px;
    height: 25px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    fill: currentColor;
}

/* 侧边栏基础样式 */
.sidebar-left {
  width: 245px;
  border-right: 1px solid #e0d8cd;
  padding: 16px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  overflow-y: auto;
  box-shadow: inset -1px 0 8px rgba(0, 0, 0, 0.03);
}

.nav-toggle-btn {
  position: fixed;
  left: 250px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 56px;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--bg-content);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle-btn:hover {
  background: var(--control-bg);
  color: var(--accent);
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-50%) scale(1.05);
}

.nav-toggle-btn:active {
  transform: translateY(-50%) scale(0.98);
}

.nav-toggle-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  fill: currentColor;
}

body.sidebar-collapsed .sidebar-left {
  transform: translateX(-100%);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 999;
}

body.sidebar-collapsed .nav-toggle-btn {
  left: 0;
  border-left: none;
}

body.sidebar-collapsed .nav-toggle-btn svg {
  transform: rotate(180deg);
}

/* 目录样式 */
#tree-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.volume-div {
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 4px;
  transition: var(--el-transition-all);
  position: relative;
  color: var(--text-primary);
  font-family: 'LXGW WenKai', 'KaiTi', serif;
  font-size: 14px;
}

.volume-div:hover {
  color: #4a3728;
}

.volume-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  border-bottom: 1px solid #cbc6c6;
}

.volume-title span {
  font-size: 0.9rem;
}

.volume-title .toggle-btn {
  font-size: 0.8rem;
  transition: transform 0.3s;
  color: var(--text-secondary);
}

.volume-div.active .toggle-btn {
  transform: rotate(90deg);
}

.chapter-list {
  margin-left: 13px;
  margin-top: 5px;
  display: none;
  flex-direction: column;
  gap: 3px;
}

.volume-div.active .chapter-list {
  display: flex;
}

.chapter-item {
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--el-transition-all);
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-item:hover {
  background-color: #ebe5dc;
  color: #4a3728;
}

.chapter-item.active {
  background-color: #e8dfd2;
  color: #5d4a3a;
  font-weight: 500;
  border-left: 3px solid #8b7355;
}

/* 内容中心 */
.content-center {
  flex: 1;
  padding: var(--zj-spacing-xxl);
  padding-right: var(--zj-spacing-xxl);
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-content);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, padding-right 0.1s ease;
}

body.sidebar-collapsed .content-center {
  margin-left: 0;
  padding-left: 38px;
}

#article-container {
  margin: 0 auto;
}

.year-group {
  margin-bottom: var(--zj-spacing-xl);
  margin-left: 28px;
}

.paragraph {
  margin-bottom: var(--zj-spacing-md);
  line-height: 1.8;
  color: var(--text-primary);
}

.chapter-info {
  margin-top: var(--zj-spacing-xs);
}

.chapter-info h3,
.original-preview h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--accent);
}

.chapter-info p {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: bolder;
  padding-bottom: 10px;
}

.original-preview {
  margin-top: var(--zj-spacing-md);
  max-width: 1000px;
  margin: 0 auto;
}

/* ========== 标注工具 ========== */
.annotation-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.annotation-canvas.active {
  pointer-events: auto;
}

/* ========== 图片放大模态框 ========== */
.image-modal {
  display: none;
  position: fixed;
  z-index: var(--el-index-popper);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: var(--el-overlay-color);
}

.modal-content {
  margin: 10% auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: var(--el-transition-color);
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #bbb;
}

.modal-caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}

/* ========== 弹窗样式 ========== */
.info-popup,
.keyword-popup {
  position: absolute;
  background: linear-gradient(180deg, #fdfbf7 0%, #f5f0e6 100%);
  border: 1px solid #d4c8b8;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 40px rgba(139, 115, 85, 0.03);
  z-index: var(--el-index-popper);
  max-width: 420px;
  font-size: var(--el-font-size-base);
  color: #4a3728;
  line-height: 1.8;
  transition: var(--el-transition-all);
  font-family: 'LXGW WenKai', 'KaiTi', serif;
}

.info-popup {
  border-left: 5px solid #8b7355;
  max-width: 340px;
  padding: 20px 24px 20px 20px;
}

.keyword-popup {
  border-left: 5px solid #8b5a2b;
  max-width: 50%;
  min-width: 260px;
  padding: 18px 22px;
}

.popup-close-btn {
  position: absolute;
  top: 4px;
  right: 5px;
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--el-border-radius-circle);
  transition: var(--el-transition-all);
}

.popup-close-btn:hover {
  background-color: var(--control-hover);
  color: var(--text-primary);
}

.note-content {
  margin-top: 10px;
  line-height: 1.8;
  font-size: 13px;
  color: #4e360a;
}

.note-content strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.note-btn {
  background: none;
  border: none;
  color: #4e360a;
  cursor: pointer;
  font-size: 0.8rem;
  /* margin-left: 0.5rem; */
  /* vertical-align: text-bottom; */
  /* border-bottom: 1px dashed var(--accent); */
  display: inline-block;
  transition: var(--el-transition-color);
  position: relative;
  z-index: var(--el-index-medium);
  pointer-events: auto;
}

.note-btn:hover {
  color: var(--el-color-primary);
}

.note-btn.note-placeholder {
  cursor: pointer;
  opacity: 0.9;
  /* border: 1px dashed var(--accent);
  border-radius: 3px; */
}



/* ========== 通鉴助手 & 右侧面板 ========== */
.tongjian-helper-btn {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background-color: var(--control-bg);
  color: var(--text-primary);
  padding: 10px 15px;
  border-radius: var(--zj-border-radius) 0 0 var(--zj-border-radius);
  cursor: pointer;
  box-shadow: var(--el-box-shadow-light);
  z-index: var(--el-index-top);
  transition: var(--el-transition-all);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 20px;
  font-weight: bold;
  border: 1px solid var(--border);
  border-right: none;
}

.tongjian-helper-btn:hover {
  background-color: var(--control-hover);
  color: var(--accent);
  padding-right: 20px;
  border-color: var(--accent);
}

.sidebar-right {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 350px;
    min-width: 350px;
    max-width: 60%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-right.active {
  transform: translateX(0);
}

.sidebar-drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background-color: #e0e0e0;
  z-index: 100;
  transition: background-color 0.2s ease;
}

.sidebar-drag-handle:hover {
  background-color: #c8a960;
}

.sidebar-header {
  padding: var(--zj-spacing-md);
  background-color: var(--control-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header h3 {
  margin: 0;
  color: var(--accent);
  font-size: 16px;
}

.home-btn {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 5px 15px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--el-transition-all);
}

.home-btn:hover {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: var(--el-box-shadow-light);
}

.close-sidebar-btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-size: 14px;
  transition: var(--el-transition-all);
}

.close-sidebar-btn:hover {
  background-color: var(--zj-color-accent-dark);
  box-shadow: var(--el-box-shadow-light);
}

.qa-module {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.annotation-tool,
.right-bottom-tools {
    flex-shrink: 0;
}

.qa-module h4 {
  margin-bottom: var(--zj-spacing-md);
  color: var(--accent);
}

.qa-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: var(--zj-spacing-md);
}

.qa-input-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--el-border-radius-base);
  font-family: inherit;
  background-color: var(--control-bg);
  color: var(--text-primary);
  transition: var(--el-transition-all);
}

.qa-input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 169, 96, 0.2);
}

.qa-input-group button {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-family: inherit;
  transition: var(--el-transition-all);
}

.qa-input-group button:hover {
  background-color: var(--zj-color-accent-dark);
  box-shadow: var(--el-box-shadow-light);
}

.qa-response {
  background-color: var(--control-bg);
  padding: var(--zj-spacing-md);
  border-radius: var(--el-border-radius-base);
  border: 1px solid var(--border);
  min-height: 100px;
  color: var(--text-secondary);
  transition: var(--el-transition-all);
}

.tool-toggle {
  background-color: var(--control-bg);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--zj-spacing-md);
  color: var(--text-primary);
  transition: var(--el-transition-all);
}

.tool-toggle:hover {
  background-color: var(--control-hover);
  border-color: var(--accent);
}

.tool-panel {
  display: none;
  padding: var(--zj-spacing-md);
  background-color: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: var(--el-border-radius-base);
  transition: var(--el-transition-all);
}

.tool-panel.active {
  display: block;
}

.tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--zj-spacing-md);
}

.tool-btn {
  background-color: var(--control-bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: var(--el-transition-all);
  color: var(--text-primary);
}

.tool-btn:hover {
  background-color: var(--control-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-btn.active {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tool-options {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.tool-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.qr-row {
  display: flex;
  gap: 20px;
  margin-bottom: var(--zj-spacing-md);
}

.qr-item {
  flex: 1;
  text-align: center;
}

.qr-item h4 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--accent);
}

.qr-placeholder {
  background-color: var(--control-bg);
  padding: 10px;
  border-radius: var(--el-border-radius-base);
  border: 1px solid var(--border);
  transition: var(--el-transition-all);
}

.qr-placeholder img {
  max-width: 100px;
  margin-bottom: 5px;
}

.qr-placeholder p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.donate-btn {
  width: 100%;
  background-color: var(--el-color-warning);
  color: white;
  border: none;
  padding: 10px;
  border-radius: var(--el-border-radius-base);
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 10px;
  transition: var(--el-transition-all);
}

.donate-btn:hover {
  background-color: var(--el-color-warning-dark-2);
  box-shadow: var(--el-box-shadow-light);
}

.donate-tip {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ========== 自定义关键词悬停提示 ========== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  background: rgba(44, 62, 47, 0.9);
  color: #f5f0e1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  white-space: normal;
  width: 500px;
  max-width: 1000px;
  min-width: 200px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(74, 107, 78, 0.6);
  text-align: left;
  max-height: 300px;
  overflow-y: auto;
  bottom: 125%;
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  left: 12px;
  border: 8px solid transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  bottom: 115%;
  border-top-color: rgba(44, 62, 47, 0.9);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

[data-tooltip]:hover::before {
  transform: translateY(-4px);
}

[data-tooltip].tooltip-below::before {
  bottom: auto;
  top: 125%;
}

[data-tooltip].tooltip-below::after {
  bottom: auto;
  top: 115%;
  border-top-color: transparent;
  border-bottom-color: rgba(44, 62, 47, 0.9);
}

[data-tooltip].tooltip-below:hover::before {
  transform: translateY(4px);
}

[data-tooltip]::before::-webkit-scrollbar {
  width: 4px;
}

[data-tooltip]::before::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

[data-tooltip]::before::-webkit-scrollbar-thumb {
  background: rgba(245, 240, 225, 0.3);
  border-radius: 2px;
}

/* 文章页脚-按钮 */
.article-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8e0d0;
}

.article-footer2 {
    /* text-align: center; */
    /* margin-top: 30px; */
    padding-bottom: 15px;
    border-bottom: 1px solid #e8e0d0;
}

.close-article-btn {
    background: linear-gradient(135deg, #8b7355 0%, #6b533c 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-article-btn:hover {
    background: linear-gradient(135deg, #a08060 0%, #8b7355 100%);
    transform: translateY(-1px);
}



/* 图片轮播样式 */
.image-carousel-container {
    position: relative;
    max-width: 800px;
    margin: 30px auto;
    padding: 11px;
    background: #830011;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    border-radius: 8px;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}
 
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 14px;
    text-align: center;
}

/* 切换按钮 */
.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

/* 指示器 */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #2c3e2f;
    border-color: #2c3e2f;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .image-carousel-container {
        margin: 20px 15px;
    }
    
    .carousel-wrapper {
        aspect-ratio: 4/3;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 35px;
        height: 35px;
        font-size: 22px;
    }
}


/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
  .nav-toggle-btn {
    display: none;
  }
  /* .ganzhi-modal-content {
            margin: 15% auto;
            padding: 20px 15px;
        } */
  .sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 999;
    transform: translateX(-100%);
  }

  body.sidebar-mobile-open .sidebar-left {
    transform: translateX(0);
  }

  .content-center {
    padding-left: 10px;
  }
}