/* === 重置 === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: #2a2a2a;
  background: #fafaf7;
  font-size: 16px;
}
a { color: #1a6d4f; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 布局 === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === 顶栏 === */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e6e2d8;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.logo {
  font-size: 18px;
  font-weight: 600;
  color: #1a6d4f;
}
.logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  color: #555;
  padding: 4px 8px;
  border-radius: 4px;
}
.nav-links a.active { background: #1a6d4f; color: white; }

/* === Hero 区 === */
.hero { padding: 32px 0 16px; }
.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  color: #1a3a2a;
}
.subtitle { color: #6b6b6b; margin: 0 0 24px; }
.subtitle span { font-weight: 600; color: #1a6d4f; }

/* === 过滤区 === */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 8px;
}
.filters label { font-size: 14px; color: #555; display: flex; align-items: center; gap: 6px; }
.filters select, .filters input[type=search] {
  padding: 6px 10px;
  border: 1px solid #d0ccc2;
  border-radius: 4px;
  font-size: 14px;
  background: white;
}
.filters input[type=search] { min-width: 200px; }
.filters .checkbox { display: flex; align-items: center; }

/* === 卡片网格 === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 24px 0;
}
.card {
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 8px;
  padding: 18px 20px;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: #1a6d4f;
}
.card .card-grade {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  color: #888;
  background: #f4f1e9;
  padding: 2px 8px;
  border-radius: 4px;
}
.card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1a3a2a;
  padding-right: 60px;
}
.card .card-author {
  font-size: 13px;
  color: #6b6b6b;
  margin: 0;
}
.card .card-category {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef4ee;
  color: #1a6d4f;
  align-self: flex-start;
}
.card[data-category="文学"] .card-category { background: #f4eee8; color: #8b5a2b; }
.card[data-category="自然科学"] .card-category { background: #e8f0f4; color: #2b5a8b; }
.card[data-category="艺术"] .card-category { background: #f4e8ee; color: #8b2b5a; }
.card[data-category="人文社科"] .card-category { background: #eee8f4; color: #5a2b8b; }

.card .card-status {
  font-size: 13px;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.song   { background: #d0d0d0; }
.status-dot.partial { background: #e0b048; }
.status-dot.complete { background: #4caf50; }
.card[data-available="complete"] .card-actions a {
  background: #1a6d4f;
  color: white;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
}
.card[data-available="partial"] .card-actions a {
  background: #b88420;
  color: white;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
}
.card[data-available="song"] .card-actions a {
  background: #f4f1e9;
  color: #888;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: not-allowed;
}
.card-actions { display: flex; gap: 8px; margin-top: 8px; }

/* === 详情页 === */
.book-hero {
  padding: 32px 0;
  border-bottom: 1px solid #e6e2d8;
  margin-bottom: 24px;
}
.back-link {
  font-size: 14px;
  color: #1a6d4f;
}
.book-hero h1 {
  margin: 12px 0 8px;
  font-size: 32px;
  color: #1a3a2a;
}
.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  color: #555;
  font-size: 14px;
}
.book-meta span { background: #f4f1e9; padding: 4px 10px; border-radius: 4px; }
.book-progress {
  margin: 16px 0;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: #f4f1e9;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a6d4f, #4caf50);
  transition: width 0.3s;
}
.book-actions { display: flex; gap: 12px; margin-top: 16px; }

.btn {
  padding: 10px 20px;
  border: 1px solid #d0ccc2;
  border-radius: 4px;
  background: white;
  color: #2a2a2a;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: #f4f1e9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #1a6d4f; color: white; border-color: #1a6d4f; }
.btn-primary:hover { background: #155a3f; color: white; }
.btn-secondary { background: white; color: #1a6d4f; border-color: #1a6d4f; }
.btn-tiny { padding: 4px 10px; font-size: 12px; }

/* === 章节列表 === */
.chapters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 40px;
}
.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 6px;
  transition: all 0.15s;
}
.chapter-item:hover { border-color: #1a6d4f; }
.chapter-item .ch-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f4f1e9;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.chapter-item .ch-title { flex: 1; font-size: 15px; }
.chapter-item .ch-meta { font-size: 13px; color: #888; margin-right: 12px; }
.chapter-item .ch-status { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.ch-status.complete { background: #e8f4ec; color: #1a6d55; }
.ch-status.partial { background: #f4f1e0; color: #8b6020; }
.ch-status.song { background: #f0f0f0; color: #888; }
.chapter-item a.ch-play {
  background: #1a6d4f;
  color: white;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
}
.chapter-item a.ch-play.disabled {
  background: #d0d0d0;
  cursor: not-allowed;
}

/* === 播放器 === */
.player-hero {
  padding: 32px 0 16px;
}
.breadcrumb { color: #888; font-size: 14px; margin-top: 12px; }
.breadcrumb .sep { margin: 0 8px; color: #ccc; }
.player-hero h1 {
  margin: 8px 0 0;
  font-size: 28px;
  color: #1a3a2a;
}
.player-box {
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.player-box audio {
  width: 100%;
  margin-bottom: 16px;
}
.player-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.player-status {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: #888;
}

/* === 文本区 === */
.lyrics {
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.lyrics h3 { margin: 0 0 16px; font-size: 16px; }
.lyrics p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.8;
  color: #444;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 4px;
}
.lyrics p.active {
  background: #fff8d8;
  color: #1a3a2a;
  font-weight: 500;
}

/* === 章节快速导航 === */
.chapters-nav h3 { font-size: 16px; margin: 24px 0 12px; }
#chapter-quick-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
#chapter-quick-nav a {
  display: block;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e6e2d8;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  color: #1a6d4f;
}
#chapter-quick-nav a:hover {
  background: #f4f1e9;
  text-decoration: none;
}
#chapter-quick-nav a.active {
  background: #1a6d4f;
  color: white;
}

/* === Footer === */
.footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid #e6e2d8;
  text-align: center;
  color: #888;
  font-size: 13px;
}
.footer p { margin: 4px 0; }
.muted { color: #999; font-size: 13px; }

/* === 响应式 === */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero h1, .book-hero h1, .player-hero h1 { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input[type=search] { width: 100%; }
}

/* === 状态提示 === */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}
.empty p { margin: 0; font-size: 15px; }

.book-source {
  background: #f4f1e9;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 24px 0;
}
.book-source h3 { margin: 0 0 12px; font-size: 16px; }
.book-source p { margin: 8px 0; font-size: 14px; line-height: 1.7; }