/* 阅读页三栏 */
.mytheme-kb-reader {
  --kb-primary: #f03030;
  min-height: calc(100vh - 4rem);
}

.mytheme-kb-reader-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.mytheme-kb-back {
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
}

.mytheme-kb-reader-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.mytheme-kb-reader-actions {
  display: flex;
  gap: 0.35rem;
}

.mytheme-kb-icon-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.mytheme-kb-reader-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: 0;
  align-items: start;
}

.mytheme-kb-chapter-nav {
  border-right: 1px solid #f0f0f0;
  padding: 1rem;
  max-height: calc(100vh - 56px);
  overflow: auto;
  position: sticky;
  top: 56px;
}

.mytheme-kb-nav-root,
.mytheme-kb-nav-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mytheme-kb-nav-children {
  padding-left: 0.75rem;
}

.mytheme-kb-chapter-nav a {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  color: #4b5563;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.45;
}

.mytheme-kb-chapter-nav li.is-active > a {
  background: rgba(240, 48, 48, 0.08);
  color: var(--kb-primary);
  font-weight: 600;
}

.mytheme-kb-content {
  margin: 1rem;
  padding: 1.25rem 1.5rem 2rem;
}

.mytheme-kb-content-header h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
}

.mytheme-kb-entry-content pre {
  overflow: auto;
}

.mytheme-kb-attachments {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.mytheme-kb-adjacent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #eee;
}

.mytheme-kb-adjacent-link {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid #eee;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
}

.mytheme-kb-adjacent-link.next {
  text-align: right;
}

.mytheme-kb-adjacent-link span {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.mytheme-kb-page-toc {
  border-left: 1px solid #f0f0f0;
  padding: 1rem;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.mytheme-kb-page-toc-title {
  font-size: 14px;
  margin: 0 0 0.75rem;
}

.mytheme-kb-page-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mytheme-kb-page-toc-list a {
  display: block;
  font-size: 12px;
  color: #6b7280;
  text-decoration: none;
  padding: 0.25rem 0;
}

.mytheme-kb-page-toc-list .level-2 {
  padding-left: 0.75rem;
}

.mytheme-kb-page-toc-list .level-3 {
  padding-left: 1.25rem;
}

.mytheme-kb-reader.is-reading-mode .mytheme-kb-chapter-nav,
.mytheme-kb-reader.is-reading-mode .mytheme-kb-page-toc {
  display: none;
}

.mytheme-kb-reader.is-reading-mode .mytheme-kb-reader-grid {
  grid-template-columns: minmax(0, 1fr);
}

.mytheme-kb-reader.is-reading-mode .mytheme-kb-content {
  max-width: 760px;
  margin-inline: auto;
}

@media (max-width: 1024px) {
  .mytheme-kb-reader-grid {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .mytheme-kb-page-toc {
    display: none;
  }
}

@media (max-width: 767px) {
  .mytheme-kb-reader-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .mytheme-kb-chapter-nav {
    position: fixed;
    inset: 56px auto 0 0;
    width: min(82vw, 300px);
    background: #fff;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.08);
  }
  .mytheme-kb-reader.is-nav-open .mytheme-kb-chapter-nav {
    transform: translateX(0);
  }
}

.kb-mermaid {
  background: #fafafa;
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
}

.mytheme-kb-slideshow-overlay {
  position: fixed;
  inset: 0;
  background: #111;
  color: #fff;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.mytheme-kb-slideshow-overlay.is-active {
  display: flex;
}

.mytheme-kb-slideshow-content {
  max-width: 900px;
  max-height: 80vh;
  overflow: auto;
  font-size: 1.25rem;
  line-height: 1.7;
}
