/* 资料详情：文库式试看（固定大小的阅读窗口，前几页竖着排成纸张在窗口里滑动，最后一页往下渐隐，压一张「解锁全文」卡片）；资料目录弹窗 */
.detail-reader h3 { display: flex; align-items: center; gap: 8px; }
.reader-count { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--text-muted); }

.reader-window {
  height: min(760px, 78vh); overflow-y: auto; overscroll-behavior: contain;   /* 滑到窗口底不带着整页一起滚 */
  border: 1px solid #e3e8f0; border-radius: 12px; background: #eef1f6; scrollbar-width: thin;
}
.reader-window::-webkit-scrollbar { display: block; width: 8px; }
.reader-window::-webkit-scrollbar-thumb { border-radius: 4px; background: #c5cfde; }
.reader-window:focus-visible { outline: 2px solid #3b7ef6; outline-offset: 2px; }
.reader-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 0 0; }
.reader-page {
  position: relative; width: min(820px, calc(100% - 32px)); background: #fff;
  box-shadow: 0 2px 10px rgba(21, 32, 51, .08); border-radius: 2px; overflow: hidden;
}
.reader-page img { display: block; width: 100%; height: auto; }
.reader-no { position: absolute; right: 10px; bottom: 8px; padding: 1px 8px; border-radius: 10px; background: rgba(23, 36, 67, .55); color: #fff; font-size: 11px; }
/* 最后一页只露出上半截，往下渐隐进解锁卡片 */
.reader-page:last-child { max-height: 520px; }
.reader-page:last-child::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 70%;
  background: linear-gradient(180deg, rgba(238, 241, 246, 0) 0%, rgba(238, 241, 246, .85) 55%, #eef1f6 100%);
  pointer-events: none;
}
.reader-page:only-child { max-height: none; }

.reader-lock { position: relative; margin-top: -120px; padding: 0 16px 24px; background: linear-gradient(180deg, transparent 0, #eef1f6 120px); }
.reader-lock-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 420px; margin: 0 auto;
  padding: 24px 24px 22px; border: 1px solid #e3eaf6; border-radius: 16px; background: #fff; text-align: center;
  box-shadow: 0 12px 32px rgba(45, 80, 155, .14);
}
.reader-lock-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #eef4ff; color: #3b7ef6; font-size: 18px; }
.reader-lock-card.owned .reader-lock-ico { background: #e9f8f0; color: #138a58; }
.reader-lock-card b { margin-top: 4px; font-size: 18px; color: var(--text); }
.reader-lock-card p { font-size: 13px; color: var(--text-muted); }
.reader-unlock {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; margin-top: 10px; padding: 0 32px; border: 0; border-radius: 23px;
  background: linear-gradient(135deg, #4d8ef9, #2f6fe8); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px rgba(59, 126, 246, .28); transition: transform .18s, filter .18s;
}
.reader-unlock:hover { transform: translateY(-1px); filter: brightness(1.05); }
.reader-unlock span { padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, .4); }
.reader-lock-card.owned .reader-unlock { background: linear-gradient(135deg, #2fc37a, #13945f); box-shadow: 0 8px 18px rgba(19, 148, 95, .25); }

@media (max-width: 768px) {
  .reader-window { height: 68vh; border-radius: 10px; }
  .reader-pages { gap: 10px; padding-top: 12px; }
  .reader-page { width: calc(100% - 20px); }
  .reader-page:last-child { max-height: 320px; }
  .reader-lock { margin-top: -90px; padding: 0 10px 16px; }
  .reader-lock-card { padding: 20px 16px 18px; }
  .reader-unlock { width: 100%; justify-content: center; }
}

/* 右上卡里的更多推荐 */
.detail-side-card .related-list { gap: 8px; }
.detail-side-card .related-item { padding: 8px; }
.detail-side-card .related-cover { width: 52px; height: 52px; }
.related-empty { padding: 24px 0; text-align: center; color: var(--text-muted); font-size: 13px; }
/* 资料信息卡里的「查看目录」 */
.facts-toc-btn { width: 100%; margin-top: 14px; }

/* 资料目录弹窗 */
.catalog-modal { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(17, 24, 39, .45); }
.catalog-modal[hidden] { display: none; }
.catalog-modal-box { display: flex; flex-direction: column; width: 560px; max-width: 100%; max-height: min(720px, 86vh); border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(17, 24, 39, .25); }
.catalog-modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.catalog-modal-head h3 { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.catalog-modal-head h3 i { color: var(--primary); }
.catalog-modal-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f2f5fa; color: var(--text-muted); font-size: 16px; cursor: pointer; }
.catalog-modal-close:hover { background: #e6ecf5; color: var(--text); }
.catalog-modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 22px 18px; }
@media (max-width: 860px) {
  .catalog-modal { align-items: flex-end; padding: 0; }
  .catalog-modal-box { width: 100%; max-height: 80vh; border-radius: 16px 16px 0 0; }
}
