/* ═══════════════════════════════════════════════════════════
   法印对照 50_reader+ — 暗金主题
   从 20_xml_reader 迁移设计令牌 + 新增首页布局
   ═══════════════════════════════════════════════════════════ */

/* ─── 文津宋体 @font-face ──────────────────────────────────── */
@font-face {
    font-family: 'WenJinMincho';
    src: url('/static/fonts/WenJinMinchoP0-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'WenJinMincho';
    src: url('/static/fonts/WenJinMinchoP2-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+2B820-2CEAF;
}

@font-face {
    font-family: 'WenJinMincho';
    src: url('/static/fonts/WenJinMinchoP3-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+2CEB0-2F7FF;
}

/* ─── 思源宋体（可变字重） ────────────────────────────────── */
@font-face {
    font-family: 'SourceHanSerif';
    src: url('/static/fonts/SourceHanSerif-VF.otf.woff2') format('woff2');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

/* ─── 字云体（Jigmo 三平面） ─────────────────────────────── */
@font-face {
    font-family: 'Jigmo';
    src: url('/static/fonts/Jigmo.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Jigmo';
    src: url('/static/fonts/Jigmo2.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+20000-2A6DF;
}

@font-face {
    font-family: 'Jigmo';
    src: url('/static/fonts/Jigmo3.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+2A700-2B81F;
}

/* ─── 老宋体（NanoOldSong 四区） ─────────────────────────── */
@font-face {
    font-family: 'NanoOldSong';
    src: url('/static/fonts/NanoOldSongA-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NanoOldSong';
    src: url('/static/fonts/NanoOldSongB-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+4E00-9FFF;
}

@font-face {
    font-family: 'NanoOldSong';
    src: url('/static/fonts/NanoOldSongC-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+20000-2A6DF;
}

@font-face {
    font-family: 'NanoOldSong';
    src: url('/static/fonts/NanoOldSongD-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+2A700-2FA1F;
}

/* ─── 设计令牌 ────────────────────────────────────────────── */
:root {
    /* 暗金配色 */
    --bg-primary: #0f0f13;
    --bg-secondary: #1a1a24;
    --bg-card: #1e1e2a;
    --bg-card-hover: #262636;
    --bg-surface: #22222e;

    /* 首页栏目主色调 */
    --hero-section-color: #d4a853;
    /* 暗色模式：金黄色 */

    --gold-bright: #d4a853;
    --gold-dim: #a07a30;
    --gold-subtle: #6b5220;

    --text-primary: #d4cdc4;
    --text-secondary: #b8b2a5;
    --text-muted: #8a837a;
    --text-link: #d4a853;
    --text-link-hover: #f0c668;

    --border-subtle: #2a2a38;
    --border-gold: rgba(212, 168, 83, 0.25);

    --red-accent: #c0504d;
    --green-dim: #5a7a5a;

    /* 模块 4 色 */
    --bamboo: #4a7c5c;
    /* 竹青 */
    --bamboo-glow: #5f9e75;
    --ochre: #8b7335;
    /* 枯黄 */
    --ochre-glow: #b89a48;
    --sandalwood: #8c5e3a;
    /* 檀色 */
    --sandalwood-glow: #b07a50;
    --cloud: #6b7a8a;
    /* 云峰白 */
    --cloud-glow: #8a9db0;

    /* 字体 */
    --font-serif: 'Noto Serif TC', 'Noto Serif CJK TC', 'Source Han Serif TC', 'WenJinMincho', serif;
    --font-sans: 'Noto Sans TC', 'Noto Sans CJK TC', 'Source Han Sans TC', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* 间距 */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* 过渡 */
    --transition: 0.2s ease;

    /* 版心（正文区最大宽度，em 单位随字号自动缩放，1em ≈ 1 个汉字宽） */
    --text-block-width: 36em;
}

/* ─── 浅色主题（纸卷风） ────────────────────────────────── */
.theme-light {
    --bg-primary: #f5f0e8;
    --bg-secondary: #ece6da;
    --bg-card: #fff8ee;
    --bg-card-hover: #f0e8d8;
    --bg-surface: #f8f2e6;

    /* 首页栏目主色调 */
    --hero-section-color: #003366;
    /* 亮色模式：藏青色 */

    --gold-bright: #8b6914;
    --gold-dim: #6b5010;
    --gold-subtle: #c9b06a;

    --text-primary: #1e1911;
    --text-secondary: #4a4030;
    --text-muted: #6b6050;
    --text-link: #8b6914;
    --text-link-hover: #a07810;

    --border-subtle: #d8ceb8;
    --border-gold: rgba(139, 105, 20, 0.25);

    --red-accent: #b8413e;
    --green-dim: #4a7a4a;

    /* 模块 4 色 — 浅色适配 */
    --bamboo: #3a6a4c;
    --bamboo-glow: #4f8e65;
    --ochre: #7b6325;
    --ochre-glow: #a88a38;
    --sandalwood: #7c4e2a;
    --sandalwood-glow: #a06a40;
    --cloud: #5b6a7a;
    --cloud-glow: #7a8da0;
}

/* 浅色主题 — 工具栏 & 面板硬编码色覆盖 */
.theme-light .tool-strip {
    background: rgba(255, 248, 238, 0.92);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.theme-light .overlay-backdrop {
    background: rgba(0, 0, 0, 0.15);
}

.theme-light .overlay-panel {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

/* 浅色主题 — 滚动条 */
.theme-light ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.theme-light ::-webkit-scrollbar-thumb {
    background: #c8bda8;
}

.theme-light ::-webkit-scrollbar-thumb:hover {
    background: #b0a48c;
}


/* ─── 基础重置 ────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 17px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--text-link-hover);
}

/* Alpine.js x-cloak */
[x-cloak] {
    display: none !important;
}


/* ─── 顶部导航 ────────────────────────────────────────────── */
.top-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--gold-bright);
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--gold-bright);
}

.brand-text {
    font-family: var(--font-serif);
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: var(--space-xs) 0;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold-dim);
}


/* ─── 主内容区 ────────────────────────────────────────────── */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg) var(--space-xl);
    width: 100%;
    flex: 1;
}


/* ─── 搜索英雄區 ──────────────────────────────────────────── */
.search-hero {
    text-align: center;
    padding: var(--space-xs) 0 var(--space-md);
    position: relative;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    color: var(--gold-bright);
    letter-spacing: 0.2em;
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 16px rgba(212, 168, 83, 0.2);
}

/* ─── 每日一偈卡片（純內容，無左側標識） ────────────────────── */
.verse-card {
    display: inline-block;
    position: relative;
    margin-bottom: var(--space-sm);
    border: 1px solid var(--border-gold);
    border-radius: 2px;
}

/* 左側：單字標識（已移除，保留選擇器相容） */
.verse-card-label {
    display: none;
}

.verse-card-divider {
    display: none;
}

/* 內容區 */
.verse-card-content {
    padding: var(--space-md) var(--space-2xl);
    text-align: center;
}

.verse-card-body {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--text-primary);
    line-height: 1.9;
    margin: 0 0 var(--space-xs);
    padding: 0;
    border: none;
}

.verse-card-body p {
    margin: 0;
    letter-spacing: 0.08em;
}

.verse-card-source {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: normal;
    letter-spacing: 0.1em;
    margin-top: var(--space-xs);
}

/* 自題標記 */
.verse-custom-badge {
    display: inline-block;
    font-size: 0.65rem;
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.1);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.05em;
}

/* ─── 偈頌工具列 ─────────────────────────────────────────── */
.verse-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(212, 168, 83, 0.08);
}

.verse-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.verse-tool-btn:hover {
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.06);
    border-color: rgba(212, 168, 83, 0.15);
}

.verse-tool-btn.is-active {
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.25);
}

.verse-tool-delete:hover {
    color: var(--red-accent);
    background: rgba(192, 80, 77, 0.06);
    border-color: rgba(192, 80, 77, 0.15);
}

.verse-counter {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 52px;
    text-align: center;
    letter-spacing: 0.05em;
}

.verse-counter:hover {
    color: var(--gold-bright);
}

.verse-counter-input {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gold-bright);
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    width: 48px;
    text-align: center;
    padding: 2px 4px;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.verse-counter-input::-webkit-outer-spin-button,
.verse-counter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.verse-toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 16px;
    background: var(--border-subtle);
    margin: 0 4px;
}

/* ─── 自題偈頌彈窗 ───────────────────────────────────────── */
.verse-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.verse-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.verse-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.verse-modal-header h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold-bright);
    letter-spacing: 0.1em;
}

.verse-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}

.verse-modal-close:hover {
    color: var(--text-primary);
}

.verse-modal-body {
    padding: var(--space-lg);
}

.verse-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.05em;
}

.verse-label+.verse-label {
    margin-top: var(--space-md);
}

.verse-textarea,
.verse-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    line-height: 1.8;
    outline: none;
    transition: border-color var(--transition);
    resize: vertical;
}

.verse-textarea:focus,
.verse-input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.1);
}

.verse-textarea::placeholder,
.verse-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.82rem;
}

.verse-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.verse-btn {
    padding: 6px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.08em;
    font-family: var(--font-sans);
    border: 1px solid transparent;
}

.verse-btn-primary {
    background: rgba(212, 168, 83, 0.15);
    color: var(--gold-bright);
    border-color: rgba(212, 168, 83, 0.3);
}

.verse-btn-primary:hover:not(:disabled) {
    background: rgba(212, 168, 83, 0.25);
}

.verse-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.verse-btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.verse-btn-secondary:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ─── 偈頌 Toast ─────────────────────────────────────────── */
.verse-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    color: var(--gold-bright);
    padding: 8px 24px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.verse-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--space-xl);
}

/* ─── 搜索栏 ──────────────────────────────────────────────── */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-box-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0 var(--space-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box-wrapper:focus-within {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 3px rgba(160, 122, 48, 0.15);
}

.search-icon {
    font-size: 1.1rem;
    margin-right: var(--space-sm);
    opacity: 0.5;
}

.search-input {
    flex: 1;
    padding: 0.75rem 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── 搜索结果下拉 ────────────────────────────────────────── */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-xs);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    transition: background var(--transition);
    text-decoration: none;
    border-bottom: 1px solid rgba(42, 42, 56, 0.4);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-card-hover);
}

.result-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.result-title {
    flex: 1;
    font-size: 0.9rem;
}

.result-author {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.search-result-hint {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

.search-no-result {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* ═══════════════════════════════════════════════════════════
   区域 ① — 我的案头（手风琴模块）
   ═══════════════════════════════════════════════════════════ */
.desk-section {
    margin-bottom: var(--space-2xl);
}

.new-module-btn {
    display: block;
    width: 100%;
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed rgba(212, 168, 83, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
}

.new-module-btn:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.04);
    box-shadow: inset 0 0 20px rgba(212, 168, 83, 0.03);
}

.section-header {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    color: var(--hero-section-color);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.section-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background-color: var(--hero-section-color);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.icon-jue {
    -webkit-mask-image: url('/static/images/enso_jue.svg');
    mask-image: url('/static/images/enso_jue.svg');
}

.icon-wen {
    -webkit-mask-image: url('/static/images/enso_wen.svg');
    mask-image: url('/static/images/enso_wen.svg');
}

.icon-deng {
    -webkit-mask-image: url('/static/images/enso_deng.svg');
    mask-image: url('/static/images/enso_deng.svg');
}

.icon-zang {
    -webkit-mask-image: url('/static/images/enso_zang.svg');
    mask-image: url('/static/images/enso_zang.svg');
}

.section-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    margin-left: var(--space-sm);
    color: var(--hero-section-color);
    opacity: 0.8;
}

.section-subtitle::before {
    content: '·';
    margin-right: var(--space-sm);
    opacity: 0.4;
}

/* 祖师/贝阙等内容区域 */
.content-section {
    margin-bottom: var(--space-xl);
}

.section-body-placeholder {
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    opacity: 0.7;
    margin-top: var(--space-sm);
}

.section-body-placeholder:hover {
    opacity: 0.9;
}

.placeholder-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
}

/* 模块网格：3 列 */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

@media (max-width: 1024px) {
    .modules-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── 模块卡片 ────────────────────────────────────────────── */
.module-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.module-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

/* 4 色主题 — 顶部边框彩色条 */
.module-bamboo {
    border-top: 3px solid var(--bamboo);
}

.module-ochre {
    border-top: 3px solid var(--ochre);
}

.module-sandalwood {
    border-top: 3px solid var(--sandalwood);
}

.module-cloud {
    border-top: 3px solid var(--cloud);
}


.module-bamboo:hover {
    border-top-color: var(--bamboo-glow);
    box-shadow: 0 -2px 12px rgba(74, 124, 92, 0.15);
}

.module-ochre:hover {
    border-top-color: var(--ochre-glow);
    box-shadow: 0 -2px 12px rgba(139, 115, 53, 0.15);
}

.module-sandalwood:hover {
    border-top-color: var(--sandalwood-glow);
    box-shadow: 0 -2px 12px rgba(140, 94, 58, 0.15);
}

.module-cloud:hover {
    border-top-color: var(--cloud-glow);
    box-shadow: 0 -2px 12px rgba(107, 122, 138, 0.15);
}

/* ─── 模块标题栏 ──────────────────────────────────────────── */
.module-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: 10px var(--space-lg);
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    text-align: left;
    transition: background var(--transition);
}

.module-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.module-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-family: var(--font-serif);
    font-size: 0.85rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
}

.module-title-group {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex: 1;
}

.module-name {
    font-weight: 600;
}

.module-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.module-subtitle::before {
    content: '·';
    margin-right: var(--space-sm);
    opacity: 0.8;
}

.module-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.module-chevron {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.module-chevron.is-open {
    transform: rotate(180deg);
}

/* ─── 模块内容 ────────────────────────────────────────────── */
.module-body {
    padding: 0 var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* 手风琴展开/折叠动画 */
.slide-enter {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.slide-enter-start {
    max-height: 0;
    opacity: 0;
}

.slide-enter-end {
    max-height: 500px;
    opacity: 1;
}

.slide-leave {
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.slide-leave-start {
    max-height: 500px;
    opacity: 1;
}

.slide-leave-end {
    max-height: 0;
    opacity: 0;
}

/* 空状态 */
.module-empty {
    padding: var(--space-lg) 0;
    text-align: center;
}

.empty-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.empty-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* 文件夹组 */
.folder-group {
    margin-top: var(--space-md);
}

.folder-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.folder-icon-sm {
    font-size: 0.9rem;
}

.folder-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 文件夹折叠箭头 */
.folder-chevron {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.folder-chevron:not(.is-open) {
    transform: rotate(-90deg);
}

/* 经文条目 */
.sutra-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    margin-left: var(--space-lg);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: background var(--transition);
    text-decoration: none;
}

.sutra-item:hover {
    background: var(--bg-card-hover);
    color: var(--gold-bright);
}

.sutra-item-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 50px;
}

.sutra-item-title {
    flex: 1;
}

/* 添加按钮 */
.module-add-btn {
    display: block;
    width: 100%;
    margin-top: var(--space-md);
    padding: var(--space-sm) 0;
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
}

.module-add-btn:hover {
    border-color: var(--gold-dim);
    color: var(--gold-dim);
    background: rgba(160, 122, 48, 0.05);
}


/* ─── 案头 CRUD 交互样式 ─────────────────────────────────── */

/* 编辑模式切换按钮 */
.fav-edit-toggle {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
}

.fav-edit-toggle:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.fav-edit-toggle.is-active {
    background: rgba(160, 122, 48, 0.15);
    border-color: var(--gold-dim);
    color: var(--gold-bright);
}

.fav-hidden-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* 模块标题行（含编辑工具） */
.module-header-row {
    display: flex;
    align-items: center;
}

.module-header-row .module-header {
    flex: 1;
    min-width: 0;
}

/* 编辑模式工具按钮组 */
.module-edit-tools {
    position: absolute;
    top: 4px;
    right: 6px;
    display: flex;
    gap: 2px;
    z-index: 2;
}

.mod-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.mod-tool-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.mod-tool-rename:hover {
    color: var(--gold-bright);
}

.mod-tool-hide:hover {
    color: var(--text-secondary);
}

.mod-tool-delete:hover {
    color: #c75050;
    background: rgba(199, 80, 80, 0.1);
}

/* 内联编辑输入框 */
.inline-edit-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 2px 8px;
    outline: none;
    min-width: 60px;
    max-width: 200px;
}

.inline-edit-input:focus {
    box-shadow: 0 0 0 2px rgba(160, 122, 48, 0.2);
}

.inline-edit-sub {
    font-size: 0.8rem;
    max-width: 140px;
}

/* 删除按钮（项目级） */
.item-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.item-delete-btn:hover {
    background: rgba(199, 80, 80, 0.15);
    color: #c75050;
}

/* 经文行（含删除按钮） */
.sutra-item-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sutra-item-row .sutra-item {
    flex: 1;
    min-width: 0;
}

/* 新建文件夹输入行 */
.new-folder-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
}

.new-folder-row .inline-edit-input {
    flex: 1;
    max-width: none;
}

.fav-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.fav-btn-ok {
    background: rgba(74, 124, 92, 0.2);
    color: #6ab080;
}

.fav-btn-ok:hover {
    background: rgba(74, 124, 92, 0.35);
}

.fav-btn-cancel {
    background: rgba(199, 80, 80, 0.1);
    color: #c75050;
}

.fav-btn-cancel:hover {
    background: rgba(199, 80, 80, 0.2);
}

/* 添加菜单（弹出） */
.add-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 20;
    min-width: 160px;
}

.add-menu-item {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.add-menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--gold-bright);
}

.add-menu-item+.add-menu-item {
    border-top: 1px solid var(--border-subtle);
}

/* 隐藏模块（编辑模式下半透明） */
.module-card[style*="opacity"] {
    transition: opacity var(--transition);
}

/* ─── 拖拽排序视觉反馈 ──────────────────────────────────── */
.sortable-ghost {
    opacity: 0.3;
}

.sortable-chosen {
    box-shadow: 0 0 0 2px var(--gold-dim);
    border-radius: var(--radius-md);
}

.sortable-drag {
    opacity: 0.9;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* 编辑模式下可拖拽元素的光标 */
.module-card .module-header {
    cursor: pointer;
}

[data-child-index] {
    transition: transform 0.15s ease;
}

.hidden-modules-hint {
    text-align: center;
    padding: var(--space-sm) 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ─── 弹窗（Modal） ───────────────────────────────────────── */

.fav-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fav-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 380px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.fav-modal-lg {
    width: 520px;
}

.fav-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.fav-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.fav-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}

.fav-modal-close:hover {
    color: var(--text-primary);
}

.fav-modal-body {
    padding: var(--space-lg);
}

.fav-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* 表单控件 */
.fav-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    margin-top: var(--space-md);
}

.fav-label:first-child {
    margin-top: 0;
}

.fav-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
    box-sizing: border-box;
}

.fav-input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(160, 122, 48, 0.15);
}

.fav-input::placeholder {
    color: var(--text-muted);
}

.fav-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
}

.fav-select:focus {
    border-color: var(--gold-dim);
}

/* 颜色选择器 */
.fav-color-picker {
    display: grid;
    grid-template-columns: repeat(4, 28px);
    gap: 8px;
    margin-top: var(--space-xs);
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.color-dot:hover {
    transform: scale(1.15);
}

.color-dot.is-selected {
    border-color: var(--gold-bright);
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.3);
}

.color-dot.is-selected::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 按钮 */
.fav-btn {
    padding: 6px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
}

.fav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fav-btn-primary {
    background: var(--gold-dim);
    color: var(--bg-primary);
    font-weight: 600;
}

.fav-btn-primary:hover:not(:disabled) {
    background: var(--gold-bright);
}

.fav-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.fav-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* 收藏搜索结果 */
.fav-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: var(--space-sm);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.fav-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(42, 42, 56, 0.3);
}

.fav-result-item:last-child {
    border-bottom: none;
}

.fav-result-item:hover {
    background: var(--bg-card-hover);
}

.fav-result-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}

.fav-result-title {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.fav-result-add {
    color: var(--gold-dim);
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.fav-no-result {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.fav-target-row {
    margin-bottom: var(--space-md);
}

/* Toast 提示 */
.fav-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius-lg);
    padding: 8px 24px;
    color: var(--gold-bright);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.fav-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 弹窗淡入/淡出动画 */
.fade-enter {
    transition: opacity 0.2s ease;
}

.fade-enter-start {
    opacity: 0;
}

.fade-enter-end {
    opacity: 1;
}

.fade-leave {
    transition: opacity 0.15s ease;
}

.fade-leave-start {
    opacity: 1;
}

.fade-leave-end {
    opacity: 0;
}

/* 新增颜色主题 */
.module-indigo {
    border-top: 3px solid #4a5c8a;
}

.module-indigo:hover {
    border-top-color: #7a8cc0;
    box-shadow: 0 -2px 12px rgba(74, 92, 138, 0.15);
}

.module-crimson {
    border-top: 3px solid #8a4a4a;
}

.module-crimson:hover {
    border-top-color: #c07a7a;
    box-shadow: 0 -2px 12px rgba(138, 74, 74, 0.15);
}

.module-rosewood {
    border-top: 3px solid #6e4a6e;
}

.module-rosewood:hover {
    border-top-color: #9e7a9e;
    box-shadow: 0 -2px 12px rgba(110, 74, 110, 0.15);
}

.module-pine {
    border-top: 3px solid #3d5c52;
}

.module-pine:hover {
    border-top-color: #6d8c82;
    box-shadow: 0 -2px 12px rgba(61, 92, 82, 0.15);
}

.module-celadon {
    border-top: 3px solid #4a7a7a;
}

.module-celadon:hover {
    border-top-color: #7aacac;
    box-shadow: 0 -2px 12px rgba(74, 122, 122, 0.15);
}

.module-amber {
    border-top: 3px solid #8a6a2a;
}

.module-amber:hover {
    border-top-color: #b89a5a;
    box-shadow: 0 -2px 12px rgba(138, 106, 42, 0.15);
}

.module-moonwhite {
    border-top: 3px solid #7a8590;
}

.module-moonwhite:hover {
    border-top-color: #a0aab5;
    box-shadow: 0 -2px 12px rgba(122, 133, 144, 0.15);
}

.module-rust {
    border-top: 3px solid #7a5040;
}

.module-rust:hover {
    border-top-color: #aa8070;
    box-shadow: 0 -2px 12px rgba(122, 80, 64, 0.15);
}


/* ═══════════════════════════════════════════════════════════
   占位符区域（区域 ②③）
   ═══════════════════════════════════════════════════════════ */
.placeholder-section {
    margin-bottom: var(--space-xl);
}

.placeholder-card {
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.placeholder-card:hover {
    opacity: 0.9;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.placeholder-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.placeholder-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

.placeholder-badge {
    display: inline-block;
    padding: 2px 12px;
    background: var(--bg-surface);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════
   区域 ③ — 贝阙（全藏目录浏览）
   ═══════════════════════════════════════════════════════════ */

/* 工具栏：Tab + 搜索 */
.catalog-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.catalog-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 3px;
}

.catalog-tab {
    padding: 6px 18px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
}

.catalog-tab:hover {
    color: var(--text-primary);
}

.catalog-tab.active {
    background: var(--bg-card);
    color: var(--gold-bright);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.catalog-search-box {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    min-width: 160px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px 10px;
    transition: border-color var(--transition);
}

.catalog-search-box:focus-within {
    border-color: var(--gold-dim);
}

.catalog-search-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    opacity: 0.5;
}

.catalog-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    padding: 4px 0;
}

.catalog-search-input::placeholder {
    color: var(--text-muted);
}

.catalog-search-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 4px;
    transition: color var(--transition);
}

.catalog-search-clear:hover {
    color: var(--text-primary);
}

.catalog-stat {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* 目录树 */
.catalog-tree {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.catalog-empty {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* L1 分类标题 */
.catalog-l1-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-bottom: 1px solid rgba(42, 42, 56, 0.3);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.catalog-l1-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.catalog-l1-header.is-open {
    border-bottom-color: var(--gold-subtle);
}

.catalog-toggle {
    font-size: 0.85rem;
    color: var(--gold-dim);
    width: 16px;
    flex-shrink: 0;
    text-align: center;
}

.catalog-l1-title {
    flex: 1;
}

.catalog-l1-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    opacity: 0.8;
}

.catalog-l1-body {
    padding-left: var(--space-sm);
}

/* L2 子分类 */
.catalog-subgroup {
    border-left: 2px solid var(--border-subtle);
    margin-left: var(--space-sm);
}

.catalog-l2-header,
.catalog-l3-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    width: 100%;
    padding: 5px var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    cursor: pointer;
    text-align: left;
    transition: color var(--transition);
}

.catalog-l2-header:hover,
.catalog-l3-header:hover {
    color: var(--text-primary);
}

.catalog-l2-header.is-open,
.catalog-l3-header.is-open {
    color: var(--gold-dim);
}

.catalog-toggle-sm {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
    text-align: center;
}

.catalog-l2-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.catalog-l2-body,
.catalog-l3-body {
    padding-left: var(--space-sm);
}

/* 叶子：经文条目 */
.catalog-leaf {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 4px var(--space-md) 4px calc(var(--space-md) + 14px);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background var(--transition), color var(--transition);
    border-radius: var(--radius-sm);
}

.catalog-leaf:hover {
    background: var(--bg-card-hover);
    color: var(--gold-bright);
}

.catalog-leaf-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 55px;
    flex-shrink: 0;
}

.catalog-leaf-title {
    flex: 1;
    font-family: var(--font-serif);
}

/* 加载状态 */
.catalog-loading {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.catalog-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--gold-dim);
    border-radius: 50%;
    animation: catalog-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: var(--space-xs);
}

@keyframes catalog-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ═══════════════════════════════════════════════════════════
   区域 ② — 祖师（完整四面板仪表盘）
   ═══════════════════════════════════════════════════════════ */

/* --- 搜索栏 + Chips --- */
.lineage-header {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    margin-bottom: var(--space-md);
}

.lineage-search-box {
    position: relative;
    flex-shrink: 0;
    width: 220px;
}

.lineage-search-box::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: currentColor;
    opacity: 0.35;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat center / contain;
    pointer-events: none;
    z-index: 1;
}

.lineage-search-box input {
    width: 100%;
    padding: 6px 12px 6px 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}

.lineage-search-box input:focus {
    border-color: var(--gold-dim);
}

.lineage-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    width: 320px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.lineage-search-results.active {
    display: block;
}

.lineage-search-results .search-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.lineage-search-results .search-item:hover {
    background: var(--bg-hover);
}

.lineage-search-results .search-item .name {
    font-size: 13px;
    color: var(--text-primary);
}

.lineage-search-results .search-item .meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Chips — PC 端在搜索框右侧 */
.lineage-search-chips {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0 4px;
    align-items: center;
    align-content: center;
}

.chip-group {
    display: inline;
}

.chip-sep {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 2px;
}

/* 移动端：chips 折到搜索框下方 */
@media (max-width: 768px) {
    .lineage-header {
        flex-wrap: wrap;
    }

    .lineage-search-box {
        width: 100%;
    }
}

.chip {
    display: inline-block;
    padding: 2px 4px;
    font-size: 11px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1.5;
}

.chip:hover {
    color: var(--gold);
}

.chip-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    padding: 0 2px;
    opacity: 0.7;
    align-self: center;
    white-space: nowrap;
}

.chip-sect {
    /* 典雅青碧色，取自傳統「青瓷」色調 */
    border-color: rgba(82, 130, 120, 0.4);
    color: #6aada0;
}

.chip-sect:hover {
    border-color: rgba(82, 130, 120, 0.7);
    background: rgba(82, 130, 120, 0.1);
    color: #8dcfc4;
}

/* --- 四面板仪表盘 --- */
.lineage-dashboard {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 78vh;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-main);
}

.ln-right-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* --- 面板通用 --- */
.ln-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}

.ln-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.ln-panel-header h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.ln-panel-icon {
    width: 14px;
    height: 14px;
    color: var(--gold-dim);
}

.ln-panel-body {
    flex: 1;
    overflow: hidden auto;
    padding: 0;
    position: relative;
}

/* 分割面板 */
.ln-bottom-split {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.split-v {
    overflow: hidden;
}

.split-h {
    overflow: hidden;
}

/* Split.js 分割线 */
.gutter {
    background: var(--border-subtle);
    transition: background 0.2s;
}

.gutter:hover {
    background: var(--gold-dim);
}

.gutter.gutter-vertical {
    cursor: row-resize;
    height: 6px !important;
}

.gutter.gutter-horizontal {
    cursor: col-resize;
    width: 6px !important;
}

/* 空状态 */
.ln-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 13px;
    gap: 8px;
    padding: var(--space-lg);
    text-align: center;
}

.ln-empty-state .icon {
    opacity: 0.3;
    color: var(--gold-dim);
}

.ln-empty-state .hint {
    font-size: 11px;
    opacity: 0.6;
}

/* --- 编年时间轴 --- */
#panel-timeline {
    overflow: hidden;
}

.chronicle-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.chr-dynasty {
    border-bottom: 1px solid var(--border-subtle);
}

.chr-dynasty-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    color: var(--text-primary);
}

.chr-dynasty-header:hover {
    background: var(--bg-hover);
}

.chr-dynasty-header.open {
    background: rgba(209, 163, 65, 0.06);
}

.chr-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
}

.chr-toggle.open {
    transform: rotate(90deg);
}

.chr-dynasty-name {
    font-weight: 600;
    color: var(--gold);
}

.chr-dynasty-years {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

.chr-stat {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
}

.chr-stat-num {
    color: var(--gold-dim);
}

.chr-dynasty-body {
    display: none;
    padding-left: 8px;
}

.chr-dynasty-body.open {
    display: block;
}

/* 二级行 */
.chr-sub-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.chr-sub-row:hover {
    background: var(--bg-hover);
}

.chr-sub-row.open {
    background: rgba(209, 163, 65, 0.04);
}

.chr-sub-label {
    font-weight: 500;
}

.chr-sub-years {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

.chr-sub-stat {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 三级详情 */
.chr-detail-panel {
    display: none;
    padding: 4px 8px;
    border-left: 2px solid var(--border-subtle);
    margin-left: 12px;
}

.chr-detail-panel.open {
    display: block;
}

.chr-inline-detail {
    padding: 4px 8px;
}

.chr-list-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chr-person-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-size: 12px;
}

.chr-person-item:hover {
    background: var(--bg-hover);
}

.chr-person-item.highlighted {
    background: rgba(209, 163, 65, 0.15);
    outline: 1px solid var(--gold-dim);
}

.chr-person-name {
    color: var(--text-primary);
    font-weight: 500;
}

.chr-person-years {
    font-size: 10px;
    color: var(--text-muted);
}

.chr-person-sect {
    font-size: 10px;
    color: #c0392b;
    margin-left: auto;
}

.chr-tool-btn {
    padding: 2px 6px;
    font-size: 10px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.chr-tool-btn:hover {
    border-color: var(--gold-dim);
    color: var(--gold);
}

.chr-tool-btn.active {
    background: var(--gold-dim);
    border-color: var(--gold-dim);
    color: #fff;
}

/* --- 人物详情三栏 --- */
.sidebar-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    height: 100%;
}

.sidebar-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
}

.sidebar-col:last-child {
    border-right: none;
}

.sidebar-col-header {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-icon {
    width: 12px;
    height: 12px;
}

.sidebar-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.6;
}

/* 人物元数据 */
.person-meta {
    margin-bottom: 8px;
}

.person-meta .person-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-serif);
    margin-bottom: 4px;
}

.tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    margin-right: 3px;
    margin-bottom: 3px;
}

.tag.dynasty {
    border: 1px solid rgba(209, 163, 65, 0.3);
    color: var(--gold-dim);
}

.tag.sect {
    border: 1px solid rgba(192, 57, 43, 0.3);
    color: #c0392b;
}

.person-section {
    margin-top: 8px;
}

.person-section h3 {
    font-size: 11px;
    color: var(--gold-dim);
    font-weight: 600;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.person-bio {
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* 师承/弟子标签流 */
.tag-flow {
    line-height: 2;
}

.tag-person {
    color: #5ec4d4;
    cursor: pointer;
    font-size: 12px;
    transition: color 0.15s;
}

.tag-person:hover {
    color: var(--gold);
    text-decoration: underline;
}

/* 经典列表 */
.scripture-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.scripture-list li {
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 4px;
}

.scripture-list .type {
    font-size: 9px;
    padding: 0 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.scripture-list .sid {
    font-size: 11px;
}

.scripture-list .label {
    font-size: 10px;
    color: var(--text-muted);
}

/* --- 法脉图 --- */
#lineage-container {
    position: relative;
    height: 100%;
    overflow: hidden;
}

#lineage-container svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lineage-expand-btn {
    padding: 2px 8px;
    font-size: 10px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.lineage-expand-btn:hover:not(:disabled) {
    border-color: var(--gold-dim);
    color: var(--gold);
}

.lineage-expand-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 全屏 */
#panel-lineage.fullscreen,
#panel-map.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 200;
    border: none;
    border-radius: 0;
}

/* --- 地图 --- */
#map-container {
    height: 100%;
    width: 100%;
    background: #1a1d24;
}

.theme-light #map-container {
    background: #e8e0d0;
}

/* Leaflet 暗色适配 */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid var(--border-subtle) !important;
    font-size: 12px !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-subtle) !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.6) !important;
    color: var(--text-muted) !important;
    font-size: 9px !important;
}

.leaflet-control-attribution a {
    color: var(--text-muted) !important;
}

/* MarkerCluster 暗色 */
.marker-cluster div {
    background: rgba(209, 163, 65, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-small {
    background: rgba(209, 163, 65, 0.3);
}

.marker-cluster-medium {
    background: rgba(209, 163, 65, 0.4);
}

.marker-cluster-large {
    background: rgba(209, 163, 65, 0.5);
}

/* --- 状态栏 --- */
.lineage-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.ln-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ln-status-icon {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* --- 工具提示 --- */
.ln-tooltip {
    display: none;
    position: fixed;
    z-index: 300;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 12px;
    max-width: 360px;
    pointer-events: none;
}

/* --- 响应式 --- */
@media (max-width: 1024px) {
    .lineage-dashboard {
        grid-template-columns: 1fr;
        height: auto;
    }

    #panel-timeline {
        max-height: 300px;
        overflow-y: auto;
    }

    .sidebar-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ln-bottom-split {
        flex-direction: column;
    }

    .lineage-dashboard {
        height: auto;
    }
}



/* ═══════════════════════════════════════════════════════════
   页脚
   ═══════════════════════════════════════════════════════════ */
.site-footer {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.footer-verse {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
}

.footer-credits {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-credits a {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    transition: color var(--transition), border-color var(--transition);
}

.footer-credits a:hover {
    color: var(--gold-bright);
    border-bottom-color: var(--gold-dim);
}


/* ═══════════════════════════════════════════════════════════════
   导航栏搜索框
   ═══════════════════════════════════════════════════════════════ */

.nav-search {
    position: relative;
    flex: 0 1 320px;
    margin: 0 var(--space-lg);
}

.nav-search-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition);
}

.nav-search-wrapper:focus-within {
    border-color: var(--gold-dim);
}

.nav-search-icon {
    font-size: 0.8rem;
    opacity: 0.5;
    flex-shrink: 0;
}

.nav-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    padding: 2px 0;
}

.nav-search-input::placeholder {
    color: var(--text-muted);
}

.nav-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-height: 360px;
    overflow-y: auto;
    z-index: 200;
}

.nav-search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(42, 42, 56, 0.4);
}

.nav-search-result-item:last-child {
    border-bottom: none;
}

.nav-search-result-item:hover {
    background: var(--bg-card-hover);
    color: var(--gold-bright);
}

.nav-search-result-item .result-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-search-result-item .result-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    min-width: 55px;
    text-align: center;
    flex-shrink: 0;
}

.nav-search-result-item .result-title {
    font-size: 0.85rem;
}

.nav-search-result-item .result-juan {
    font-size: 0.7rem;
    color: var(--gold-dim);
    background: rgba(212, 168, 83, 0.1);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.nav-search-result-item .result-snippet {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    padding-left: 4px;
    border-left: 2px solid var(--border-gold);
    margin-left: 2px;
}

.nav-search-result-item .result-snippet mark {
    background: rgba(212, 168, 83, 0.3);
    color: var(--gold-bright);
    padding: 0 1px;
    border-radius: 1px;
}

.nav-search-no-result {
    padding: var(--space-md);
    text-align: center;
}

.nav-search-no-result p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-result-hint {
    text-align: center;
    padding: var(--space-xs) 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 搜索分段标签 */
.search-section-label {
    font-size: 0.7rem;
    color: var(--gold-dim);
    padding: 4px var(--space-md) 2px;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: 0.1em;
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   沉浸式阅读模式 (Immersive Reader Mode)
   ═══════════════════════════════════════════════════════════════ */

/* 阅读模式下隐藏标准页脚、将内容放满 */
.reader-mode .site-footer {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   阅读页布局（主区 + 右侧图标条）
   ═══════════════════════════════════════════════════════════════ */

.reader-layout {
    display: flex;
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    gap: 0;
}

.reader-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-xl) var(--space-lg);
    padding-top: 60px;
    /* 为顶部工具栏留空间 */
    padding-right: calc(var(--space-lg) + 2rem);
    /* 右侧额外留白避免工具栏遮挡 */
}

/* 版心：阅读主区内容居中约束 */
.reader-main .sutra-header,
.reader-main .juan-selector,
.reader-main .breadcrumb {
    max-width: var(--text-block-width);
    margin-left: auto;
    margin-right: auto;
}


/* ═══════════════════════════════════════════════════════════════
   面包屑
   ═══════════════════════════════════════════════════════════════ */

/* 单栏时吸顶容器：包裹面包屑 + 经文头部 */
.reader-sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-xs) 0;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--gold-bright);
}

.breadcrumb .sep {
    color: var(--text-muted);
    margin: 0 4px;
    opacity: 0.5;
}

.breadcrumb .current {
    color: var(--text-primary);
}

.crumb-category {
    color: var(--text-secondary);
}


/* ═══════════════════════════════════════════════════════════════
   经文 Header + 详情面板
   ═══════════════════════════════════════════════════════════════ */

.sutra-header {
    margin-bottom: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08), transparent);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    position: relative;
}

/* 标题 + 卷导航 合并为一行 */
.sutra-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
    min-height: 36px;
}

/* 左侧：经名 + 经号 + 详情按钮 */
.sutra-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}

.sutra-title {
    font-family: 'SourceHanSerif', 'WenJinMincho', 'Jigmo', var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold-bright);
    margin: 0;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-id-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(212, 168, 83, 0.12);
    color: var(--gold-bright);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 168, 83, 0.2);
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: color var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-toggle:hover {
    color: var(--gold-dim);
}

.detail-toggle.is-expanded {
    color: var(--gold-dim);
}

/* 右侧：卷选择 + 翻页 */
.sutra-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.sutra-header-right .juan-select {
    padding: 3px 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    cursor: pointer;
    min-width: 80px;
}

.sutra-header-right .juan-select:focus {
    outline: none;
    border-color: var(--gold-dim);
}

.sutra-header-right .juan-btn {
    padding: 3px 10px;
    font-size: 0.85rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    line-height: 1;
}

.sutra-header-right .juan-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--gold-dim);
}

.sutra-header-right .juan-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sutra-header-right .juan-indicator {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    white-space: nowrap;
    padding: 0 2px;
}

[x-cloak] {
    display: none !important;
}

.detail-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 4px;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.detail-grid {
    display: grid;
    gap: var(--space-xs);
}

.detail-row {
    display: grid;
    grid-template-columns: 5em 1fr;
    gap: var(--space-md);
    padding: 4px 0;
    align-items: baseline;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: right;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.detail-mono {
    font-family: var(--font-mono);
}

.detail-en {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-small {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}


/* ═══════════════════════════════════════════════════════════════
   卷选择器
   ═══════════════════════════════════════════════════════════════ */

.juan-selector {
    margin-bottom: var(--space-md);
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
    border: 1px solid var(--border-subtle);
    border-bottom: 2px solid rgba(212, 168, 83, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.juan-selector.bottom {
    display: none;
}

.juan-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.juan-nav-btns {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.juan-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.juan-indicator {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    white-space: nowrap;
    padding: 0 var(--space-sm);
}

.juan-btn {
    padding: 4px 12px;
    font-size: 0.82rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

/* 回顶/回首按钮：加左侧分隔线 */
.scroll-home-btn {
    margin-left: var(--space-sm);
    border-left: 2px solid var(--border-subtle);
    padding-left: var(--space-sm);
}

.juan-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--gold-dim);
}

.juan-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.juan-select {
    padding: 6px 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    cursor: pointer;
    min-width: 120px;
}

.juan-select:focus {
    outline: none;
    border-color: var(--gold-dim);
}


/* ═══════════════════════════════════════════════════════════════
   经文正文渲染
   ═══════════════════════════════════════════════════════════════ */

.juan-body {
    font-family: var(--font-body, var(--font-serif));
    font-size: 1.1rem;
    line-height: 2.0;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    white-space: pre-line;
    /* 版心宽度：em 单位随字号自动缩放，保持约 34 字/行 */
    max-width: var(--text-block-width);
    margin-left: auto;
    margin-right: auto;
}

/* 行号 */
.juan-body .line-num {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.5;
    vertical-align: super;
    margin: 0 0.15em;
    font-family: var(--font-sans);
    user-select: none;
}

/* 段落 */
.juan-body p {
    display: block;
    margin: 0.8em 0;
    text-indent: 2em;
    white-space: normal;
}

.juan-body p br {
    display: none;
}

.juan-body p .line-num {
    display: inline;
    font-size: 0.6rem;
    color: var(--gold-subtle);
    opacity: 0.4;
    vertical-align: super;
    margin: 0 0.1em;
}

.juan-body p[id]::before {
    display: none;
}

/* 标题 */
.juan-body h3,
.juan-body .head- {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold-bright);
    margin: var(--space-lg) 0 var(--space-sm);
}

/* 偈颂 */
.juan-body .verse,
.lg {
    width: fit-content;
    margin: var(--space-md) auto;
    padding: 0;
    line-height: 1.6;
    text-align: left;
    white-space: normal;
}

.juan-body .verse br,
.lg br {
    display: none;
}

.juan-body .verse .lb-marker,
.lg .lb-marker {
    display: none;
}

.juan-body .verse .line-num {
    display: none;
}

.juan-body .verse-line,
.l {
    display: inline;
    margin: 0;
    padding: 0;
}

.l::after {
    content: '\A';
    white-space: pre;
}

.juan-body .caesura {
    display: inline-block;
    width: 1.5em;
}

/* 分页标记 */
.juan-body .page-break {
    display: inline;
}

.juan-body .page-break:empty {
    display: none;
}

/* 原版图片链接 */
.juan-body .page-img-link {
    font-size: 1em;
    line-height: 1;
    display: inline;
    text-decoration: none;
    opacity: 0.35;
    transition: opacity 0.2s;
    vertical-align: baseline;
    margin: 0 0.1em;
    cursor: pointer;
}

.juan-body .page-img-link:hover {
    opacity: 0.65;
}

/* 隐藏目录标记 */
.juan-body .mulu[hidden] {
    display: none;
}

/* 锚点 */
.juan-body a.anchor {
    text-decoration: none;
    color: inherit;
}

/* 卷头 */
.jhead {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--gold-bright);
    text-align: center;
    margin: var(--space-lg) 0;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-gold);
}

.head {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--gold-bright);
    margin: var(--space-lg) 0 var(--space-sm);
    font-weight: bold;
    text-align: center;
}

.byline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-lg);
}

.juan {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--gold-bright);
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-gold);
}

.div-pin {
    margin-top: var(--space-2xl);
}

.para-id {
    display: none;
}

.para-block {
    position: relative;
}

.lb-marker {
    display: none;
}


/* ═══════════════════════════════════════════════════════════════
   注释系统
   ═══════════════════════════════════════════════════════════════ */

.note-inline {
    font-size: 0.85em;
    color: var(--text-muted);
}

.noted {
    border-bottom: 1.5px dashed var(--gold-dim);
    cursor: help;
    transition: background-color 0.2s, border-color 0.2s;
}

.noted:hover {
    background-color: rgba(212, 168, 83, 0.15);
    border-bottom-color: var(--gold-bright);
}

.noted.app-var {
    border-bottom-style: dotted;
}

.juan-body sup.note-ref {
    font-size: 0.65em;
    vertical-align: super;
    line-height: 0;
    color: var(--gold-dim);
    cursor: help;
    transition: color var(--transition);
}

.juan-body sup.note-ref:hover {
    color: var(--gold-bright);
}

.juan-body sup.note-ref a {
    color: var(--gold-dim);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition);
}

.juan-body sup.note-ref a:hover {
    color: var(--gold-bright);
}

/* 注释弹窗 */
.note-popup {
    position: fixed;
    z-index: 9999;
    max-width: 420px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
}

.note-popup.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.note-popup .popup-num {
    color: var(--gold-dim);
    font-family: var(--font-mono);
    margin-right: 0.3em;
}

/* 尾注区 */
.endnotes {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-gold);
    line-height: 1.4;
    white-space: normal;
}

.endnotes h3 {
    font-family: var(--font-serif);
    color: var(--gold-bright);
    margin-bottom: var(--space-md);
    font-size: 1.1rem;
}

.endnotes ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.endnotes li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    padding: 2px 0;
    line-height: 1.5;
    scroll-margin-top: 60px;
}

.endnotes li:target {
    background-color: rgba(212, 168, 83, 0.12);
    border-radius: var(--radius-sm);
    padding-left: var(--space-sm);
    transition: background-color 0.5s;
}

.note-back {
    color: var(--gold-dim);
    text-decoration: none;
    font-size: 0.85em;
    margin-right: var(--space-xs);
    transition: color var(--transition);
}

.note-back:hover {
    color: var(--gold-bright);
}

.note-num {
    color: var(--gold-dim);
    font-family: var(--font-mono);
    font-size: 0.85em;
    margin-right: 0.3em;
}

.cf-label {
    display: inline-block;
    font-size: 0.75em;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 0 4px;
    margin-right: 4px;
    vertical-align: middle;
}

[id^="ref-"]:target {
    background-color: rgba(212, 168, 83, 0.2);
    border-radius: 2px;
    transition: background-color 1s;
}

.foreign {
    font-family: "Gentium Plus", "Times New Roman", serif;
    font-style: italic;
    font-size: 0.8em;
    color: var(--text-muted);
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════════
   加载指示器
   ═══════════════════════════════════════════════════════════════ */

.loading-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-2xl) 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--gold-dim);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.htmx-request .juan-body {
    opacity: 0.4;
    transition: opacity 0.2s;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}


/* ═══════════════════════════════════════════════════════════════
   右侧图标条 (Tool Strip)
   ═══════════════════════════════════════════════════════════════ */

.tool-strip {
    position: fixed;
    top: 12px;
    right: 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: rgba(30, 30, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg, 12px);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: var(--font-sans);
    /* 思源黑体 */
}

.tool-strip-btn {
    height: 32px;
    padding: 0 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    color: #7a9ab8;
    /* 玄青色，與祖師面板一致 */
    flex-shrink: 0;
    white-space: nowrap;
}

/* Lucide SVG 圖標尺寸 */
.tool-strip-btn .tool-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.75;
}

.tool-strip-btn .tool-label {
    font-size: 0.75rem;
    color: inherit;
    font-family: var(--font-sans);
    line-height: 1;
    letter-spacing: 0.05em;
    transition: color var(--transition);
}

.tool-strip-btn:hover {
    background: rgba(122, 154, 184, 0.15);
    color: #a8c8e8;
}

.tool-strip-btn.active {
    background: rgba(122, 154, 184, 0.2);
    color: #b8d8f0;
}

.tool-strip-btn.active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 1.5px;
    background: #7a9ab8;
    border-radius: 1px;
}

.tool-strip-spacer {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 4px;
}


/* ═══════════════════════════════════════════════════════════════
   覆盖面板 (Overlay Panel)
   ═══════════════════════════════════════════════════════════════ */

.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
    backdrop-filter: blur(2px);
}

.overlay-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 360px;
    max-height: calc(100vh - 72px);
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.overlay-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.overlay-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.overlay-panel-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold-bright);
    margin: 0;
}

.overlay-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.overlay-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--gold-dim);
    background: var(--bg-surface);
}

.overlay-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* 面板内容通用样式 */
.panel-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.panel-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-lg) 0;
}

.panel-section {
    margin-bottom: var(--space-lg);
}

.panel-section-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.panel-search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
}

.panel-search-input:focus {
    border-color: var(--gold-dim);
}

.panel-search-input::placeholder {
    color: var(--text-muted);
}

.panel-action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.panel-action-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.panel-action-btn.danger {
    border-color: rgba(220, 80, 80, 0.3);
    color: #dc5050;
}

.panel-action-btn.danger:hover {
    background: rgba(220, 80, 80, 0.1);
}

/* 占位符样式 */
.parallel-placeholder {
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--text-muted);
}

.parallel-placeholder .placeholder-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-sm);
    opacity: 0.5;
}

.parallel-placeholder p {
    margin: var(--space-xs) 0;
    font-size: 0.9rem;
}

.parallel-placeholder .placeholder-hint {
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════════
   设置面板 (Settings Panel)
   ═══════════════════════════════════════════════════════════════ */

.settings-section {
    margin-bottom: var(--space-lg);
}

.settings-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-family: var(--font-sans);
}

.settings-value {
    color: var(--gold-dim);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-left: var(--space-xs);
}

/* 按钮组（简繁切换） */
.settings-btn-group {
    display: flex;
    gap: 2px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 2px;
    border: 1px solid var(--border-subtle);
}

.settings-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.settings-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.settings-btn.active {
    background: rgba(212, 168, 83, 0.2);
    color: var(--gold-bright);
}

/* 滑块行 */
.settings-slider-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.settings-slider-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    flex-shrink: 0;
    width: 1.2em;
    text-align: center;
}

/* 自定义滑块样式 */
.settings-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--gold-dim);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.settings-slider::-webkit-slider-thumb:hover {
    background: var(--gold-bright);
    transform: scale(1.2);
}

.settings-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--gold-dim);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.settings-slider::-moz-range-thumb:hover {
    background: var(--gold-bright);
}


/* ═══════════════════════════════════════════════════════════════
   对照工作台 (Comparison Workspace)
   ═══════════════════════════════════════════════════════════════ */

.compare-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
}

.compare-item.current {
    border-color: var(--gold-dim);
}

.compare-item-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 12px;
    min-height: 36px;
}

.compare-item-icon {
    font-size: 0.8rem;
    color: var(--gold-bright);
    flex-shrink: 0;
}

.compare-item-title {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-item-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.compare-item-badge {
    font-size: 0.65rem;
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.15);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.compare-load-btn,
.compare-remove-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: all var(--transition);
}

.compare-load-btn:hover {
    background: rgba(212, 168, 83, 0.12);
    color: var(--gold-bright);
}

.compare-remove-btn:hover {
    background: rgba(220, 80, 80, 0.12);
    color: #dc5050;
}

.compare-open-link {
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.compare-open-link:hover {
    opacity: 1;
}

/* 注疏文件夹 */
.compare-sub-folder {
    border-top: 1px solid var(--border-subtle);
}

.compare-folder-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    width: 100%;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--transition);
}

.compare-folder-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.compare-folder-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.compare-folder-content {
    padding: 4px 12px 8px 28px;
}

.compare-empty-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 4px 0;
}

.compare-commentary-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.compare-commentary-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 添加按钮 */
.compare-add-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 4px;
}

.compare-add-btn:hover {
    border-color: var(--gold-dim);
    color: var(--gold-bright);
    background: rgba(212, 168, 83, 0.06);
}

.compare-add-btn.primary {
    width: 100%;
    justify-content: center;
    padding: 8px;
    font-size: 0.85rem;
    border-style: dashed;
}

/* 搜索对话框 */
.compare-add-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    margin-top: var(--space-sm);
}

.compare-search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
    box-sizing: border-box;
}

.compare-search-input:focus {
    border-color: var(--gold-dim);
}

.compare-search-input::placeholder {
    color: var(--text-muted);
}

.compare-search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: var(--space-xs);
}

.compare-search-result-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.compare-search-result-btn:hover {
    background: rgba(212, 168, 83, 0.1);
}

.result-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 60px;
}

.result-title {
    font-family: var(--font-serif);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ═══ AI 释义面板 ═══ */
.ai-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-md);
    background: var(--bg-surface);
    border-radius: var(--radius-sm, 4px);
    padding: 3px;
}

.ai-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-mode-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.ai-mode-tab.active {
    background: rgba(212, 168, 83, 0.15);
    color: var(--gold-bright);
    font-weight: 600;
}

.ai-selected-text {
    background: rgba(212, 168, 83, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: 0.85rem;
}

.ai-selected-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin-bottom: 4px;
}

.ai-selected-content {
    font-family: var(--font-serif);
    color: var(--text-primary);
    line-height: 1.6;
    max-height: 4.8em;
    overflow: hidden;
}

.ai-selected-text.ai-empty {
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    padding: var(--space-md);
}

.ai-question-area {
    margin-bottom: var(--space-sm);
}

.ai-question-input {
    width: 100%;
    min-height: 100px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ai-question-input:focus {
    border-color: var(--gold-dim);
}

.ai-question-input::placeholder {
    color: var(--text-muted);
}

.ai-action-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.ai-send-btn {
    flex: 1;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c7ff7, #9d78f8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.ai-send-btn.ai-sent {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    opacity: 0.85;
}

.ai-send-btn.ai-sent:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    opacity: 1;
}

.ai-stop-btn {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-stop-btn:hover {
    border-color: var(--red-accent, #ef4444);
    color: var(--red-accent, #ef4444);
}

.ai-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm, 4px);
    padding: var(--space-sm) var(--space-md);
    color: #f87171;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    margin-bottom: var(--space-sm);
}

.ai-result-area {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    padding: var(--space-md);
    margin-top: var(--space-sm);
}

.ai-result-label {
    font-size: 0.75rem;
    color: var(--gold-bright);
    font-family: var(--font-sans);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-result-content {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-result-typing {
    display: inline-block;
    width: 6px;
    height: 1em;
    background: var(--gold-bright);
    opacity: 0.7;
    animation: ai-blink 0.8s infinite;
    margin-left: 2px;
    vertical-align: text-bottom;
    border-radius: 1px;
}

@keyframes ai-blink {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 0.7;
    }
}

.ai-provider-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

/* AI 设置区 */
.ai-provider-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}

.ai-provider-select:focus {
    border-color: var(--gold-dim);
}

.ai-key-input-row {
    display: flex;
    gap: var(--space-xs);
}

.ai-key-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
}

.ai-key-input:focus {
    border-color: var(--gold-dim);
}

.ai-key-input::placeholder {
    color: var(--text-muted);
}

.settings-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 6px;
}


/* ═══════════════════════════════════════════════════════════════
   阅读页响应式
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 960px) {
    .tool-strip-btn .tool-label {
        display: none;
    }

    .overlay-panel {
        width: 300px;
    }

    .nav-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .sutra-title {
        font-size: 1.4rem;
    }

    .juan-body {
        font-size: 1rem;
        line-height: 1.8;
    }

    .breadcrumb {
        font-size: 0.8rem;
    }

    .reader-main {
        padding-top: 56px;
        padding-bottom: 8px;
    }

    .tool-strip {
        top: 8px;
        right: 8px;
        padding: 3px 4px;
    }

    .tool-strip-spacer {
        display: none;
    }

    .tool-strip-btn {
        width: 32px;
        height: 32px;
    }

    .overlay-panel {
        right: 8px;
        top: 52px;
        width: calc(100vw - 16px);
        max-height: calc(100vh - 64px);
        border-radius: var(--radius-md, 8px);
    }
}


/* ═══════════════════════════════════════════════════════════════
   对照分栏 (Split Panel)
   ═══════════════════════════════════════════════════════════════ */

.reader-layout.split-active {
    max-width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* 横排分栏：左栏纵向 flex，头部吸顶，内容区滚动 */
.reader-layout.split-active:not(.writing-vertical) .reader-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    padding-top: 0;
}

/* 头部元素：吸顶显示，不随内容滚动 */
.reader-layout.split-active:not(.writing-vertical) .reader-sticky-top {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}

/* 双栏时左栏头部简化：去边框和底色，加底线，与右栏一致 */
.reader-layout.split-active .reader-sticky-top {
    padding: 0;
}

.reader-layout.split-active .sutra-header {
    border: none;
    border-radius: 0;
    background: none;
    background-color: transparent;
    margin-bottom: 0;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--gold-dim, #b8860b55);
}

/* 双栏时隐藏详情面板（因为详情按钮已隐藏） */
.reader-layout.split-active .detail-panel {
    display: none !important;
}

/* 双栏时头部两行布局：第一行经名，第二行导航 */
.reader-layout.split-active .sutra-header-row {
    flex-wrap: wrap;
}

.reader-layout.split-active .sutra-header-right {
    width: 100%;
}

/* 双栏时隐藏详情按钮和卷下拉框，让左栏与右栏格式一致 */
/* 只隐藏左栏 (.reader-main) 内的，不影响右栏的 ✕ 关闭按钮 */
.reader-layout.split-active .reader-main .detail-toggle,
.reader-layout.split-active .sutra-header-right .juan-select {
    display: none;
}

/* 内容区：填满剩余高度，纵向滚动 */
.reader-layout.split-active:not(.writing-vertical) .juan-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
}

/* 横排分栏右栏：同样 flex布局 */
.reader-layout.split-active:not(.writing-vertical) .reader-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    padding-top: 0;
    /* 移除原始 padding-top: 60px */
}

.reader-layout.split-active:not(.writing-vertical) .reader-right-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}


.reader-layout.split-active:not(.writing-vertical) #reader-right-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
}

/* 分栏时隐藏面包屑（的所有模式）：节省空间，两栏高度更对称 */
.reader-layout.split-active .breadcrumb {
    display: none;
}

/* 右栏头部：与左栏 sutra-header-row 格式一致 */
.reader-right-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--gold-dim, #b8860b55);
    gap: var(--space-xs) var(--space-sm);
    min-height: 0;
}

/* 左组：标题 + ID + 关闭 */
.rr-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
    flex: 1;
}

/* 右组：翻卷导航 + 回顶/回首（双栏时独占第二行） */
.rr-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-xs, 4px);
    flex-shrink: 0;
    width: 100%;
}


.reader-right-title-group {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    min-width: 0;
}

.reader-right-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--gold-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-right-id {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 1px 6px;
    border-radius: var(--radius-sm, 4px);
    white-space: nowrap;
}

.reader-right-close {
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.reader-right-close:hover {
    color: var(--red-accent);
    border-color: var(--red-accent);
}



.reader-right .juan-body {
    font-family: var(--font-body, var(--font-serif));
}

.reader-right .juan-selector {
    margin-bottom: var(--space-md);
}

/* Split.js gutter 手柄 */
.gutter {
    background-color: var(--bg-surface);
    background-repeat: no-repeat;
    background-position: 50%;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
}

.gutter::after {
    content: '⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.gutter:hover {
    background-color: var(--border-gold);
}

.gutter.gutter-horizontal {
    width: 6px;
}


/* ═══════════════════════════════════════════════════════════════
   闪念笔记面板 (Notes Panel)
   ═══════════════════════════════════════════════════════════════ */

.notes-input-area {
    margin-bottom: var(--space-lg);
}

.notes-quote-box {
    background: rgba(212, 168, 83, 0.08);
    border-left: 3px solid var(--gold-dim);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
    min-height: 2.2em;
    max-height: 6em;
    overflow-y: auto;
    white-space: pre-wrap;
}

.notes-quote-box:empty::before {
    content: '选中经文后自动填入，或直接跳过';
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-sans);
    font-size: 0.8rem;
}

.notes-quote-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    float: right;
    margin-top: -2px;
}

.notes-quote-clear:hover {
    color: var(--red-accent);
}

.notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: var(--space-sm);
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--gold-dim);
}

.notes-textarea::placeholder {
    color: var(--text-muted);
}

.notes-save-btn {
    width: 100%;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--gold-dim), var(--gold-subtle));
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.notes-save-btn:hover {
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
    transform: translateY(-1px);
}

.notes-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.notes-save-status {
    text-align: center;
    font-size: 0.8rem;
    color: var(--green-dim);
    margin-top: var(--space-xs);
    min-height: 1.2em;
}

.notes-list-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    font-family: var(--font-sans);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-xs);
}

/* ═══ 人物面板 ═══ */
.person-section-title {
    font-size: 0.85rem;
    color: var(--gold-bright);
    font-family: var(--font-sans);
    margin: var(--space-md) 0 var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.person-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--gold-bright);
    border-radius: var(--radius-sm, 4px);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    transition: border-color 0.2s;
}

.person-card:hover {
    border-color: var(--gold-bright);
}

.person-card-mentioned {
    border-left-color: var(--text-muted);
}

.person-card-mentioned:hover {
    border-left-color: var(--gold-dim, #b8860b88);
}

.person-card-main {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    margin-bottom: 2px;
}

.person-card-name {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.person-card-dynasty {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 3px;
}

.person-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.person-card-link {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--gold-dim, #b8860b);
    text-decoration: none;
    margin-top: 4px;
    transition: color 0.2s;
}

.person-card-link:hover {
    color: var(--gold-bright);
    text-decoration: underline;
}

.person-card-textfound {
    border-left-color: #4dabae;
}

.person-card-textfound:hover {
    border-left-color: #6fcfd1;
}

.person-card-count {
    font-size: 0.7rem;
    color: #4dabae;
    font-family: var(--font-sans);
    font-weight: 600;
}

.person-source-tag {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.person-source-authority {
    color: var(--gold-bright);
    border: 1px solid var(--gold-dim, #b8860b88);
}

.person-source-scan {
    color: #4dabae;
    border: 1px solid rgba(77, 171, 174, 0.4);
}

.person-scan-disclaimer {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin: 0 0 var(--space-sm);
    padding: 4px 8px;
    background: rgba(77, 171, 174, 0.06);
    border-radius: 3px;
    line-height: 1.5;
}

.person-data-source-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
    line-height: 1.8;
}

/* ═══ 字典面板 ═══ */
.dict-search-area {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.dict-search-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-serif);
    outline: none;
    transition: border-color 0.2s;
}

.dict-search-input:focus {
    border-color: var(--accent-gold, #c9a84c);
}

.dict-search-btn {
    padding: 8px 14px;
    background: var(--accent-gold, #c9a84c);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.dict-search-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dict-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin: 0 0 var(--space-md);
}

.dict-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.dict-result-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    margin-bottom: var(--space-xs);
}

.dict-result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
    transition: border-color 0.2s;
}

.dict-result-card:hover {
    border-color: var(--accent-gold, #c9a84c);
}

.dict-result-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.dict-result-toggle {
    font-size: 0.65rem;
    color: var(--text-muted);
    width: 1em;
    flex-shrink: 0;
}

.dict-result-name {
    font-size: 0.75rem;
    color: var(--accent-gold, #c9a84c);
    font-family: var(--font-sans);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.dict-result-term {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    font-family: var(--font-serif);
}

.dict-result-body {
    padding: 0 12px 12px;
    border-top: 1px solid var(--border-subtle);
}

.dict-definition {
    font-size: 0.82rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-family: var(--font-serif);
    white-space: pre-wrap;
    word-break: break-all;
}

.dict-source-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
    line-height: 1.8;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.note-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm, 4px);
    padding: var(--space-md);
    transition: border-color 0.2s;
}

.note-card:hover {
    border-color: var(--gold-subtle);
}

.note-card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: var(--space-xs);
}

.note-card-quote {
    background: rgba(212, 168, 83, 0.06);
    border-left: 2px solid var(--gold-subtle);
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    line-height: 1.5;
}

.note-card-content {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.notes-empty {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notes-empty-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    opacity: 0.4;
}

/* 字体风格预览文字 */
.settings-font-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── 悉昙字符 GIF 图片 ───────────────────────────────────── */
.siddham-char {
    display: inline-block;
    height: 1.4em;
    width: auto;
    vertical-align: middle;
    margin: 0 1px;
    filter: invert(1);
    /* 黑底白字 → 适配暗色主题 */
}

.siddham {
    display: inline;
}

/* ─── 拼音 ruby 注音 ──────────────────────────────────────── */
ruby.pinyin-ruby {
    ruby-align: center;
}

ruby.pinyin-ruby rt {
    font-size: 0.5em;
    font-family: 'Noto Sans SC', 'Noto Sans CJK SC', system-ui, sans-serif;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    user-select: none;
}

/* ── 阅读进度条 ── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    z-index: 9999;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ── 回到顶部按钮 ── */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--gold);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--gold);
    color: var(--bg-main);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(209, 163, 65, 0.3);
}

/* Section Icon - Day/Night Colors */
.section-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    /* Default Dark Mode: Gold */
    color: var(--gold-bright);
    transition: color var(--transition);
}

html.theme-light .section-icon {
    /* Light Mode: Deep Ink / Dark Grey */
    color: #4a4a4a;
}


/* ═══════════════════════════════════════════════════════════════
   版心：右栏对照也居中约束
   ═══════════════════════════════════════════════════════════════ */

.reader-right .juan-body {
    max-width: var(--text-block-width);
    margin-left: auto;
    margin-right: auto;
}


/* ═══════════════════════════════════════════════════════════════
   竖排模式 (writing-mode: vertical-rl)
   ═══════════════════════════════════════════════════════════════ */

/* 竖排单栏时：头部水平吸附，不随经文横向滚动 */
/* 改为 flex 布局：头部固定 + 经文区横向滚动，与分栏竖排一致 */
.reader-layout.writing-vertical:not(.split-active) {
    overflow: hidden;
    max-width: 100vw;
    height: calc(100vh - 60px);
}

.reader-layout.writing-vertical:not(.split-active) .reader-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 100%;
    min-width: unset;
    padding-top: var(--space-sm);
}

.reader-layout.writing-vertical:not(.split-active) .reader-sticky-top {
    flex-shrink: 0;
    writing-mode: horizontal-tb;
    z-index: 10;
    background: var(--bg-primary);
}

/* 竖排经文通用样式 */
.reader-layout.writing-vertical .juan-body {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    max-width: none;
    padding: var(--space-lg) var(--space-xl);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-primary) 100%);
}

/* ── 分栏 + 竖排 ── */

.reader-layout.writing-vertical.split-active {
    overflow: hidden;
    height: calc(100vh - 60px);
}

.reader-layout.writing-vertical.split-active .reader-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    min-width: unset;
    height: 100%;
    padding-top: 0;
}

.reader-layout.writing-vertical.split-active .reader-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    padding-right: 2px;
    /* 防止 juan-body 右边框被裁切 */
}

.reader-layout.writing-vertical.split-active .reader-sticky-top,
.reader-layout.writing-vertical.split-active .reader-right-header {
    flex-shrink: 0;
    writing-mode: horizontal-tb;
}

.reader-layout.writing-vertical.split-active .juan-body {
    /* 统一固定高度 → 底部边框对齐（不依赖 flex: 1，避免头部高度差导致错位） */
    height: calc(100vh - 180px);
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* ── 竖排单栏 ── */

.reader-layout.writing-vertical:not(.split-active) .juan-body {
    flex: 1;
    width: 100%;
    min-height: 0;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* 竖排标题和作者行：不缩进，居中即可 */
.reader-layout.writing-vertical .juan-body .head,
.reader-layout.writing-vertical .juan-body .byline,
.reader-layout.writing-vertical .juan-body .juan {
    text-align: center;
    text-indent: 0;
    height: auto;
    padding-top: 0;
}

/* 竖排偈颂：统一缩进 4 字 */
.reader-layout.writing-vertical .juan-body .verse,
.reader-layout.writing-vertical .juan-body .lg {
    width: auto;
    margin: var(--space-md) 0;
    padding-top: 4em;
    /* 顶部缩进 4 个汉字 */
}

/* 竖排版心：固定每列 20 字（大藏经传统格式），不随窗口缩放 */
.reader-layout.writing-vertical .juan-body p {
    text-indent: 2em;
    height: 20em;
    /* 1em ≈ 1 字，固定 20 字/列 */
}

/* 竖排时行号隐藏（位置会错乱） */
.reader-layout.writing-vertical .juan-body .line-num {
    display: none;
}

/* 竖排时 header/selector 仍然横排 */
.reader-layout.writing-vertical .reader-sticky-top,
.reader-layout.writing-vertical .juan-selector {
    writing-mode: horizontal-tb;
}

/* 竖排时的滚动条样式 */
.reader-layout.writing-vertical .juan-body::-webkit-scrollbar {
    height: 6px;
}

.reader-layout.writing-vertical .juan-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.reader-layout.writing-vertical .juan-body::-webkit-scrollbar-thumb {
    background: var(--gold-subtle);
    border-radius: 3px;
}

.reader-layout.writing-vertical .juan-body::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dim);
}