/* =========================================================
   研修堂
   古籍列表 / 书籍详情 / 阅读页
   ========================================================= */

/* ---------- 列表 ---------- */
.studio-header { padding: 26px 20px 16px; background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-color) 100%); }
.studio-header h1 { font-size: 28px; font-weight: 700; letter-spacing: 3px; }
.studio-header p { font-size: 13px; color: var(--text-light); margin-top: 8px; letter-spacing: 1px; }

.studio-tabs { display: flex; gap: 8px; padding: 0 20px 18px; overflow-x: auto; scrollbar-width: none; }
.studio-tabs::-webkit-scrollbar { display: none; }
.studio-tab {
    flex-shrink: 0; padding: 7px 15px; border-radius: 20px; cursor: pointer;
    background: #E9E5DB; color: var(--text-sub); font-size: 13px;
    border: none; font-family: inherit; transition: background 0.2s, color 0.2s;
}
.studio-tab.active { background: var(--accent-dark); color: #FFFFFF; font-weight: 600; }

.studio-list { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 14px; }

.studio-book {
    display: flex; gap: 16px; padding: 16px; cursor: pointer;
    background: #FFFFFF; border: 1px solid var(--border-color);
    border-radius: 16px; box-shadow: var(--shadow-sm);
}
.studio-book:active { background: #FBF9F5; }

/* 书封：左侧金色书脊 + 墨绿封面 + 竖排书名 */
.book-cover {
    flex-shrink: 0; width: 88px; height: 138px; border-radius: 4px;
    background: linear-gradient(135deg, #2C3E2E, #1A2A1C);
    color: #F2D89E; display: flex; align-items: center; justify-content: center;
    writing-mode: vertical-rl; text-orientation: upright;
    font-size: 19px; letter-spacing: 5px; font-family: 'STKaiti', 'KaiTi', 'Noto Serif SC', serif;
    border-left: 5px solid #D4B87E;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.14), inset -6px 0 12px rgba(0, 0, 0, 0.18);
    position: relative; overflow: hidden;
}
.book-cover::after {
    content: ''; position: absolute; inset: 6px; border: 1px solid rgba(212, 184, 126, 0.28);
    border-radius: 2px; pointer-events: none;
}

.book-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.book-main h3 { font-size: 18px; font-weight: 700; letter-spacing: 1px; margin-bottom: 6px; }
.book-desc {
    font-size: 13px; color: var(--text-sub); line-height: 1.75;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-progress { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; }
.book-progress .bar { flex: 1; height: 4px; border-radius: 2px; background: #EBE7DF; overflow: hidden; }
.book-progress .bar i { display: block; height: 100%; background: var(--accent-gold); border-radius: 2px; }
.book-progress .pct { font-size: 12px; color: var(--accent-gold); min-width: 34px; text-align: right; }
.book-progress .pct.unread { color: var(--text-light); }

/* ---------- 详情 ---------- */
.book-hero { display: flex; gap: 18px; padding: 4px 20px 20px; align-items: center; }
.book-hero .book-cover { width: 102px; height: 152px; font-size: 21px; }
.book-hero-info { flex: 1; min-width: 0; }
.book-hero-info h2 { font-size: 21px; letter-spacing: 2px; margin-bottom: 8px; }
.book-meta { font-size: 12px; color: var(--text-light); line-height: 1.8; }
.book-hero-progress { margin-top: 12px; }
.book-hero-progress .bar { height: 5px; border-radius: 3px; background: #EBE7DF; overflow: hidden; }
.book-hero-progress .bar i { display: block; height: 100%; background: var(--accent-gold); }
.book-hero-progress span { display: block; font-size: 11px; color: var(--text-light); margin-top: 6px; }

.book-section { margin: 0 20px 20px; }
.book-section h3 {
    font-size: 14px; font-weight: 700; margin-bottom: 10px;
    display: flex; align-items: center;
}
.book-section h3::before { content: '◆'; font-size: 9px; color: var(--accent-gold); margin-right: 8px; }
.book-intro { font-size: 13px; line-height: 1.9; color: var(--text-sub); }

.chapter-list { background: #FFFFFF; border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; }
.chapter-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid #F5F2EC; cursor: pointer; font-size: 13.5px;
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:active { background: #FBF9F5; }
.chapter-item .ch-name { color: var(--text-main); font-weight: 600; }
.chapter-item .ch-state { font-size: 11px; color: var(--text-light); flex-shrink: 0; }
.chapter-item .ch-state.done { color: var(--accent-green); }

.book-cta {
    display: block; width: calc(100% - 40px); margin: 4px 20px 8px;
    padding: 14px; border: none; border-radius: 14px;
    background: var(--accent-dark); color: #FFFFFF;
    font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.book-cta:active { opacity: 0.9; }

/* ---------- 阅读页 ---------- */
.reader-header {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 12px; border-bottom: 1px solid var(--border-color);
}
.reader-header .back-btn {
    font-size: 22px; color: var(--accent-gold); cursor: pointer;
    background: transparent; border: none; font-family: inherit; padding: 0 4px 0 0; line-height: 1;
}
.reader-title { flex: 1; min-width: 0; }
.reader-title h1 { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.reader-title span { font-size: 11px; color: var(--text-light); }
.reader-catalog {
    border: 1px solid var(--border-color); background: #FFFFFF; color: var(--text-sub);
    font-family: inherit; font-size: 12px; padding: 6px 12px; border-radius: 14px; cursor: pointer;
}

.reader-body { padding: 22px 24px 8px; }
.reader-body h2 {
    font-size: 18px; letter-spacing: 2px; margin-bottom: 18px; text-align: center; font-weight: 700;
}
.reader-body p {
    font-size: 15.5px; line-height: 2.05; color: var(--text-main);
    text-indent: 2em; margin-bottom: 14px;
}
.reader-body .reader-note {
    margin-top: 18px; padding: 12px 14px; border-radius: 10px;
    background: #FBF9F5; font-size: 11px; color: var(--text-light);
    line-height: 1.8; text-indent: 0;
}

.reader-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 8px 20px 20px; padding-top: 14px; border-top: 1px solid var(--border-color);
}
.reader-foot button {
    border: 1px solid var(--border-color); background: #FFFFFF; color: var(--text-sub);
    font-family: inherit; font-size: 13px; padding: 8px 18px; border-radius: 10px; cursor: pointer;
}
.reader-foot button:disabled { color: #C9C4BA; cursor: not-allowed; }
.reader-foot .reader-progress { font-size: 12px; color: var(--text-light); }

/* ---------- 详情：课程字段与底部操作 ---------- */
.book-stats {
    display: flex; margin: 0 20px 20px; padding: 14px 0;
    background: #FFFFFF; border: 1px solid var(--border-color);
    border-radius: 14px; box-shadow: var(--shadow-sm);
}
.book-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; border-right: 1px solid #F3EFE7; }
.book-stat:last-child { border-right: none; }
.bs-num { font-size: 13px; color: var(--text-sub); }
.bs-num b { font-size: 18px; color: var(--text-main); margin-right: 1px; }
.bs-label { font-size: 10.5px; color: var(--text-light); }

.book-page.active {
    display: flex; flex-direction: column; height: 100%;
    overflow: hidden; padding-bottom: 65px;
}
.book-detail-scroll { flex: 1; overflow-y: auto; padding-bottom: 8px; scrollbar-width: none; }
.book-detail-scroll::-webkit-scrollbar { display: none; }

.book-actions {
    flex-shrink: 0; z-index: 5;
    display: flex; gap: 10px; margin: 6px 20px 10px; padding: 10px;
    background: rgba(248, 246, 240, 0.94);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border-color); border-radius: 16px;
    box-shadow: var(--shadow-md);
}
.book-actions button {
    flex: 1; padding: 12px 0; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border-color); background: #FFFFFF;
    font-family: inherit; font-size: 13px; color: var(--text-sub);
}
.book-actions button.primary {
    flex: 1.2; background: var(--accent-dark); color: #FFFFFF;
    border-color: var(--accent-dark); font-weight: 600;
}
.book-actions button.primary:active { opacity: 0.9; }

/* ---------- 阅读页：沉浸式布局 ---------- */
#app.reading .bottom-nav { display: none; }
.reader-page.active {
    display: flex; flex-direction: column; height: 100%;
    padding-bottom: 0; overflow: hidden; background: var(--bg-color);
}
.reader-header {
    flex-shrink: 0; display: flex; align-items: center; gap: 10px;
    padding: 18px 20px 12px; border-bottom: 1px solid var(--border-color);
    background: transparent;
}
.reader-header .back-btn {
    font-size: 22px; color: var(--accent-gold); background: none; border: none;
    font-family: inherit; line-height: 1; padding: 0 4px 0 0; cursor: pointer;
}
.reader-title { flex: 1; min-width: 0; }
.reader-title h1 { font-size: 14px; font-weight: 700; letter-spacing: 1px; color: var(--text-main); }
.reader-title span { font-size: 10.5px; color: var(--text-light); }
.reader-percent { flex-shrink: 0; font-size: 11px; color: var(--text-light); }

.reader-body {
    flex: 1; overflow-y: auto; padding: 22px 24px 10px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.reader-body::-webkit-scrollbar { display: none; }
.reader-body h2 {
    font-size: 1.15em; letter-spacing: 2px; margin-bottom: 18px;
    text-align: center; font-weight: 700; color: var(--text-main);
}
.reader-body p {
    font-size: 1em; line-height: 2.05; color: var(--text-main);
    text-indent: 2em; margin-bottom: 14px;
}
.reader-body .reader-note {
    margin-top: 18px; padding: 12px 14px; border-radius: 10px;
    background: rgba(185, 154, 107, 0.08); font-size: 11px; color: var(--text-light);
    line-height: 1.8; text-indent: 0;
}
.reader-body.night h2 { color: #E6DDC8; }
.reader-body.night p { color: #CFC7B8; }
.reader-body.night .reader-note { background: rgba(255, 255, 255, 0.05); color: #8D8779; }

.reader-panel {
    display: none; flex-shrink: 0; padding: 14px 20px;
    background: #FFFFFF; border-top: 1px solid var(--border-color);
}
.reader-panel.show { display: block; }
.panel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-row:last-child { margin-bottom: 0; }
.panel-label { width: 32px; font-size: 12px; color: var(--text-light); flex-shrink: 0; }
.bg-swatches { display: flex; gap: 12px; }
.bg-swatch {
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    border: 1px solid #D8D2C6; padding: 0;
}
.bg-swatch.active { box-shadow: 0 0 0 2px var(--accent-gold); }
.font-btn {
    border: 1px solid var(--border-color); background: #FFFFFF; border-radius: 8px;
    padding: 5px 14px; font-family: inherit; font-size: 12px; color: var(--text-sub); cursor: pointer;
}
.font-size-val { width: 22px; text-align: center; font-size: 12px; color: var(--text-sub); }

.reader-toolbar {
    flex-shrink: 0; display: flex; justify-content: space-around;
    padding: 10px 0 14px; background: #FFFFFF; border-top: 1px solid var(--border-color);
}
.reader-toolbar button {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: none; background: none; cursor: pointer; font-family: inherit;
    font-size: 10.5px; color: var(--text-light); padding: 0 12px;
}
.reader-toolbar button svg { width: 20px; height: 20px; }
.reader-toolbar button.active { color: var(--accent-gold); }

/* 夜间主题 */
#page-reader.reader-night { background: #151514; }
#page-reader.reader-night .reader-header { border-color: #2A2926; }
#page-reader.reader-night .reader-title h1 { color: #E6DDC8; }
#page-reader.reader-night .reader-title span,
#page-reader.reader-night .reader-percent { color: #8D8779; }
#page-reader.reader-night .reader-toolbar { background: #1D1C1A; border-color: #2A2926; }
#page-reader.reader-night .reader-panel { background: #1D1C1A; border-color: #2A2926; }
#page-reader.reader-night .font-btn { background: #262522; border-color: #3A3833; color: #CFC7B8; }
#page-reader.reader-night .reader-toolbar button { color: #8D8779; }
#page-reader.reader-night .reader-toolbar button.active { color: #D4B87E; }

/* ---------- 阅读弹层 ---------- */
.catalog-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-light); margin-bottom: 10px; }
.catalog-list {
    max-height: 46vh; overflow-y: auto; margin-bottom: 14px;
    border: 1px solid var(--border-color); border-radius: 12px; background: #FFFFFF;
}
.catalog-item {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 12px 14px; border-bottom: 1px solid #F5F2EC;
    font-size: 13px; color: var(--text-main); cursor: pointer;
}
.catalog-item:last-child { border-bottom: none; }
.catalog-item.current { background: #FBF9F5; color: var(--accent-gold); font-weight: 600; }
.catalog-item em { font-style: normal; font-size: 11px; color: var(--text-light); }

.rp-bar { height: 6px; border-radius: 3px; background: #EBE7DF; overflow: hidden; margin-bottom: 8px; }
.rp-bar i { display: block; height: 100%; background: var(--accent-gold); }
.rp-text { font-size: 12px; color: var(--text-sub); margin-bottom: 14px; }
.rp-chapters { max-height: 36vh; overflow-y: auto; margin-bottom: 14px; }

.resume-check {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 11.5px; color: var(--text-sub); margin: -6px 0 16px;
}
.resume-check input { width: 15px; height: 15px; accent-color: var(--accent-gold); }

/* ---------- 书架入口与书架页 ---------- */
.studio-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.studio-shelf {
    flex-shrink: 0; margin-top: 6px; cursor: pointer;
    border: 1px solid var(--border-color); background: #FFFFFF; border-radius: 16px;
    padding: 7px 14px; font-family: inherit; font-size: 12px; color: var(--text-sub);
}
.shelf-list { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.shelf-item {
    display: flex; gap: 14px; padding: 14px; cursor: pointer;
    background: #FFFFFF; border: 1px solid var(--border-color);
    border-radius: 16px; box-shadow: var(--shadow-sm);
}
.shelf-cover {
    flex-shrink: 0; width: 62px; height: 92px; border-radius: 4px;
    background: linear-gradient(135deg, #2C3E2E, #1A2A1C); color: #F2D89E;
    display: flex; align-items: center; justify-content: center;
    writing-mode: vertical-rl; text-orientation: upright;
    font-size: 14px; letter-spacing: 4px;
    font-family: 'STKaiti', 'KaiTi', serif;
    border-left: 4px solid #D4B87E;
}
.shelf-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shelf-info h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.shelf-info .shelf-meta { font-size: 11px; color: var(--text-light); }
.shelf-info .book-progress { margin-top: auto; padding-top: 8px; }
.shelf-empty { padding: 42px 20px; text-align: center; }
.shelf-empty .mark {
    width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px;
    background: rgba(185, 154, 107, 0.12); color: var(--accent-gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-family: 'STKaiti', serif;
}
.shelf-empty h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.shelf-empty p { font-size: 11.5px; color: var(--text-light); line-height: 1.7; }
.shelf-empty button {
    margin-top: 14px; border: none; border-radius: 16px; cursor: pointer;
    background: var(--accent-dark); color: #FFFFFF; font-family: inherit;
    font-size: 12px; font-weight: 600; padding: 8px 18px;
}

/* 书架：移除 */
.shelf-item { position: relative; }
.shelf-info { padding-right: 46px; }
.shelf-remove {
    position: absolute; top: 10px; right: 10px;
    border: 1px solid #D8D2C6; background: #FFFFFF;
    color: var(--text-sub); font-family: inherit; font-size: 11px;
    padding: 4px 10px; border-radius: 10px; cursor: pointer;
}
.shelf-item.selected { border-color: var(--accent-gold); background: #FFFDF8; }
.shelf-item.managing .shelf-info { padding-right: 0; }
.shelf-check {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; align-self: center;
    border: 1px solid var(--border-color); color: #FFFFFF; font-size: 11px;
    display: flex; align-items: center; justify-content: center;
}
.shelf-check.checked { background: var(--accent-gold); border-color: var(--accent-gold); }
.shelf-check.checked::after { content: '✓'; }
.shelf-manage-bar {
    display: none; position: sticky; bottom: 72px; z-index: 5;
    margin: 0 20px 14px; gap: 10px;
}
.shelf-manage-bar.show { display: flex; }
.shelf-selall {
    flex: 1; padding: 12px 0; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border-color); background: #FFFFFF;
    font-family: inherit; font-size: 13px; color: var(--text-sub);
}
.shelf-remove-selected {
    flex: 2; padding: 12px 0; border-radius: 12px; border: none; cursor: pointer;
    background: var(--accent-red); color: #FFFFFF;
    font-family: inherit; font-size: 13px; font-weight: 600;
}

/* 富文本正文：后台编辑器插入的图片与结构 */
.reader-body figure { margin: 16px 0 18px; }
.reader-body figure img {
    display: block; width: 100%; height: auto;
    border-radius: 10px; background: #F3EEE4;
}
.reader-body figcaption {
    margin-top: 7px; text-align: center;
    font-size: 10px; color: var(--text-light);
    letter-spacing: .5px; text-indent: 0;
}
.reader-body h3 {
    font-size: 1.05em; line-height: 1.7; font-weight: 700;
    color: var(--text-main); margin: 18px 0 8px; letter-spacing: 1px;
}
.reader-body blockquote {
    margin: 12px 0; padding: 10px 14px;
    border-left: 2px solid var(--accent-gold);
    background: rgba(185, 154, 107, 0.07);
    color: var(--text-sub); font-size: .95em; line-height: 1.9;
}
.reader-body blockquote p { text-indent: 0; margin: 0; }
.reader-body ul, .reader-body ol { margin: 8px 0 14px 1.2em; padding: 0; }
.reader-body li { font-size: 1em; line-height: 1.95; color: var(--text-main); }
.reader-body.night figure img { opacity: .82; }
