/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #f5f6f8; color: #2b2b2b; line-height: 1.6;
}
a { color: #3a6ea5; text-decoration: none; }
a:hover { color: #2a5580; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
img { max-width: 100%; }

/* ===== 头部 ===== */
.site-header { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 20px; padding: 12px 16px; flex-wrap: wrap; }
.logo { font-size: 22px; font-weight: 700; color: #2b2b2b; }
.search-form { flex: 1; display: flex; max-width: 460px; }
.search-form input {
  flex: 1; padding: 8px 12px; border: 1px solid #d1d5db; border-right: none;
  border-radius: 6px 0 0 6px; outline: none; font-size: 14px;
}
.search-form button {
  padding: 8px 16px; border: none; background: #3a6ea5; color: #fff;
  border-radius: 0 6px 6px 0; cursor: pointer; font-size: 14px;
}
.search-form button:hover { background: #2a5580; }
.nav a { margin-left: 16px; font-size: 15px; color: #374151; }
.category-bar { display: flex; gap: 4px; padding: 0 16px 10px; flex-wrap: wrap; }
.category-bar a {
  padding: 4px 12px; font-size: 14px; color: #4b5563; border-radius: 14px; background: #f3f4f6;
}
.category-bar a:hover { background: #e0e7f1; color: #2a5580; }

/* ===== 主体 ===== */
.main { padding: 24px 16px 48px; min-height: 60vh; }
.section-title { font-size: 20px; margin: 28px 0 14px; padding-left: 10px; border-left: 4px solid #3a6ea5; }
.section-title:first-child { margin-top: 0; }

/* ===== 书籍网格 ===== */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.book-card {
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: transform .15s;
}
.book-card:hover { transform: translateY(-3px); }
.book-card .cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #e5e7eb; display: block; }
.book-card .cover-placeholder {
  width: 100%; aspect-ratio: 3/4; background: #e0e7f1; display: flex;
  align-items: center; justify-content: center; color: #6b7280; font-size: 14px; padding: 8px; text-align: center;
}
.book-card .info { padding: 10px 12px; }
.book-card .title {
  font-size: 14px; font-weight: 600; color: #2b2b2b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-card .author { font-size: 12px; color: #9ca3af; margin-top: 2px; }

/* ===== 分页 ===== */
.pagination { margin: 28px 0 8px; text-align: center; }
.pagination a, .pagination span.current {
  display: inline-block; padding: 6px 12px; margin: 0 3px; border-radius: 5px;
  background: #fff; border: 1px solid #e5e7eb; font-size: 14px;
}
.pagination span.current { background: #3a6ea5; color: #fff; border-color: #3a6ea5; }

/* ===== 书籍详情 ===== */
.detail-wrap { display: flex; gap: 28px; background: #fff; padding: 28px; border-radius: 10px; }
.detail-cover { width: 220px; flex-shrink: 0; }
.detail-cover img, .detail-cover .cover-placeholder { width: 100%; border-radius: 6px; aspect-ratio: 3/4; object-fit: cover; background: #e0e7f1; display: flex; align-items: center; justify-content: center; color: #6b7280; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { font-size: 26px; margin-bottom: 10px; }
.meta { color: #6b7280; font-size: 14px; margin-bottom: 4px; }
.meta b { color: #374151; font-weight: 600; }
.desc { margin: 16px 0 22px; color: #4b5563; white-space: pre-wrap; }
.btn {
  display: inline-block; padding: 10px 26px; border-radius: 6px; font-size: 15px;
  cursor: pointer; border: none; margin-right: 10px;
}
.btn-primary { background: #3a6ea5; color: #fff; }
.btn-primary:hover { background: #2a5580; color: #fff; }
.btn-outline { background: #fff; border: 1px solid #3a6ea5; color: #3a6ea5; }
.btn-outline:hover { background: #eef4fa; }
.badge {
  display: inline-block; padding: 2px 8px; font-size: 12px; border-radius: 4px;
  background: #eef4fa; color: #3a6ea5; margin-left: 6px; vertical-align: middle;
}
.tip { color: #9ca3af; font-size: 13px; margin-top: 10px; }

/* ===== 文章 ===== */
.article-item {
  background: #fff; border-radius: 8px; padding: 18px 22px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.article-item h2 { font-size: 18px; }
.article-item .time { color: #9ca3af; font-size: 13px; margin-top: 6px; }
.article-body { background: #fff; border-radius: 10px; padding: 32px; }
.article-body h1 { margin-bottom: 8px; }
.article-body .content { margin-top: 20px; }
.article-body .content img { border-radius: 6px; }

/* ===== 阅读器 ===== */
.reader-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 20;
}
.reader-header .title { font-weight: 600; flex: 1; min-width: 120px; }
.reader-header button, .reader-header select {
  padding: 6px 12px; border: 1px solid #d1d5db; background: #fff; border-radius: 5px;
  cursor: pointer; font-size: 13px;
}
.reader-header button:hover { background: #f3f4f6; }
.reader-body { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; }
.reader-body.txt { white-space: pre-wrap; word-break: break-word; }
.reader-body.theme-white { background: #fff; color: #2b2b2b; }
.reader-body.theme-green { background: #cce8cf; color: #2b3a2b; }
.reader-body.theme-night { background: #1f1f1f; color: #b8b8b8; }
.pager { display: flex; justify-content: center; gap: 12px; padding: 20px 0 40px; flex-wrap: wrap; }
.pager button { padding: 8px 24px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; }
.pager .page-info { align-self: center; color: #6b7280; font-size: 14px; }
.jump-input { width: 72px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 5px; font-size: 13px; align-self: center; }
.pager .jump-input { padding: 8px 10px; }
.zoom-select { min-width: 96px; }
#pdf-canvas { display: block; margin: 0 auto; }
.reader-body-pdf { max-width: none; padding: 16px 12px 80px; overflow-x: auto; }
#epub-view { max-width: 860px; margin: 0 auto; }
.toc { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 18px; margin-bottom: 16px; display: none; }
.toc.open { display: block; }
.toc a { display: block; padding: 4px 0; font-size: 14px; }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid #e5e7eb; padding: 20px 0; color: #9ca3af; font-size: 13px; text-align: center; background: #fff; }

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .detail-wrap { flex-direction: column; padding: 18px; }
  .detail-cover { width: 150px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .header-inner { gap: 10px; }
}

/* ===== 用户系统 ===== */
.auth-box {
  max-width: 420px; margin: 40px auto; background: #fff; border-radius: 10px;
  padding: 32px; box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.auth-box h2 { margin-bottom: 20px; text-align: center; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 14px; margin-bottom: 6px; color: #374151; }
.form-row input {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; outline: none;
}
.form-row input:focus { border-color: #3a6ea5; }
.form-row .help { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.form-row .error, .error { color: #dc2626; font-size: 13px; margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: #6b7280; }

.flash {
  padding: 10px 16px; border-radius: 6px; margin-bottom: 14px; font-size: 14px;
  background: #eef4fa; border: 1px solid #c8dcf0; color: #2a5580;
}
.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.info { background: #eef4fa; }

.panel { background: #fff; border-radius: 10px; padding: 8px 22px; }
.panel-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #f3f4f6; flex-wrap: wrap;
}
.panel-row:last-child { border-bottom: none; }

.badge-vip { background: #fdf3d7; color: #b8860b; }
.badge-login { background: #e8f0e9; color: #3d7a4d; }
.btn-sm { padding: 5px 14px; font-size: 13px; }

/* ===== VIP 套餐 ===== */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 18px; }
.plan-card {
  background: #fff; border-radius: 10px; padding: 26px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); border: 2px solid transparent;
}
.plan-card:hover { border-color: #3a6ea5; }
.plan-card h3 { font-size: 18px; margin-bottom: 8px; }
.plan-card .price { font-size: 32px; font-weight: 700; color: #b8860b; margin-bottom: 14px; }
.plan-card .price span { font-size: 14px; font-weight: 400; color: #9ca3af; }
.plan-card ul { list-style: none; margin-bottom: 20px; }
.plan-card li { padding: 5px 0; font-size: 14px; color: #4b5563; }
