/* ============================================
   NOVEL SITE DESIGN SYSTEM v2.0
   Modern · Elegant · Responsive · Dark Mode
   ============================================ */

/* ── CSS Custom Properties ── */
:root {
  /* Color Palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Neutral */
  --bg-0: #f8fafc;
  --bg-1: #ffffff;
  --bg-2: #f1f5f9;
  --bg-3: #e2e8f0;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Text */
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --text-inverse: #ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Spacing */
  --gap: 20px;
  --container: 1200px;
  --header-h: 64px;

  /* Transition */
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast: .15s;
  --t-normal: .25s;
  --t-slow: .4s;

  /* Font */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace;

  /* Reader */
  --rd-bg: #ffffff;
  --rd-color: #1e293b;
  --rd-size: 18px;
  --rd-lh: 2;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg-0: #0f1218;
  --bg-1: #1a1f2e;
  --bg-2: #242b3d;
  --bg-3: #2e3750;
  --border: #2e3750;
  --border-light: #242b3d;
  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;
  --primary-50: #1e1b4b;
  --primary-100: #312e81;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.3);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.35);
  --rd-bg: #1a1f2e;
  --rd-color: #e2e8f0;
}

/* ── Sepia Reader Theme ── */
.reader-theme-sepia { --rd-bg: #f5e6c8; --rd-color: #5b4636; }

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--primary-dark); }
img { display: block; max-width: 100%; height: auto; }
button, input { font-family: inherit; }

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,.85);
}

[data-theme="dark"] .site-header {
  background: rgba(26,31,46,.9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.header-logo .logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}

.header-nav a:hover { color: var(--text-1); background: var(--bg-2); }
.header-nav a.active { color: var(--primary); background: var(--primary-50); }

.header-search {
  position: relative;
  flex-shrink: 0;
}

.header-search input {
  width: 220px;
  height: 38px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-2);
  font-size: 13px;
  color: var(--text-1);
  outline: none;
  transition: all var(--t-fast) var(--ease);
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-200);
  background: var(--bg-1);
  width: 280px;
}

.header-search input::placeholder { color: var(--text-4); }

.header-search .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--r-full);
  background: var(--bg-2);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--t-fast) var(--ease);
}

.theme-toggle:hover { background: var(--bg-3); color: var(--text-1); }

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 20px;
  align-items: center;
  justify-content: center;
}

/* Mobile Nav Overlay */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-normal) var(--ease);
}

.mobile-nav.open { opacity: 1; visibility: visible; }

.mobile-nav-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-1);
  padding: 24px;
  transform: translateX(100%);
  transition: transform var(--t-normal) var(--ease);
  overflow-y: auto;
}

.mobile-nav.open .mobile-nav-panel { transform: translateX(0); }

.mobile-nav-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--r-full);
  background: var(--bg-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}

.mobile-nav-links a:hover, .mobile-nav-links a.active {
  background: var(--primary-50);
  color: var(--primary);
}

/* ── Hero Section ── */
.hero {
  position: relative;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 48px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 60px var(--gap);
}

.hero-cover {
  flex-shrink: 0;
  width: 220px;
  position: relative;
}

.hero-cover img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,.4);
}

.hero-cover-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--r-full);
  box-shadow: 0 4px 12px rgba(239,68,68,.4);
}

.hero-info {
  flex: 1;
  min-width: 0;
  color: #fff;
}

.hero-tag {
  display: inline-block;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  padding: 4px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.1);
}

.hero-title {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -.5px;
}

.hero-author {
  font-size: 16px;
  opacity: .85;
  margin-bottom: 10px;
}

.hero-stats {
  font-size: 14px;
  opacity: .7;
  margin-bottom: 20px;
}

.hero-desc {
  font-size: 14px;
  line-height: 1.7;
  opacity: .75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 28px;
  max-width: 560px;
}

.hero-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--r-full);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t-normal) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99,102,241,.5);
  color: #fff;
}

.btn-ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-sm { padding: 8px 18px; font-size: 13px; }

/* ── Section ── */
.section {
  padding: 36px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}

.section-icon {
  font-size: 22px;
}

.section-more {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--t-fast) var(--ease);
}

.section-more:hover { color: var(--primary); }

/* ── Book Grid ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
}

.book-card {
  background: var(--bg-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-normal) var(--ease);
  border: 1px solid var(--border-light);
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.book-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--bg-2);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow) var(--ease);
}

.book-card:hover .book-cover img { transform: scale(1.05); }

.book-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-full);
}

.book-tag.tag-green { background: rgba(16,185,129,.85); }

.book-body {
  padding: 14px;
}

.book-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-author {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-4);
}

.book-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Category Grid (5 columns) ── */
.cat-grid-wrap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: all var(--t-normal) var(--ease);
  position: relative;
  overflow: hidden;
}

.cat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.3), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity var(--t-normal) var(--ease);
}

.cat-card:hover::before { opacity: 1; }

.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.cat-card-icon {
  font-size: 36px;
  line-height: 1;
}

.cat-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}

.cat-card-cnt {
  font-size: 12px;
  color: var(--text-3);
  background: rgba(0,0,0,.05);
  padding: 2px 10px;
  border-radius: var(--r-full);
}

[data-theme="dark"] .cat-card-cnt {
  background: rgba(255,255,255,.08);
}

/* ── Rank List ── */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-1);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  border: 1px solid var(--border-light);
}

.rank-item:hover {
  background: var(--bg-2);
  border-color: var(--border);
}

.rank-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Gold */
.rank-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,.35);
}

/* Silver */
.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(148,163,184,.3);
}

/* Bronze */
.rank-3 {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217,119,6,.3);
}

/* Other */
.rank-other {
  background: var(--bg-2);
  color: var(--text-3);
}

.rank-info { flex: 1; min-width: 0; }

.rank-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

/* ── Tabs / Chips ── */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab {
  padding: 9px 22px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid transparent;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
  cursor: pointer;
}

.tab:hover { color: var(--text-1); background: var(--bg-3); }
.tab.on { color: var(--primary); background: var(--primary-50); border-color: var(--primary-200); font-weight: 600; }

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.chip {
  padding: 7px 18px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}

.chip:hover { color: var(--primary); border-color: var(--primary-200); }
.chip.on { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ── Detail Page ── */
.brd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-4);
}

.brd a { color: var(--text-3); }
.brd a:hover { color: var(--primary); }

.detail {
  background: var(--bg-1);
  border-radius: var(--r-xl);
  padding: 32px;
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.detail-inner {
  display: flex;
  gap: 40px;
}

.cover-lg {
  flex-shrink: 0;
  width: 200px;
}

.cover-lg img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.info { flex: 1; min-width: 0; }

.info .title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 10px;
  letter-spacing: -.3px;
}

.author-line {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 20px;
}

.author-line a { color: var(--primary); font-weight: 500; }

.stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
  min-width: 80px;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 4px;
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tags span {
  padding: 4px 14px;
  background: var(--bg-2);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.desc {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-3);
  max-height: 5.4em;
  overflow: hidden;
  transition: max-height var(--t-slow) var(--ease);
}

.desc.exp { max-height: 600px; }

.desc-toggle {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.desc-toggle:hover { text-decoration: underline; }

.action-btns {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Chapter List */
.ch-list {
  background: var(--bg-1);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.ch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.ch-head h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}

.ch-sort {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

.ch-body {
  max-height: 500px;
  overflow-y: auto;
  padding: 8px 0;
}

.ch-body::-webkit-scrollbar { width: 6px; }
.ch-body::-webkit-scrollbar-track { background: transparent; }
.ch-body::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

.vol-title {
  padding: 12px 24px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.ch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  transition: background var(--t-fast) var(--ease);
}

.ch-item:hover { background: var(--bg-2); }

.ch-item a {
  font-size: 14px;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-item a:hover { color: var(--primary); }

.ch-item .wc {
  font-size: 12px;
  color: var(--text-4);
  flex-shrink: 0;
  margin-left: 16px;
}

/* ── Reader ── */
.reader {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px var(--gap) 100px;
}

.reader-top {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.reader-top h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}

.reader-top .sub {
  font-size: 14px;
  color: var(--text-4);
}

.reader-top .sub a { color: var(--primary); }

.reader-content {
  font-family: var(--font-serif);
  font-size: var(--rd-size);
  line-height: var(--rd-lh);
  color: var(--rd-color);
  background: var(--rd-bg);
  padding: 40px 32px;
  border-radius: var(--r-lg);
  min-height: 300px;
  word-break: break-word;
  white-space: pre-wrap;
}

.reader-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.prev-ch { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-ch { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reader Settings Panel */
.rd-set {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  width: 320px;
  max-width: 90vw;
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-normal) var(--ease);
}

.rd-set.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.rd-set h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 18px;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.set-row label {
  font-size: 14px;
  color: var(--text-3);
  font-weight: 500;
}

.ctls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctls button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
}

.ctls button:hover { border-color: var(--primary); color: var(--primary); }

.val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 30px;
  text-align: center;
}

.theme-picks {
  display: flex;
  gap: 8px;
}

.theme-picks button {
  width: 34px;
  height: 34px;
  border: 2px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
}

.theme-picks button:hover { border-color: var(--primary); transform: scale(1.1); }

/* Reader Bottom Bar */
.rd-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 1000;
  padding: 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}

.rd-bar .tb {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 0;
  cursor: pointer;
  color: var(--text-3);
  transition: color var(--t-fast) var(--ease);
  max-width: 100px;
}

.rd-bar .tb:hover { color: var(--primary); }
.rd-bar .tb i { font-style: normal; font-size: 18px; }
.rd-bar .tb span { font-size: 11px; font-weight: 500; }

/* ── Search Page ── */
.search-hero {
  text-align: center;
  padding: 60px 0 40px;
}

.search-hero h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 10px;
}

.search-hero .sub {
  font-size: 15px;
  color: var(--text-3);
  margin-bottom: 32px;
}

.search-hero form {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  gap: 0;
}

.search-hero input {
  flex: 1;
  height: 52px;
  padding: 0 24px;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: var(--r-full) 0 0 var(--r-full);
  background: var(--bg-1);
  font-size: 16px;
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t-fast) var(--ease);
}

.search-hero input:focus { border-color: var(--primary); }
.search-hero input::placeholder { color: var(--text-4); }

.search-hero button {
  height: 52px;
  padding: 0 32px;
  border: none;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--t-fast) var(--ease);
  white-space: nowrap;
}

.search-hero button:hover { opacity: .9; }

/* Search Results */
.search-results { padding-bottom: 40px; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.results-count { font-size: 14px; color: var(--text-3); }
.results-count strong { color: var(--primary); }
.results-kw { font-size: 13px; color: var(--text-4); }

.result-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: var(--bg-1);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  border: 1px solid var(--border-light);
  transition: all var(--t-normal) var(--ease);
  text-decoration: none;
}

.result-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.result-cv {
  flex-shrink: 0;
  width: 90px;
  aspect-ratio: 3/4;
  border-radius: var(--r-md);
  overflow: hidden;
}

.result-cv img { width: 100%; height: 100%; object-fit: cover; }

.result-info { flex: 1; min-width: 0; }

.result-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.result-author {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.result-desc {
  font-size: 13px;
  color: var(--text-4);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-4);
  flex-wrap: wrap;
}

.result-tag {
  padding: 2px 10px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 11px;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 0;
}

.no-results-icon { font-size: 48px; margin-bottom: 16px; }

.no-results h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.no-results p { font-size: 14px; color: var(--text-4); }

/* Search Home */
.search-home { padding-bottom: 40px; }

.search-section {
  margin-bottom: 36px;
}

.search-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 16px;
}

.hot-tags {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.hot-tag {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-1);
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}

.hot-tag:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
}

.hot-tag-cv {
  width: 40px;
  height: 53px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.hot-tag-cv img { width: 100%; height: 100%; object-fit: cover; }

.hot-tag-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hot-tag-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-tag-author {
  font-size: 12px;
  color: var(--text-4);
}

/* Search Pagination */
.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

.page-btn {
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  transition: opacity var(--t-fast) var(--ease);
}

.page-btn:hover { opacity: .85; color: #fff; }

.page-info { font-size: 13px; color: var(--text-4); }

/* ── Empty State ── */
.empty {
  text-align: center;
  padding: 80px 0;
  color: var(--text-4);
}

.empty i {
  font-style: normal;
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

/* ── Footer ── */
.site-footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

.footer-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px var(--gap) 32px;
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
}

.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 14px;
}

.footer-brand .footer-logo .logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-4);
  line-height: 1.7;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col li a {
  font-size: 13px;
  color: var(--text-3);
  transition: color var(--t-fast) var(--ease);
}

.footer-col li a:hover { color: var(--primary); }

.footer-bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px var(--gap);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-4);
}

.footer-bottom a { color: var(--text-3); }
.footer-bottom a:hover { color: var(--primary); }

/* ── Responsive: Tablet (768-1024px) ── */
@media (max-width: 1024px) {
  :root { --gap: 16px; }

  .book-grid { grid-template-columns: repeat(4, 1fr); }
  .cat-grid-wrap { grid-template-columns: repeat(4, 1fr); }

  .hero-inner { padding: 40px var(--gap); gap: 32px; }
  .hero-cover { width: 180px; }
  .hero-title { font-size: 28px; }

  .detail-inner { gap: 28px; }
  .cover-lg { width: 160px; }
  .info .title { font-size: 24px; }

  .footer-main { grid-template-columns: 1fr 1fr; gap: 28px; }
  .hot-tags { grid-template-columns: repeat(2, 1fr); }
}

/* ── Responsive: Mobile (<768px) ── */
@media (max-width: 768px) {
  :root { --gap: 14px; --header-h: 56px; }

  .book-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .cat-grid-wrap { grid-template-columns: repeat(3, 1fr); gap: 10px; }

  /* Header */
  .header-nav { display: none; }
  .header-search { display: none; }
  .mobile-menu-btn { display: flex; }
  .mobile-nav { display: block; }

  .header-search input { width: 160px; }
  .header-search input:focus { width: 200px; }

  /* Hero */
  .hero-inner {
    flex-direction: column;
    text-align: center;
    padding: 36px var(--gap);
    gap: 24px;
  }

  .hero-cover { width: 160px; }
  .hero-title { font-size: 24px; }
  .hero-desc { -webkit-line-clamp: 2; }
  .hero-btns { justify-content: center; }

  /* Detail */
  .detail { padding: 20px; }
  .detail-inner { gap: 20px; }
  .cover-lg { width: 120px; }
  .info .title { font-size: 18px; margin-bottom: 8px; }
  .stats { flex-wrap: wrap; gap: 8px; }
  .tags { flex-wrap: wrap; gap: 6px; }
  .action-btns { flex-wrap: wrap; gap: 8px; }
  .desc-toggle { text-align: center; display: block; }

  /* Rank */
  .rank-item { padding: 12px 14px; }
  .rank-num { width: 28px; height: 28px; font-size: 12px; }

  /* Search */
  .search-hero { padding: 40px 0 28px; }
  .search-hero h2 { font-size: 24px; }
  .search-hero input { height: 46px; font-size: 15px; }
  .search-hero button { height: 46px; padding: 0 24px; }

  .result-card { flex-direction: row; gap: 14px; padding: 14px; }
  .result-cv { width: 70px; }
  .result-title { font-size: 15px; }

  .hot-tags { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Reader */
  .reader-content { padding: 24px 18px; }
  .reader-top h1 { font-size: 20px; }
  .rd-set { width: 280px; padding: 18px; }

  /* Category */
  .cat-card { padding: 20px 10px; }
  .cat-card-icon { font-size: 28px; }
  .cat-card-name { font-size: 13px; }

  /* Footer - minimal */
  .footer-main {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 28px var(--gap) 20px;
    text-align: center;
  }

  .footer-brand p { max-width: none; margin: 0 auto; }
  .footer-col { display: none; }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

/* ── Responsive: Small Mobile (<480px) ── */
@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-grid-wrap { grid-template-columns: repeat(2, 1fr); }

  .hero-cover { width: 130px; }
  .hero-title { font-size: 20px; }
  .hero-btns .btn { padding: 10px 20px; font-size: 13px; }

  .btn { padding: 10px 22px; font-size: 14px; }

  .search-hero form { flex-direction: column; gap: 10px; }
  .search-hero input { border-radius: var(--r-full); border-right: 2px solid var(--border); }
  .search-hero input:focus { border-color: var(--primary); }
  .search-hero button { border-radius: var(--r-full); }

  .result-card { gap: 10px; padding: 12px; }
  .result-cv { width: 60px; }
  .hot-tags { grid-template-columns: 1fr; }
}

/* ── Utilities ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.section { animation: fadeInUp .5s var(--ease) both; }
.section:nth-child(2) { animation-delay: .05s; }
.section:nth-child(3) { animation-delay: .1s; }
.section:nth-child(4) { animation-delay: .15s; }
.section:nth-child(5) { animation-delay: .2s; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ── Selection ── */
::selection { background: var(--primary-200); color: var(--primary-dark); }
[data-theme="dark"] ::selection { background: var(--primary-100); }
