/* ==========================================================================
   书架 / 书籍阅读器
   ========================================================================== */

#body-wrap.type-book-shelf .layout.hide-aside,
#body-wrap.type-book .layout.hide-aside {
  max-width: 1360px;
}

#body-wrap.type-book-shelf #page,
#body-wrap.type-book #page {
  width: 100%;
  padding: 30px;
}

#body-wrap.type-book-shelf #page-header,
#body-wrap.type-book #page-header {
  box-shadow: none;
}

#body-wrap.type-book-shelf #page > .page-title,
#body-wrap.type-book #page > .page-title {
  display: none;
}

.book-shelf-page,
.book-home,
.book-reader {
  --book-accent: #3b82f6;
  --book-accent-2: #8b5cf6;
  --book-green: #22c55e;
  --book-muted: #94a3b8;
  color: var(--font-color);
}

/* --------------------------------------------------------------------------
   书架首页
   -------------------------------------------------------------------------- */

.book-shelf-page {
  padding: 6px 0 30px;
}

.shelf-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  padding: 48px 46px;
  overflow: hidden;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 48%, #4c1d95 100%);
  box-shadow: 0 28px 60px -30px rgba(15, 23, 42, 0.85);
}

.shelf-hero::before {
  position: absolute;
  inset: 0;
  content: '';
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 70% 30%, #000 0%, transparent 75%);
}

.shelf-hero::after {
  position: absolute;
  top: -140px;
  right: -80px;
  width: 380px;
  height: 380px;
  content: '';
  background: radial-gradient(circle, rgba(125, 211, 252, 0.38) 0%, transparent 68%);
  pointer-events: none;
}

.shelf-hero-text {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.shelf-kicker {
  margin: 0;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.shelf-kicker i {
  margin-right: 6px;
}

.shelf-hero h1 {
  margin: 12px 0 14px;
  color: #fff;
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.shelf-lead {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  line-height: 1.9;
}

.shelf-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.shelf-stats > div {
  min-width: 92px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  backdrop-filter: blur(8px);
}

.shelf-stats strong {
  display: block;
  color: #fff;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
}

.shelf-stats span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 20px;
}

.shelf-search {
  position: relative;
  flex: 1;
  max-width: 430px;
}

.shelf-search i {
  position: absolute;
  top: 50%;
  left: 17px;
  color: var(--book-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.shelf-search input {
  width: 100%;
  padding: 11px 18px 11px 44px;
  border: 1px solid var(--light-grey);
  border-radius: 999px;
  outline: none;
  background: var(--card-bg);
  color: var(--font-color);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shelf-search input:focus {
  border-color: var(--book-accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.shelf-sort {
  color: var(--font-color);
  font-size: 0.88rem;
  opacity: 0.68;
}

.shelf-sort:hover {
  color: var(--book-accent);
  opacity: 1;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.book-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--card-box-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.book-card:hover {
  border-color: rgba(59, 130, 246, 0.32);
  box-shadow: var(--card-hover-box-shadow);
  transform: translateY(-5px);
}

.book-card-cover {
  position: relative;
  flex: 0 0 128px;
  align-self: flex-start;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border-radius: 13px;
  box-shadow: 0 16px 30px -16px rgba(15, 23, 42, 0.75);
}

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

.book-card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.28) 0%, transparent 38%, transparent 100%);
  pointer-events: none;
}

.book-card-status {
  position: absolute;
  bottom: 9px;
  left: 9px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}

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

.book-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

[data-theme='dark'] .book-tag {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
}

.book-card-title {
  margin: 10px 0 6px;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.45;
}

.book-card-title a {
  color: var(--text-highlight-color);
}

.book-card-title a:hover {
  color: var(--book-accent);
}

.book-card-subtitle {
  margin: 0 0 6px;
  color: var(--font-color);
  font-size: 0.8rem;
  opacity: 0.62;
  line-height: 1.6;
}

.book-card-desc {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 12px;
  color: var(--font-color);
  font-size: 0.82rem;
  line-height: 1.75;
  opacity: 0.72;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.book-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  color: var(--font-color);
  font-size: 0.75rem;
  opacity: 0.6;
}

.book-card-meta i {
  margin-right: 4px;
}

.book-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 10px;
}

.book-card-progress .book-progress-track {
  flex: 1;
}

.book-card-progress .book-progress-label {
  min-width: 64px;
  color: var(--font-color);
  font-size: 0.7rem;
  opacity: 0.6;
  text-align: right;
}

.book-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
}

.book-progress-track > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--book-accent), var(--book-accent-2));
  transition: width 0.25s ease;
}

.book-card-enter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--book-accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.book-card-enter i {
  transition: transform 0.2s ease;
}

.book-card-enter:hover i {
  transform: translateX(4px);
}

.shelf-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 30px;
  padding: 16px 20px;
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--font-color);
  font-size: 0.82rem;
  line-height: 1.8;
}

[data-theme='dark'] .shelf-tip {
  background: #161b22;
}

.shelf-tip i {
  margin-top: 4px;
  color: var(--book-accent);
}

.shelf-tip code,
.book-home-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.18);
  font-size: 0.86em;
}

.shelf-empty {
  padding: 40px 0;
  color: var(--font-color);
  text-align: center;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   书籍首页
   -------------------------------------------------------------------------- */

.book-home {
  padding: 4px 4px 26px;
}

.book-hero {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 44px;
  align-items: center;
  padding: 8px 0 36px;
}

.book-hero-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border-radius: 17px;
  box-shadow: 0 30px 56px -26px rgba(15, 23, 42, 0.85);
}

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

.book-hero-cover-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.24) 0%, transparent 34%);
  pointer-events: none;
}

.book-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--font-color);
  font-size: 0.8rem;
  opacity: 0.6;
}

.book-breadcrumb i {
  font-size: 0.62rem;
}

.book-breadcrumb a {
  color: var(--font-color);
}

.book-breadcrumb a:hover {
  color: var(--book-accent);
}

.book-hero-title {
  margin: 0 0 10px;
  color: var(--text-highlight-color);
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.35;
}

.book-hero-subtitle {
  margin: 0 0 10px;
  color: var(--font-color);
  font-size: 0.98rem;
  opacity: 0.68;
}

.book-hero-desc {
  max-width: 640px;
  margin: 0 0 16px;
  color: var(--font-color);
  font-size: 0.9rem;
  line-height: 1.85;
  opacity: 0.78;
}

.book-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 20px;
  color: var(--font-color);
  font-size: 0.8rem;
  opacity: 0.66;
}

.book-hero-meta i {
  margin-right: 5px;
}

.book-status-pill {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  font-size: 0.72rem;
  opacity: 1;
}

[data-theme='dark'] .book-status-pill {
  color: #4ade80;
}

.book-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.book-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
  background: rgba(59, 130, 246, 0.1);
  color: var(--font-color);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.book-btn:hover {
  transform: translateY(-1px);
}

.book-btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 14px 28px -14px rgba(59, 130, 246, 0.85);
}

.book-btn-primary:hover {
  color: #fff;
  box-shadow: 0 18px 34px -14px rgba(124, 58, 237, 0.9);
}

.book-btn-ghost {
  border-color: var(--light-grey);
  background: transparent;
  font-weight: 400;
}

.book-btn-ghost:hover {
  border-color: var(--book-accent);
  color: var(--book-accent);
}

.book-hero-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.book-hero-progress .book-progress-track {
  width: 120px;
}

.book-hero-progress .book-progress-label {
  color: var(--font-color);
  font-size: 0.76rem;
  opacity: 0.6;
}

.book-intro {
  padding: 26px 30px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-left: 3px solid var(--book-accent);
  border-radius: 4px 16px 16px 4px;
  background: #f8fafc;
  color: var(--font-color);
  font-size: 0.92rem;
  line-height: 1.95;
}

[data-theme='dark'] .book-intro {
  background: #161b22;
}

.book-intro h2 {
  margin: 0.6em 0 0.5em;
  padding: 0;
  border: 0;
  font-size: 1.08rem;
}

.book-intro h2:first-child {
  margin-top: 0;
}

.book-intro ul,
.book-intro ol {
  margin: 0.4em 0;
  padding-left: 1.4em;
}

.book-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 34px;
  align-items: start;
  margin-top: 34px;
}

.book-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  color: var(--text-highlight-color);
  font-size: 1.18rem;
  font-weight: 700;
}

.book-section-title i {
  color: var(--book-accent);
  font-size: 0.95em;
}

.book-home-part {
  margin-bottom: 24px;
}

.book-home-part-title {
  margin: 0 0 4px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--light-grey);
  color: var(--font-color);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  opacity: 0.55;
}

.book-home-chapter-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-home-chapter > a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 12px;
  border-radius: 11px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.book-home-chapter > a:hover {
  background: rgba(59, 130, 246, 0.07);
  transform: translateX(3px);
}

.book-home-chapter-index {
  flex: 0 0 38px;
  color: var(--book-accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

.book-home-chapter-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.book-home-chapter-text strong {
  overflow: hidden;
  color: var(--font-color);
  font-size: 0.95rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-home-chapter > a:hover .book-home-chapter-text strong {
  color: var(--book-accent);
}

.book-home-chapter-text small {
  margin-top: 3px;
  color: var(--font-color);
  font-size: 0.7rem;
  opacity: 0.48;
}

.book-home-chapter-arrow {
  color: var(--book-muted);
  font-size: 0.66rem;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.book-home-chapter > a:hover .book-home-chapter-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.book-chapter-check {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  color: var(--book-green);
  font-size: 0.78rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.book-home-chapter.is-read .book-chapter-check,
.book-chapter-item.is-read .book-chapter-check {
  opacity: 1;
  transform: scale(1);
}

.book-home-aside {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.book-resource-card,
.book-home-note {
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-box-shadow);
}

.book-resource-card h3,
.book-home-note h3 {
  margin: 0 0 12px;
  color: var(--text-highlight-color);
  font-size: 0.88rem;
  font-weight: 600;
}

.book-resource-card h3 i,
.book-home-note h3 i {
  margin-right: 6px;
  color: var(--book-accent);
}

.book-resource-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-resource-card li + li {
  margin-top: 6px;
}

.book-resource-card a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--font-color);
  font-size: 0.82rem;
  transition: background 0.18s ease, color 0.18s ease;
}

.book-resource-card a:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--book-accent);
}

.book-resource-card a > span {
  flex: 1;
}

.book-resource-out {
  font-size: 0.62rem;
  opacity: 0.45;
}

.book-home-note p {
  margin: 0 0 12px;
  color: var(--font-color);
  font-size: 0.8rem;
  line-height: 1.8;
  opacity: 0.68;
}

.book-home-note-link {
  color: var(--book-accent);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   阅读页
   -------------------------------------------------------------------------- */

.book-reader {
  position: relative;
  padding-bottom: 20px;
}

.book-reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1005;
  width: 100%;
  height: 3px;
  background: transparent;
  pointer-events: none;
}

.book-reading-bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #8b5cf6);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  transition: width 0.1s linear;
}

.book-reader-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr) 218px;
  gap: 20px;
  align-items: start;
}

.book-sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-box-shadow);
}

.book-sidebar-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--light-grey);
}

.book-sidebar-title {
  display: block;
  overflow: hidden;
  color: var(--text-highlight-color);
  font-size: 0.94rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-sidebar-title:hover {
  color: var(--book-accent);
}

.book-sidebar-sub {
  margin-top: 5px;
  color: var(--font-color);
  font-size: 0.7rem;
  opacity: 0.5;
}

.book-sidebar-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.book-sidebar-progress .book-progress-track {
  flex: 1;
  height: 5px;
}

.book-sidebar-progress span {
  color: var(--font-color);
  font-size: 0.66rem;
  opacity: 0.55;
  white-space: nowrap;
}

.book-filter {
  position: relative;
  padding: 10px 14px;
  border-bottom: 1px solid var(--light-grey);
}

.book-filter i {
  position: absolute;
  top: 50%;
  left: 25px;
  color: var(--book-muted);
  font-size: 0.72rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.book-filter input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  border: 1px solid var(--light-grey);
  border-radius: 8px;
  outline: none;
  background: transparent;
  color: var(--font-color);
  font-size: 0.78rem;
}

.book-filter input:focus {
  border-color: var(--book-accent);
}

.book-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 14px;
  overscroll-behavior: contain;
}

.book-part-group + .book-part-group {
  margin-top: 14px;
}

.book-part-title {
  padding: 8px 10px 6px;
  color: var(--font-color);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0.45;
}

.book-chapter-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-chapter-item + .book-chapter-item {
  margin-top: 2px;
}

.book-chapter-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--font-color);
  font-size: 0.8rem;
  line-height: 1.45;
  transition: background 0.18s ease, color 0.18s ease;
}

.book-chapter-link:hover {
  background: rgba(59, 130, 246, 0.07);
  color: var(--book-accent);
}

.book-chapter-link.is-current {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.16), rgba(139, 92, 246, 0.05));
  color: var(--book-accent);
  font-weight: 600;
}

.book-chapter-index {
  flex: 0 0 22px;
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0.5;
}

.book-chapter-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-chapter-time {
  color: var(--font-color);
  font-size: 0.62rem;
  opacity: 0.4;
}

.book-chapter-link .book-chapter-check {
  margin-left: 0;
}

.book-sidebar-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--light-grey);
  font-size: 0.76rem;
}

.book-sidebar-foot a {
  color: var(--font-color);
  opacity: 0.6;
}

.book-sidebar-foot a:hover {
  color: var(--book-accent);
  opacity: 1;
}

.book-main {
  min-width: 0;
  overflow: hidden;
  overflow: clip;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-box-shadow);
}

.book-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--light-grey);
  border-radius: 16px 16px 0 0;
  background: var(--card-bg);
}

.book-menu-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--light-grey);
  border-radius: 8px;
  background: transparent;
  color: var(--font-color);
  font-size: 0.76rem;
  cursor: pointer;
}

.book-toolbar-crumb {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--font-color);
  font-size: 0.76rem;
  opacity: 0.62;
}

.book-toolbar-crumb a {
  overflow: hidden;
  max-width: 34%;
  color: var(--font-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-toolbar-crumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-toolbar-crumb i {
  flex: 0 0 auto;
  font-size: 0.58rem;
  opacity: 0.5;
}

.book-mark-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  background: transparent;
  color: var(--book-green);
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.book-mark-btn.is-read,
.book-mark-btn:hover {
  background: rgba(34, 197, 94, 0.1);
}

.book-content {
  padding: 4px 40px 18px;
  font-size: 1rem;
  line-height: 1.95;
}

#article-container .book-content h2,
#article-container .book-content h3,
#article-container .book-content h4 {
  scroll-margin-top: 74px;
}

#article-container .book-content h2 {
  margin: 2.2em 0 0.9em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--light-grey);
  font-size: 1.35rem;
}

#article-container .book-content h3 {
  margin: 1.8em 0 0.7em;
  font-size: 1.12rem;
}

#article-container .book-content h4 {
  margin: 1.4em 0 0.5em;
  font-size: 1rem;
}

#article-container .book-content img {
  border-radius: 10px;
}

#article-container .book-content pre {
  border-radius: 10px;
}

#article-container .book-content table {
  display: table;
  width: 100%;
}

.book-chapter-heading {
  padding: 22px 0 2px;
}

.book-chapter-kicker {
  color: var(--book-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  opacity: 0.75;
}

.book-chapter-heading h1 {
  margin: 8px 0 6px;
  color: var(--text-highlight-color);
  font-size: clamp(1.5rem, 2.2vw, 1.95rem);
  line-height: 1.4;
}

.book-chapter-meta {
  color: var(--font-color);
  font-size: 0.74rem;
  opacity: 0.48;
}

.book-end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 10px 40px 4px;
}

.book-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 40px 28px;
}

.book-pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 13px 16px;
  border: 1px solid var(--light-grey);
  border-radius: 12px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.book-pager-link:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.05);
}

.book-pager-link.next {
  text-align: right;
}

.book-pager-link.is-empty {
  border: 0;
}

.book-pager-dir {
  color: var(--font-color);
  font-size: 0.7rem;
  opacity: 0.5;
}

.book-pager-link strong {
  overflow: hidden;
  color: var(--font-color);
  font-size: 0.84rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-pager-link:hover strong {
  color: var(--book-accent);
}

.book-mini-toc {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 16px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--card-box-shadow);
  font-size: 0.78rem;
  overscroll-behavior: contain;
}

.book-mini-toc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text-highlight-color);
  font-size: 0.78rem;
  font-weight: 700;
}

.book-mini-toc-title i {
  color: var(--book-accent);
}

.book-mini-toc .book-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-mini-toc .book-toc-list .book-toc-list {
  padding-left: 10px;
}

.book-toc-link {
  display: block;
  overflow: hidden;
  padding: 4px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--font-color);
  font-size: 0.76rem;
  line-height: 1.5;
  opacity: 0.64;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.book-toc-link:hover,
.book-toc-link.is-active {
  border-left-color: var(--book-accent);
  background: rgba(59, 130, 246, 0.07);
  color: var(--book-accent);
  opacity: 1;
}

.book-toc-item.level-3 > .book-toc-link {
  padding-left: 18px;
  font-size: 0.72rem;
  opacity: 0.55;
}

.book-toc-item.level-4 > .book-toc-link {
  padding-left: 28px;
  font-size: 0.7rem;
  opacity: 0.5;
}

.book-mini-toc-empty {
  margin: 0;
  color: var(--font-color);
  font-size: 0.74rem;
  opacity: 0.5;
}

.book-mini-top {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--light-grey);
  color: var(--font-color);
  font-size: 0.72rem;
  opacity: 0.55;
}

.book-mini-top:hover {
  color: var(--book-accent);
  opacity: 1;
}

.book-mask {
  display: none;
}

.book-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  z-index: 10010;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 0.82rem;
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.book-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 普通文章的顶部阅读进度 */
.blog-reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1005;
  width: 100%;
  height: 3px;
  pointer-events: none;
}

.blog-reading-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #49b1f5, #8b5cf6);
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .book-reader-shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .book-mini-toc {
    display: none;
  }
}

@media (max-width: 900px) {
  #body-wrap.type-book-shelf #page,
  #body-wrap.type-book #page {
    padding: 18px 10px;
  }

  .shelf-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    padding: 34px 26px;
  }

  .shelf-stats {
    width: 100%;
  }

  .shelf-stats > div {
    flex: 1;
    min-width: 0;
  }

  .shelf-grid {
    grid-template-columns: 1fr;
  }

  .book-hero {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 24px;
  }

  .book-home-grid {
    grid-template-columns: 1fr;
  }

  .book-home-aside {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .book-home-aside > * {
    flex: 1 1 260px;
  }

  .book-reader-shell {
    display: block;
  }

  .book-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1002;
    width: 86%;
    max-width: 336px;
    max-height: none;
    visibility: hidden;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.28s ease, visibility 0.28s ease;
  }

  .book-reader.menu-open .book-sidebar {
    visibility: visible;
    transform: translateX(0);
  }

  .book-reader.menu-open .book-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(2px);
  }

  .book-menu-btn {
    display: inline-flex;
  }

  .book-content {
    padding: 2px 20px 14px;
  }

  .book-toolbar {
    padding: 10px 14px;
  }

  .book-toolbar-crumb {
    font-size: 0.7rem;
  }

  .book-pager {
    padding: 16px 20px 22px;
  }

  .book-end-actions {
    padding: 8px 20px 2px;
  }
}

@media (max-width: 640px) {
  .shelf-toolbar {
    flex-wrap: wrap;
  }

  .shelf-sort {
    display: none;
  }

  .book-card {
    gap: 14px;
    padding: 14px;
  }

  .book-card-cover {
    flex-basis: 104px;
  }

  .book-card-desc {
    -webkit-line-clamp: 2;
  }

  .book-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .book-hero-cover {
    width: 168px;
  }

  .book-intro {
    padding: 20px 18px;
  }

  .book-home-chapter > a {
    gap: 10px;
    padding: 11px 8px;
  }

  .book-home-chapter-index {
    flex-basis: 30px;
  }

  .book-home-chapter-text strong {
    font-size: 0.88rem;
  }

  .book-pager {
    grid-template-columns: 1fr;
  }

  .book-pager-link.next {
    text-align: left;
  }

  .book-mark-btn span {
    display: none;
  }

  .book-toolbar-crumb {
    display: none;
  }

  .book-end-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-card,
  .book-btn,
  .book-chapter-link,
  .book-home-chapter > a {
    transition: none;
  }
}
