/* 1. Tomato Novel Style Book Card */
.book-card {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 14px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.book-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-medium);
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.12), 0 2px 8px var(--accent-gold-subtle);
}

.book-cover-wrap {
  position: relative;
}

.desktop-score-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  color: #ff3b5c;
  background: rgba(255, 59, 92, 0.12);
  border: 1px solid rgba(255, 59, 92, 0.25);
  padding: 1.5px 6px;
  border-radius: 6px;
  line-height: 1;
}

.book-card-title {
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  height: 2.7em; /* 无论1行还是2行标题，高度绝对等高 */
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card:hover .book-card-title {
  color: var(--accent-gold);
}

.book-card-desc {
  font-size: 12px;
  line-height: 1.45;
  height: 2.9em; /* 无论简介长短，高度绝对等高 */
  color: var(--text-secondary);
  margin-bottom: 6px;
  opacity: 0.88;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.book-card-meta .dot {
  opacity: 0.4;
}

.book-tag-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 500;
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* 2. Mini 3D Book Cover */
.book-cover-mini {
  position: relative;
  width: 82px;
  height: 112px;
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  box-shadow:
    -3px 4px 10px rgba(0, 0, 0, 0.28),
    inset 3px 0 4px rgba(255, 255, 255, 0.18),
    inset -1px 0 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
}

.book-cover-mini::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.4) 0%, rgba(255, 255, 255, 0.2) 40%, rgba(0, 0, 0, 0.2) 100%);
  z-index: 5;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.book-cover-mini::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.14) 0%, transparent 60%);
  pointer-events: none;
}

.book-card:hover .book-cover-mini {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    -5px 8px 16px rgba(0, 0, 0, 0.38),
    0 2px 8px var(--accent-gold-subtle);
}

/* Classic Bookcloth Tones */
.cover-theme-slate {
  background: linear-gradient(145deg, #2b3a4a 0%, #1a2530 100%);
  border-left: 3px solid #60a5fa;
}
.cover-theme-ochre {
  background: linear-gradient(145deg, #854d0e 0%, #452405 100%);
  border-left: 3px solid #fbbf24;
}
.cover-theme-forest {
  background: linear-gradient(145deg, #14532d 0%, #052e16 100%);
  border-left: 3px solid #34d399;
}
.cover-theme-crimson {
  background: linear-gradient(145deg, #881337 0%, #4c0519 100%);
  border-left: 3px solid #fb7185;
}
.cover-theme-indigo {
  background: linear-gradient(145deg, #312e81 0%, #1e1b4b 100%);
  border-left: 3px solid #818cf8;
}
.cover-theme-carbon {
  background: linear-gradient(145deg, #3f3f46 0%, #18181b 100%);
  border-left: 3px solid #d4d4d8;
}

/* 3. Badge Chips */
.badge-gold {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--accent-gold-subtle);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
}
.badge-neutral {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* 4. Filter Tags & Pills */
.filter-pill {
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.filter-pill:hover {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}
.filter-pill.active {
  background-color: var(--accent-gold);
  color: #ffffff;
  font-weight: 600;
  border-color: var(--accent-gold);
  box-shadow: 0 3px 10px var(--accent-gold-subtle);
}

/* 5. Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  background-color: var(--accent-gold);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-gold-subtle);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background-color: var(--accent-gold-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-gold-subtle);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}
.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Custom Select Field Styling */
.select-field {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(230,184,115,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 11px;
  padding-right: 26px !important;
  cursor: pointer;
  transition: all 0.18s ease;
}
.select-field:hover, .select-field:focus {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 0 2px var(--accent-gold-subtle);
}

/* ==========================================================================
   设计图1：移动端双列瀑布流海报卡（Waterfall Card）
   ========================================================================== */

@media (max-width: 640px) {
  #booksGrid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    align-items: stretch !important;
  }
}

.wf-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.wf-card:active { transform: scale(0.977); }

/* 封面海报：3:4 渐变底 + 居中书名 */
.wf-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}
.wf-cover::after {
  /* 轻微高光，模拟封面质感 */
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 78% 8%, rgba(255,255,255,0.14) 0%, transparent 55%),
    linear-gradient(to top, rgba(0,0,0,0.42) 0%, transparent 42%);
  pointer-events: none;
}
.wf-cover-body {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px 24px;
  text-align: center;
}
.wf-cover-title {
  font-family: "Songti SC", "SimSun", "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wf-cover-title.long { font-size: 14px; }
.wf-cover-author {
  font-size: 9.5px;
  color: rgba(255,255,255,0.82);
  letter-spacing: 0.06em;
}

/* 评分角标（橙红渐变胶囊，左下角） */
.wf-score {
  position: absolute;
  left: 7px;
  bottom: 7px;
  z-index: 3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
  padding: 1.5px 7px;
  border-radius: 7px 7px 7px 2px;
  background: linear-gradient(135deg, #ff7a18, #ff3b5c);
  box-shadow: 0 2px 8px rgba(255, 59, 92, 0.45);
}
.wf-score em { font-style: normal; font-size: 9px; margin-left: 1px; }

/* 续读标记（右上角） */
.wf-resume {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 3;
  font-size: 9.5px;
  font-weight: 600;
  color: #ffe9b8;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(230,184,115,0.4);
  padding: 2px 7px;
  border-radius: 999px;
}

/* 卡片下方文字区：固定统一行高与高度，确保1行与2行标题卡片完全等高 */
.wf-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 8px 10px 10px;
  box-sizing: border-box;
}
.wf-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  height: 2.7em; /* 精准锁定 2 行高度：无论1行还是2行文字，高度绝对一致 */
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wf-desc {
  font-size: 11px;
  line-height: 1.45;
  height: 2.9em; /* 精准锁定 2 行高度：无论简介多长多短，高度绝对一致 */
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 海报渐变底色（沿用书架 6 色系） */
.wf-cover.cover-theme-slate   { background: linear-gradient(168deg, #35506b 0%, #22364a 46%, #101a24 100%); }
.wf-cover.cover-theme-ochre   { background: linear-gradient(168deg, #9a5d15 0%, #6b3a08 48%, #34190a 100%); }
.wf-cover.cover-theme-forest  { background: linear-gradient(168deg, #1c6b40 0%, #124a2c 48%, #07230f 100%); }
.wf-cover.cover-theme-crimson { background: linear-gradient(168deg, #a32047 0%, #6e1230 48%, #33060f 100%); }
.wf-cover.cover-theme-indigo  { background: linear-gradient(168deg, #43389e 0%, #2b2769 48%, #131233 100%); }
.wf-cover.cover-theme-carbon  { background: linear-gradient(168deg, #4b4b52 0%, #2e2e33 48%, #141417 100%); }
