/* ============================================================
   二十四史 · 全站样式（2026 版）
   纸墨底色 + 朱砂点缀 + 宋体正文
   ------------------------------------------------------------
   版式原则
   · 一条顶栏解决导航、检索、账号，不再有两层导航与两个搜索框
   · 正文优先：阅读页单列居中，目录在宽屏才出现，手机不被侧栏挤压
   · 间距用 4 的倍数，标题用宋体、界面用黑体，信息层级只靠字号与颜色
   ============================================================ */

/* hidden 必须压过组件自身 display（连读换章、抽屉靠它切显示） */
[hidden] { display: none !important; }

:root {
    /* 纸与墨 */
    --ink: #241f1a;
    --ink-2: #332b24;
    --paper: #f6f1e6;
    --paper-2: #f1e9d9;
    --card: #fffdf7;
    --line: #e2d8c3;
    --line-2: #d5c7aa;
    --text: #2c2721;
    --muted: #7c6f5e;
    /* 朱砂与金 */
    --red: #8f2b22;
    --red-2: #a83a2e;
    --red-soft: #f7e3dc;
    --gold: #a8874f;
    --gold-2: #c9a86a;
    /* 顶栏蜜黄（沿用原配色） */
    --head-1: #f3c168;
    --head-2: #e8a33d;
    --head-line: #d99a2b;
    --head-ink: #4a3218;
    /* 字体与尺度 */
    --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", "STSong", serif;
    --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
    --reading: 18px;
    --w: 1180px;
    --topbar-h: 62px;
    --r: 5px;
    --shadow: 0 6px 20px rgba(86, 60, 30, .07);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

img { max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

button { font: inherit; color: inherit; }

mark {
    background: #f9dfd6;
    color: var(--red);
    font-weight: 600;
    padding: 0 1px;
    border-radius: 2px;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: .9em;
    background: #f0e6d2;
    border: 1px solid #e2d6bd;
    border-radius: 3px;
    padding: 1px 5px;
    color: #6f4a1f;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--red);
    color: #fff;
    padding: 8px 14px;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ============================================================
   1. 顶栏
   ============================================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(180deg, var(--head-1) 0%, var(--head-2) 100%);
    border-bottom: 1px solid var(--head-line);
    color: var(--head-ink);
}

.topbar-in {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
}

.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand:hover { opacity: .9; }

.brand-logo {
    display: block;
    height: 44px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.nav-a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 12px;
    border-radius: 4px;
    font-size: 14.5px;
    color: var(--head-ink);
    white-space: nowrap;
    transition: background .14s, color .14s;
}

.nav-a:hover { background: rgba(255, 255, 255, .42); color: #3a2410; }

.nav-a.is-on {
    background: rgba(255, 255, 255, .62);
    box-shadow: inset 0 -2px 0 var(--red);
    font-weight: 600;
}

.nav-btn { border: 0; background: transparent; cursor: pointer; }

.caret {
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4.5px solid currentColor;
    opacity: .75;
    transition: transform .15s;
}
.nav-drop:hover .caret,
.nav-drop.is-open .caret { transform: rotate(180deg); }

.nav-drop { position: relative; }

.drop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 216px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: 0 14px 34px rgba(70, 45, 20, .16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 70;
}

.drop-right { left: auto; right: 0; min-width: 176px; }

.nav-drop:hover .drop,
.nav-drop:focus-within .drop,
.nav-drop.is-open .drop {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* hover 展开的桥接：鼠标从按钮移到菜单时不闪断 */
.nav-drop::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
}

.drop-a {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 10px;
    border-radius: 4px;
    color: var(--text);
    line-height: 1.4;
}

.drop-a:hover { background: var(--paper-2); color: var(--red); }
.drop-a.is-on { background: var(--paper-2); box-shadow: inset 2px 0 0 var(--red); }

.drop-t { font-size: 14px; }
.drop-s { font-size: 12px; color: var(--muted); }

.drop-sep {
    height: 1px;
    background: var(--line);
    margin: 6px 4px;
}

.drop-btn {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    padding: 7px 10px;
    border-radius: 4px;
    color: var(--text);
}
.drop-btn:hover { background: var(--paper-2); color: var(--red); }

/* 全站检索框 */
.qbar {
    display: flex;
    align-items: center;
    margin-left: auto;
    height: 36px;
    width: 100%;
    max-width: 372px;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--head-line);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(120, 80, 20, .06);
}

.qbar-scope {
    flex: 0 0 auto;
    height: 100%;
    border: 0;
    border-right: 1px solid #ecd9b0;
    background: #f8eed7;
    color: #6b4a1e;
    font-size: 13px;
    padding: 0 4px 0 8px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #8c6a33 50%), linear-gradient(135deg, #8c6a33 50%, transparent 50%);
    background-position: calc(100% - 11px) 15px, calc(100% - 7px) 15px;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    padding-right: 18px;
}

.qbar-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0 10px;
    font-size: 14px;
    color: var(--text);
    font-family: var(--sans);
}
.qbar-input::placeholder { color: #a2947f; }

.qbar-btn {
    flex: 0 0 auto;
    height: 100%;
    border: 0;
    background: var(--red);
    color: #fff6e3;
    padding: 0 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background .14s;
}
.qbar-btn:hover { background: var(--red-2); }

.acct {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.acct-link { font-size: 14px; }
.acct-link:hover { color: #7a2018; }

.acct-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 4px 6px 4px 4px;
    border-radius: 20px;
    color: var(--head-ink);
}
.acct-btn:hover { background: rgba(255, 255, 255, .4); }

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--red);
    color: #fff6e3;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-family: var(--serif);
    flex: 0 0 auto;
}

.acct-nm {
    font-size: 14px;
    max-width: 9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-btn {
    display: none;
    border: 1px solid rgba(74, 50, 24, .28);
    background: rgba(255, 255, 255, .34);
    border-radius: 4px;
    width: 38px;
    height: 34px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
}
.mb-bar { display: block; width: 16px; height: 2px; background: var(--head-ink); border-radius: 2px; }

/* 抽屉 */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 348px);
    background: var(--card);
    border-left: 1px solid var(--line-2);
    box-shadow: -14px 0 40px rgba(60, 40, 20, .18);
    z-index: 90;
    transform: translateX(102%);
    transition: transform .22s ease;
    overflow-y: auto;
    padding: 18px 16px 40px;
    -webkit-overflow-scrolling: touch;
}
.drawer.is-open { transform: none; }

.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(36, 31, 26, .38);
    z-index: 85;
    opacity: 0;
    transition: opacity .22s;
}
.drawer-mask.is-open { opacity: 1; }

.drawer-q {
    display: flex;
    height: 38px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
    background: #fff;
}
.drawer-q input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    padding: 0 10px;
    font-size: 14px;
    background: transparent;
}
.drawer-q button {
    border: 0;
    background: var(--red);
    color: #fff6e3;
    padding: 0 14px;
    font-size: 14px;
    cursor: pointer;
}

.drawer-nav { display: flex; flex-direction: column; }

.drawer-nav > a,
.drawer-out {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 4px;
    font-size: 15px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}
.drawer-nav > a:hover,
.drawer-out:hover { background: var(--paper-2); color: var(--red); }

.drawer-cap {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .12em;
    padding: 16px 8px 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}

.drawer-sub { font-size: 14px; padding-left: 14px !important; }
.drawer-sub span { font-size: 12px; color: var(--muted); }

/* ============================================================
   2. 骨架与通用组件
   ============================================================ */

.shell {
    max-width: var(--w);
    margin: 0 auto;
    padding: 0 22px;
}

.main { min-height: 58vh; padding-bottom: 56px; }

.crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 16px 0 0;
    font-size: 13px;
    color: var(--muted);
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--red); }
.crumb .cur { color: var(--text); }
.crumb .sep { color: #c3b59d; }

.phead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 26px;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
}

.phead-t { font-family: var(--serif); font-size: 27px; letter-spacing: .02em; }
.phead-d { font-size: 14px; color: var(--muted); margin-top: 4px; max-width: 62ch; }

.figs { display: flex; gap: 24px; flex: 0 0 auto; }
.figs > div { display: flex; align-items: baseline; gap: 3px; line-height: 1; }
.figs b { font-family: var(--serif); font-size: 20px; color: var(--red); font-weight: 600; }
.figs span { font-size: 12px; color: var(--muted); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.sec-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 34px 0 14px;
}
.sec-h h2 {
    font-family: var(--serif);
    font-size: 20px;
    letter-spacing: .04em;
    padding-left: 11px;
    border-left: 3px solid var(--red);
    line-height: 1.2;
}
.sec-h p { font-size: 13px; color: var(--muted); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { border-color: var(--red); color: var(--red); }

.btn-red {
    background: var(--red);
    border-color: var(--red);
    color: #fff6e3;
}
.btn-red:hover { background: var(--red-2); border-color: var(--red-2); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper-2); color: var(--red); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 13.5px; }

.btn-block { width: 100%; }

/* 输入框（统一类名，避免污染全局） */
.ipt {
    height: 36px;
    width: 100%;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-family: var(--sans);
    outline: none;
    transition: border-color .14s, box-shadow .14s;
}
.ipt:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(168, 135, 79, .14); }
.ipt::placeholder { color: #a89a86; }

/* 页签 */
.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 9px 13px;
    border-bottom: 2px solid transparent;
    color: #5f5344;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    transition: color .14s, border-color .14s, background .14s;
}
.tab:hover { color: var(--red); }
.tab.is-on {
    color: var(--red);
    border-bottom-color: var(--red);
    font-weight: 600;
    background: linear-gradient(180deg, rgba(143, 43, 34, .05), transparent);
}
.tab-num { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.tab-num em { font-style: normal; font-size: 11px; opacity: .8; }

.chip {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 3px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    color: #6b5f4e;
    font-size: 11.5px;
    white-space: nowrap;
}

/* 已收藏的书目：在卡片底部打一个金色小标，不占书名位置 */
.chip-fav {
    background: #fbf1dc;
    border-color: #e8d8b4;
    color: #8a6a2a;
}
.chip-red { background: #fbeee9; border-color: #eed6cc; color: var(--red); }
.chip-gold { background: #faf1dc; border-color: #e8d8b4; color: #8a6a2a; }

.empty {
    padding: 26px 20px;
    background: var(--card);
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.tip {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.8;
    margin: 10px 0 18px;
}
.tip code { font-size: 12.5px; }
.tip-short { display: none; }

.muted { color: var(--muted); }

/* 分页 */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 22px 0 8px;
    font-size: 13.5px;
}
.pg {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--card);
    color: var(--text);
}
.pg:hover { border-color: var(--red); color: var(--red); }
.pg.dis { color: #b8ac99; border-color: var(--line); background: transparent; cursor: default; }
.pg-info { color: var(--muted); padding: 0 4px; }
.pg-jump { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--muted); }
.pg-input { width: 62px; height: 30px; text-align: center; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; font-size: 13px; }
.pg-go { height: 30px; padding: 0 10px; border: 1px solid var(--line-2); background: var(--card); border-radius: 4px; cursor: pointer; font-size: 13px; }
.pg-go:hover { border-color: var(--red); color: var(--red); }

/* ============================================================
   3. 首页
   ============================================================ */

.hero {
    position: relative;
    padding: 52px 0 40px;
    text-align: center;
    background:
        radial-gradient(900px 260px at 50% -120px, #fdf4de 0%, rgba(253, 244, 222, 0) 70%),
        linear-gradient(180deg, #faf4e6 0%, var(--paper) 100%);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    top: 34px;
    width: 1px;
    height: 92px;
    background: linear-gradient(180deg, transparent, var(--line-2), transparent);
}
.hero::before { left: 8%; }
.hero::after { right: 8%; }

.hero-eyebrow {
    font-family: var(--serif);
    font-size: 13px;
    letter-spacing: .34em;
    color: var(--gold);
    margin-bottom: 14px;
}

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(34px, 5.2vw, 54px);
    letter-spacing: .14em;
    color: var(--ink);
    text-indent: .14em;
}

.hero-sub {
    max-width: 640px;
    margin: 14px auto 0;
    font-size: 14.5px;
    line-height: 1.9;
    color: #6b5d4b;
}

.hero-form {
    display: flex;
    gap: 6px;
    max-width: 640px;
    margin: 24px auto 0;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(96, 66, 30, .09);
}

.hero-form input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0 12px;
    font-size: 16px;
    font-family: var(--sans);
    color: var(--text);
}
.hero-form input::placeholder { color: #a89a86; }

.hero-form button {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 24px;
    border: 0;
    border-radius: 4px;
    background: var(--red);
    color: #fff6e3;
    font-size: 15.5px;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .14s;
}
.hero-form button:hover { background: var(--red-2); }

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--muted);
}
.hero-tags b { font-weight: 400; color: #9d8a6e; margin-right: 2px; }
.hero-tags a {
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 253, 247, .7);
    color: #6b5d4b;
    font-size: 12.5px;
}
.hero-tags a:hover { border-color: var(--red); color: var(--red); background: #fff; }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 46px;
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.hero-stats > div { text-align: center; line-height: 1.25; }
.hero-stats b {
    display: block;
    font-family: var(--serif);
    font-size: 26px;
    color: var(--red);
    font-weight: 600;
}
.hero-stats span { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; }

/* 版本卡 */
.eds {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 12px;
}

.ed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 16px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.ed:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    color: inherit;
}
.ed-tag {
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--gold);
}
.ed-name {
    font-family: var(--serif);
    font-size: 19px;
    color: var(--ink);
}
.ed-blurb {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted);
    min-height: 3.4em;
}
.ed-meta {
    font-size: 12px;
    color: #6b5f4e;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}
.ed-meta b { color: var(--red); font-weight: 600; }

/* 二十五史 */
.shu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 8px;
}

.shu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    transition: border-color .14s, background .14s;
}
.shu a:hover { border-color: var(--gold-2); background: #fffefa; }

.shu-no {
    font-family: var(--serif);
    font-size: 12px;
    color: var(--gold);
    flex: 0 0 20px;
    align-self: flex-start;
    padding-top: 3px;
}
.shu-main { flex: 1 1 auto; min-width: 0; }
.shu-name {
    display: block;
    font-family: var(--serif);
    font-size: 16px;
    color: var(--ink);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shu-author {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shu-count { font-size: 11.5px; color: #a08e75; flex: 0 0 auto; align-self: flex-start; padding-top: 3px; }

/* 三条说明 */
.feats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}
.feat {
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.feat-no {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--gold-2);
    border-radius: 50%;
    color: var(--gold);
    font-family: var(--serif);
    font-size: 13px;
    margin-bottom: 8px;
}
.feat h3 { font-family: var(--serif); font-size: 16.5px; margin-bottom: 5px; }
.feat p { font-size: 13.5px; line-height: 1.8; color: #5f5344; }

/* ============================================================
   4. 史书库（版本栏 + 书目）
   ============================================================ */

.lib {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.lib-side {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 8px;
}

.lib-cap {
    font-size: 11.5px;
    letter-spacing: .14em;
    color: var(--gold);
    padding: 8px 10px 6px;
}

.lib-a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text);
}
.lib-a:hover { background: var(--paper-2); color: var(--red); }
.lib-a.is-on {
    background: var(--paper-2);
    color: var(--red);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--red);
}
.lib-a span { font-size: 12px; color: var(--muted); font-weight: 400; }

.filter {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.filter .ipt { flex: 1 1 auto; }
.filter-hint { font-size: 13px; color: var(--muted); white-space: nowrap; }
.filter-hint b { color: var(--red); }

.books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 10px;
}

.bcard {
    display: flex;
    gap: 11px;
    padding: 13px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: border-color .14s, box-shadow .14s, transform .14s;
}
.bcard:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    color: inherit;
}

.bcard-no {
    flex: 0 0 24px;
    font-family: var(--serif);
    font-size: 12.5px;
    color: var(--gold);
    padding-top: 3px;
}
.bcard-main { min-width: 0; flex: 1 1 auto; }
.bcard-name {
    display: block;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink);
    line-height: 1.35;
}
.bcard-author {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bcard-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    font-size: 12px;
    color: #8a7c69;
}

.group-h {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 22px 0 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}
.group-h:first-child { margin-top: 4px; }
.group-h h2 { font-family: var(--serif); font-size: 17px; }
.group-h span { font-size: 12.5px; color: var(--muted); }
.group-h a { color: var(--ink); }

/* ============================================================
   5. 书目详情（章节目录）
   ============================================================ */

.bk-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 0 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.bk-name { font-family: var(--serif); font-size: 32px; letter-spacing: .04em; color: var(--ink); }
.bk-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.bk-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 书目页的收藏按钮与「开始阅读 / 下载」同高，视觉上排成一行 */
.bk-acts .fav-btn,
.bk-acts .fav-login { height: 34px; padding: 0 14px; font-size: 14px; }

.bk-figs {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--muted);
}
.bk-figs b { color: var(--red); font-family: var(--serif); font-size: 16px; }

/* 图书目录页「本书内检索」：置顶在章节目录之前，目录再长也不用滚回顶部 */
.bkfind {
    margin: 0 0 20px;
    padding: 14px 16px 13px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--red);
    border-radius: var(--r);
}
.bkfind-form { max-width: 760px; }
.bkfind-lb {
    display: block;
    margin: 0 0 9px;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink);
}
.bkfind-row { display: flex; gap: 8px; }
.bkfind-ipt {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
}
.bkfind-ipt:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(168, 135, 79, .15);
}
.bkfind-btn {
    flex: 0 0 auto;
    height: 38px;
    padding: 0 24px;
    border: 0;
    border-radius: 4px;
    background: var(--red);
    color: #fff6e3;
    font-family: var(--sans);
    font-size: 15px;
    cursor: pointer;
}
.bkfind-btn:hover { background: var(--red-2); }
.bkfind-hint { margin: 9px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.bkfind-hint a { color: var(--red); text-decoration: underline; }

@media (max-width: 720px) {
    .bkfind { padding: 12px 13px 11px; }
    .bkfind-row { flex-direction: column; }
    .bkfind-btn { width: 100%; }
}

.vol { margin-bottom: 18px; }
.vol-h {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line-2);
    margin-bottom: 8px;
}
.vol-h h2 { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.vol-h span { font-size: 12px; color: var(--muted); }

.chs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
    gap: 6px;
}

.ch {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text);
    background: rgba(255, 253, 247, .55);
}
.ch:hover { background: var(--card); border-color: var(--line-2); color: var(--red); }
.ch-no { font-size: 11.5px; color: var(--gold); flex: 0 0 auto; }
.ch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   6. 阅读页
   ============================================================ */

.read {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 262px;
    gap: 30px;
    align-items: start;
}

.read-main { min-width: 0; }

.toolbar {
    position: sticky;
    top: calc(var(--topbar-h) + 10px);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    margin: 14px 0 12px;
    background: rgba(252, 248, 239, .96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow-x: auto;
    scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.tb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    height: 30px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #5f5344;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.tb:hover { background: var(--paper-2); color: var(--red); }
.tb.is-on { background: #fbeee9; color: var(--red); border-color: #eed6cc; }

.tb-sep { flex: 0 0 auto; width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

.tb-note { flex: 0 0 auto; font-size: 12px; color: var(--muted); margin-left: auto; padding-right: 4px; }

.toc-open { display: none; }

.paper {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 34px 44px 30px;
}

.read-book {
    font-family: var(--serif);
    font-size: 13px;
    letter-spacing: .12em;
    color: var(--gold);
}
.read-title {
    font-family: var(--serif);
    font-size: clamp(24px, 3.2vw, 31px);
    letter-spacing: .03em;
    color: var(--ink);
    margin-top: 8px;
}
.read-sub {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--muted);
    margin-top: 5px;
    letter-spacing: .04em;
}

.read-head {
    padding-bottom: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.read-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--muted);
}
.hit-note { color: var(--red); }
.hit-jump { color: var(--red); border-bottom: 1px dashed currentColor; }
/* 从检索结果进正文后的回程入口：单独一行，不与「第X章 / 命中N段」挤在一起 */
.hit-back-row {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.4;
}
.hit-back {
    color: var(--red);
    border-bottom: 1px dashed currentColor;
    white-space: nowrap;
}

.read-body { font-family: var(--serif); }

.nav-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 0 12px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
    color: #6b5f4e;
    font-family: var(--sans);
}
.nav-simple a { color: #6b5f4e; }
.nav-simple a:hover { color: var(--red); }
.nav-simple .off { color: #c0b3a0; }
.nav-simple .rns-toc { font-family: var(--serif); font-size: 13.5px; }

.read-mask {
    position: fixed;
    inset: 0;
    background: rgba(36, 31, 26, .46);
    z-index: 86;
    opacity: 0;
    transition: opacity .2s;
}
.read-mask.is-open { opacity: 1; }
@media (min-width: 901px) { .read-mask { display: none !important; } }

.side-close {
    display: none;
    width: fit-content;
    height: 30px;
    margin: 0 0 10px auto;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--card);
    color: #5f5344;
    font-size: 13px;
    cursor: pointer;
}
.side-close:hover { border-color: var(--red); color: var(--red); }

.read-body p.para {
    font-size: var(--reading);
    line-height: 2.15;
    text-indent: 2em;
    margin: 0 0 .5em;
    color: #2a251f;
    overflow-wrap: break-word;
}

.read-body p.para:last-child { margin-bottom: 0; }

.read-body p.para.hit {
    text-indent: 0;
    border-left: 2px solid #e3b9ac;
    background: linear-gradient(90deg, rgba(249, 223, 214, .42), rgba(249, 223, 214, 0) 62%);
    padding-left: 12px;
    margin-left: -14px;
}

.read-body p.para.flash {
    animation: paraFlash 1.7s ease;
}

@keyframes paraFlash {
    0% { background: rgba(201, 168, 106, .34); }
    100% { background: transparent; }
}

.read-body p.para.speaking {
    background: rgba(201, 168, 106, .16);
    box-shadow: inset 3px 0 0 var(--gold-2);
}

.read-body.guest p.para:last-of-type { color: #4a423a; }

.guest-wall {
    margin-top: 22px;
    padding: 18px 20px;
    background: #fbf4e4;
    border: 1px solid #ecd9b0;
    border-radius: var(--r);
    font-size: 14px;
    font-family: var(--sans);
    color: #6b5d4b;
    text-align: center;
    line-height: 1.9;
}
.guest-wall a { color: var(--red); font-weight: 600; border-bottom: 1px solid currentColor; }

/* 上下章 */
.chnav {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 22px;
}
.chnav a,
.chnav span {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    font-size: 13px;
}
.chnav a:hover { border-color: var(--red); color: var(--red); }
.chnav .nxt { text-align: right; }
.chnav .dir { font-size: 12px; color: var(--muted); }
.chnav .nm {
    font-family: var(--serif);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chnav .off { color: #b3a695; background: transparent; border-style: dashed; justify-content: center; align-items: center; }
.chnav .toc-mid {
    flex: 0 0 auto;
    width: 78px;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
}

/* 右侧目录 */
.read-side { position: sticky; top: calc(var(--topbar-h) + 16px); }

.side-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 12px;
}
.side-h {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}
.side-q { display: flex; gap: 6px; }
.side-q .ipt { height: 32px; font-size: 13px; }
.side-q button {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--red);
    background: var(--red);
    color: #fff6e3;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.side-hint { font-size: 12px; color: var(--muted); margin-top: 7px; }

.toc-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--topbar-h) - 100px);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.toc-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    background: #fbf6ea;
}
.toc-book { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.toc-count { font-size: 11.5px; color: var(--muted); }

.toc {
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.toc-item {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #4a423a;
}
.toc-item:hover { background: var(--paper-2); color: var(--red); }
.toc-item.cur {
    background: #fbeee9;
    color: var(--red);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--red);
}
.toc-no { font-size: 11px; color: var(--gold); flex: 0 0 22px; }
.toc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 回到顶部 / 底部 */
.scroll-tools {
    position: fixed;
    right: 22px;
    bottom: 26px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sc-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background: rgba(255, 253, 247, .95);
    color: #6b5f4e;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: .18s;
    box-shadow: 0 4px 12px rgba(80, 55, 25, .1);
}
.sc-btn.show { opacity: 1; visibility: visible; transform: none; }
.sc-btn:hover { color: var(--red); border-color: var(--red); }

/* 朗读按钮 */
.tts-tools { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.tts-btn {
    height: 30px;
    padding: 0 9px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    color: #5f5344;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.tts-btn:hover { background: var(--paper-2); color: var(--red); }
.tts-btn.on { background: #fbeee9; color: var(--red); border-color: #eed6cc; }
.tts-ch { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tts-note { font-size: 11.5px; color: #a08e75; white-space: nowrap; }

/* 收藏 */
.fav-form { display: inline; margin: 0; }
.fav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--card);
    color: #5f5344;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.fav-btn:hover { border-color: var(--red); color: var(--red); }
.fav-btn.is-on { background: #fbeee9; border-color: #eed6cc; color: var(--red); }
.fav-btn.is-busy { opacity: .6; cursor: wait; }
.fav-ico { font-size: 14px; line-height: 1; }
.fav-login {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border: 1px dashed var(--line-2);
    border-radius: 4px;
    font-size: 13px;
    color: var(--muted);
}

/* 字号按钮 */
.font-tools { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.font-tools button {
    height: 30px;
    min-width: 32px;
    padding: 0 7px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 4px;
    color: #5f5344;
    font-size: 12.5px;
    cursor: pointer;
}
.font-tools button:first-child { border-radius: 4px 0 0 4px; }
.font-tools button:last-child { border-radius: 0 4px 4px 0; }
.font-tools button:hover { color: var(--red); border-color: var(--red); }

/* ============================================================
   7. 检索页
   ============================================================ */

.search-top {
    padding: 18px 0 4px;
}

.search-big {
    display: flex;
    gap: 6px;
    max-width: 760px;
    padding: 5px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
}
.search-big input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0 11px;
    font-size: 15.5px;
    color: var(--text);
}
.search-big button {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 20px;
    border: 0;
    border-radius: 4px;
    background: var(--red);
    color: #fff6e3;
    font-size: 15px;
    cursor: pointer;
}
.search-big button:hover { background: var(--red-2); }

.srch {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
    margin-top: 14px;
}

.srch-side {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 10px;
    scrollbar-width: thin;
}

.side-t {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--serif);
    font-size: 14px;
    color: var(--ink);
    padding: 2px 4px 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}
.side-t span { font-family: var(--sans); font-size: 11.5px; color: var(--muted); }

.facet-all {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13.5px;
    color: #4a423a;
}
.facet-all:hover { background: var(--paper-2); color: var(--red); }
.facet-all.is-on {
    background: #fbeee9;
    color: var(--red);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--red);
}
.facet-all span { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.facet {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13.5px;
    color: #4a423a;
}
.facet:hover { background: var(--paper-2); color: var(--red); }
.facet.is-on {
    background: #fbeee9;
    color: var(--red);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--red);
}
.facet span { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.srch-main { min-width: 0; }

.srch.no-side { grid-template-columns: minmax(0, 1fr); }

.result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    padding: 2px 0 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}
.rm-strong { font-family: var(--serif); font-size: 20px; color: var(--red); }
.rm-sep { color: #cbbda3; }
.rm-filter { color: var(--red); }
.rm-filter a { border-bottom: 1px dashed currentColor; margin-left: 4px; }

.exact-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 14px;
    background: #fbf3df;
    border: 1px solid #e8d8b4;
    border-radius: var(--r);
    font-size: 13.5px;
    color: #6b5326;
}
.en-tag {
    flex: 0 0 auto;
    padding: 2px 8px;
    background: var(--gold);
    color: #fff8e8;
    border-radius: 3px;
    font-size: 12px;
    letter-spacing: .06em;
}
.en-text { flex: 1 1 260px; line-height: 1.75; }
.en-back { color: var(--red); border-bottom: 1px solid currentColor; white-space: nowrap; }

.exact-hint {
    font-size: 13px;
    color: var(--muted);
    margin: -4px 0 14px;
}
.exact-hint a { color: var(--red); border-bottom: 1px dashed currentColor; }
.eh-sub { margin-left: 6px; color: #a08e75; }

.hits { display: flex; flex-direction: column; gap: 10px; }

.hit {
    padding: 14px 16px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: border-color .14s, box-shadow .14s;
}
.hit:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.hit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.hit-no {
    flex: 0 0 auto;
    min-width: 30px;
    font-family: var(--serif);
    font-size: 12px;
    color: var(--gold);
}
.hit-book {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--ink);
    border-bottom: 1px solid transparent;
}
.hit-book:hover { color: var(--red); border-bottom-color: currentColor; }
.hit-ch { color: #6b5f4e; }
.hit-pos { margin-left: auto; font-size: 12px; color: #a08e75; }

.hit-body {
    font-family: var(--serif);
    font-size: 15.5px;
    line-height: 1.95;
    color: #302a23;
    margin: 8px 0 6px;
    overflow-wrap: break-word;
}

.hit-link { font-size: 12.5px; color: var(--red); opacity: .85; }
.hit-link:hover { opacity: 1; border-bottom: 1px solid currentColor; }

.export-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: #fbf6ea;
    border: 1px solid var(--line);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}
.ex-btn {
    display: inline-flex;
    align-items: center;
    height: 27px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: var(--card);
    color: #5f5344;
    font-size: 12.5px;
}
.ex-btn:hover { border-color: var(--red); color: var(--red); }
.fav-slot { display: inline-flex; flex: 0 0 auto; }
.export-bar .fav-slot { margin-left: auto; }

.need-login {
    padding: 28px 24px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    text-align: center;
}
.nl-title { font-family: var(--serif); font-size: 19px; margin-bottom: 8px; }
.nl-text { font-size: 14px; color: #5f5344; line-height: 1.9; }
.nl-text a { color: var(--red); font-weight: 600; border-bottom: 1px solid currentColor; }
.nl-q { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.nl-q b { color: var(--ink); }

.search-intro { margin-top: 10px; }

/* ============================================================
   8. 目录检索
   ============================================================ */

.cat-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cat-grp {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}

.cat-hd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 9px;
    padding: 11px 14px;
    background: #fbf6ea;
    border-bottom: 1px solid var(--line);
}
.cat-book {
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink);
    border-bottom: 1px solid transparent;
}
.cat-book:hover { color: var(--red); border-bottom-color: currentColor; }
.cat-n { margin-left: auto; font-size: 12px; color: var(--muted); }

.cat-list { padding: 4px 0; }
.cat-list li + li { border-top: 1px dashed #eee5d2; }

.cat-it {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text);
    transition: background .12s, color .12s;
}
.cat-it:hover { background: #fdf8ec; color: var(--red); }
.cat-no {
    flex: 0 0 30px;
    font-size: 11.5px;
    color: var(--gold-2);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.cat-t { font-family: var(--serif); font-size: 15.5px; }
.cat-crumb { margin-left: auto; flex: 0 0 auto; font-size: 12px; color: var(--muted); }

/* ===== 检索范围：在当前版本里自选图书（≤200 部） ===== */
.bk-bar {
    margin: 12px 0 0;
    padding: 8px 12px 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.bk-bar-hd { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bk-scope-tip { font-size: 13px; color: var(--muted); }
.bk-scope-tip strong { color: var(--red); font-weight: 600; }
.bk-scope-ed { font-size: 12px; color: var(--muted); }
.bk-open {
    padding: 5px 12px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid var(--gold-2);
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.bk-open:hover { background: #f4dcc9; }
.bk-clear { font-size: 12.5px; color: var(--red); }
.bk-clear:hover { color: var(--gold); text-decoration: underline; }
.bk-note { margin: 6px 0 0; font-size: 12px; color: var(--gold); }

.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bk-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px 2px 8px;
    font-size: 12.5px;
    line-height: 20px;
    color: #6b4a22;
    background: #f8eccf;
    border: 1px solid #e6d0a4;
    border-radius: 12px;
}
.bk-chip-x {
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #a08964;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.bk-chip-x:hover { color: var(--red); }

/* ===== 选书弹窗 ===== */
.bk-dlg {
    width: min(760px, 94vw);
    max-height: min(78vh, 740px);
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 18px 48px rgba(60, 40, 15, .28);
    overflow: hidden;
}
.bk-dlg::backdrop { background: rgba(40, 26, 8, .38); }
.bk-dlg-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
}
.bk-dlg-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 15px;
    font-weight: 600;
    color: var(--red);
}
.bk-dlg-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
.bk-dlg-count {
    margin-left: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--red);
    font-variant-numeric: tabular-nums;
}
.bk-dlg-x {
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: #8a755a;
    cursor: pointer;
}
.bk-dlg-x:hover { color: var(--red); }

.bk-dlg-search {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px dashed var(--line);
}
.bk-dlg-search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 3px;
}
.bk-dlg-search input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--red-soft);
}
.bk-dlg-all {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 12.5px;
    font-family: inherit;
    white-space: nowrap;
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid var(--gold-2);
    border-radius: 3px;
    cursor: pointer;
}
.bk-dlg-all:hover { background: #f4dcc9; }

.bk-dlg-list { max-height: 46vh; overflow-y: auto; padding: 6px 8px; }
.bk-dlg-empty { margin: 24px 8px; text-align: center; font-size: 13px; color: var(--muted); }
.bk-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: 3px;
    cursor: pointer;
}
.bk-row:hover { background: #fdf6e8; }
.bk-row.on { background: #fbf1d6; }
.bk-row-cb { flex: 0 0 auto; width: 15px; height: 15px; accent-color: var(--red); cursor: pointer; }
.bk-row-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.bk-row-name { font-size: 13.5px; color: var(--text); }
.bk-row.on .bk-row-name { color: var(--red); font-weight: 600; }
.bk-row-meta { font-size: 12px; color: var(--muted); }

.bk-dlg-ft {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fffcf3;
    border-top: 1px solid var(--line);
}
.bk-dlg-hint { font-size: 12px; color: var(--gold); }
.bk-btn-plain {
    padding: 6px 14px;
    font-size: 13px;
    font-family: inherit;
    color: var(--red);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    cursor: pointer;
}
.bk-btn-plain:hover { border-color: var(--gold-2); color: var(--gold); }
.bk-btn-main {
    margin-left: auto;
    padding: 6px 20px;
    font-size: 13px;
    font-family: inherit;
    color: #fff6e3;
    background: var(--red);
    border: 1px solid var(--red);
    border-radius: 3px;
    cursor: pointer;
}
.bk-btn-main:hover { background: var(--red-2); }

@media (max-width: 720px) {
    .bk-dlg-title { font-size: 14px; }
    .bk-dlg-sub { flex: 1 1 100%; }
    .bk-scope-ed { display: none; }
}

/* ============================================================
   9. 账号、用户中心
   ============================================================ */

.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 40px 0 20px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 30px 32px 26px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: var(--shadow);
}
.auth-box h1 { font-family: var(--serif); font-size: 24px; text-align: center; }
.auth-tip {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    line-height: 1.8;
    margin: 8px 0 20px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }

.fld { display: flex; flex-direction: column; gap: 5px; }
.fld-label { font-size: 13px; color: #5f5344; }
.fld .ipt { height: 38px; }

.auth-msg {
    padding: 9px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 14px;
}
.auth-msg.err { background: #fbeee9; border: 1px solid #eed6cc; color: var(--red); }

.auth-alt { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.auth-alt a { color: var(--red); border-bottom: 1px solid currentColor; }

/* 登录页：图形验证码 + 「记住我」 */
.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-input { flex: 1 1 auto; min-width: 0; letter-spacing: 2px; text-transform: uppercase; }
.captcha-img {
    flex: 0 0 auto;
    display: block;
    width: 118px;
    height: 38px;
    background: var(--paper);
    border: 1px solid var(--line-2);
    border-radius: 4px;
    cursor: pointer;
}
.captcha-refresh {
    align-self: flex-start;
    margin-top: 3px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: var(--muted);
}
.captcha-refresh:hover { color: var(--red); text-decoration: underline; }
.fld-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #5f5344;
    cursor: pointer;
    user-select: none;
}
.fld-check input { width: 15px; height: 15px; accent-color: var(--red); cursor: pointer; }

.me-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 18px;
}
.me-user { display: flex; align-items: baseline; gap: 9px; }
.me-name { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.me-role {
    font-size: 11.5px;
    color: var(--gold);
    border: 1px solid var(--gold-2);
    border-radius: 20px;
    padding: 1px 8px;
}
.me-stats { font-size: 13px; color: var(--muted); }
.me-stats b { color: var(--red); }
.me-dot { color: #cbbda3; margin: 0 4px; }
.me-admin { margin-left: auto; font-size: 13.5px; color: var(--red); }

.me-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.me-tabs { display: flex; gap: 5px; }
.me-tab {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 13.5px;
    color: #5f5344;
    background: var(--card);
}
.me-tab span { font-size: 12px; color: var(--muted); }
.me-tab.is-on { background: var(--red); border-color: var(--red); color: #fff6e3; }
.me-tab.is-on span { color: #f6d9cf; }

.me-clear {
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    background: var(--card);
    border-radius: 4px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}
.me-clear:hover { border-color: var(--red); color: var(--red); }

.fav-list { display: flex; flex-direction: column; gap: 8px; }

.fav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.fav-kind {
    flex: 0 0 auto;
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 3px;
}
.k-read { background: #fbf1dc; color: #8a6a2a; border: 1px solid #e8d8b4; }
.k-search { background: #fbeee9; color: var(--red); border: 1px solid #eed6cc; }
.k-book { background: #eef1f0; color: #4e6259; border: 1px solid #d5ded9; }

.fav-main { flex: 1 1 auto; min-width: 0; }
.fav-title {
    display: block;
    font-family: var(--serif);
    font-size: 15.5px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fav-title:hover { color: var(--red); }
.fav-meta { font-size: 12px; color: var(--muted); }

.fav-acts { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.fav-go {
    font-size: 12.5px;
    padding: 4px 10px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
}
.fav-go:hover { border-color: var(--red); color: var(--red); }
.fav-del {
    font-size: 12.5px;
    padding: 4px 8px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
}
.fav-del:hover { color: var(--red); background: #fbeee9; }

.me-empty {
    padding: 40px 20px;
    text-align: center;
    background: var(--card);
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
}
.me-empty-t { font-family: var(--serif); font-size: 17px; margin-bottom: 6px; }
.me-empty-d { font-size: 13.5px; color: var(--muted); line-height: 1.9; }
.me-empty-links { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.me-empty-links a {
    padding: 7px 14px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    font-size: 13.5px;
}
.me-empty-links a:hover { border-color: var(--red); color: var(--red); }

/* ===== 用户中心 · 账号信息表 + 底部链接 ===== */
.acct-info { margin-bottom: 26px; }

.info-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.info-table th,
.info-table td {
    padding: 11px 16px;
    font-size: 14px;
    text-align: left;
    vertical-align: top;
    border-top: 1px solid var(--line);
}
.info-table tr:first-child th,
.info-table tr:first-child td { border-top: 0; }
.info-table th {
    width: 108px;
    font-weight: 400;
    color: var(--muted);
    background: #fbf6ea;
    white-space: nowrap;
}
.info-table td { color: var(--text); }
.info-table td b { font-weight: 500; color: var(--ink); }
.info-table a { color: var(--red); }

.acct-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
}
.acct-foot a { color: var(--muted); }
.acct-foot a:hover { color: var(--red); }
.acct-foot form { margin-left: auto; }
.me-logout {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    background: var(--card);
    border-radius: 4px;
    color: var(--muted);
    font-size: 13.5px;
    cursor: pointer;
}
.me-logout:hover { border-color: var(--red); color: var(--red); }

/* ===== 我的收藏 · 两栏 + 分类分组 ===== */
.fav-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 262px;
    gap: 30px;
    align-items: start;
}
.fav-main-col { min-width: 0; }
.fav-side { position: sticky; top: calc(var(--topbar-h) + 16px); }

.side-tip { font-size: 12.5px; line-height: 1.9; color: var(--muted); }
.side-tip + .side-tip { margin-top: 8px; }
.side-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13.5px;
}
.side-links a { color: #5f5344; }
.side-links a:hover { color: var(--red); }

.me-tab.is-off { color: #b7ab98; background: #f8f3e7; cursor: default; }

.fav-cat + .fav-cat { margin-top: 28px; }
.fav-cat-hd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}
.fav-cat-title {
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 400;
    color: var(--ink);
}
.fav-cat-count {
    font-size: 11.5px;
    color: var(--gold);
    border: 1px solid var(--gold-2);
    border-radius: 20px;
    padding: 1px 8px;
}
.fav-cat-hint { font-size: 12.5px; color: var(--muted); }

.fav-sub + .fav-sub { margin-top: 16px; }
.fav-sub-hd {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 400;
    color: #5f5344;
    margin-bottom: 8px;
}
.fav-sub-count {
    font-size: 11.5px;
    color: var(--muted);
    background: #f4ecdb;
    border-radius: 20px;
    padding: 0 7px;
}
.fav-item form { margin: 0; }

@media (max-width: 900px) {
    .fav-wrap { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .fav-side { position: static; }
}

/* ============================================================
   10. 管理后台（与中药100 后台同一套版式：书签页签 + 时段卡 + 明细表）
   ============================================================ */

.adm-page {
    --brand: var(--red);
    --brand-dark: #6f211a;
    --accent: var(--gold);
    --accent-dark: #8a6c3a;
    --brand-pale: var(--red-soft);
    --cream: var(--paper-2);
    --gold-light: var(--gold-2);
    --gold-deep: #8a6c3a;
}

.adm-head { margin-bottom: 14px; }
.adm-title {
    position: relative;
    margin: 0 0 4px;
    padding-left: 12px;
    font-family: var(--serif);
    font-size: 22px;
    color: var(--ink);
}
.adm-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--gold-2) 0%, var(--red) 100%);
}
.adm-desc { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.75; }

.adm-note { margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.adm-note.ok { color: #2e7d4f; font-weight: bold; }
.adm-note.bad { color: var(--red); font-weight: bold; }

.adm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--red);
    border-radius: 4px;
    background: var(--red);
    color: #fff6e3;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .14s, border-color .14s, color .14s;
}
.adm-btn:hover { background: #a83a2e; border-color: #a83a2e; text-decoration: none; }
.adm-btn.primary { background: var(--red); border-color: var(--red); }
.adm-btn.ghost { color: var(--red); background: var(--card); border-color: var(--line-2); }
.adm-btn.ghost:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }

.adm-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    margin: 0 0 12px;
    padding: 10px 14px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.adm-filter-cap { color: var(--red); font-weight: bold; font-size: 13px; }
.adm-filter-item { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.adm-filter-k { color: var(--muted); font-size: 12px; }
.adm-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    background: var(--card);
    color: #5f5344;
    font-size: 12.5px;
    white-space: nowrap;
}
.adm-chip:hover { background: var(--red-soft); text-decoration: none; }
.adm-chip.on { color: #fff6e3; background: var(--red); border-color: var(--red); }

.adm-sec { margin-bottom: 26px; }
.adm-sec-hd {
    position: relative;
    margin: 0 0 10px;
    padding-left: 10px;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink);
}
.adm-sec-hd::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 2px;
    background: var(--gold);
}
.adm-sec-sub { margin-left: 8px; font-size: 12px; font-weight: normal; color: var(--muted); }

.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }

.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th {
    padding: 8px 10px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line-2);
    font-weight: bold;
    font-size: 12.5px;
    color: #5f5344;
    text-align: left;
    white-space: nowrap;
}
.adm-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0e8d8;
    color: var(--text);
    vertical-align: top;
}
.adm-table tbody tr:hover { background: var(--paper-2); }
.adm-table tbody tr.cur { background: var(--red-soft); }

.adm-num { white-space: nowrap; }
.adm-table th.adm-num,
.adm-table td.adm-num { text-align: right; }
.adm-col-rank { color: var(--muted); }
.adm-table th.adm-col-rank,
.adm-table td.adm-col-rank { text-align: center; }
.adm-mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; white-space: nowrap; }
.adm-mono.muted { color: var(--muted); }
.adm-digits {
    font-family: Consolas, "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.adm-row-zero td { color: #b5a795; }
.adm-total td {
    font-weight: bold;
    color: var(--red);
    background: var(--paper-2);
    border-top: 2px solid var(--gold);
}

.adm-kw {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    font-family: var(--serif);
    font-size: 14px;
    color: var(--ink);
}
.adm-kw-n { margin-left: 5px; font-size: 12px; color: var(--muted); }
.adm-kind {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 3px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    color: #6b5f4e;
    font-size: 11.5px;
    white-space: nowrap;
}
.adm-kind.admin { color: #fff; background: var(--gold); border-color: var(--gold); }
.adm-link { color: var(--red); white-space: nowrap; }
.adm-link:hover { color: #a83a2e; }
.adm-empty {
    margin: 0;
    padding: 26px 16px;
    background: var(--paper-2);
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
    color: var(--muted);
    font-size: 13.5px;
    text-align: center;
}

.adm-tabs { display: flex; gap: 6px; }
.adm-tab {
    position: relative;
    flex: 0 0 auto;
    padding: 10px 20px 8px;
    background: #efe6d5;
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: var(--muted);
    text-align: center;
    transition: background .16s, color .16s;
}
.adm-tab::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: -1px;
    height: 3px;
    border-radius: 6px 6px 0 0;
    background: transparent;
}
.adm-tab:hover { background: #f5ecdc; text-decoration: none; }
.adm-tab.on { background: var(--card); color: var(--ink); }
.adm-tab.on::before { background: linear-gradient(90deg, var(--gold-2) 0%, var(--red) 100%); }
.adm-tab-t { display: block; font-family: var(--serif); font-size: 16px; }
.adm-tab-s { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.adm-tab.on .adm-tab-s { color: #9b805c; }

.adm-panel {
    padding: 18px 20px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0 var(--r) var(--r) var(--r);
    box-shadow: var(--shadow);
}

.adm-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 16px;
    border-bottom: 1px solid var(--line);
}
.adm-subtab {
    position: relative;
    padding: 7px 14px 8px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    color: #5f5344;
    font-size: 13.5px;
    white-space: nowrap;
}
.adm-subtab:hover { background: var(--paper-2); text-decoration: none; }
.adm-subtab.on {
    background: var(--paper-2);
    border-color: var(--line);
    color: var(--red);
    font-weight: bold;
}
/* 顶部指标书签（检索次数与人数 / 注册人数）：与主标签同款，靠间距区分主次 */
.adm-subtabs-stat { margin: 6px 0 0; }
.adm-subtabs-stat + .adm-stats { margin-top: 12px; }
.adm-stat-cap { font-size: 12px; color: #8a755a; white-space: nowrap; }
.adm-subtab.on::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--paper-2);
}

.adm-stats { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.adm-stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.adm-stat {
    position: relative;
    padding: 12px 16px;
    background: #fffefa;
    border: 1px solid #ecd9b8;
    border-radius: var(--r);
    box-shadow: 0 1px 3px rgba(140, 90, 43, .07);
}
.adm-stat.today {
    background: linear-gradient(180deg, #fff8ea 0%, #fbeccf 100%);
    border-color: #e6bd7a;
}
.adm-stat.today::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: -1px;
    height: 3px;
    border-radius: var(--r) var(--r) 0 0;
    background: linear-gradient(90deg, var(--gold-2) 0%, var(--gold) 100%);
}
.adm-stat-h {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    font-weight: bold;
    color: var(--red);
}
.adm-stat-d {
    font-size: 11.5px;
    font-weight: normal;
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
}
.adm-stat-b { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.adm-stat-item { display: inline-flex; align-items: baseline; gap: 3px; }
.adm-stat-item b {
    font-size: 26px;
    line-height: 1.12;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}
.adm-stat-item i { font-style: normal; font-size: 12.5px; color: #8a755a; }
.adm-stat-div { width: 1px; height: 22px; background: #ecd9b8; }

.adm-mng-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.adm-mng-card {
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: 0 1px 3px rgba(140, 90, 43, .06);
}
.adm-mng-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.adm-mng-t { margin: 0; font-size: 15px; color: var(--red); }
.adm-mng-num { font-size: 12.5px; font-weight: bold; color: var(--gold); white-space: nowrap; }
.adm-mng-desc { margin: 8px 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.adm-mng-list { margin: 0 0 12px; padding: 0; list-style: none; font-size: 12.5px; }
.adm-mng-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px dashed #ede0c9;
}
.adm-mng-list li:last-child { border-bottom: none; }
.adm-mng-list span { color: var(--muted); }
.adm-mng-list strong { color: var(--ink); font-weight: bold; font-variant-numeric: tabular-nums; }
.adm-mng-me { color: var(--gold); }
.adm-mng-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.adm-mng-acts form { margin: 0; }

@media (max-width: 900px) {
    .adm-stats-row { grid-template-columns: 1fr; }
    .adm-tab { flex: 1; min-width: 0; padding: 9px 12px 7px; }
    .adm-tab-s { display: none; }
    .adm-panel { padding: 16px 14px 20px; }
    .adm-subtabs { flex-wrap: nowrap; gap: 3px; overflow-x: auto; scrollbar-width: none; }
    .adm-subtabs::-webkit-scrollbar { display: none; }
    .adm-subtab { padding: 7px 12px; font-size: 13px; }
    .adm-mng-grid { grid-template-columns: minmax(0, 1fr); }
}


/* ============================================================
   11. 错误页
   ============================================================ */

.error-box {
    max-width: 560px;
    margin: 70px auto;
    padding: 40px 32px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
}
.error-box h1 { font-family: var(--serif); font-size: 26px; margin-bottom: 10px; }
.error-box p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ============================================================
   12. 页脚
   ============================================================ */

.footer {
    background: var(--ink);
    color: #cbbfa9;
    padding: 28px 0 24px;
    margin-top: 20px;
}
.footer-in {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 18px 40px;
}
.footer-brand { flex: 1 1 220px; }
.footer-title {
    display: block;
    font-family: var(--serif);
    font-size: 19px;
    letter-spacing: .1em;
    color: #f0e4cc;
}
.footer-slogan { font-size: 12.5px; color: #9d8f7a; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; padding-top: 4px; }
.footer-nav a { color: #cbbfa9; }
.footer-nav a:hover { color: #f0e4cc; }

.footer-meta {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: #8b7f6c;
    padding-top: 14px;
    border-top: 1px solid #3a332b;
}
.footer-icp { color: #9d8f7a; }
.footer-icp:hover { color: #f0e4cc; }
/* 联系邮箱比备案号显眼一档：暗底上要看得清、可点 */
.footer-mail { color: #d9c9a8; }
.footer-mail:hover { color: #f0e4cc; text-decoration: underline; }

/* ============================================================
   13. 响应式
   ============================================================ */

@media (max-width: 1080px) {
    :root { --w: 100%; }
    .qbar { max-width: 300px; }
    .acct-nm { display: none; }
    .lib { grid-template-columns: 184px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 900px) {
    .nav { display: none; }
    .qbar { display: none; }
    .icon-btn { display: inline-flex; }
    .acct { margin-left: auto; }
    .acct-link, .acct > .btn { display: none; }
    .acct-btn { padding: 0; }
    .brand-logo { height: 36px; }
    :root { --topbar-h: 56px; }

    .read { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .read-side {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(86vw, 340px);
        z-index: 88;
        background: var(--paper);
        border-left: 1px solid var(--line-2);
        box-shadow: -12px 0 34px rgba(60, 40, 20, .18);
        padding: 12px;
        overflow-y: auto;
        transform: translateX(102%);
        transition: transform .22s ease;
        -webkit-overflow-scrolling: touch;
    }
    .read-side.is-open { transform: none; }
    .toc-box { max-height: none; }
    .toc-open { display: inline-flex; }
    .side-close { display: block; }

    .srch { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .srch-side {
        position: static;
        max-height: none;
        overflow: visible;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 8px;
        scrollbar-width: none;
    }
    .srch-side::-webkit-scrollbar { display: none; }
    .side-t { display: none; }
    .facet {
        flex: 0 0 auto;
        border: 1px solid var(--line);
        border-radius: 20px;
        padding: 4px 11px;
        font-size: 13px;
    }
    .facet.is-on { box-shadow: none; border-color: var(--red); }
    .facet-all { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; font-size: 13px; }

    .lib { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .lib-side {
        position: static;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 8px;
        scrollbar-width: none;
    }
    .lib-side::-webkit-scrollbar { display: none; }
    .lib-cap { display: none; }
    .lib-a {
        flex: 0 0 auto;
        border: 1px solid var(--line);
        border-radius: 20px;
        padding: 5px 12px;
        font-size: 13px;
    }
    .lib-a.is-on { box-shadow: none; border-color: var(--red); }
    .lib-a span { display: none; }

    .ops { display: flex; gap: 10px; }
}

@media (max-width: 720px) {
    .shell { padding: 0 14px; }
    .main { padding-bottom: 40px; }

    .hero { padding: 34px 0 28px; }
    .hero::before, .hero::after { display: none; }

    .tip { margin: 8px 0 14px; font-size: 12.5px; }
    .tip-full { display: none; }
    .tip-short { display: inline; }
    .hero-sub { font-size: 13.5px; padding: 0 4px; }
    .hero-form { margin-top: 18px; }
    .hero-form button { padding: 0 16px; font-size: 15px; }
    .hero-stats { gap: 22px; margin-top: 22px; padding-top: 18px; }
    .hero-stats b { font-size: 21px; }

    .phead { flex-direction: column; align-items: flex-start; gap: 10px; }
    .phead-t { font-size: 22px; }
    .figs { gap: 18px; }

    .sec-h { flex-direction: column; align-items: flex-start; gap: 3px; margin: 26px 0 12px; }
    .sec-h h2 { font-size: 19px; white-space: nowrap; }
    .sec-h p { font-size: 12.5px; }

    .hero-eyebrow { font-size: 11px; letter-spacing: .16em; margin-bottom: 10px; }

    .paper { padding: 22px 18px 20px; }
    .read-body p.para { line-height: 2; }
    .read-body p.para.hit { margin-left: 0; padding-left: 9px; }

    .toolbar { top: calc(var(--topbar-h) + 6px); margin-top: 10px; }

    .bk-name { font-size: 25px; }
    .bk-head { gap: 12px; }
    .bk-figs { gap: 14px; flex-wrap: wrap; }

    .chs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .ch { font-size: 13.5px; padding: 7px 9px; }

    .books { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
    .bcard { padding: 11px 12px; gap: 8px; }
    .bcard-name { font-size: 16px; }
    .bcard-no { flex: 0 0 18px; font-size: 11.5px; }

    .filter { flex-wrap: wrap; }
    .filter .ipt { flex: 1 1 auto; min-width: 0; }
    .filter-hint { flex: 1 1 100%; text-align: right; }

    .hit { padding: 12px 13px 10px; }
    .hit-book { font-size: 15px; }
    .hit-pos { margin-left: 0; flex: 1 1 100%; }
    .hit-body { font-size: 15px; }

    .chnav { flex-wrap: wrap; }
    .chnav .toc-mid { width: 100%; order: 3; }
    .chnav a, .chnav span { flex: 1 1 40%; }

    .cat-it { padding: 9px 12px; gap: 8px; }
    .cat-crumb { display: none; }
    .cat-no { flex: 0 0 24px; }

    .auth-box { padding: 24px 20px 22px; }
    .auth-wrap { padding-top: 20px; }
    .captcha-img { width: 104px; }

    .footer-in { gap: 14px; }
    .footer-meta { gap: 10px; }

    .export-bar .fav-slot { margin-left: 0; }
    .pg-jump { margin-left: 0; width: 100%; }
}

@media (max-width: 420px) {
    .hero h1 { letter-spacing: .1em; }
    .hero-tags { display: none; }
    .shu { grid-template-columns: minmax(0, 1fr); }
    .books { grid-template-columns: minmax(0, 1fr); }
    .chs { grid-template-columns: minmax(0, 1fr); }
    .bcard { padding: 9px 11px; }
    .bcard-foot { margin-top: 4px; }
}

/* ============================================================
   会员开通 / 支付结果 / 后台付费用户
   ============================================================ */
.mb-state {
    padding: 16px 18px;
    margin: 0 0 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--r);
}
.mb-state-on { border-left-color: #4a7c4e; }
.mb-state-t { font-family: var(--serif); font-size: 19px; margin: 0 0 6px; color: var(--ink); }
.mb-state-d { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--muted); }
.mb-state-d b { color: var(--red); }
.mb-state-d a { color: var(--red); text-decoration: underline; }

.mb-h2 { font-family: var(--serif); font-size: 20px; margin: 26px 0 12px; color: var(--ink); }
/* 支付/开通求助：一行小字，不抢套餐卡的注意力 */
.mb-help { margin: 22px 0 8px; font-size: 13px; color: var(--muted); }
.mb-help a { color: var(--red); }
.mb-help a:hover { text-decoration: underline; }
.mb-form { max-width: 100%; }
.mb-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.mb-plan {
    display: block;
    position: relative;
    padding: 18px 16px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    cursor: pointer;
}
.mb-plan:hover { border-color: var(--gold); }
.mb-plan:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 2px rgba(143, 43, 34, .12); }
.mb-plan-hot { border-color: var(--gold-2); }
.mb-plan input { position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; accent-color: var(--red); }
.mb-plan-body { display: flex; flex-direction: column; gap: 5px; }
.mb-plan-tag {
    align-self: flex-start;
    padding: 1px 8px;
    font-size: 11.5px;
    color: #fff;
    background: var(--gold);
    border-radius: 10px;
}
.mb-plan-name { font-family: var(--serif); font-size: 19px; color: var(--ink); }
.mb-plan-price { font-size: 14px; color: var(--muted); }
.mb-plan-price b { font-family: var(--serif); font-size: 28px; color: var(--red); }
.mb-plan-desc { font-size: 13px; color: var(--text); line-height: 1.6; }
.mb-plan-secs { font-size: 12px; color: var(--muted); }
.mb-off { padding: 10px 12px; font-size: 13.5px; color: var(--red); background: var(--red-soft); border-radius: var(--r); }
.mb-note { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.mb-tbl-wrap { overflow-x: auto; margin: 0 0 18px; }
.mb-tbl { width: 100%; }
.mb-tbl th, .mb-tbl td { white-space: nowrap; }
.mb-tag { padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.mb-tag.active { color: #2f6135; background: #e4f0e2; }
.mb-tag.expired { color: var(--red); background: var(--red-soft); }
.mb-tag.none { color: var(--muted); background: var(--paper-2); }
/* 账号管理：注册邮箱列。长邮箱允许折行，避免把整张表撑得过宽。 */
.mb-tbl td.mb-email { color: var(--muted); font-size: 13px; white-space: normal; word-break: break-all; min-width: 150px; max-width: 240px; }

.mb-return { padding: 26px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.mb-return-t { font-family: var(--serif); font-size: 24px; margin: 0 0 10px; color: var(--ink); }
.mb-return-t.ok { color: #2f6135; }
.mb-return-d { font-size: 14px; line-height: 1.9; color: var(--text); }
.mb-return-d b { color: var(--red); }
.mb-return-acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }

.adm-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.adm-filter input, .adm-filter select {
    height: 34px; padding: 0 10px; font-size: 13px;
    border: 1px solid var(--line-2); border-radius: 4px; background: #fff; color: var(--text);
}
.adm-grant { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 14px 0; }
.adm-grant label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.adm-grant input, .adm-grant select {
    height: 34px; padding: 0 10px; font-size: 13px;
    border: 1px solid var(--line-2); border-radius: 4px; background: #fff; color: var(--text);
}
.adm-grant .adm-grant-cb { flex-direction: row; align-items: center; gap: 6px; }
.adm-grant .adm-grant-cb input { width: 15px; height: 15px; accent-color: var(--red); }
.adm-pager { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0 22px; font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
    .mb-plans { grid-template-columns: minmax(0, 1fr); }
    .mb-return { padding: 20px 15px; }
    /* 四个后台页签在窄屏均分，缩小内边距与字号避免「付费用户」换行 */
    .adm-tab { padding: 8px 6px 6px; }
    .adm-tab-t { font-size: 14px; }
    /* 后台表格：窄屏保持最小列宽、单元格不折行，靠 .tbl-scroll 横向滚动。
       否则列被压窄后中文会一字一行竖排（书名、类型这类两三字的列最明显）。 */
    .adm-table { min-width: 560px; }
    .adm-table th,
    .adm-table td { white-space: nowrap; }
    /* 长文本列（书名列表、导出内容）保持换行，避免把表格拖得过宽 */
    .adm-table td.wrap { white-space: normal; min-width: 150px; }
}

/* ============ 首页改版公告飘窗（.fwin） ============ */
.fwin {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 322px;
    max-width: calc(100vw - 36px);
    z-index: 55;
    padding: 15px 18px 14px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-top: 3px solid var(--red);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(60, 40, 20, .16), 0 2px 6px rgba(60, 40, 20, .07);
}
.fwin-h {
    margin: 0 0 8px;
    padding-right: 22px;
    font-family: var(--serif);
    font-size: 17px;
    letter-spacing: .5px;
    color: var(--red);
}
.fwin-b { margin: 0; font-size: 13.5px; line-height: 1.85; color: #5c5044; }
.fwin-b b {
    padding: 0 5px;
    font-family: var(--serif);
    font-size: 15px;
    color: var(--ink);
    background: var(--red-soft);
    border-radius: 3px;
}
.fwin-a { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.fwin-btn {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    color: #fff;
    background: var(--red);
    border-radius: 4px;
}
.fwin-btn:hover { background: var(--red-2); color: #fff; }
.fwin-mail {
    font-size: 12.5px;
    color: var(--gold);
    border-bottom: 1px dotted var(--gold-2);
}
.fwin-mail:hover { color: var(--red); border-bottom-color: var(--red); }
.fwin-x {
    position: absolute;
    top: 5px;
    right: 7px;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 19px;
    line-height: 1;
    color: #b3a58f;
    background: none;
    border: 0;
    cursor: pointer;
}
.fwin-x:hover { color: var(--red); }

@media (max-width: 720px) {
    .fwin {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        padding: 13px 14px 12px;
    }
    .fwin-h { font-size: 16px; }
    .fwin-b { font-size: 13px; }
}

/* ===== 用户中心 · 账号设置（改密码 / 改邮箱） ===== */
.auth-msg.ok { background: #eef5ea; border: 1px solid #d3e3ca; color: #3c6b2f; }

.acct-set { margin: 26px 0 6px; }
.acctset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.acctset-card {
    display: flex; flex-direction: column; gap: 11px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 8px; padding: 16px 18px;
}
.acctset-card.is-err { border-color: #e2b8ad; box-shadow: 0 0 0 2px rgba(143, 43, 34, .07); }
.acctset-t {
    margin: 0; font-family: var(--serif); font-weight: 400;
    font-size: 17px; color: var(--ink);
}
.acctset-d { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.acctset-d b { color: var(--ink); font-weight: 500; }
.acctset-card .btn-block { margin-top: auto; }

@media (max-width: 720px) {
    .acctset-grid { grid-template-columns: minmax(0, 1fr); }
    .acctset-card { padding: 14px 14px; }
}

/* 打印：只留正文 */
@media print {
    .topbar, .footer, .toolbar, .read-side, .chnav, .scroll-tools, .crumb, .fwin { display: none !important; }
    body { background: #fff; }
    .paper { border: 0; padding: 0; }
    .read { display: block; }
}
