/* ============================================================
   巴迪斯官网 · 电子图册
   色系对齐官网：浅色底 + 驼色主色（#cf9c7e → #a67a5a）
   阅读器保留深色沉浸底（暖调），强调色统一驼色
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #fafafa;
    color: #3c3c3c;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
.icon { vertical-align: -2px; }

.text-muted { color: #999999; }
.text-primary { color: #a67a5a; }

/* ---------- 顶部 Header ---------- */
.ebook-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.ebook-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ebook-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ebook-brand-icon {
    height: 34px;
    width: 34px;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.ebook-brand:hover .ebook-brand-icon {
    transform: scale(1.08);
    filter: brightness(1.15);
}

.ebook-page-title {
    font-size: 16px;
    font-weight: 500;
    color: #626262;
    padding-left: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}

/* ---------- 主区域 ---------- */
.ebook-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ---------- 工具栏 ---------- */
.toolbar { margin-bottom: 24px; }

.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-info { font-size: 14px; color: #626262; }

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 筛选按钮 / 重置按钮 */
.btn-filter-minimal {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    height: 31px;
    font-size: 13px;
    font-weight: 500;
    color: #626262;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s;
}

.btn-filter-minimal:hover {
    background: #faf5f1;
    border-color: #cf9c7e;
    color: #a67a5a;
}

/* 分类筛选 */
.filter-dimension-item { position: relative; flex-shrink: 0; }

.filter-dimension-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    height: 31px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    color: #626262;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-dimension-btn:hover {
    background: #faf5f1;
    border-color: #cf9c7e;
    color: #a67a5a;
}

.filter-dimension-btn.selected {
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    border-color: #a67a5a;
    color: #ffffff;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    margin-top: 8px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}

.filter-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fafafa;
    border: 1px solid #eeeeee;
    border-radius: 6px;
    color: #3c3c3c;
    font-size: 14px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.25s;
}

.filter-dropdown-item:last-child { margin-bottom: 0; }

.filter-dropdown-item:hover {
    background: #faf5f1;
    color: #a67a5a;
    border-color: #cf9c7e;
}

.filter-dropdown-item.active {
    background: linear-gradient(90deg, rgba(207, 156, 126, 0.18), rgba(207, 156, 126, 0.08));
    color: #a67a5a;
    border-color: #cf9c7e;
}

/* 搜索 */
.search-form { display: flex; gap: 6px; }

.search-input {
    width: 200px;
    height: 31px;
    padding: 0 10px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    color: #3c3c3c;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus { border-color: #cf9c7e; }
.search-input::placeholder { color: #bbbbbb; }

.search-btn {
    height: 31px;
    width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    border: 1px solid #a67a5a;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn:hover { filter: brightness(1.08); }

/* 布局切换 */
.layout-switcher {
    display: flex;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    padding: 2px;
}

.layout-switcher-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #999999;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}

.layout-switcher-btn:hover {
    background: #faf5f1;
    color: #a67a5a;
}

.layout-switcher-btn.active {
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    color: #ffffff;
}

/* 排序 */
.sort-group {
    display: flex;
    gap: 0;
    border: 1px solid #dddddd;
    border-radius: 6px;
    overflow: hidden;
}

.sort-btn {
    padding: 6px 12px;
    height: 31px;
    border: none;
    background: #ffffff;
    color: #626262;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid #eeeeee;
}

.sort-btn:last-child { border-right: none; }

.sort-btn:hover { color: #a67a5a; background: #faf5f1; }

.sort-btn.active {
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    color: #ffffff;
}

/* ---------- 电子书卡片 ---------- */
.ebook-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    width: fit-content;
    max-width: 100%;
    color: inherit;
}

.ebook-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(166, 122, 90, 0.18);
    border-color: #cf9c7e;
}

.ebook-card-cover-wrap {
    --ebook-cover-height: 260px;
    height: var(--ebook-cover-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f2ee;
    flex-shrink: 0;
}

.ebook-card-cover {
    max-height: 100%;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.ebook-card-info {
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.ebook-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #3c3c3c;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em;
}

.ebook-card-meta {
    font-size: 12px;
    color: #999999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.ebook-card-author {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ebook-card-stats { display: flex; gap: 8px; flex-shrink: 0; }

.ebook-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 悬停操作按钮 */
.ebook-hover-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ebook-card:hover .ebook-hover-actions { opacity: 1; }

.ebook-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.ebook-action-btn:hover {
    background: rgba(207, 156, 126, 0.5);
    border-color: rgba(207, 156, 126, 0.7);
    color: #ffffff;
}

/* 卡片式布局：横向排列，每张卡宽度随封面比例变化 */
.ebook-grid-card {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

/* 瀑布流布局：JS 分列（轮询分配），保持从左到右阅读顺序 */
.ebook-masonry-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.ebook-masonry-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ebook-masonry-grid .ebook-card { width: 100%; }

@media (max-width: 768px) {
    .ebook-masonry-grid { gap: 12px; }
    .ebook-masonry-col { gap: 12px; }
    .ebook-main { padding: 16px; }
    .toolbar-row { flex-direction: column; align-items: stretch; }
    .toolbar-actions { flex-wrap: wrap; }
    .search-input { width: 140px; }
}

@media (max-width: 576px) {
    .ebook-card-cover-wrap { --ebook-cover-height: 200px; }
    .ebook-grid-card { gap: 12px; }
    .ebook-header-inner { padding: 12px 16px; }
}

/* ---------- 加载中 ---------- */
.ebook-loading {
    text-align: center;
    padding: 80px 0;
    color: #999999;
}

.ebook-loading-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 16px;
    border: 3px solid rgba(0, 0, 0, 0.08);
    border-top-color: #cf9c7e;
    border-radius: 50%;
    animation: ebookSpin 0.8s linear infinite;
}

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

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 80px 0;
}

.empty-state h4 {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 500;
    color: #999999;
}

.empty-state p { margin-top: 8px; font-size: 14px; color: #999999; }

.btn-primary-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #cf9c7e;
    border-radius: 6px;
    color: #a67a5a;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-outline:hover {
    background: rgba(207, 156, 126, 0.12);
}

/* ---------- 分页 ---------- */
.ebook-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.ebook-pagination-list {
    display: flex;
    gap: 6px;
    list-style: none;
}

.ebook-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    color: #626262;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.ebook-page-link:hover {
    border-color: #cf9c7e;
    color: #a67a5a;
}

.ebook-page-link.active {
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    border-color: #a67a5a;
    color: #ffffff;
}

.ebook-page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================================
   阅读器（深色沉浸底，暖调；强调色统一驼色）
   ============================================================ */

.ebook-reader-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #14110e;
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

/* 云展沉浸（PC/微信统一）：藏实心顶栏与左下缩放，改用右下浮标 */
#readerContainer.ebook-wechat-immersive .reader-content {
    padding: 8px;
}
#readerContainer.ebook-wechat-immersive #readerToolbar {
    display: none !important;
    pointer-events: none !important;
}
#readerContainer.ebook-wechat-immersive .zoom-controls {
    display: none !important;
}
/* 微信专属：不显示返回/分享/全屏浮标（含首屏 UA 标记，避免闪一下） */
#readerContainer.ebook-is-wechat .ebook-dock-pc-only,
html[data-ebook-ua="wechat"] #readerContainer .ebook-dock-pc-only {
    display: none !important;
}

/* 云展式底部浮标 */
.ebook-wechat-dock {
    display: none;
    position: absolute;
    right: 16px;
    bottom: 20px;
    z-index: 1200;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
#readerContainer.ebook-wechat-immersive .ebook-wechat-dock {
    display: flex;
    pointer-events: auto;
}
/* PC：右移避让 AI 悬浮球（约 60–70px），微信无球保持贴边 */
#readerContainer.ebook-wechat-immersive:not(.ebook-is-wechat) .ebook-wechat-dock {
    right: 100px;
}
#readerContainer.ebook-wechat-immersive .ebook-wechat-dock.is-hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}
.ebook-wechat-dock-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.38);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ebook-wechat-dock-btn:active {
    background: rgba(0, 0, 0, 0.55);
    transform: scale(0.96);
}
.ebook-wechat-dock-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.ebook-wechat-dock-btn.is-active {
    background: rgba(166, 122, 90, 0.75);
}
.ebook-wechat-dock-main,
.ebook-wechat-dock-zoombar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ebook-wechat-dock-zoombar {
    display: none;
}
.ebook-wechat-dock.is-zoom-mode .ebook-wechat-dock-main {
    display: none;
}
.ebook-wechat-dock.is-zoom-mode .ebook-wechat-dock-zoombar {
    display: flex;
}
.ebook-wechat-dock-btn.is-done {
    background: rgba(166, 122, 90, 0.85);
}

/* 云展式选页面板 */
.ebook-wechat-page-picker {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1150;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.45) 70%, transparent 100%);
    pointer-events: none;
}
#readerContainer.ebook-wechat-immersive .ebook-wechat-page-picker.is-open {
    display: block;
    pointer-events: auto;
}
.ebook-wechat-page-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 10px;
    scrollbar-width: none;
}
.ebook-wechat-page-thumbs::-webkit-scrollbar { display: none; }
.ebook-wechat-page-thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 72px;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.ebook-wechat-page-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ebook-wechat-page-thumb.is-current {
    border-color: #cf9c7e;
    box-shadow: 0 0 0 1px rgba(207, 156, 126, 0.5);
}
.ebook-wechat-page-thumb-num {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
}
.ebook-wechat-page-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    padding-bottom: 52px;
}
.ebook-wechat-page-jump input {
    width: 52px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    text-align: center;
    font-size: 13px;
    padding: 0 4px;
}

/* ---------- 工具栏 ---------- */
.reader-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(20, 17, 14, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    transition: transform 0.3s;
}

.reader-toolbar.hidden {
    transform: translateY(-100%);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d8d8d8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(207, 156, 126, 0.5);
    color: #cf9c7e;
}

.toolbar-btn.active {
    background: rgba(207, 156, 126, 0.22);
    border-color: rgba(207, 156, 126, 0.5);
    color: #cf9c7e;
}

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

.toolbar-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #d8d8d8;
}

/* ---------- 进度条 ---------- */
.reader-progress {
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.progress-bar {
    height: 100%;
    background: #cf9c7e;
    border-radius: 2px;
    transition: width 0.3s;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #cf9c7e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-bar-wrapper:hover .progress-handle { opacity: 1; }
.progress-handle:active { cursor: grabbing; }

.page-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    position: relative;
    flex-shrink: 0;
}

.page-input-wrapper input {
    width: 60px;
    height: 31px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #d8d8d8;
    text-align: center;
    font-size: 13px;
    outline: none;
}

.page-input-wrapper input:focus { border-color: rgba(207, 156, 126, 0.6); }

.page-total-text { color: #999999; font-size: 13px; white-space: nowrap; }

.page-input-error {
    position: absolute;
    top: 100%;
    left: 0;
    color: #f85149;
    font-size: 12px;
    margin-top: 4px;
    white-space: nowrap;
}

/* ---------- 阅读区域 ---------- */
.reader-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 80px 20px 20px;
    position: relative;
}

/* 窄屏/微信：减少留白，书页占更多像素 */
@media (max-width: 700px) {
    .reader-content {
        padding: 56px 8px 12px;
    }
}

.st-flip-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

/* 平移/缩放作用在外层，避免 StPageFlip 覆盖 #ebookBook 的 transform */
#ebookBookStage {
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.35s ease;
    will-change: transform;
}

/* 封面：只显示右半页（左半是库渲染的空白占位，直接裁掉） */
#ebookBook.is-cover-page { clip-path: inset(0 0 0 50%); }
/* 封底：只显示左半页 */
#ebookBook.is-back-cover-page { clip-path: inset(0 50% 0 0); }

#ebookBook {
    margin: 0 auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
    min-width: 1px;
    min-height: 1px;
}

/* 不要用 CSS 改写 canvas 宽高，否则位图会被拉成 0 或变形 */
#ebookBook canvas { display: block; }

#ebookBook .stf__parent,
#ebookBook .stf__wrapper { max-width: none; }

/* ---------- 翻页区域 ---------- */
.page-nav-area {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12%;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

.page-nav-area.prev { left: 0; justify-content: flex-start; padding-left: 20px; }
.page-nav-area.next { right: 0; justify-content: flex-end; padding-right: 20px; }

.page-nav-area .nav-arrow {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-style: normal;
}

.page-nav-area:hover .nav-arrow {
    opacity: 1;
    transform: scale(1.1);
}

.page-nav-area.disabled { cursor: not-allowed; opacity: 0.3; }
.page-nav-area.disabled .nav-arrow { opacity: 0; }

/* ---------- 目录面板 ---------- */
.reader-toc-panel {
    position: absolute;
    top: 60px;
    left: 0;
    width: 300px;
    height: calc(100% - 60px);
    background: rgba(20, 17, 14, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 150;
}

.reader-toc-panel.active { transform: translateX(0); }

.toc-title {
    color: #d8d8d8;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.toc-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    font-size: 14px;
    color: #d8d8d8;
}

.toc-item:hover { background: rgba(255, 255, 255, 0.06); }

.toc-item.active {
    background: rgba(207, 156, 126, 0.22);
    color: #cf9c7e;
}

/* ---------- 缩放控制 ---------- */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    background: rgba(20, 17, 14, 0.9);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d8d8d8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.zoom-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- 加载指示器 ---------- */
.page-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
}

.page-loading.active { display: block; }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #cf9c7e;
    border-radius: 50%;
    animation: readerSpin 0.8s linear infinite;
}

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

.loading-text {
    color: #999999;
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}

/* ---------- 错误提示 ---------- */
.page-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(248, 81, 73, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    display: none;
    text-align: center;
}

.page-error.active { display: block; }

.page-error button {
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
}

/* ---------- 提示浮层 ---------- */
.page-turn-tip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 10000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s;
}

.page-input-tip {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    z-index: 10000;
    font-size: 14px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .reader-toolbar {
        height: 50px;
        padding: 0 10px;
    }

    .toolbar-left,
    .toolbar-right { gap: 6px; }

    .reader-content { padding: 60px 10px 10px; }

    .reader-toc-panel { width: 80%; }

    .reader-progress { max-width: none; }

    .page-input-wrapper { margin-left: 6px; }
    .page-input-wrapper input { width: 48px; }

    .zoom-controls {
        bottom: 12px;
        left: 12px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .toolbar-btn {
        width: 32px;
        height: 32px;
    }

    .page-total-text { display: none; }
}

/* 触摸设备：加大点击区域 */
@media (hover: none) and (pointer: coarse) {
    .toolbar-btn {
        min-height: 40px;
        min-width: 40px;
    }

    .reader-content { touch-action: pan-y pinch-zoom; }

    .page-nav-area .nav-arrow { opacity: 0.6; }
}

/* ---------- 横屏提示（竖屏手机） ---------- */
.rotate-hint {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 17, 14, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(207, 156, 126, 0.4);
    border-radius: 24px;
    padding: 10px 18px;
    color: #e8e8e8;
    font-size: 13px;
    z-index: 10100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: rotateHintIn 0.3s ease;
    white-space: nowrap;
}

.rotate-hint svg {
    color: #cf9c7e;
    flex-shrink: 0;
    animation: rotateHintIcon 2s ease-in-out infinite;
}

.rotate-hint-close {
    background: none;
    border: none;
    color: #999999;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 2px;
}

.rotate-hint-close:hover { color: #e8e8e8; }

@keyframes rotateHintIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes rotateHintIcon {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* 小屏隐藏页码输入，保留进度条与翻页键 */
@media (max-width: 480px) {
    .page-input-wrapper { display: none; }
}

/* ---------- 分享弹层（复制链接 + 微信扫码） ---------- */
.ebook-share-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ebook-share-modal {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: #1c1713;
    border: 1px solid rgba(207, 156, 126, 0.35);
    border-radius: 14px;
    padding: 22px 20px 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    color: #e8e8e8;
}

.ebook-share-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}

.ebook-share-close:hover { color: #cf9c7e; background: rgba(255, 255, 255, 0.06); }

.ebook-share-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 24px;
}

.ebook-share-cover {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    background: #2a221c;
    flex-shrink: 0;
}

.ebook-share-title {
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ebook-share-sub {
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.ebook-share-actions { margin-bottom: 16px; }

.ebook-share-copy-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #cf9c7e 0%, #a67a5a 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s;
}

.ebook-share-copy-btn:hover { filter: brightness(1.08); }

.ebook-share-qr-block {
    text-align: center;
    padding: 14px 12px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.ebook-share-qr-wrap {
    width: 180px;
    height: 180px;
    margin: 0 auto 10px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ebook-share-qr-wrap img,
.ebook-share-qr-wrap canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.ebook-share-qr-hint {
    font-size: 12px;
    color: #b0a090;
    line-height: 1.5;
    margin: 0;
}
