/* =========================================================
   CSS 变量
   ========================================================= */
:root {
  --bg: #F8F7F4;
  --bg-card: #FFFFFF;
  --bg-muted: #F4F4F5;
  --bg-nav: #FFFFFF;
  --text: #18181B;
  --text-muted: #71717A;
  --text-light: #A1A1AA;
  --accent: #EA580C;
  --accent-hover: #C2410C;
  --accent-light: #FFF4ED;
  --border: #E4E4E7;
  --nav-h: 60px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --font-ui: 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================================================
   基础重置
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; background: none; border: none; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* =========================================================
   顶部导航（白色扁平）
   ========================================================= */
.nav {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background 0.15s;
}
.nav-hamburger:hover { background: var(--bg-muted); }
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-brand-icon {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.nav-categories {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 6px;
}
.nav-cat-link {
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-cat-link:hover { color: var(--text); background: var(--bg-muted); }
.nav-cat-link.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

.nav-spacer { flex: 1; }

/* 搜索按钮（pill 样式，点击打开弹窗） */
.nav-search-wrap { flex: 1; max-width: 260px; min-width: 0; }
.nav-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg-muted);
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.nav-search-btn svg { flex-shrink: 0; }
.nav-search-btn:hover { background: #EBEBEB; border-color: var(--border); color: var(--text-muted); }
.nav-search-btn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 右侧动作按钮组 */
.nav-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.nav-fav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-fav-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-fav-label { font-size: 0.82rem; }

.fav-badge {
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.nav-login-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.nav-login-btn:hover { background: var(--accent-hover); }

/* 已登录：用户头像按钮 */
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}
.user-avatar-btn:hover { border-color: var(--accent); }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 子页面返回链接 */
.nav-back {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-back:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* =========================================================
   邮箱验证 Modal
   ========================================================= */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.auth-modal-logo {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: white;
}

.auth-title { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.auth-subtitle strong { color: var(--text); font-weight: 600; }

.auth-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.15s;
  margin-bottom: 12px;
  text-align: left;
}
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-input::placeholder { color: var(--text-light); }

.auth-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  margin-bottom: 12px;
}
.auth-btn:hover:not(:disabled) { background: var(--accent-hover); }
.auth-btn:disabled { background: #D4D4D8; cursor: not-allowed; }

.auth-skip {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.auth-skip:hover { color: var(--text); background: var(--bg-muted); }

.auth-err {
  font-size: 0.82rem;
  color: #DC2626;
  text-align: left;
  margin: -6px 0 10px;
  display: none;
}
.auth-err.show { display: block; }

.auth-resend {
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  transition: color 0.15s;
  text-align: center;
  border: none;
  background: none;
}
.auth-resend:hover { color: var(--accent); }

/* OTP 6位输入格 */
.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.otp-cell {
  height: 50px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.15s;
  width: 100%;
}
.otp-cell:focus { outline: none; border-color: var(--accent); }

.demo-hint {
  background: var(--accent-light);
  border: 1px solid #FCDEC6;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.83rem;
  color: var(--accent-hover);
  margin-bottom: 14px;
  text-align: left;
  line-height: 1.5;
}
.demo-hint strong { font-size: 1.1rem; letter-spacing: 0.15em; }

/* =========================================================
   搜索弹窗
   ========================================================= */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 300;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 70px;
}
.search-overlay.active { display: flex; }

.search-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-icon-svg { color: var(--text-light); flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-light); }
.search-close-btn {
  width: 26px;
  height: 26px;
  background: var(--bg-muted);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.search-close-btn:hover { background: #DDDDE1; }

.search-results { max-height: 380px; overflow-y: auto; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result-item:hover { background: var(--bg-muted); }
.search-result-cover {
  width: 40px;
  height: 54px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-muted);
}
.search-result-cover img { width: 100%; height: 100%; object-fit: cover; }
.search-result-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.search-result-meta { font-size: 0.8rem; color: var(--text-muted); }
.search-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* =========================================================
   收藏侧抽屉
   ========================================================= */
.fav-drawer {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100%;
  background: var(--bg-card);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
}
.fav-drawer.open { right: 0; }

.fav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.drawer-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.drawer-close-btn:hover { background: #DDDDE1; }

.fav-list { flex: 1; overflow-y: auto; }
.fav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
}
.fav-item:hover { background: var(--bg-muted); }
.fav-item-cover {
  width: 36px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-muted);
}
.fav-item-cover img { width: 100%; height: 100%; object-fit: cover; }
.fav-item-info { flex: 1; min-width: 0; }
.fav-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-item-author { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.fav-item-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.fav-item-remove:hover { background: #FEE2E2; color: #DC2626; }

/* 通用半透明遮罩 */
.overlay-bd {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 350;
  display: none;
}
.overlay-bd.active { display: block; }

/* =========================================================
   移动端侧滑菜单
   ========================================================= */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 260px;
  height: 100%;
  background: var(--bg-card);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: left 0.25s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}
.mobile-drawer.open { left: 0; }

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.mobile-drawer-brand-icon {
  width: 26px;
  height: 26px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.mobile-nav-links { padding: 6px 0; }
.mobile-nav-link {
  display: block;
  padding: 11px 20px;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s;
}
.mobile-nav-link:hover { background: var(--bg-muted); color: var(--accent); }
.mobile-nav-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* =========================================================
   广告位
   ========================================================= */
.ad-bar { padding: 10px 20px; }
.ad-bar-inner { max-width: 1200px; margin: 0 auto; }
.ad-slot {
  background: var(--bg-card);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 0.78rem;
}
.ad-leaderboard { height: 62px; }
.ad-rect { height: 52px; margin: 14px 0; }
.ad-sidebar { height: 200px; }
.ad-label { font-weight: 600; }

/* =========================================================
   主体 / 布局
   ========================================================= */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-main { padding: 20px 0 48px; }

.home-layout {
  display: grid;
  grid-template-columns: 1fr 236px;
  gap: 24px;
  align-items: start;
}

/* =========================================================
   Section 标题
   ========================================================= */
.home-section { margin-bottom: 28px; }
.section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 17px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.section-more {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.section-more:hover { color: var(--accent); background: var(--accent-light); }

/* =========================================================
   小说卡片
   ========================================================= */
.novels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}

.novel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.novel-card:hover { border-color: #C4C4C4; transform: translateY(-2px); }

.novel-card-cover {
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--bg-muted);
}
.novel-card-cover img { width: 100%; height: 100%; object-fit: cover; }

.novel-card-body { padding: 8px 9px 9px; }
.novel-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
  margin-bottom: 3px;
}
.novel-card-author {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.novel-card-meta {
  display: flex;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

/* =========================================================
   侧栏排行榜
   ========================================================= */
.home-sidebar { position: sticky; top: calc(var(--nav-h) + 14px); }

.rank-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.rank-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}
.rank-more { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); text-decoration: none; }
.rank-more:hover { color: var(--accent); }

.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.rank-item:hover { background: var(--bg-muted); }
.rank-num {
  width: 18px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  text-align: center;
  flex-shrink: 0;
}
.rank-num.top1 { color: #DC2626; }
.rank-num.top2 { color: #EA580C; }
.rank-num.top3 { color: #D97706; }
.rank-info { min-width: 0; }
.rank-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

/* =========================================================
   更多/分类页头部
   ========================================================= */
.page-hd {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-top: 4px;
}
.page-hd-title { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.page-hd-count { font-size: 0.875rem; color: var(--text-muted); }

.load-more-wrap { display: flex; justify-content: center; padding: 28px 0 8px; }
.btn-load-more {
  padding: 10px 32px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.btn-load-more:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   Toast 通知
   ========================================================= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: white;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #16A34A; }
.toast-error { background: #DC2626; }
.toast-info { background: var(--accent); }

/* =========================================================
   底部 Footer
   ========================================================= */
.site-footer {
  background: #18181B;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 32px;
}
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 40px 20px 0; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
}
.footer-brand-icon {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.footer-desc { font-size: 0.82rem; line-height: 1.7; }
.footer-col-title { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.85); margin-bottom: 12px; }
.footer-links { list-style: none; font-size: 0.82rem; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(255,255,255,0.5); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 16px 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.35);
  text-align: center;
}

/* =========================================================
   通用 Empty / Loading
   ========================================================= */
.loading { padding: 48px; text-align: center; color: var(--text-light); font-size: 0.9rem; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.empty a { color: var(--accent); }

/* =========================================================
   移动端底部标签栏
   ========================================================= */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.67rem;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: color 0.15s;
}
.tab-item.tab-active, .tab-item:hover { color: var(--accent); }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .home-layout { grid-template-columns: 1fr 216px; gap: 20px; }
}

@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr; }
  .home-sidebar { display: none; }
  .nav-categories { display: none; }
}

@media (max-width: 768px) {
  .nav { padding: 0 14px; gap: 6px; }
  .nav-hamburger { display: flex; }
  .nav-search-wrap { max-width: 160px; }
  .nav-search-btn-text { display: none; }
  .nav-fav-label { display: none; }
  .mobile-tabbar { display: flex; }
  .page-main { padding-bottom: 72px; }
  .picks-bar-inner { padding: 0 14px; }
}

@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > .footer-col:first-child { grid-column: 1 / -1; }
  .auth-modal { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .novels-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .nav-search-wrap { display: none; }
}

/* =========================================================
   通用按钮
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 7px 16px; font-size: 0.82rem; }

/* =========================================================
   徽章
   ========================================================= */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge-completed { background: #D1FAE5; color: #065F46; }
.badge-ongoing { background: var(--accent-light); color: var(--accent); }

/* =========================================================
   小说详情页
   ========================================================= */
.novel-hero {
  display: flex;
  gap: 28px;
  padding: 28px 0 32px;
}
.novel-hero-cover {
  width: 140px;
  flex-shrink: 0;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-light);
}
.novel-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.novel-hero-info { flex: 1; min-width: 0; padding-top: 4px; }
.novel-hero-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 10px;
}
.novel-hero-author { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 12px; }
.novel-hero-meta { margin-bottom: 16px; }
.novel-hero-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 章节目录区 */
.novel-chapters { padding-top: 4px; }
.novel-chapters .section-hd { margin-bottom: 12px; }

.chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
}
.chapter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.1s;
  min-width: 0;
}
.chapter-item:hover { background: var(--bg-muted); }
.chapter-num {
  font-size: 0.72rem;
  color: var(--text-light);
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}
.chapter-title-link {
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .novel-hero { gap: 16px; padding: 20px 0 24px; }
  .novel-hero-cover { width: 100px; }
  .novel-hero-title { font-size: 1.25rem; }
  .chapter-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .chapter-list { grid-template-columns: 1fr; }
}

/* =========================================================
   阅读页
   ========================================================= */
.read-header {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.read-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}
.read-home-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.read-home-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.read-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow: hidden;
}
.read-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: block;
}
.read-breadcrumb a:hover { color: var(--accent); }
.read-breadcrumb-sep { color: var(--text-light); flex-shrink: 0; }
#breadcrumbChapter {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 500;
  display: block;
  min-width: 0;
}

.read-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.font-size-ctrl {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 2px;
}
.font-size-btn {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.font-size-btn:hover { background: var(--bg-card); color: var(--text); }
#fontSizeLabel {
  min-width: 26px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
  white-space: nowrap;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

.read-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
.chapter-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 32px;
  line-height: 1.4;
  text-align: center;
}
.chapter-content {
  font-size: 17px;
  line-height: 2;
  color: var(--text);
}
.chapter-content p {
  margin-bottom: 1.2em;
  text-indent: 2em;
}
.read-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 0 24px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.read-nav-center { text-align: center; }
.read-nav-progress { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.read-nav-toc { font-size: 0.82rem; color: var(--text-muted); text-decoration: none; }
.read-nav-toc:hover { color: var(--accent); }
.read-nav-btns { display: flex; gap: 12px; width: 100%; max-width: 360px; }
.read-nav-btns .btn { flex: 1; justify-content: center; }
.read-btn-disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* 夜间模式 */
[data-theme="dark"] {
  --bg: #1C1C1E;
  --bg-card: #2C2C2E;
  --bg-muted: #3A3A3C;
  --bg-nav: #1C1C1E;
  --text: #F2F2F7;
  --text-muted: #AEAEB2;
  --text-light: #636366;
  --border: #3A3A3C;
}

/* =========================================================
   小说详情页增强
   ========================================================= */
.novel-hero-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.novel-meta-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}
.novel-meta-cat {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.novel-hero-stats {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 14px 0 18px;
  padding: 12px 0;
}
.novel-stat {
  flex: 1;
  text-align: center;
  border-right: 1px solid var(--border);
}
.novel-stat:last-child { border-right: none; }
.novel-stat-val { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.novel-stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }
.novel-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.novel-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 600px) {
  .novel-hero-actions .btn { flex: 1; justify-content: center; }
}

/* =========================================================
   收藏本站按钮
   ========================================================= */
.nav-bookmark-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-bookmark-btn:hover { border-color: #D97706; color: #D97706; background: #FFFBEB; }

/* =========================================================
   Page Banner (二级页面顶部 banner，由 common.js 控制显隐)
   ========================================================= */
.page-banner {
  display: none;
  background: #1A1612;
  color: white;
  padding: 40px 20px;
  text-align: center;
  overflow: hidden;
}
.page-banner-inner { max-width: 800px; margin: 0 auto; }
.page-banner-title { font-size: 1.75rem; font-weight: 700; line-height: 1.35; margin: 0 0 10px; color: #fff; }
.page-banner-sub   { font-size: 1rem; color: rgba(255,255,255,0.75); margin: 0; }
@media (max-width: 600px) {
  .page-banner { padding: 28px 16px; }
  .page-banner-title { font-size: 1.35rem; }
}

/* =========================================================
   Hero Banner
   ========================================================= */
.hero-banner {
  background: #1A1612;
  color: white;
  overflow: hidden;
}
.hero-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px;
  display: flex;
  align-items: center;
  gap: 48px;
}
.hero-text { flex: 1; min-width: 0; }
.hero-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}
.hero-subtitle {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.8;
  margin-bottom: 28px;
  max-width: 380px;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}
.hero-cta:hover { background: var(--accent-hover); }
.hero-covers {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-shrink: 0;
}
.hero-cover-item {
  width: 84px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.hero-cover-item:hover { transform: translateY(-6px) !important; }
.hero-cover-item:nth-child(1) { transform: translateY(0); }
.hero-cover-item:nth-child(2) { transform: translateY(-10px); }
.hero-cover-item:nth-child(3) { transform: translateY(-4px); }
.hero-cover-item:nth-child(4) { transform: translateY(-14px); }
.hero-cover-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }

@media (max-width: 900px) {
  .hero-covers { gap: 10px; }
  .hero-cover-item { width: 68px; }
}
@media (max-width: 768px) {
  .hero-banner-inner { padding: 36px 16px; gap: 28px; }
  .hero-title { font-size: 1.7rem; }
  .hero-covers { gap: 8px; }
  .hero-cover-item { width: 60px; }
  .hero-cover-item:nth-child(2) { transform: translateY(-6px); }
  .hero-cover-item:nth-child(4) { transform: translateY(-8px); }
}
@media (max-width: 540px) {
  .hero-banner-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .hero-title { font-size: 1.5rem; }
  .hero-subtitle { max-width: 100%; }
  .hero-covers { align-self: center; }
  .hero-cover-item { width: 56px; }
  .hero-cover-item:nth-child(2) { transform: translateY(-8px); }
  .hero-cover-item:nth-child(4) { transform: translateY(-4px); }
}

/* =========================================================
   阅读页 3-按钮翻页
   ========================================================= */
.btn-toc {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-toc:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* =========================================================
   移动端小说详情页
   ========================================================= */
@media (max-width: 520px) {
  .novel-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 20px 0 24px;
  }
  .novel-hero-cover { width: 130px; }
  .novel-hero-meta-row { justify-content: center; }
  .novel-hero-tags { justify-content: center; }
  .novel-hero-actions { justify-content: center; }
  .novel-hero-stats { gap: 0; }
  .novel-stat-val { font-size: 1rem; }
}

/* =========================================================
   移动端阅读页 header
   ========================================================= */
@media (max-width: 520px) {
  .read-header-inner { gap: 6px; padding: 0 12px; }
  .read-home-btn span { display: none; }
  .read-home-btn { padding: 6px 8px; }
  #fontSizeLabel { display: none; }
  .font-size-btn { padding: 3px 6px; font-size: 0.72rem; }
  .theme-btn span { display: none; }
  .theme-btn { padding: 5px 8px; }
  #breadcrumbChapter { max-width: 80px; }
}
