/* ========================================
  诗词汇 - 全局样式表
  Shicihui - Global Stylesheet
  
  目录结构：
  1. Design Tokens - 设计变量
  2. Base Reset - 基础重置
  3. Utility Classes - 工具类
  4. Layout Components - 布局组件
  5. Header - 顶部导航
  6. Breadcrumbs - 面包屑导航
  7. Footer - 页脚
  8. Card Components - 卡片组件
  9. Page Sections - 页面区块（Hero等）
  9.5. Search Box - 搜索框组件
  10.5. Content Card - 内容卡片（含搜索结果扩展）
  11. Content Card Lists - 内容卡片列表
  11.5. Content Card Components - 内容卡片子组件
  12. Sidebar Layout - 侧边栏布局
  13. Dark Mode - 暗黑模式
  ======================================== */

/* ============ 1. Design Tokens ============ */
:root {
  --bg: linear-gradient(135deg, #fdfcfb 0%, #f3f4f6 100%);
  --text: #1d1d1f;
  --muted: #5f6472;
  --accent: #c89b3c;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
  --glass: rgba(255,255,255,0.7);
  --glass-border: rgba(255,255,255,0.5);
  
  /* Accent gradient background */
  --accent-gradient: linear-gradient(135deg, rgba(200,155,60,0.12), rgba(255,255,255,0.9));
  --accent-border: rgba(200,155,60,0.2);
  --accent-shadow: 0 10px 26px rgba(200,155,60,0.16);
}

/* ============ 2. Base Reset ============ */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body {
  font-family: "Source Han Serif SC","Noto Serif CJK SC","Songti SC","SimSun", serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

a, button { 
  font-family: inherit; 
}

/* ============ 2.5 Utility Classes ============ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============ 3. Layout Components ============ */
.page {
  max-width: 1024px;
  margin: 0 auto;
  padding: 32px 18px 30px;
}

/* Mobile: unify page paddings on all sides */
@media (max-width: 640px) {
  .page {
    padding: 18px 18px;
  }
}

.section { 
  margin-bottom: 32px; 
}

.section q {
  font-size: 14px;
  font-style: italic;
  &::before {
    content: '——';
  }
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}

/* Section title count: scoped child style */
.section-title .section-count {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 400;
}

/* ============ 4. Header ============ */
.header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: transparent;
  border-bottom: none;
}

.header .logo {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.header .logo img{ 
  height: 36px;
}

.header .main-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.header .main-nav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.header .main-nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(200,155,60,0.1), rgba(255,255,255,0.7));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header .main-nav a:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), inset 0 -1px 0 rgba(200,155,60,0.2);
}

.header .main-nav a:hover::before {
  opacity: 1;
}

.header .main-nav a:active {
  background: rgba(255,255,255,0.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -1px 0 rgba(200,155,60,0.15);
}

@media (max-width: 640px) {
  .header { 
    padding: 0 16px;
    height: 48px;
  }
  .header .logo img {
    height: 28px;
  }
  .header .logo {
    margin-right: 8px;
  }
  .header .main-nav a { 
    padding: 0 12px;
    font-size: 14px; 
  }
}

/* ============ 4.5 Breadcrumbs ============ */
.breadcrumb { 
  max-width: 1024px; 
  margin: 12px auto 0; 
  padding: 0 20px; 
  font-size: 13px; 
  color: var(--muted); 
  display: flex; 
  align-items: center; 
  flex-wrap: wrap; 
  gap: 6px; 
  line-height: 1.6; 
  list-style: none; 
}

.breadcrumb a { 
  color: var(--text); 
  text-decoration: none; 
  padding: 2px 4px; 
  border-radius: 6px; 
  transition: 0.2s;
}

.breadcrumb a:hover { 
  color: var(--accent); 
  background: rgba(200,155,60,0.08); 
}

.breadcrumb li { 
  display: inline-flex; 
  align-items: center; 
}

.breadcrumb li+li::before { 
  content: "/"; 
  color: #bbb; 
  margin: 0 6px; 
}

/* ============ 5. Footer ============ */
.footer {
  text-align: center;
  padding: 18px 16px 18px;
  color: var(--muted);
  font-size: 13px;
}

.footer .footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  color: var(--muted);
}

.footer .locale-switch {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid rgba(95,100,114,0.26);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.6;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.footer .locale-switch:hover {
  color: var(--accent);
  border-color: rgba(200,155,60,0.42);
  background: rgba(200,155,60,0.08);
}

.footer .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

.footer .footer-links li {
  display: inline-flex;
  align-items: center;
}

.footer .footer-links li+li::before {
  content: "·";
  margin: 0 8px;
  color: var(--muted);
}

.footer .footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 4px 0;
}

.footer .footer-links a:hover {
  color: var(--accent);
}

/* ============ 6. Card Components ============ */
.cards {
  display: grid;
  gap: 14px;
}

.card {
  display: block;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

/* Card title meta/badge: child style for secondary info */
.card-title .meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}

.card-badge {
  display: inline-block;
  background: rgba(200,155,60,0.15);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
}

.card-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.card-text .meta {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  margin-right: 16px;
}

.card-top-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.card-hero {
  padding-right: 140px;
}

.card-hero-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.card-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 14px;
  color: var(--muted);
}

.card-hero-meta .card-badge {
  margin-left: 0;
}

.card-hero-meta a.meta-item {
  color: #0066cc;
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-hero-meta a.meta-item:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card-text .meta:last-child {
  margin-right: 0;
}

@media (max-width: 1024px) {
  .card-hero-title {
    font-size: 22px;
  }
  .card-hero {
    padding-right: 110px;
  }
}

@media (max-width: 640px) {
  .card-hero-title {
    font-size: 20px;
    line-height: 1.3;
  }
  .card-hero {
    padding-right: 90px;
  }
}

/* Card Responsive */
.cards-auto {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

@media (min-width: 700px) {
  .cards-3 { 
    grid-template-columns: repeat(3, 1fr); 
  }
  .cards-2 { 
    grid-template-columns: repeat(2, 1fr); 
  }
}

@media (max-width: 640px) {
  .cards-auto {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

/* ============ 7. Page Sections (Hero, header) ============ */
/* Unified page container for Hero and content headers */
.hero, .page-section {
  max-width: 1024px;
  margin: 0 auto 32px;
  margin-left: calc((100% - 1024px) / 2 + 18px);
  margin-right: calc((100% - 1024px) / 2 + 18px);
  padding: 48px 32px 40px;
  text-align: center;
  position: relative;
  overflow: visible;
  background: var(--accent-gradient);
  border: 1px solid var(--accent-border);
  box-shadow: var(--accent-shadow);
  border-radius: 14px;
  z-index: 10;
}

.hero::after, .page-section::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(200,155,60,0.12), transparent 40%),
              radial-gradient(circle at 80% 0%, rgba(0,0,0,0.06), transparent 36%);
  pointer-events: none;
}

/* Page Title Styles */
.page-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.page-subtitle {
  font-size: 15px;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

/* Hero Content */

.hero-quote {
  font-family: "Kaiti SC","KaiTi","AR PL KaitiM GB", serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.hero-quote a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.hero-quote a:hover {
  color: var(--accent);
}

.hero-author {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.hero-author a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.hero-author a:hover {
  color: var(--accent);
}

.hero .quick-links, .page-section .quick-links {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero .quick-links span { 
  color: var(--muted); 
}

.hero .quick-links a, .page-section .quick-links a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(245,246,248,0.7);
  transition: all 0.2s ease;
}

.hero .quick-links a:hover, .page-section .quick-links a:hover { 
  background: rgba(200,155,60,0.15); 
  color: var(--accent); 
}

/* Hero Responsive */
@media (max-width: 1024px) {
  .hero,
  .page-section {
    margin-left: auto;
    margin-right: auto;
    padding: 40px 24px 32px;
  }
  .hero-quote {
    font-size: 20px;
  }
  .page-title {
    font-size: 32px;
  }
}

@media (max-width: 640px) {
  .hero,
  .page-section {
    margin-left: auto;
    margin-right: auto;
    padding: 32px 18px 28px;
  }
  .hero-quote {
    font-size: 18px;
  }
  .hero-author {
    font-size: 13px;
    margin-bottom: 24px;
  }
  .page-title {
    font-size: 28px;
  }
  .page-subtitle {
    font-size: 14px;
  }
  .section-title { 
    font-size: 18px; 
  }
  .section-title .section-count {
    font-size: 11px;
  }
}

/* ============ 9.5. Search Box ============ */
/* 搜索框组件 - 用于页面顶部的搜索功能 */
.search-box {
  max-width: 560px;
  margin: 12px auto 0;
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.search-box input {
  flex: 1;
  padding: 14px 18px;
  font-size: 15px;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid rgba(200,155,60,0.25);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 12px rgba(200,155,60,0.15);
}

.search-box input::placeholder { 
  color: #999; 
}

.search-box button {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-box button:hover {
  background: #b88a2a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200,155,60,0.3);
}

.search-box button:active { 
  transform: translateY(0); 
}

.search-box-with-suggest {
  z-index: 100;
}

.page-section-top-action {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(200,155,60,0.22);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.page-section-top-action:hover {
  background: rgba(200,155,60,0.14);
  color: var(--accent);
  transform: translateY(-1px);
}

.search-hint {
  max-width: 1024px;
  margin: -12px auto 20px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Search Box Responsive */
@media (max-width: 640px) {
  .search-box { 
    flex-direction: column; 
  }
  .search-box button { 
    width: 100%; 
  }
  .page-section-top-action {
    top: 10px;
    right: 12px;
    padding: 6px 10px;
    font-size: 12px;
  }
}

@media (max-width: 1024px) {
  .search-box input { 
    font-size: 14px; 
    padding: 12px 16px; 
  }
  .search-box button { 
    padding: 12px 20px; 
    font-size: 14px; 
  }
}

/* ============ 10.5. Content Card ============ */
/* Content card: reuse .card base with content-specific styles */
.content-card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  padding: 20px;
  margin-bottom: 24px;
}

/* Shared spacing: first content card following breadcrumbs */
.breadcrumb + .page { padding-top: 24px; }
@media (max-width: 640px) {
  .breadcrumb + .page { padding-top: 20px; }
}

.content-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}

.content-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
}

.content-card p {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  margin-bottom: 16px;
}

.content-card ul,
.content-card ol {
  margin: 16px 0 16px 24px;
  padding: 0;
}

.content-card li {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 10px;
}

.content-card strong {
  color: var(--accent);
  font-weight: 600;
}

.content-card a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.content-card a:hover {
  color: #b88a2a;
}

.content-card .update-time {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(200,155,60,0.15);
}

/* Content Card Responsive */
@media (max-width: 640px) {
  .content-card {
    padding: 20px;
    margin-bottom: 20px;
  }
  .content-card h2 {
    font-size: 20px;
  }
  .content-card h3 {
    font-size: 16px;
  }
  .content-card p,
  .content-card li {
    font-size: 14px;
  }
}

/* Content Card with Accent Gradient */
.content-card.accent-gradient {
  background: var(--accent-gradient);
  border: 1px solid var(--accent-border);
  box-shadow: var(--accent-shadow);
  position: relative;
  overflow: hidden;
}

.content-card.accent-gradient::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(200,155,60,0.12), transparent 40%),
              radial-gradient(circle at 80% 0%, rgba(0,0,0,0.06), transparent 36%);
  pointer-events: none;
  z-index: 0;
}

.content-card.accent-gradient > .accent-foreground {
  position: relative;
  z-index: 1;
}

/* ============ 9. Card Media (Horizontal) ============ */
.card-horizontal {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  align-items: start;
}

.card-horizontal .card-avatar,
.card-horizontal .avatar,
.avatar {
  width: 100px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-horizontal .card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-horizontal .card-text { text-align: left; }

@media (max-width: 1024px) {
  .card-horizontal {
    grid-template-columns: 80px 1fr;
  }
  .card-horizontal .card-avatar,
  .card-horizontal .avatar,
  .avatar {
    width: 80px;
    height: 80px;
  }
}


/* ---- 10.5.1 Content Card: Search Results Extension ---- */
/* Single-column layout for search result lists */
.content-card .card-list.search-result-list {
  grid-template-columns: 1fr;
}
.content-card .card-list.search-result-list .list-item-subtitle {
  white-space: inherit;
}
/* Search results no-results empty state card */
.content-card.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.content-card.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.content-card.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text);
}

.content-card.empty-state p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.content-card.empty-state .empty-link {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.content-card.empty-state .empty-link:hover {
  background: #b88a2a;
  transform: translateY(-1px);
}

/* ============ 11. Content Card Lists ============ */
/* Unified list container for content cards */
.content-card .card-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.content-card .card-list li { 
  margin: 0; 
}

/* Card list items - unified link styling */
.content-card .card-list a {
  display: block;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245,246,248,0.7), rgba(250,250,251,0.5));
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s ease;
  font-size: 15px;
  line-height: 1.6;
}

.content-card .card-list a:hover {
  background: linear-gradient(135deg, rgba(200,155,60,0.12), rgba(250,250,251,0.6));
  transform: translateY(-2px);
}

/* Card-list variant: TOC links with dot + chevron */
.content-card .card-list a.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.content-card .card-list a.toc-link::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(200,155,60,0.8);
  flex-shrink: 0;
}
.content-card .card-list a.toc-link::after {
  content: "›";
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
}

/* Shared: chapter navigation (prev/next buttons inside hero) */
.content-card .chapter-nav {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  position: relative;
  z-index: 1;
}
.content-card .chapter-nav .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.5);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  border: 1px solid rgba(0,0,0,0.04);
}
.content-card .chapter-nav .nav-btn:hover {
  background: rgba(255,255,255,0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.content-card .chapter-nav .nav-btn .nav-label {
  font-size: 12px;
  color: var(--muted);
}
.content-card .chapter-nav .nav-btn .nav-title {
  font-size: 14px;
  font-weight: 500;
}
.content-card .chapter-nav .nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* TOC list variant (目录列表样式) */
.content-card .card-list.toc-list a,
.content-card .card-list .toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.content-card .card-list.toc-list a::before,
.content-card .card-list .toc-list a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(200,155,60,0.8);
  flex-shrink: 0;
}

.content-card .card-list.toc-list a::after,
.content-card .card-list .toc-list a::after {
  content: "›";
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
}

/* Nested TOC list container */
.content-card .card-list .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

/* Card list item components (for complex list items with metadata) */
.content-card .card-list .list-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.content-card .card-list .list-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* prevent flex overflow on mobile */
}

.content-card .card-list .list-item-tag {
  font-size: 13px;
  color: #999;
  font-weight: 400;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-card .card-list .list-item-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

  /* List item badge (inline accent badge in header) */
  .content-card .card-list .list-item-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(200,155,60,0.15);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
  }

  /* Highlight text within list items (for search results) */
  .content-card .card-list .highlight {
    color: var(--accent);
    font-weight: 600;
    background: rgba(200,155,60,0.1);
    padding: 1px 3px;
    border-radius: 3px;
  }
/* Shared hero layout for book pages inside content-card */
.content-card .book-hero { 
  display: flex; 
  gap: 18px; 
  align-items: flex-start; 
}
.content-card .book-hero .book-cover { 
  width: 150px; 
  height: 210px; 
  border-radius: 12px; 
  object-fit: cover; 
  box-shadow: 0 12px 32px rgba(0,0,0,0.18); 
  border: 2px solid rgba(255,255,255,0.9); 
  flex-shrink: 0; 
}
.book-cover-default {
  width: 150px;
  height: 210px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid #b6cae6;
  box-shadow: 0 12px 32px rgba(15, 45, 86, 0.22);
  background:
    radial-gradient(140px 80px at 18% 12%, rgba(255,255,255,0.92), rgba(255,255,255,0) 72%),
    radial-gradient(170px 100px at 88% 86%, rgba(255,255,255,0.86), rgba(255,255,255,0) 70%),
    linear-gradient(160deg, #0f3d75 0%, #2d5f9a 55%, #4674ad 100%);
  flex-shrink: 0;
}
.book-cover-default[hidden] {
  display: none;
}
.book-cover-default::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 34px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.36), rgba(255,255,255,0.08)),
    linear-gradient(90deg, rgba(255,255,255,0.2), rgba(255,255,255,0));
  border-right: 1px solid rgba(255,255,255,0.28);
}
.book-cover-default::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 9px;
  pointer-events: none;
}
.book-cover-default .cover-title-wrap {
  position: absolute;
  left: 46px;
  right: 14px;
  top: 20px;
  bottom: 20px;
  background: rgba(247, 251, 255, 0.93);
  border: 1px solid rgba(36, 83, 140, 0.22);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 10px;
}
.book-cover-default .cover-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 2px;
  color: #163f70;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  max-height: 100%;
  overflow: hidden;
}
.book-cover-default .cover-seal {
  position: absolute;
  right: 11px;
  bottom: 11px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dbe9fb;
  border: 1px solid #9ab7dd;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8);
}
.card-horizontal .book-cover-thumb,
.book-recommend-card .book-cover-thumb {
  width: 92px;
  height: 128px;
  max-height: none;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 45, 86, 0.14);
}
.book-cover-default.book-cover-thumb::before {
  width: 22px;
}
.book-cover-default.book-cover-thumb::after {
  inset: 7px;
  border-radius: 6px;
}
.book-cover-default.book-cover-thumb .cover-title-wrap {
  left: 30px;
  right: 9px;
  top: 12px;
  bottom: 12px;
  border-radius: 6px;
  padding: 10px 6px;
}
.book-cover-default.book-cover-thumb .cover-title {
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 1.35;
}
.book-cover-default.book-cover-thumb .cover-seal {
  width: 16px;
  height: 16px;
  right: 7px;
  bottom: 7px;
}
.book-recommend-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: start;
}
.book-recommend-card .card-body {
  min-width: 0;
}
.content-card .book-hero .book-hero-body {
  flex: 1;
  min-width: 0;
}
.content-card .book-hero .book-summary { 
  margin-top: 14px; 
  padding-top: 14px; 
  border-top: 1px solid rgba(0,0,0,0.06); 
  font-size: 15px; 
  line-height: 1.8; 
  color: #333; 
}
.content-card .book-hero .book-summary p { margin: 0; }

/* Center meta row only on mobile */
@media (max-width: 768px) {
  .card-hero-meta { justify-content: center; width: 100%; }
}

/* Utility: force left alignment for meta row on all breakpoints */
.card-hero-meta.txt-l {
  justify-content: flex-start;
  text-align: left;
}
@media (max-width: 768px) {
  .card-hero-meta.txt-l { justify-content: flex-start; }
}

@media (max-width: 768px) {
  .content-card .book-hero { flex-direction: column; align-items: center; text-align: center; }
  .content-card .book-hero .book-cover,
  .content-card .book-hero .book-cover-default { width: 130px; height: 182px; }
  .content-card .book-hero .book-cover-default .cover-title-wrap { left: 40px; }
  .content-card .book-hero .book-cover-default .cover-title { font-size: 18px; }
}

@media (max-width: 640px) {
  .content-card .card-list {
    grid-template-columns: 1fr;
  }
  .content-card .card-list.chapter-nav {
    grid-template-columns: 1fr;
  }
  .book-recommend-card {
    grid-template-columns: 78px 1fr;
  }
  .card-horizontal .book-cover-thumb,
  .book-recommend-card .book-cover-thumb {
    width: 78px;
    height: 108px;
  }
  .book-cover-default.book-cover-thumb::before {
    width: 18px;
  }
  .book-cover-default.book-cover-thumb .cover-title-wrap {
    left: 25px;
    right: 7px;
    top: 10px;
    bottom: 10px;
  }
  .book-cover-default.book-cover-thumb .cover-title {
    font-size: 13px;
  }
}

.content-card .more-link { 
  margin-top: 20px; 
  text-align: center;
}
.content-card .more-link a { 
  display: inline-block;
  padding: 8px 20px; 
  border-radius: 50px; 
  background: transparent;
  border: 1px solid rgba(0,0,0,0.08);
  color: var(--muted); 
  text-decoration: none; 
  font-size: 13px;
  font-weight: 400;
  transition: all 0.2s ease;
}
.content-card .more-link a:hover { 
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.12);
  color: var(--text);
}

/* ============ 11.6. Partners ============ */
.partners-section {
  margin: 34px 0 28px;
}

.partners-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.partners-heading .section-title {
  margin-bottom: 0;
}

.partners-heading p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.7;
}

.partners-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.partner-link {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.66);
  box-shadow: 0 8px 22px rgba(0,0,0,0.05);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.partner-link:hover {
  transform: translateY(-2px);
  border-color: rgba(200,155,60,0.28);
  background: rgba(255,255,255,0.84);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

.partner-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(200,155,60,0.12), rgba(255,255,255,0.9));
  border: 1px solid rgba(200,155,60,0.16);
}

.partner-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: contain;
}

.partner-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.partner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-meta,
.partner-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-meta {
  color: var(--muted);
  font-size: 12px;
}

.partner-domain {
  color: rgba(200,155,60,0.9);
  font-size: 12px;
}

@media (max-width: 640px) {
  .partners-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .partners-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ 11.5. Content Card Components ============ */

/* Reading text - 阅读文本 */
.content-card .reading-text {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
  font-weight: 500;
  white-space: pre-line;
  margin-bottom: 14px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.content-card .translation-text {
  white-space: pre-line;
  margin-bottom: 14px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.content-card .chapter-reference {
  margin: 18px 0 0;
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(200, 155, 60, 0.08);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}

/* Top action buttons - 顶部操作按钮 */
.content-card .card-top-actions .card-action-btn {
  border: none;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 56px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04);
}

.content-card .card-top-actions .card-action-btn:hover {
  background: rgba(255,255,255,0.65);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.content-card .card-top-actions .card-action-btn:active {
  background: rgba(255,255,255,0.4);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04);
}

.content-card .card-top-actions .card-action-btn:focus-visible {
  outline: 2px solid rgba(200,155,60,0.4);
  outline-offset: 2px;
}

.content-card .card-top-actions .card-action-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(200,155,60,0.25);
}

.content-card .card-top-actions .card-action-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  margin-right: 6px;
}

/* Meta tags - 元数据标签 */
.content-card .meta-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.content-card .meta-tags a.badge {
  background: rgba(0,0,0,0.04);
  color: #444;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.content-card .meta-tags a.badge:hover {
  background: rgba(200,155,60,0.15);
  color: var(--accent);
}

/* Card footer actions - 卡片底部操作 */
.content-card .card-footer-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.05);
  position: relative;
  z-index: 1;
}

.content-card .card-footer-actions .footer-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: 0.2s;
}

.content-card .card-footer-actions .footer-action-btn:hover {
  color: var(--accent);
  background: rgba(200,155,60,0.05);
}

.content-card .card-footer-actions .footer-action-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Pinyin grid - 拼音网格 */
.content-card .pinyin-grid {
  display: none;
  margin-top: 8px;
  margin-bottom: 14px;
  padding: 0;
  color: #1a1a1a;
  font-weight: 700;
  line-height: 1.8;
  z-index: 1;
  position: relative;
}

.content-card .pinyin-grid.active {
  display: block;
}

.content-card .pinyin-grid .pinyin-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.content-card .pinyin-grid .pinyin-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content-card .pinyin-grid .pinyin-text {
  font-size: 11px;
  color: #7d7d7d;
  height: 16px;
  margin-bottom: 2px;
  min-width: 36px;
  text-align: center;
}

.content-card .pinyin-grid .pinyin-char {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(225,228,232,0.7);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #1d1d1f;
  background: rgba(255,255,255,0.85);
}

/* Tip/Note - 提示/注释 */
.content-card .tip {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
  margin: 12px 0;
  color: #2d2f33;
  font-size: 14px;
}

/* Meaning/Translation section - 释义/翻译区块 */
.content-card .meaning-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.content-card .meaning-section .meaning-text,
.content-card .meaning-section .translation-text {
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.8;
}

.content-card .meaning-section .meaning-text {
  font-weight: 500;
  color: var(--text);
}

.content-card .meaning-section .meaning-label,
.content-card .meaning-section .translation-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-right: 6px;
}

.content-card .meaning-section .translation-text {
  color: var(--muted);
  font-style: italic;
}

.content-card .meaning-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-right: 6px;
}

/* ============ 12. Sidebar Layout ============ */
.main-wrapper { 
  display: flex; 
  gap: 24px; 
  max-width: 1024px; 
  margin: 20px auto 60px; 
  padding: 0 18px 24px; 
}

.main-content { 
  flex: 1; 
  min-width: 0; 
}

.sidebar { 
  width: 140px; 
  position: sticky; 
  top: 20px; 
  height: fit-content; 
}

.sidebar-nav { 
  background: rgba(255,255,255,0.55); 
  backdrop-filter: blur(16px); 
  -webkit-backdrop-filter: blur(16px); 
  border: 1px solid rgba(255,255,255,0.7); 
  box-shadow: 0 8px 24px rgba(0,0,0,0.06); 
  border-radius: 14px; 
  padding: 10px; 
  position: sticky; 
  top: 20px; 
}

.sidebar-nav a { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  padding: 10px 12px; 
  text-decoration: none; 
  color: var(--text); 
  font-size: 13px; 
  font-weight: 500; 
  border-radius: 10px; 
  transition: transform .18s ease, background .2s ease, color .2s ease, box-shadow .2s ease; 
}

.sidebar-nav a::before { 
  content: ""; 
  width: 6px; 
  height: 6px; 
  border-radius: 50%; 
  background: #cfd2d7; 
  flex-shrink: 0; 
  transition: background .2s ease; 
}

.sidebar-nav a:hover { 
  background: rgba(255,255,255,0.9); 
  box-shadow: 0 6px 18px rgba(0,0,0,0.08); 
  transform: translateY(-1px); 
}

.sidebar-nav a.active { 
  color: var(--text); 
  background: linear-gradient(135deg, rgba(200,155,60,0.16), rgba(255,255,255,0.9)); 
  box-shadow: 0 8px 22px rgba(200,155,60,0.18); 
}

.sidebar-nav a.active::before { 
  background: var(--accent); 
}

@media (max-width: 1024px) {
  .main-wrapper { 
    flex-direction: column; 
    gap: 0; 
    padding: 0; 
    margin: 12px auto 60px; 
  }
  
  .sidebar { 
    width: 100%; 
    position: sticky; 
    top: 0; 
    left: 0; 
    right: 0; 
    max-width: 100%; 
    height: auto; 
    display: flex; 
    gap: 0; 
    padding: 10px 16px; 
    background: var(--glass); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    border-bottom: 1px solid var(--glass-border); 
    box-shadow: var(--shadow); 
    z-index: 1000; 
    margin: 12px 0; 
  }
  
  .sidebar-nav { 
    display: flex; 
    flex: 1; 
    gap: 6px; 
    padding: 0; 
    background: transparent; 
    border: none; 
    flex-wrap: nowrap; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
  }
  
  .sidebar-nav::-webkit-scrollbar { 
    display: none; 
  }
  
  .sidebar-nav a { 
    flex: 0 0 auto; 
    padding: 8px 14px; 
    text-align: center; 
    font-size: 13px; 
    font-weight: 500; 
    min-width: fit-content; 
    white-space: nowrap; 
    border-radius: 10px; 
    color: var(--text); 
    background: transparent; 
    transition: background .2s, box-shadow .2s; 
  }
  
  .sidebar-nav a::before { 
    display: none; 
  }
  
  .sidebar-nav a:hover { 
    background: rgba(0,0,0,0.04); 
  }
  
  .sidebar-nav a.active { 
    background: var(--accent); 
    color: #fff; 
    box-shadow: 0 4px 12px rgba(200,155,60,0.25); 
    font-weight: 600; 
  }
  
  .sidebar { 
    order: 1; 
  }
  
  .main-content { 
    order: 2; 
    padding: 0 20px; 
  }
  
  /* Offset for sticky sidebar nav on mobile/tablet */
  .section { 
    scroll-margin-top: 140px; 
  }
}

/* ============ 12. Mobile Sidebar (≤640px) ============ */
@media (max-width: 640px) {
  .sidebar {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
    margin: 0 0 20px;
    padding: 0 20px; /* 对齐正文与面包屑的左右间距 */
  }
}

/* ============ 13. Dark Mode ============ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: linear-gradient(135deg, #141416 0%, #1c1d20 100%);
    --text: #f5f4e8;
    --muted: #c2c4cc;
    --glass: rgba(24,24,28,0.6);
    --glass-border: rgba(255,255,255,0.08);
    --shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
}

.result-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.stack {
  display: grid;
  gap: 14px;
}

.text-lines p {
  margin: 0 0 10px;
  line-height: 2;
}

.pagination-wrap {
  margin: 24px 0;
}

@media (max-width: 640px) {
  .card-title {
    overflow-wrap: anywhere;
  }
}
