*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.container {
  max-width: 1860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 45px;
  width: auto;
}

.nav {
  display: flex;
  gap: 2px;
}

.nav-item {
  display: block;
  padding: 0 20px;
  height: 70px;
  line-height: 70px;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  transition: all 0.3s ease;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* 一级栏目下拉（二级分类） */
.nav-dropdown {
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}

.nav-dropdown__caret {
  display: none;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.85);
  vertical-align: middle;
}

.nav-dropdown:has(a.nav-dropdown__link) .nav-dropdown__caret {
  display: inline-block;
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 180px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  z-index: 1100;
}

.nav-dropdown__link {
  display: block;
  padding: 10px 18px;
  color: #2c3e50;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-dropdown__link:hover {
  background-color: #e8f4fc;
  color: #2980b9;
}

@media (hover: hover) and (pointer: fine) {
  .nav-dropdown:has(a.nav-dropdown__link):hover .nav-dropdown__menu,
  .nav-dropdown:has(a.nav-dropdown__link):focus-within .nav-dropdown__menu {
    display: block;
  }
}

.nav-dropdown.is-open .nav-dropdown__menu {
  display: block;
}

.nav-dropdown.is-open .nav-item--parent {
  background-color: rgba(255, 255, 255, 0.12);
}

.header-right {
  display: flex;
  align-items: center;
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-input {
  width: 200px;
  padding: 10px 15px;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background-color: #3498db;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-btn:hover {
  background-color: #2980b9;
}

/* Main Content */
.main {
  margin-top: 90px;
  padding-bottom: 60px;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
}

.content-area {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  padding: 30px;
}

.sidebar {
  position: sticky;
  top: 90px;
}

/* Book Card */
.book-card {
  display: flex;
  gap: 20px;
  padding: 25px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
  border-radius: 10px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: #3498db;
}

.book-cover {
  flex-shrink: 0;
  width: 120px;
  height: 160px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-title {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.book-title:hover {
  color: #3498db;
}

.book-desc {
  flex: 1;
  font-size: 14px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.book-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #999;
}

.book-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.book-meta i {
  font-size: 14px;
}

/* Card Grid Layout */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.card-item {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
}

.card-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: #3498db;
}

.card-item.featured {
  grid-column: span 1;
}

.card-thumb {
  display: block;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card-item:hover .card-thumb img {
  transform: scale(1.05);
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  text-decoration: none;
  margin-bottom: 10px;
  display: block;
  line-height: 1.4;
  transition: color 0.3s ease;
}

.card-title:hover {
  color: #3498db;
}

.card-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
  margin-bottom: 15px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #999;
}

.card-meta span {
  display: flex;
  align-items: center;
}

.card-meta a {
  color: #3498db;
  text-decoration: none;
}

.card-meta a:hover {
  text-decoration: underline;
}

/* Article List (legacy) */
.article-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.article-item {
  display: flex;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.3s ease;
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background-color: #fafafa;
}

.article-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-content {
  flex: 1;
  padding-left: 20px;
}

.article-title {
  font-size: 17px;
  font-weight: 500;
  color: #2c3e50;
  text-decoration: none;
  margin-bottom: 8px;
  display: block;
  transition: color 0.3s ease;
}

.article-title:hover {
  color: #3498db;
}

.article-desc {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
  margin-bottom: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.article-meta {
  font-size: 12px;
  color: #aaa;
}

/* Sidebar Panel */
.sidebar-panel {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 2px solid #3498db;
  position: relative;
}

.panel-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
}

/* Tags */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  padding: 6px 12px;
  background-color: #f0f4f8;
  color: #5a6a7a;
  text-decoration: none;
  font-size: 13px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.tag-item:hover {
  background-color: #3498db;
  color: #fff;
}

/* Recent Posts */
.recent-posts {
  padding: 0;
  margin: 0;
  list-style: none;
}

.recent-post {
  margin-bottom: 15px;
}

.recent-post:last-child {
  margin-bottom: 0;
}

.recent-post a {
  display: block;
  font-size: 14px;
  color: #444;
  text-decoration: none;
  line-height: 1.5;
  transition: color 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-post a:hover {
  color: #3498db;
}

.recent-post span {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-top: 4px;
}

/* Detail Page */
.detail-header {
  text-align: center;
  margin-bottom: 30px;
}

.detail-title {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 15px;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 14px;
  color: #888;
}

.detail-meta a {
  color: #3498db;
  text-decoration: none;
}

.detail-meta a:hover {
  text-decoration: underline;
}

.detail-body {
  font-size: 16px;
  line-height: 1.9;
  color: #444;
}

.detail-body p {
  margin-bottom: 20px;
  text-indent: 2em;
}

.detail-body h2 {
  font-size: 22px;
  font-weight: 600;
  color: #2c3e50;
  margin: 30px 0 15px;
  padding-left: 12px;
  border-left: 4px solid #3498db;
}

.detail-body h3 {
  font-size: 19px;
  font-weight: 600;
  color: #34495e;
  margin: 25px 0 12px;
}

.detail-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 15px 0;
}

.detail-body a {
  color: #3498db;
  text-decoration: none;
}

.detail-body a:hover {
  text-decoration: underline;
}

.detail-body code {
  background-color: #f4f4f4;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 14px;
  color: #c7254e;
}

.detail-body pre {
  background-color: #2c3e50;
  color: #ecf0f1;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 15px 0;
}

.detail-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Table of Contents */
.toc-container {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 25px;
  margin-top: 30px;
  margin-bottom: 25px;
}

.toc-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 20px;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background-color: #fff;
  border-radius: 8px;
  text-decoration: none;
  color: #555;
  font-size: 14px;
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
}

.toc-item:hover {
  background-color: #eff6ff;
  border-color: #3498db;
  color: #3498db;
}

.toc-item.active {
  background-color: #3498db;
  border-color: #3498db;
  color: #fff;
}

.toc-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: #f0f4f8;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.toc-item:hover .toc-number,
.toc-item.active .toc-number {
  background-color: rgba(255, 255, 255, 0.2);
}

.toc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Legacy toc-list */
.toc-list {
  padding: 0 0 0 20px;
  margin: 0;
}

.toc-list li {
  margin-bottom: 8px;
}

.toc-list li a {
  color: #555;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.toc-list li a:hover {
  color: #3498db;
}

.toc-list li.active a {
  color: #3498db;
  font-weight: 500;
}

/* Chapter Navigation */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-top: 30px;
}

.chapter-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #555;
  font-size: 14px;
  transition: color 0.3s ease;
}

.chapter-link:hover {
  color: #3498db;
}

.chapter-link.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.chapter-link.prev i {
  transform: rotate(180deg);
}

/* Footer */
.footer {
  background-color: #2c3e50;
  padding: 40px 0;
  margin-top: 50px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
  margin-bottom: 20px;
}

.footer-links a {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #fff;
}

.copyright {
  text-align: center;
  color: #95a5a6;
  font-size: 13px;
}

.copyright a {
  color: #bdc3c7;
  text-decoration: none;
}

/* Comment Form */
.comment-section {
  margin-top: 40px;
}

.comment-title {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 25px;
}

.comment-form {
  background-color: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #444;
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  display: inline-block;
  padding: 12px 30px;
  background-color: #3498db;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.submit-btn:hover {
  background-color: #2980b9;
}

/* Links Section */
.links-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e9ecef;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 20px;
}

.links-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-item {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background-color: #f8f9fa;
  color: #5a6a7a;
  text-decoration: none;
  font-size: 14px;
  border-radius: 25px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.link-item:hover {
  background-color: #3498db;
  color: #fff;
  border-color: #3498db;
}

/* ========== Home & list refinement (book theme) ========== */
.main--home {
  background: linear-gradient(180deg, #f0f4f8 0%, #f8f9fa 22%, transparent 55%);
}

.content-area--home {
  background: linear-gradient(145deg, #ffffffed 0%, #fafcfd 100%);
  border: 1px solid #e8edf2;
  box-shadow: 0 4px 24px rgba(44, 62, 80, 0.06);
}

.home-intro {
  margin: -8px 0 28px;
  padding: 14px 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(52, 152, 219, 0.08) 0%, rgba(46, 204, 113, 0.06) 100%);
  border-left: 4px solid #3498db;
}

.home-intro__line {
  margin: 0;
  font-size: 14px;
  color: #5a6f86;
  letter-spacing: 0.06em;
}

.home-section {
  margin-bottom: 44px;
}

.home-section:last-of-type {
  margin-bottom: 0;
}

.section-head {
  margin-bottom: 8px;
}

.section-head__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-head__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e2d3d;
  letter-spacing: -0.02em;
}

.section-head__badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #fff;
}

.section-head__badge--hot {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.section-head__sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: #7b8a9a;
  line-height: 1.5;
}

.section-head__title--inline {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e9ecef;
}

.links-section--home {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px dashed #d0d8e0;
}

.card-grid--home,
.card-grid--list {
  gap: 22px;
}

.card-item--home,
.card-item--list {
  position: relative;
  border-radius: 12px;
  border: 1px solid #e8ecef;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.card-item--home::before,
.card-item--list::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.card-item--home:hover::before,
.card-item--list:hover::before {
  opacity: 1;
}

.card-item--home:hover,
.card-item--list:hover {
  border-color: #c5d9eb;
  box-shadow: 0 12px 32px rgba(44, 62, 80, 0.1);
}

.content-area--list {
  border: 1px solid #e8edf2;
}

.breadcrumb-bar {
  font-size: 13px;
  color: #7b8a9a;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f6;
}

.breadcrumb-bar__link {
  color: #3498db;
  text-decoration: none;
}

.breadcrumb-bar__link:hover {
  text-decoration: underline;
}

.breadcrumb-bar__sep {
  margin: 0 8px;
  color: #cbd5e1;
}

.breadcrumb-bar__current {
  color: #475569;
  font-weight: 500;
}

/* 标签聚合页：与 .content-area--list 同顶边距、同边框，避免 breadcrumb 顶贴边 */
.content-area--tags {
  border: 1px solid #e8edf2;
}

.tags-page-head {
  margin-top: 0;
  margin-bottom: 28px;
  padding: 10px 20px 16px;
  background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 55%, #fff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.tags-page-head__row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.tags-page-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e40af;
  background: #fff;
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  line-height: 1;
}

.tags-page-head__text {
  min-width: 0;
}

.tags-page-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e2d3d;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.tags-page-meta {
  margin: 0;
  font-size: 15px;
  color: #64748b;
  line-height: 1.6;
}

.tags-page-meta strong {
  color: #2563eb;
  font-weight: 600;
}

.tags-page-meta--muted {
  color: #94a3b8;
}

.card-grid--tags {
  margin-top: 8px;
}

.list-hero {
  margin-bottom: 28px;
}

.list-hero__title {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e2d3d;
  letter-spacing: -0.02em;
}

.list-hero__desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: #64748b;
  max-width: 52em;
}

.list-pagination {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid #eef2f6;
}

.empty-state--list {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
}

.empty-state__icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.85;
}

.empty-state__title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: #475569;
}

.empty-state__text {
  margin: 0 0 20px;
  font-size: 14px;
  color: #94a3b8;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state__btn {
  display: inline-block;
  padding: 10px 22px;
  background: #2c3e50;
  color: #fff !important;
  text-decoration: none;
  border-radius: 999px;
  font-size: 14px;
  transition: background 0.2s;
}

.empty-state__btn:hover {
  background: #34495e;
}

.sidebar-panel--tags,
.sidebar-panel--recent,
.sidebar-panel--hot {
  border: 1px solid #e8edf2;
  box-shadow: 0 4px 18px rgba(44, 62, 80, 0.05);
}

.sidebar-panel--tags .panel-title {
  background: linear-gradient(90deg, rgba(52, 152, 219, 0.12) 0%, transparent 100%);
  margin: -20px -20px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #e8edf2;
}

.sidebar-panel--recent .panel-title {
  background: linear-gradient(90deg, rgba(46, 204, 113, 0.1) 0%, transparent 100%);
  margin: -20px -20px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #e8edf2;
}

.sidebar-panel--hot .panel-title {
  background: linear-gradient(90deg, rgba(231, 76, 60, 0.1) 0%, transparent 100%);
  margin: -20px -20px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #e8edf2;
}

/* 侧栏最新/热门：单行省略（与上文 .recent-post a 一致，避免被多行截断规则覆盖） */
.sidebar .recent-post a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.tag-item {
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tag-item:hover {
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
}

/* Pagination：ThinkPHP paginate() 输出 ul.pagination > li > a|span */
#page {
  margin-top: 40px;
  text-align: center;
}

#page .pagination,
ul.pagination {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pagination li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination li > a,
.pagination li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid #e9ecef;
  background-color: #fff;
  color: #5a6a7a;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pagination li > a:hover {
  background-color: #eff6ff;
  border-color: #3498db;
  color: #3498db;
}

.pagination li.active > span,
.pagination li.active > a,
.pagination a.cur {
  background-color: #3498db;
  border-color: #3498db;
  color: #fff;
  cursor: default;
}

.pagination li.active > a:hover {
  background-color: #3498db;
  border-color: #3498db;
  color: #fff;
}

.pagination li.disabled > span,
.pagination li.disabled > a {
  background-color: #f5f7f9;
  border-color: #e5e8eb;
  color: #94a3b8;
  cursor: not-allowed;
  pointer-events: none;
}

/* 少数模板仍用平铺的 p / 直接子级 a */
.pagination > p {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid #e9ecef;
  color: #5a6a7a;
}

.pagination > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  border: 1px solid #e9ecef;
  background-color: #fff;
  color: #5a6a7a;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pagination > a:hover:not(.cur) {
  background-color: #eff6ff;
  border-color: #3498db;
  color: #3498db;
}

.pagination .pageRemark {
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid #e9ecef;
  color: #94a3b8;
  font-size: 13px;
}

.pagination .pageRemark b {
  color: #3498db;
  font-weight: 600;
}

/* Content Styles */
.detail-body {
  line-height: 1.8;
  color: #333;
  font-size: 16px;
}

.detail-body p {
  margin-bottom: 16px;
  text-indent: 2em;
}

.detail-body h1,
.detail-body h2,
.detail-body h3,
.detail-body h4,
.detail-body h5,
.detail-body h6 {
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
  color: #2c3e50;
}

.detail-body h2 {
  font-size: 20px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

.detail-body h3 {
  font-size: 18px;
}

/* Remove code block style for classical texts */
.detail-body pre {
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 0;
}

.detail-body blockquote {
  border-left: 4px solid #3498db;
  padding-left: 16px;
  margin: 16px 0;
  color: #666;
  font-style: italic;
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

table caption {
  text-align: left;
  font-weight: 600;
  font-size: 16px;
  color: #2c3e50;
  margin-bottom: 12px;
}

table thead th {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #fff;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 2px solid #2471a3;
}

table thead th:first-child {
  border-radius: 8px 0 0 0;
}

table thead th:last-child {
  border-radius: 0 8px 0 0;
}

table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  color: #374151;
}

table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

table tbody tr:hover {
  background-color: #f3f4f6;
}

table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

table tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

table tfoot td {
  padding: 12px 16px;
  background-color: #f8f9fa;
  font-weight: 600;
  color: #374151;
  border-top: 2px solid #e5e7eb;
}

table th,
table td {
  word-break: break-all;
  white-space: normal;
}

/* Responsive table */
@media screen and (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table thead,
  table tbody,
  table th,
  table td,
  table tr {
    display: block;
  }
  
  table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  table tbody tr {
    border: 1px solid #e5e7eb;
    margin-bottom: 10px;
    border-radius: 8px;
  }
  
  table tbody td {
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    padding-left: 50%;
    text-align: right;
  }
  
  table tbody td:last-child {
    border-bottom: none;
  }
  
  table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-left: 12px;
    font-weight: 600;
    text-align: left;
    color: #6b7280;
  }
}

/* Detail-body specific table styles */
.detail-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.detail-body th,
.detail-body td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}

.detail-body th {
  background-color: #f8f9fa;
  font-weight: 600;
}

/* Classical Text Styles - Row-based layout */
.detail-body pre.jingwen,
.detail-body pre.comment {
  padding: 15px 18px !important;
  border-radius: 4px !important;
  line-height: 2.1 !important;
  white-space: pre-wrap !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  min-height: max-content !important;
}

.detail-body pre.jingwen {
  background-color: #fef9c3 !important;
  color: #854d0e !important;
  font-family: "STSong", "SimSun", "Songti SC", serif !important;
  font-size: 16px !important;
  border: 1px solid #fbbf24 !important;
}

.detail-body pre.comment {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif !important;
  font-size: 15px !important;
  border: 1px solid #cbd5e1 !important;
}

.detail-body pre.yiven {
  background-color: #f0fdf4 !important;
  color: #166534 !important;
  padding: 12px 16px !important;
  border-radius: 4px !important;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif !important;
  font-size: 15px !important;
  line-height: 2 !important;
  white-space: pre-wrap !important;
  border: 1px solid #86efac !important;
  margin: 4px 0 !important;
}

/* Yiwen annotation style */
.detail-body .yiwen {
  background-color: #fef9c3 !important;
  border-left: 4px solid #f59e0b !important;
  padding: 12px 16px !important;
  margin: 16px 0 !important;
  border-radius: 0 4px 4px 0 !important;
  color: #854d0e !important;
  font-size: 14px !important;
  line-height: 1.8 !important;
}

/* Floating div layout fix - Row based */
.detail-body div[style*="float:left"] {
  float: left;
  width: calc(50% - 8px);
  display: flex !important;
  min-height: 100% !important;
}

.detail-body div[style*="float:left"] pre {
  flex: 1 !important;
  min-height: 100% !important;
}

.jieshu {
  background-color: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  border-left: 4px solid #3498db;
  margin: 16px 0;
}

.jiedu {
  background-color: #fff3cd;
  padding: 16px;
  border-radius: 6px;
  border-left: 4px solid #ffc107;
  margin: 16px 0;
}

/* Three-column layout for classical text */
.detail-body .three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
  align-items: stretch;
}

.detail-body .three-col > div {
  padding: 16px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

/* Filter Tip */
.filter-tip {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #856404;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-tip i {
  color: #f59e0b;
  font-size: 16px;
}

/* System Paused */
.system-paused {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.system-paused .paused-icon {
  width: 60px;
  height: 60px;
  background-color: #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.system-paused .paused-icon i {
  color: #fff;
  font-size: 28px;
}

.system-paused .paused-content {
  flex: 1;
}

.system-paused .paused-content h3 {
  color: #1d4ed8;
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 600;
}

.system-paused .paused-content p {
  color: #374151;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.system-paused .paused-tip {
  color: #6b7280 !important;
  font-style: italic;
  margin-bottom: 0 !important;
  font-size: 13px !important;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #666;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
  }
}

@media screen and (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 15px;
  }
  
  .logo img {
    height: 35px;
  }
  
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
  }
  
  .nav-item {
    white-space: nowrap;
    height: auto;
    line-height: 36px;
    padding: 0 15px;
  }

  .nav-dropdown__menu.nav-dropdown__menu--fixed {
    border-radius: 0;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
  }

  .nav-dropdown__menu.nav-dropdown__menu--fixed .nav-dropdown__link {
    white-space: normal;
    padding: 12px 18px;
    border-bottom: 1px solid #eef2f5;
  }

  .nav-dropdown__menu.nav-dropdown__menu--fixed .nav-dropdown__link:last-child {
    border-bottom: none;
  }
  
  .search-input {
    width: 150px;
  }
  
  .search-btn {
    padding: 8px 15px;
  }
  
  .main {
    margin-top: 140px;
  }
  
  .content-area {
    padding: 20px 15px;
  }
  
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .card-thumb {
    height: 150px;
  }
  
  .book-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .book-cover {
    width: 150px;
    height: 200px;
  }
  
  .book-meta {
    justify-content: center;
  }
  
  .toc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .detail-body .three-col {
    grid-template-columns: 1fr;
  }
  
  .toc-item {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .toc-number {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  
  .article-item {
    flex-direction: column;
    text-align: center;
  }
  
  .article-thumb {
    width: 100%;
    height: 150px;
  }
  
  .article-content {
    padding-left: 0;
    padding-top: 15px;
  }
  
  .detail-title {
    font-size: 22px;
  }
  
  .detail-meta {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .chapter-nav {
    flex-direction: column;
    gap: 15px;
  }
  
  .footer-links {
    gap: 15px;
  }
}

@media screen and (max-width: 480px) {
  .search-input {
    width: 120px;
  }
  
  .book-cover {
    width: 120px;
    height: 160px;
  }
  
  .book-title {
    font-size: 18px;
  }
  
  .detail-title {
    font-size: 20px;
  }
  
  .card-thumb {
    height: 120px;
  }
  
  .toc-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Search page --- */
.search-page {
  min-height: 42vh;
}

.search-page-head {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px 28px 20px;
  margin-bottom: 28px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.search-page-title {
  margin: 0 0 18px;
  font-size: 1.45rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
}

.search-kw-mark {
  color: #2563eb;
  font-weight: 700;
}

.search-page-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.search-page-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  color: #334155;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-page-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-page-submit {
  padding: 12px 26px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.search-page-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.search-page-meta {
  margin: 14px 0 0;
  font-size: 14px;
  color: #64748b;
}

.search-page-meta--muted {
  color: #94a3b8;
}

.search-result-grid .search-hit-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.search-result-grid .search-hit-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.search-pagination {
  margin-top: 28px;
  padding: 16px 0;
}

.search-pagination .pagination {
  justify-content: center;
}

.search-empty-panel {
  text-align: center;
  padding: 56px 28px 64px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  margin-bottom: 24px;
}

.search-empty-panel--soft {
  background: #f8fafc;
  border-style: solid;
}

.search-empty-icon {
  color: #94a3b8;
  margin: 0 auto 16px;
}

.search-empty-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: #475569;
  font-weight: 600;
}

.search-empty-desc {
  margin: 0 0 24px;
  font-size: 15px;
  color: #64748b;
  line-height: 1.7;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.search-empty-btn {
  display: inline-block;
  padding: 10px 28px;
  background: #1e293b;
  color: #fff !important;
  text-decoration: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.search-empty-btn:hover {
  background: #334155;
}

@media screen and (max-width: 768px) {
  .search-page-head {
    padding: 18px 16px;
  }
  .search-page-form-row {
    flex-direction: column;
  }
  .search-page-submit {
    width: 100%;
  }
}