:root {
  --bs-bg: #f4efe6;
  --bs-paper: #fffdf8;
  --bs-paper-2: #f7f1e6;
  --bs-line: #ded1be;
  --bs-line-strong: #c8b297;
  --bs-text: #31271f;
  --bs-muted: #7d6a58;
  --bs-accent: #8a6240;
  --bs-shadow: 0 16px 36px rgba(63, 43, 22, .08);
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #f8f4ed 0%, #f1e9dd 100%);
  color: var(--bs-text);
  font-family: "Georgia", "Times New Roman", "PingFang SC", serif;
}

body {
  line-height: 1.8;
}

img {
  max-width: 100%;
}

a {
  color: var(--bs-accent);
  text-decoration: none;
}

a:hover {
  color: #68452a;
}

.bs-hidden {
  display: none;
}

.bs-wrap {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
}

.bs-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 239, 230, .95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bs-line);
}

/* Row 1: brand + search/actions */
.bs-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 16px;
}

.bs-brand a {
  font-size: 26px;
  font-weight: 700;
  color: var(--bs-text);
  white-space: nowrap;
}

.bs-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Shared muted text */
.bs-meta,
.bs-mini-entry span,
.bs-mini-entry strong,
.bs-tag-cloud span,
.bs-breadcrumb,
.bs-breadcrumb a,
.bs-breadcrumb li,
.bs-diy-box strong {
  color: var(--bs-muted);
  font-size: 13px;
}

/* Row 2: nav bar */
.bs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0 12px;
  border-top: 1px solid var(--bs-line);
  margin-top: 2px;
}

.bs-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--bs-text);
  font-size: 14px;
  font-weight: 500;
  transition: .2s ease;
  white-space: nowrap;
}

.bs-nav a:hover,
.bs-home-link {
  background: rgba(255,255,255,.7);
}

.bs-home-link {
  font-weight: 700;
}

.bs-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--bs-line);
  background: #fff;
  color: var(--bs-text);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.bs-search,
.bs-search-wide {
  display: grid;
  grid-template-columns: minmax(120px, 200px) auto;
  gap: 0;
}

.bs-search input,
.bs-search-wide input {
  height: 38px;
  border-radius: 12px 0 0 12px;
  border: 1px solid var(--bs-line);
  border-right: none;
  background: #fff;
  padding: 0 14px;
  outline: none;
  color: var(--bs-text);
  font-size: 13px;
}

.bs-search input:focus {
  border-color: var(--bs-accent);
}

.bs-search button,
.bs-search-wide button,
.bs-btn {
  height: 38px;
  border: 0;
  border-radius: 0 12px 12px 0;
  padding: 0 16px;
  background: var(--bs-accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.bs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bs-btn-light {
  background: #fff;
  color: var(--bs-text);
  border: 1px solid var(--bs-line);
}

.bs-main {
  padding: 24px 0 40px;
}

.bs-book-hero,
.bs-section-cover,
.bs-search-spread,
.bs-article-book,
.bs-ledger-book,
.bs-detail-panel,
.bs-comments-box,
.bs-empty-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 22px;
}

.bs-page,
.bs-chapter-card,
.bs-chapter-entry,
.bs-detail-panel,
.bs-comments-box,
.bs-empty-page,
.bs-footer-inner {
  background: var(--bs-paper);
  border: 1px solid var(--bs-line);
  box-shadow: var(--bs-shadow);
}

.bs-page {
  padding: 28px;
  min-height: 100%;
}

.bs-book-hero .bs-page:first-child,
.bs-section-cover .bs-page:first-child,
.bs-search-spread .bs-page:first-child,
.bs-article-book .bs-page:first-child {
  border-radius: 28px 0 0 28px;
  border-right: 0;
}

.bs-book-hero .bs-page:last-child,
.bs-section-cover .bs-page:last-child,
.bs-search-spread .bs-page:last-child,
.bs-article-book .bs-page:last-child {
  border-radius: 0 28px 28px 0;
}

.bs-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f1e5d5;
  color: var(--bs-accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.bs-page-intro h1,
.bs-page-highlight h2,
.bs-page-highlight h1,
.bs-article-meta-page h1,
.bs-empty-page h1 {
  margin: 14px 0 10px;
  line-height: 1.08;
}

.bs-page-intro h1,
.bs-article-meta-page h1 {
  font-size: 48px;
}

.bs-page-highlight h2,
.bs-ledger-head h2,
.bs-search-item h3,
.bs-entry-body h3,
.bs-chapter-card h3 {
  font-size: 28px;
  line-height: 1.18;
}

.bs-page-intro p,
.bs-page-highlight p,
.bs-entry-body p,
.bs-search-item p,
.bs-chapter-card p,
.bs-diy-box span {
  color: var(--bs-muted);
}

.bs-page-mark {
  color: var(--bs-muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  margin-bottom: 10px;
}

.bs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.bs-text-link {
  font-weight: 700;
}

.bs-spread-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.bs-chapter-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
}

.bs-card-order,
.bs-entry-order {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: var(--bs-line-strong);
  font-size: 34px;
  font-weight: 700;
}

.bs-ledger-book {
  grid-template-columns: 1fr;
  background: transparent;
  box-shadow: none;
}

.bs-ledger-head {
  padding: 0 4px 14px;
}

.bs-chapter-list {
  display: grid;
  gap: 14px;
}

.bs-chapter-entry {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
}

.bs-entry-body p,
.bs-search-item p,
.bs-mini-entry span,
.bs-diy-box span {
  margin-bottom: 0;
}

.bs-breadcrumb {
  margin-bottom: 18px;
}

.bs-article-book {
  align-items: stretch;
}

.bs-article-cover {
  margin-top: 18px;
  overflow: hidden;
  border-radius: 18px;
}

.bs-article-content {
  font-size: 17px;
  line-height: 1.95;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bs-article-content > :first-child { margin-top: 0 !important; }

.bs-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 18px 0;
  display: block;
}

.bs-article-content h1, .bs-article-content h2, .bs-article-content h3,
.bs-article-content h4, .bs-article-content h5, .bs-article-content h6 {
  margin: 32px 0 14px; font-weight: 700; line-height: 1.3;
}
.bs-article-content h1 { font-size: 28px; }
.bs-article-content h2 { font-size: 24px; border-bottom: 1px solid var(--bs-line); padding-bottom: 8px; }
.bs-article-content h3 { font-size: 20px; }
.bs-article-content h4 { font-size: 18px; }

.bs-article-content p, .bs-article-content div { margin: 0 0 16px; }
.bs-article-content a { text-decoration: underline; text-underline-offset: 3px; }
.bs-article-content b, .bs-article-content strong { font-weight: 700; }

.bs-article-content ul, .bs-article-content ol {
  margin: 14px 0; padding: 0 0 0 28px; line-height: 1.8;
}
.bs-article-content ol { list-style: decimal; }
.bs-article-content ul { list-style: disc; }
.bs-article-content li { margin-bottom: 6px; }

.bs-article-content blockquote {
  border-left: 4px solid var(--bs-accent);
  padding: 14px 20px; margin: 20px 0;
  background: var(--bs-paper-2, #f7f2ea);
  border-radius: 0 14px 14px 0;
}

.bs-article-content code {
  padding: 2px 6px; margin: 0 3px;
  background: var(--bs-paper-2, #f7f2ea);
  border: 1px solid var(--bs-line);
  border-radius: 6px; font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.bs-article-content pre {
  padding: 18px 20px; margin: 20px 0;
  background: var(--bs-text);
  color: var(--bs-bg, #fff);
  border-radius: 14px; font-size: 14px; line-height: 1.6;
  overflow-x: auto; white-space: pre;
  font-family: 'Consolas', 'Monaco', monospace;
}
.bs-article-content pre code {
  padding: 0; margin: 0; background: none; border: none; color: inherit;
}

.bs-article-content hr {
  border: 0; border-top: 1px solid var(--bs-line); margin: 24px 0;
}

.bs-article-content table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  overflow-x: auto; display: block;
}
.bs-article-content td, .bs-article-content th {
  min-width: 60px; border: 1px solid var(--bs-line);
  padding: 8px 12px; text-align: left;
}
.bs-article-content th { font-weight: 700; }

/* Title word-wrap */
.bs-hero-title, .bs-article-shell h1 {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mini-entry link truncation */
.bs-mini-entry a {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bs-tag-line,
.bs-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.bs-tag-line a,
.bs-tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #faf5ed;
  border: 1px solid var(--bs-line);
  color: var(--bs-text);
}

.bs-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.bs-detail-panel,
.bs-comments-box {
  padding: 22px;
  border-radius: 24px;
}

.bs-detail-panel h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.bs-mini-entry,
.bs-search-item,
.bs-diy-box,
.bs-empty-inline {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bs-paper-2);
  border: 1px solid var(--bs-line);
}

.bs-mini-entry + .bs-mini-entry,
.bs-search-item + .bs-search-item {
  margin-top: 12px;
}

.bs-mini-entry a {
  display: block;
  color: var(--bs-text);
  font-weight: 700;
}

.bs-mini-entry strong {
  display: block;
  margin-bottom: 6px;
}

.bs-diy-grid {
  display: grid;
  gap: 12px;
}

.bs-pagination,
.pagination {
  margin-top: 18px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  margin: 4px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--bs-line);
  background: #fff;
  color: var(--bs-text);
}

.bs-empty-inline {
  text-align: center;
  color: var(--bs-muted);
}

.bs-footer {
  padding: 0 0 30px;
}

.bs-footer-inner {
  padding: 20px 24px;
  text-align: center;
  border-radius: 22px;
}

.bs-footer p {
  margin: 0;
  color: var(--bs-muted);
}

.bs-empty-page {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 50px 24px;
  border-radius: 28px;
}

.bs-scrolltop {
  position: fixed;
  right: 20px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--bs-accent);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .25s ease;
  box-shadow: 0 8px 24px rgba(70, 46, 27, .22);
}

.bs-scrolltop.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 991px) {
  .bs-book-hero,
  .bs-section-cover,
  .bs-search-spread,
  .bs-article-book,
  .bs-spread-grid,
  .bs-detail-grid {
    grid-template-columns: 1fr;
  }

  .bs-menu-toggle {
    display: inline-flex;
  }

  .bs-nav {
    display: none;
    border-top: none;
    padding: 8px 0 12px;
  }

  .bs-nav.open {
    display: flex;
  }

  .bs-search,
  .bs-search-wide {
    grid-template-columns: 1fr;
  }

  .bs-book-hero .bs-page:first-child,
  .bs-section-cover .bs-page:first-child,
  .bs-search-spread .bs-page:first-child,
  .bs-article-book .bs-page:first-child {
    border-radius: 28px 28px 0 0;
    border-right: 1px solid var(--bs-line);
    border-bottom: 0;
  }

  .bs-book-hero .bs-page:last-child,
  .bs-section-cover .bs-page:last-child,
  .bs-search-spread .bs-page:last-child,
  .bs-article-book .bs-page:last-child {
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 767px) {
  .bs-wrap {
    width: min(100% - 16px, 1280px);
  }

  .bs-main {
    padding-top: 16px;
  }

  /* Header mobile */
  .bs-header-top {
    flex-wrap: wrap;
    min-height: 50px;
    gap: 8px;
  }

  .bs-brand a {
    font-size: 22px;
  }

  .bs-search,
  .bs-search-wide {
    grid-template-columns: 1fr auto;
  }

  .bs-page,
  .bs-detail-panel,
  .bs-comments-box,
  .bs-chapter-card,
  .bs-chapter-entry,
  .bs-footer-inner,
  .bs-empty-page {
    padding: 18px;
  }

  .bs-page-intro h1,
  .bs-article-meta-page h1,
  .bs-empty-page h1 {
    font-size: 32px;
  }

  .bs-page-highlight h2,
  .bs-ledger-head h2,
  .bs-search-item h3,
  .bs-entry-body h3,
  .bs-chapter-card h3 {
    font-size: 22px;
  }

  .bs-chapter-card,
  .bs-chapter-entry {
    grid-template-columns: 1fr;
  }

  /* Article content mobile */
  .bs-article-content { font-size: 15px; }
  .bs-article-content h1 { font-size: 24px; }
  .bs-article-content h2 { font-size: 20px; }
  .bs-article-content h3 { font-size: 18px; }
  .bs-article-content pre { font-size: 12px; padding: 14px; }
  .bs-article-content td, .bs-article-content th { padding: 6px 8px; min-width: 40px; }
  .bs-article-content img { border-radius: 10px; margin: 12px 0; }
}
