:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "SimSun", "STSong", "Noto Serif CJK SC", serif;
  --reader-max-width: 820px;
}

/* 阅读器专属配色主题 */
body.theme-light {
  --reader-bg: #ffffff;
  --reader-text: #2c3e50;
  --reader-border: #eaeaea;
  --reader-hover: #f5f5f5;
  --reader-toolbar: rgba(255, 255, 255, 0.95);
}

body.theme-parchment {
  --reader-bg: #f6f1e7;
  --reader-text: #382f24;
  --reader-border: #e7decb;
  --reader-hover: #eae1d0;
  --reader-toolbar: rgba(246, 241, 231, 0.95);
}

body.theme-green {
  --reader-bg: #e3eed7;
  --reader-text: #243821;
  --reader-border: #d0e0c2;
  --reader-hover: #d7e7c9;
  --reader-toolbar: rgba(227, 238, 215, 0.95);
}

body.theme-dark {
  --reader-bg: #18181b;
  --reader-text: #e4e4e7;
  --reader-border: #27272a;
  --reader-hover: #27272a;
  --reader-toolbar: rgba(24, 24, 27, 0.95);
  --bg-main: #09090b;
  --bg-card: #18181b;
  --bg-subtle: #27272a;
  --border: #27272a;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==================== 顶部导航 ==================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-btn:hover {
  color: var(--primary);
  background-color: var(--bg-subtle);
}

.nav-btn.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==================== 主内容容器 ==================== */
.main-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.2s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 搜索视图 ==================== */
.search-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  max-width: 760px;
  margin: 0 auto;
}

.hero-heading {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, #1e293b 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.theme-dark .hero-heading {
  background: linear-gradient(135deg, #f8fafc 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.search-input-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.4rem 0.5rem 0.4rem 1.2rem;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.search-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.05rem;
  color: var(--text-main);
  padding: 0.5rem 0;
}

.search-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

.hot-tags-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.tag-label {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-right: 0.25rem;
}

.tag-pill {
  font-size: 0.82rem;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.tag-pill:hover {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--primary-light);
}

/* 搜索结果卡片流 */
.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.book-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.book-cover-wrap {
  width: 85px;
  height: 115px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #475569, #1e293b);
  position: relative;
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-fallback {
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.2;
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.book-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.book-desc-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 0.6rem;
  flex: 1;
}

.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
}

.btn-card {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-card:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ==================== 详情视图 ==================== */
.detail-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.detail-hero {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.75rem;
}

.detail-cover {
  width: 150px;
  height: 200px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  background: linear-gradient(135deg, #334155, #0f172a);
}

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

.detail-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.detail-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.detail-author-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.detail-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  background-color: var(--bg-subtle);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  width: fit-content;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.detail-btns {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background-color: var(--border);
}

.btn-download-glow {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  transition: all 0.15s ease;
}

.btn-download-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.detail-intro-box {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.intro-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.intro-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ==================== 目录视图 ==================== */
.catalog-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.catalog-search-box {
  position: relative;
  min-width: 260px;
}

.catalog-search-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  outline: none;
  font-size: 0.9rem;
}

.catalog-search-input:focus {
  border-color: var(--primary);
  background-color: var(--bg-card);
}

.catalog-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.chapter-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapter-item:hover {
  background-color: var(--primary-light);
  border-color: #93c5fd;
  color: var(--primary);
}

.chapter-item.active-reading {
  background-color: #dbeafe;
  border-color: var(--primary);
  color: var(--primary-hover);
  font-weight: 600;
}

/* ==================== 正文阅读器视图 ==================== */
.reader-wrapper {
  background-color: var(--reader-bg);
  min-height: 80vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--reader-border);
  box-shadow: var(--shadow-md);
  position: relative;
  transition: background-color 0.25s ease;
}

/* 顶部阅读器工具条 */
.reader-top-bar {
  position: sticky;
  top: 64px;
  z-index: 40;
  background-color: var(--reader-toolbar);
  border-bottom: 1px solid var(--reader-border);
  backdrop-filter: blur(10px);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.reader-book-crumbs {
  font-size: 0.88rem;
  color: var(--reader-text);
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.crumb-link {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumb-link:hover {
  color: var(--primary);
}

.reader-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tool-group {
  display: flex;
  align-items: center;
  background-color: var(--reader-hover);
  border: 1px solid var(--reader-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.tool-btn {
  border: none;
  background: transparent;
  color: var(--reader-text);
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.tool-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.theme-dots {
  display: flex;
  gap: 0.4rem;
  margin-left: 0.25rem;
}

.theme-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.theme-dot:hover {
  transform: scale(1.15);
}

.theme-dot.active {
  border-color: var(--primary);
  transform: scale(1.1);
}

.dot-light { background-color: #ffffff; border: 1px solid #ccc; }
.dot-parchment { background-color: #f6f1e7; border: 1px solid #d4c8b2; }
.dot-green { background-color: #e3eed7; border: 1px solid #bcd1a8; }
.dot-dark { background-color: #18181b; border: 1px solid #444; }

/* 正文渲染容器 */
.reader-article {
  max-width: var(--reader-max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  color: var(--reader-text);
}

.chapter-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--reader-border);
}

.reader-chapter-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.reader-chapter-meta {
  font-size: 0.85rem;
  opacity: 0.7;
}

.reader-content-body {
  font-size: 18px;
  line-height: 1.85;
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}

.reader-content-body p {
  margin-bottom: 1.25em;
  text-indent: 2em;
  text-align: justify;
}

/* 底部翻页控制器 */
.reader-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--reader-max-width);
  margin: 2rem auto 3rem;
  padding: 1.5rem 1rem 0;
  border-top: 1px solid var(--reader-border);
  gap: 1rem;
}

.btn-nav-page {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--reader-border);
  background-color: var(--reader-hover);
  color: var(--reader-text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-nav-page:hover:not(:disabled) {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

/* ==================== 抽屉式侧边栏目录 ==================== */
.drawer-mask {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-mask.open {
  opacity: 1;
  pointer-events: auto;
}

.catalog-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 85vw;
  background-color: var(--bg-card);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer-mask.open .catalog-drawer {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ==================== 模态弹窗 (下载) ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: 500px;
  max-width: 92vw;
  padding: 1.75rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-box {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  margin-bottom: 1.5rem;
}

.download-book-preview {
  background-color: var(--bg-subtle);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-icon {
  font-size: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  margin-left: 1.5rem;
}

.input-num {
  width: 90px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.download-progress-box {
  margin-top: 1.15rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  display: none;
  animation: fadeIn 0.2s ease forwards;
}

.download-progress-box.show {
  display: block;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  background-color: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  background-size: 30px 30px;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
  border-radius: 9999px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressStripes 1.2s linear infinite;
}

@keyframes progressStripes {
  from { background-position: 30px 0; }
  to { background-position: 0 0; }
}

.progress-status-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 阅读器顶部全局阅读进度条 */
.reading-progress-track {
  width: 100%;
  height: 4px;
  background-color: transparent;
  position: sticky;
  top: 108px;
  z-index: 41;
  overflow: hidden;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 0.3s ease;
}

/* ==================== 全局 Toast 提示 ==================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background-color: #1e293b;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInRight 0.25s ease forwards;
  pointer-events: auto;
}

.toast.success { background-color: #059669; }
.toast.error { background-color: #dc2626; }
.toast.info { background-color: #2563eb; }

.download-task-card { padding: 1rem 0; border-bottom: 1px solid var(--border-color, #ddd); }
.download-task-card a { display: inline-block; margin-right: 1rem; }
#dlSuccessSummary .btn-secondary { margin-left: .75rem; padding: .35rem .65rem; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .nav-container {
    height: auto;
    min-height: 60px;
    padding: 0.6rem 0.9rem;
    flex-wrap: wrap;
    gap: 0.55rem;
  }
  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }
  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
  }
  .brand-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-subtitle,
  .status-badge {
    display: none;
  }
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
    gap: 0.3rem;
  }
  .nav-btn {
    flex: 0 1 auto;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    min-height: 44px;
  }
  .main-wrapper {
    padding: 1rem 0.85rem 2rem;
  }
  .hero-heading {
    font-size: clamp(1.45rem, 6vw, 2rem);
  }
  .hero-desc {
    font-size: 0.9rem;
  }
  .search-input-box {
    padding: 0.3rem 0.35rem 0.3rem 0.8rem;
    gap: 0.25rem;
  }
  .search-input {
    min-width: 0;
    font-size: 1rem;
  }
  .search-btn {
    padding: 0.6rem 0.9rem;
    white-space: nowrap;
  }
  .hot-tags-row {
    justify-content: flex-start;
    gap: 0.4rem;
  }
  .books-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .detail-card {
    padding: 1rem;
  }
  .detail-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }
  .detail-cover {
    width: 120px;
    height: 160px;
  }
  .detail-title {
    font-size: 1.45rem;
  }
  .detail-author-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
  }
  .detail-meta {
    width: 100%;
  }
  .detail-stats {
    width: 100%;
    margin: 0 0 1rem;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 0.7rem 0.5rem;
  }
  .stat-num {
    font-size: 1.05rem;
  }
  .detail-btns {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .detail-btns > button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .card-actions .btn-card {
    min-height: 44px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }
  .catalog-toolbar > div {
    flex-wrap: wrap;
    width: 100%;
  }
  .catalog-search-box {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }
  .catalog-grid {
    grid-template-columns: 1fr;
    max-height: none;
    padding-right: 0;
  }
  .reader-top-bar {
    position: relative;
    top: 0;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
  }
  .reader-book-crumbs {
    width: 100%;
  }
  .reader-tools {
    flex-wrap: wrap;
    width: 100%;
    gap: 0.4rem;
  }
  .theme-dots {
    margin-left: 0;
  }
  .reader-tools .nav-btn {
    min-height: 36px;
  }
  .reader-article {
    padding: 1.25rem 0.95rem 3rem;
  }
  .reader-chapter-title {
    font-size: 1.3rem;
  }
  .reader-content-body {
    font-size: 17px;
  }
  .modal-box {
    width: calc(100vw - 1.5rem);
    max-width: 500px;
    max-height: 90vh;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1.15rem;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.55rem;
  }
  .modal-footer > button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .download-book-preview {
    align-items: flex-start;
  }
  .range-inputs {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .input-num {
    flex: 1 1 90px;
    width: auto;
    min-width: 0;
  }
  .download-task-card {
    overflow-wrap: anywhere;
  }
  .download-task-card a,
  .download-task-card button {
    margin-bottom: 0.35rem;
  }
  .progress-info-row {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .modal-close-btn,
  .drawer-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }
}
@media (max-width: 420px) {
  .brand-title {
    font-size: 0.92rem;
  }
  .nav-btn {
    font-size: 0.76rem;
    padding: 0.38rem 0.5rem;
  }
  .search-btn {
    padding: 0.55rem 0.75rem;
  }
  .hero-heading {
    font-size: 1.4rem;
  }
  .reader-content-body {
    font-size: 16px;
  }
}
