.book-topbar { position: sticky; top: 14px; z-index: 60; padding: 16px 0 0; }
.topbar-inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 78px;
  padding: 18px 22px; border-radius: var(--radius-lg); border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 250, 255, 0.9));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.book-window-controls { display: inline-flex; align-items: center; gap: 8px; }
.book-window-controls span { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.book-window-controls span:nth-child(1) { background: #ff6159; }
.book-window-controls span:nth-child(2) { background: #ffbe2f; }
.book-window-controls span:nth-child(3) { background: #28c840; }
.book-topbar-primary { min-width: 0; display: grid; gap: 4px; }
.book-brand a { color: var(--text); font-size: 1.02rem; font-weight: 750; }
.book-brand a:hover { color: var(--accent-strong); }
.book-topbar-context { color: var(--text-soft); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-topbar-actions { display: inline-flex; align-items: center; gap: 10px; }
.book-toc-toggle,
.topbar-link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.82); background: rgba(255, 255, 255, 0.56); color: var(--text);
  font-size: 0.92rem; font-weight: 650; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}
.book-toc-toggle:hover,
.topbar-link:hover { color: var(--accent-strong); border-color: rgba(31, 103, 242, 0.24); background: rgba(255, 255, 255, 0.78); }
.book-search-strip,
.book-shell,
.book-home-main { margin-top: 18px; }
.book-shell { display: grid; grid-template-columns: minmax(240px, var(--sidebar-w)) minmax(0, 1fr); gap: 22px; align-items: start; }
.book-sidebar {
  position: sticky; top: 116px; padding: 22px 18px; border-radius: var(--radius-lg); border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(244, 248, 255, 0.92)); box-shadow: var(--shadow-md);
}
.book-sidebar-title { margin-bottom: 14px; color: var(--text-soft); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.book-toc-part + .book-toc-part { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(111, 129, 156, 0.16); }
.book-toc-part-link,
.book-toc-link {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 12px; border-radius: 18px; color: var(--text-dim);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.book-toc-part-link { font-weight: 750; color: var(--text); }
.book-toc-links { display: grid; gap: 4px; margin-top: 6px; }
.book-toc-link:hover,
.book-toc-part-link:hover { background: rgba(255, 255, 255, 0.72); color: var(--accent-strong); transform: translateX(2px); }
.book-toc-link.is-active {
  background: linear-gradient(180deg, rgba(31, 103, 242, 0.12), rgba(31, 103, 242, 0.04));
  color: var(--accent-strong); box-shadow: inset 0 0 0 1px rgba(31, 103, 242, 0.12);
}
.book-toc-num { flex: 0 0 auto; min-width: 26px; color: var(--text-soft); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; }
.book-toc-link.is-active .book-toc-num { color: var(--accent-strong); }
.book-main { display: grid; gap: 20px; }
.book-header-card,
.book-content-card,
.book-nav-card {
  border-radius: var(--radius-lg); border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(247, 250, 255, 0.92));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}
.book-header-card { display: grid; gap: 14px; padding: 30px 34px; }
.book-content-card { padding: 30px 34px; }
.book-nav-card { padding: 22px 28px; }
.book-nav-card a { display: grid; gap: 6px; }
.book-nav-card small { color: var(--text-soft); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.book-nav-card strong { color: var(--text); font-size: 1rem; }
.part-guide-card { display: grid; gap: 14px; }
.part-guide-kicker { color: var(--accent-strong); font-size: 0.84rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.part-guide-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.part-guide-chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: rgba(31, 103, 242, 0.08); border: 1px solid rgba(31, 103, 242, 0.12); color: var(--accent-strong);
  font-size: 0.88rem; font-weight: 700;
}
.part-chapter-grid { display: grid; gap: 12px; }
.part-chapter-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 20px;
  border-radius: 24px; border: 1px solid rgba(111, 129, 156, 0.16); background: rgba(255, 255, 255, 0.62); color: inherit;
}
.part-chapter-card:hover { border-color: rgba(31, 103, 242, 0.18); background: rgba(255, 255, 255, 0.86); box-shadow: var(--shadow-sm); }
.part-chapter-num,
.part-chapter-arrow { color: var(--text-soft); font-weight: 800; }
.part-chapter-body { display: grid; gap: 6px; }
.part-chapter-body strong { color: var(--text); font-size: 1.02rem; }
.part-chapter-body span:last-child { color: var(--text-dim); font-size: 0.92rem; line-height: 1.66; }
.chapter-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.chapter-nav span { display: block; }
@media (max-width: 1080px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 18px 18px; }
  .book-topbar-primary { gap: 6px; }
  .book-topbar-context { white-space: normal; font-size: 0.95rem; line-height: 1.45; }
  .book-topbar-actions { grid-column: 1 / -1; justify-content: stretch; flex-wrap: wrap; gap: 12px; }
  .book-toc-toggle,
  .topbar-link { flex: 1 1 180px; min-height: 48px; }
  .book-shell { grid-template-columns: 1fr; }
  .book-sidebar {
    position: fixed; top: 114px; left: 12px; right: 12px; max-height: calc(100vh - 132px); overflow: auto; z-index: 55;
    transform: translateY(16px); opacity: 0; visibility: hidden; transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
  }
  body.book-sidebar-open .book-sidebar { transform: translateY(0); opacity: 1; visibility: visible; }
  .book-header-card,
  .book-content-card,
  .book-nav-card { padding: 26px 20px; }
  .chapter-nav { grid-template-columns: 1fr; }
}

.book-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.book-sidebar-head .book-sidebar-title { margin-bottom: 0; }
.book-sidebar-close {
  display: none; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(111, 129, 156, 0.18); background: rgba(255, 255, 255, 0.86); color: var(--text); font-weight: 650; cursor: pointer;
}
.book-sidebar-close:hover { color: var(--accent-strong); border-color: rgba(31, 103, 242, 0.24); }
@media (max-width: 1080px) {
  .book-sidebar-head { position: sticky; top: 0; z-index: 2; padding-bottom: 10px; background: inherit; }
  .book-sidebar-close { display: inline-flex; }
}
