/* Qidian discovery surface. */
.discover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.discover-header-copy { min-width: 0; }
.discover-title {
  margin: 0;
  color: var(--editorial-ink, #1d1d1f);
  font-size: 30px;
  font-weight: 740;
  letter-spacing: -.025em;
  line-height: 1.2;
}
.discover-mascot {
  display: block;
  flex: none;
  width: 64px;
  height: 64px;
  pointer-events: none;
  user-select: none;
}
.rank-group-switch {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid #e5e9ed;
  border-radius: 12px;
  background: #eef0f3;
}
.rank-group-option {
  min-width: 76px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #687585;
  font-size: 13px;
  font-weight: 650;
}
.rank-group-option.active {
  background: #fff;
  color: #202a38;
  box-shadow: 0 1px 5px #28344614;
}
.rank-group-option:focus-visible { outline: 2px solid #0066cc; outline-offset: 3px; }
.rank-category-scroll {
  display: flex;
  gap: 8px;
  margin: 0 -2px 22px;
  padding: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.rank-category-scroll::-webkit-scrollbar { display: none; }
.rank-category {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #e0e5ea;
  border-radius: 999px;
  background: #fff;
  color: #64717f;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.rank-category.active {
  border-color: #2e4056;
  background: #2e4056;
  color: #fff;
}
.rank-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rank-section-heading-copy { min-width: 0; }
.rank-section-title {
  margin: 0;
  color: #242c36;
  font-size: 19px;
  font-weight: 730;
  line-height: 1.35;
  letter-spacing: -.015em;
}
.rank-refresh-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #e5e9ed;
  border-radius: 12px;
  background: #f7f8fa;
  color: #5f6b78;
  font-size: 13px;
  line-height: 1.5;
}
.rank-refresh-status.warning { border-color: #e8d9c5; background: #fbf6ed; color: #805c32; }
.rank-refresh-status.error { border-color: #ecd0d0; background: #fdf1f0; color: #8e4844; }
.rank-retry {
  flex: none;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid currentColor;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}
.rank-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 108px;
  margin: 8px 0 22px;
  padding: 20px;
  border: 1px solid #e5e9ed;
  border-radius: 14px;
  background: #fff;
  color: #66717e;
  font-size: 14px;
  line-height: 1.55;
}
.rank-skeleton-list { display: grid; gap: 10px; }
.rank-skeleton-row {
  height: 94px;
  border-radius: 14px;
  background: #e9edf1;
  animation: rank-skeleton-pulse 1.5s ease-in-out infinite alternate;
}
.rank-skeleton-row:nth-child(2) { animation-delay: .15s; }
.rank-skeleton-row:nth-child(3) { animation-delay: .3s; }
.rank-skeleton-row:nth-child(4) { animation-delay: .45s; }
@keyframes rank-skeleton-pulse { to { opacity: .48; } }
.featured-books {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.featured-book {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid #e3e7eb;
  border-radius: 16px;
  background: #fff;
}
.book-cover {
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  background: #e6ebf0;
}
.featured-book > .book-cover {
  width: 112px;
  height: 150px;
  margin: 14px 0 14px 14px;
  border-radius: 10px;
}
.book-cover-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.book-cover-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #647384;
  font-size: 30px;
  font-weight: 650;
}
.book-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  gap: 6px;
  padding: 14px;
}
.book-rank {
  color: #68788a;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.featured-book .book-title {
  color: #222b36;
  font-size: 16px;
  font-weight: 740;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.book-author {
  color: #6a7683;
  font-size: 12px;
  line-height: 1.45;
}
.book-description,
.ranked-desc {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #64717e;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.book-total { color: #3d526b; font-size: 12px; font-weight: 700; }
.book-latest,
.book-update {
  color: #75818d;
  font-size: 11px;
  line-height: 1.45;
}
.rank-find-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: auto;
  padding: 0 14px;
  border: 1px solid #2e4056;
  border-radius: 11px;
  background: #2e4056;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.book-copy .rank-find-source { margin-top: 8px; }
.ranked-list {
  margin: 0;
  padding: 0 14px;
  list-style: none;
  border: 1px solid #e3e7eb;
  border-radius: 16px;
  background: #fff;
}
.ranked-work {
  display: grid;
  grid-template-columns: 30px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0f2;
}
.ranked-work:last-child { border-bottom: 0; }
.ranked-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #f0f2f5;
  color: #606d7b;
  font-size: 14px;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
}
.ranked-work:nth-child(1) .ranked-number { background: #fff1cc; color: #8a6100; }
.ranked-work:nth-child(2) .ranked-number { background: #eef0f3; color: #4b5563; }
.ranked-work:nth-child(3) .ranked-number { background: #f6e6dc; color: #96572c; }
.ranked-work .book-cover {
  width: 44px;
  height: 60px;
  border-radius: 6px;
}
.ranked-work .book-cover-fallback { font-size: 18px; }
.ranked-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.ranked-title {
  color: #252e39;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.ranked-author {
  overflow: hidden;
  color: #6b7682;
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranked-work .rank-find-source { margin-left: 4px; }
.rank-category:focus-visible,
.rank-find-source:focus-visible,
.rank-retry:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 3px;
}
@media (hover: hover) {
  .rank-category:hover:not(.active),
  .rank-retry:hover { background: #f5f7f9; }
  .rank-find-source:hover { background: #40556e; }
  .featured-book:hover { border-color: #c6d0da; }
}
@media (max-width: 1050px) {
  .featured-books { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .discover-header { gap: 12px; }
  .discover-title { font-size: 27px; }
  .discover-mascot { width: 56px; height: 56px; }
  .featured-books { grid-template-columns: 1fr; }
  .featured-book > .book-cover { width: 88px; height: 118px; border-radius: 8px; }
  .ranked-work { grid-template-columns: 26px 40px minmax(0, 1fr); gap: 10px; }
  .ranked-work .book-cover { width: 40px; height: 56px; }
  .ranked-work .rank-find-source {
    grid-column: 3;
    justify-self: start;
    margin: 3px 0 0;
  }
  .rank-empty { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 390px) {
  .ranked-list { padding-inline: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  .rank-category,
  .featured-book,
  .rank-find-source,
  .rank-retry { transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
  .rank-category:active,
  .rank-find-source:active,
  .rank-retry:active { transform: scale(.97); }
}
@media (prefers-reduced-motion: reduce) {
  .rank-skeleton-row { animation: none; }
}
html[data-theme="dark"] .discover-title,
html[data-theme="dark"] .rank-section-title,
html[data-theme="dark"] .featured-book .book-title,
html[data-theme="dark"] .ranked-title { color: #f1f3f5; }
html[data-theme="dark"] .rank-group-switch { border-color: #3b4149; background: #25282d; }
html[data-theme="dark"] .rank-group-option { color: #aab4c0; }
html[data-theme="dark"] .rank-group-option.active { background: #373d45; color: #f2f5f8; }
html[data-theme="dark"] .rank-category,
html[data-theme="dark"] .rank-empty,
html[data-theme="dark"] .featured-book,
html[data-theme="dark"] .ranked-list { background: #1f2226; border-color: #3b4149; }
html[data-theme="dark"] .rank-category { color: #b2bdc9; }
html[data-theme="dark"] .rank-category.active { border-color: #8ba4c2; background: #344457; color: #eef4fb; }
html[data-theme="dark"] .book-cover { background: #30363e; }
html[data-theme="dark"] .book-cover-fallback { color: #b0bdcc; }
html[data-theme="dark"] .book-author,
html[data-theme="dark"] .book-description,
html[data-theme="dark"] .ranked-desc,
html[data-theme="dark"] .ranked-author,
html[data-theme="dark"] .book-latest { color: #a3afbc; }
html[data-theme="dark"] .book-total { color: #a9c5e6; }
html[data-theme="dark"] .rank-find-source { border-color: #9ab4d2; background: #9ab4d2; color: #152232; }
html[data-theme="dark"] .rank-find-source:hover { background: #b4cbe4; }
html[data-theme="dark"] .rank-skeleton-row { background: #30353c; }
html[data-theme="dark"] .rank-refresh-status { background: #25282d; border-color: #3b4149; color: #b5c0cc; }
html[data-theme="dark"] .rank-refresh-status.warning { background: #3a3127; border-color: #66533b; color: #dfc39c; }
html[data-theme="dark"] .rank-refresh-status.error { background: #3b2929; border-color: #694242; color: #efb4b1; }
html[data-theme="dark"] .ranked-list .ranked-number {
  background: #3b434e;
  color: #f7f9fc;
  text-shadow: none;
}

/* 书籍详情页 */
.detail-page {
  display: flex;
  flex-direction: column;
  width: min(100%, 680px);
  min-height: calc(100dvh - 154px - env(safe-area-inset-bottom));
  margin: 0 auto;
  color: var(--editorial-ink, #1d1d1f);
}
.detail-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -4px 0 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--editorial-blue, #0066cc);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.detail-content {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(44px, 7dvh, 72px) 0 32px;
}
.detail-head {
  position: relative;
  isolation: isolate;
  padding: 0 0 26px;
  border-bottom: 1px solid var(--editorial-line, #d6d6d6);
}
.detail-head > :not(.detail-rank-watermark) { position: relative; z-index: 1; }
.detail-rank-watermark {
  position: absolute;
  z-index: 0;
  top: -35px;
  right: 0;
  color: var(--editorial-ink, #1d1d1f);
  font-size: clamp(92px, 29vw, 156px);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -.06em;
  opacity: .055;
  pointer-events: none;
  user-select: none;
}
.detail-rank {
  margin: 0 0 15px;
  color: var(--editorial-blue, #0066cc);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .03em;
}
.detail-title {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 740;
  letter-spacing: -.012em;
  line-height: 1.28;
  overflow-wrap: anywhere;
}
.detail-author { margin: 14px 0 0; color: var(--editorial-muted, #707070); font-size: 15px; line-height: 1.5; }
.detail-intro { padding: 24px 0 0; }
.detail-intro-title { margin: 0 0 12px; font-size: 16px; font-weight: 650; line-height: 1.4; }
.detail-desc { margin: 0; color: var(--editorial-muted, #707070); font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.detail-actions { display: flex; margin: auto 0 0; padding-top: 34px; }
.detail-actions .primary-button { width: 100%; min-height: 52px; font-size: 16px; }
.detail-back:focus-visible, .detail-actions .primary-button:focus-visible {
  outline: 2px solid var(--editorial-blue, #0066cc);
  outline-offset: 3px;
}
@media (max-width: 480px) {
  .detail-content { padding-bottom: 34px; }
}
@media (max-height: 640px) {
  .detail-content { padding-top: 36px; }
}
